
485 TO ETH (B) User Manual
22
/
36
Here we design a test JSON, pay attention to check the RS485 device offline data
clearing. When the register can be read, the data sent is {"test":123}, where 123 is the actual
register content. Once the device is offline or the data cannot be read, it will be uploaded as
{"test":0}. This way can avoid saying that the data still exists after the device is offline, which
can give people a misunderstanding.
3.9. DEVICE OFFLINE
If the data cannot be read, the data is 0. In some cases, it is impossible to judge that the
device is offline. For example, if the data content itself is 0, it is impossible to judge whether
the device is offline or the data is 0. In addition, sometimes the device has multiple registers
that need to be read, so a separate JSON keyword should be used, such as {online1:0} as 0 or
1 to indicate that the device is online. For this, you can design online1 as follows. First design
all the registers, and then add a JSON node:
Figure 23 Device online
The name here is online1, which can be taken at will. The register number can select an
arbitrary existing register. The most important thing is to check the Rs485 device offline data
clearing and if the device is online, regardless of the register content, it is forcibly set to 1. In
this way, even if the data read is 0, it will be 1 as long as the data read. That is, online1 has
only two data, 0 and 1. 1 means online, 0 means offline.