writeCharacteristic

Scale and write specified characteristic value to direct memory

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