This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

writeCharacteristic

Scale and write specified characteristic value to direct memory

Syntax

writeCharacteristic(chanObj,characteristic,value)

Description

example

writeCharacteristic(chanObj,characteristic,value) scales and writes a value for the specified characteristic through the XCP channel object chanObj. This action performs a direct write to memory on the slave module.

Examples

collapse all

Write a value to an XCP characteristic and verify the value.

Read the original value.

a2lObj = xcpA2L('myA2Lfile.a2l');
chanObj = xcpChannel(a2lObj,'CAN','Vector','Virtual 1',1);
connect(chanObj);
charObj = a2lObj.CharacteristicInfo('torque_demand');
value = readCharacteristic(chanObj,charObj)'
     100

Write new value.

newValue = 200;
writeCharacteristic(chanObj,charObj,newValue');

Read value again to verify change.

readCharacteristic(chanObj,charObj)'
     200

Input Arguments

collapse all

XCP channel, specified as an XCP channel object.

Example: xcpChannel()

XCP channel characteristic, specified as a character vector or characteristic object.

Example: 'torque_demand'

Data Types: char

Value for characteristic write, specified as a type supported by the characteristic.

Introduced in R2018a