READMB2 ch, ID, addr, var, count
Purpose Think of this as the multi-word version of READMODBUS command. Unlike the READMODBUS command which is a function that returns a single 16-bit word, this command is implemented as a statement so that multiple words of data can be stored into the PLC internal memory .
ch - PLC COMM port number (1to 8 using Modbus ASCII or 11to 18 using Modbus RTU).
ID - Device ID of the MODBUS slave device (1 to 255)
addr - Zero-offset address of the holding register in the MODBUS slave device starting from 0 = 40001.
var - the starting variable in the master for storing the returned data. (may be a DM or any system variable)
count - number of variables to read (max. =16 in M+ PLC).
Examples    READMB2 3,5,101,DM[10],8
Comments The PLC will use MODBUS ASCII protocol, via its Comm port #3, to query the slave MODBUS device with ID = 05 and ask for 8 words of data starting from register offset address 101 (in MODBUS term this refer to the #40102 holding register) . Once it receives the returned data these 8 words will be stored in the memory locations: DM[10], DM[11],…..DM[17]. 

This command automatically checks the response string received from the slave device for the correct slave address and LRC (or CRC16 RTU protocol is used). Like READMODBUS command, the status of this operation can be checked by the user program by testing the STATUS(2) function.
 

See Also WRITEMB2, STATUS(2)

  backbutton.gif (507 bytes)  Basic to TBASIC Reference Manual