The following command examples assume the WattNode slave address is set to 1 (i.e. DIP switch 1 is ON, 2 to 7 are OFF). To start with a simple polling example, a Modbus Master application running on a PC can send a Read Multiple Holding Registers command to read the integer holding registers from 1201 to 1221. A hex dump of the command that would need to be sent by the master is:
0x01 0x03 0x04 0xB0 0x00 0x15 0x84 0xD2
The first byte is the slave device address (01), the 2nd byte is the command (03, to read multiple holding registers), the 3rd and 4th bytes are the address of the start register (0x4B0 or 1200), the 5th and 6th bytes are the number of registers (0x15 or 21)) and the last two bytes are the CRC.
A hex dump for the slave reply from the WattNode is (note that the bytes in this reply will vary depending on the current energies, power and voltage register values):
0x01 0x03 0x2A 0x01 0x40 0x00 0x00 0x01 0x40 0x00 0x00 0x01 0x40 0x00 0x00 0x01 0x40 0x00 0x00 0x07 0x17 0x02 0x65 0x02 0x3E 0x02 0x73 0x04 0x9F 0x04 0xBC 0x04 0x6D 0x04 0xB3 0x08 0x01 0x07 0xEF 0x07 0xE7 0x08 0x2C 0x02 0x58 0xC3 0xFC
The first byte is the replying slave’s device address (01), the 2nd byte is the command echo (03, to read multiple holding registers), the 3rd byte is the number of data bytes (0x2A or 42, since there are 2 bytes per register). The next 42 bytes comprise the data for the 21 registers that were requested. The final two bytes are the CRC.
A hex dump for the command to be sent to a WattNode with address 1 to read integer registers 1301 to 1322 is:
0x01 0x03 0x05 0x14 0x00 0x16 0x84 0xCC
The preceding command examples can be sent out the Master’s serial port to a slave to retrieve its current readings.