![Asentria Teleboss 850 Скачать руководство пользователя страница 190](http://html.mh-extra.com/html/asentria/teleboss-850/teleboss-850_user-manual_2981745190.webp)
TeleBoss 850 2.06.280_STD User Manual
Page 184
Example
-- open serial device
handle = a_lib.OpenDevice("com1")
-- request a floating point value from register 0x338 of device at address 1
value, error = a_lib.GetModbusValue(handle, 1, "float", 0x338)
print (value, error)
handle = a_lib.CloseDevice(handle)
a_lib.SetModbusValue
Description
Set a register value on a Modbus device.
Syntax
a_lib.SetModbusValue(handle, address, type, register, value)
handle: The handle obtained when the serial port device was opened
address: Address of the Modbus device (1-63)
type: The type of data to store ("int16", "uint16", "int32", "uint32",
"float")
register: The register on the Modbus device to write the value to
value: Value to write to the reigster
Returns
Returns 1 if successful, otherwise returns nil plus a string containing an error message.
Note:
The serial port device must already be set to the required baud rate and data format.
Note:
It is assumed that the device stores the values high-word-first, high-byte-first, and that floating point
values are stored in 32-bit IEEE format.
Example
-- open serial device
handle = a_lib.OpenDevice("com1")
-- set an unsigned 32-bit integer value at register 3 of device at address 2
to value -456.4
result = a_lib.SetModbusValue(handle, 2, "float", 3, -456.4)
handle = a_lib.CloseDevice(handle)
a_lib.MODBUSReadRegisters
Description
Read one or more registers from a MODBUS device
Syntax
a_lib.MODBUSReadRegisters(handle, address, register, register_count)
handle: The handle obtained when the serial port device was opened
address: Address of the Modbus device (1-63)
register: The first register on the Modbus device to read
register_count: How many 16-bit registers to read
Содержание Teleboss 850
Страница 6: ......