Skip to main content

15.4.20 Register commands

15.4.20.1 ReadRegByName

Explanation

It is used to read the value of the corresponding register according to the register name

Definition

ReadRegByName(RegData, Value);

RegData, data type: readable register variable, Setup -> Communication -> Register interface function, register variable.

Value, data type: bool/int/byte/double, the register data will be written into Value, and if the register variable type mismatches with the interpreter variable, the format will be converted automatically

Example

Example 1

int tmp_int;
ReadRegByName(modbus_int_read, tmp_int);

Read the data named modbus_int_read with subscript 6 into tmp_int variable

15.4.20.2 WriteRegByName

Explanation

It is used to read the variable value of the corresponding register according to the name of the register. If the command is performed after the motion command, it will not interrupt the turning zone and be triggered at the end of the motion command trajectory or at the starting point of the turning zone. See Example 2 of SetDO for specific usage.

Definition

WriteRegByName(RegData, Value);

RegData, data type: writable register variable, Setup -> Communication -> Register interface function, register variable.

Value, data type: bool/int/byte/double, the register data will be written into Value, and if the register variable type mismatches with the interpreter variable, the format will be converted automatically

Example

Example 1

WriteRegByName(modbus_int_write[6], 200);

Write the data of INT 200 to the register corresponding to modbus_int_write[6].

15.4.20.3 ReadRegByteByName

Explanation

It is used to read the value of the corresponding byte of the register according to its name

Definition

ReadRegByteByName(RegData, Value, byteFlag);

RegData, data type: readable or writable int16/int32 type register, Communication -> Register interface function, register variable.

Value, data type: byte type variable, the byte value corresponding to the register is read into Value which must be a variable of byte type.

byteFlag, byte flag, with a value range of 1−4 where 1 is LSB and 4 is MSB.

Example

Example 1

byte tmp_value;
ReadRegByteByName(modbus_reg, tmp_value, 1);

The first byte of the register named modbus_reg is read into the tmp_value variable

15.4.20.4 WriteRegByteByName

Explanation

It is used to write the value of the corresponding register byte according to the name of the register. If the command is performed after the motion command, it will not interrupt the turning zone and be triggered at the end of the motion command trajectory or at the starting point of the turning zone. See Example 2 of SetDO for specific usage.

Definition

WriteRegByteByName(RegData, Value, byteFlag);

RegData, data type: writable int16/int32 type register, Communication -> Register interface function, register variable.

Value, data type: byte, the Value data is written into the corresponding byte of the register

byteFlag, byte flag, with a value range of 1−4 where 1 is LSB and 4 is MSB.

Example

Example 1

WriteRegByteByName(modbus_reg, 200, 2);

200 data is written into the second byte of modbus_reg.