DOBOT CR5 User Guide 6 Program Language
Issue V3.5.3.1 (2020-05-09) User Guide Copyright © Yuejiang Technology Co., Ltd
106
Example 1: Read a 16-bit unsigned integer starting at address 2048
data = GetHoldRegs(2048,1)
Example 1: Read a 32-bit unsigned integer starting at address 2048
data = GetInRegs(2048, 1, “U32”)
Table 6.62 Set holding register command
SetHoldRegs(addr, count, table, type)
Set the holding register in the Modbus slave
addr: Starting address of the holding registers to set. Value range: 0 - 4095
count: Number of the holding registers to set. Value range: 0 to 4096-addr
table: Holding register value, stored in a table
type: Datatype
Empty: Read 16-bit unsigned integer ( two bytes, occupy one register)
“U16”: Set 16-bit unsigned integer ( two bytes, occupy one register)
“U32”: Set 32-bit unsigned integer (four bytes, occupy two registers)
“F32”: Set 32-bit single-precision floating-point number (four bytes, occupy two
registers)
“F64”: Set 64-bit double-precision floating-point number (eight bytes, occupy four
registers)
Example1: Set a 16-bit unsigned integer starting at address 2048
local data = {6000}
SetHoldRegs(2048, #data, data, “U16”)
Example2: Set a 64-bit double-precision floating-point number starting at address 2048
local data = {95.32105}
SetHoldRegs(2048, #data, data, “F64”)