User Manual for LoRaWAN End Nodes - RS485-LN – RS485 to LoRaWAN Converter User Manual
3.5.3 Sensor related commands
RS485 Debug Command
This command is used to configure the RS485 devices; they won’t be used during sampling.
•
AT Command
AT+CFGDEV=xx xx xx xx xx xx xx xx xx xx xx xx,m
m: 0: no CRC, 1: add CRC-16/MODBUS in the
end of this command
•
Downlink Payload
Format: A8 MM NN XX XX XX XX YY
Where:
• MM: 1: add CRC-16/MODBUS ; 0: no CRC
• NN: The length of RS485 command
• XX XX XX XX: RS485 command total NN bytes
• YY: How many bytes will be uplink from the return of this RS485 command,
• if YY=0, RS485-LN will execute the downlink command without uplink;
• if YY>0, RS485-LN will uplink total YY bytes from the output of this RS485 command; Fport=200
• if YY=FF, RS485-LN will uplink RS485 output with the downlink command content; Fport=200.
Example 1
--> Configure without ask for uplink (YY=0)
To connect a Modbus Alarm with below commands.
• The command to active alarm is: 0A 05 00 04 00 01 4C B0. Where 0A 05 00 04 00 01 is the Modbus
command to read the register 00 40 where stored the DI status. The 4C B0 is the CRC-16/MODBUS which
calculate manually.
• The command to deactivate alarm is: 0A 05 00 04 00 00 8D 70. Where 0A 05 00 04 00 00 is the Modbus
command to read the register 00 40 where stored the DI status. The 8D 70 is the CRC-16/MODBUS which
calculate manually.
So if user want to use downlink command to control to RS485 Alarm, he can use:
A8 01 06 0A 05 00 04 00 01 00
: to activate the RS485 Alarm
A8 01 06 0A 05 00 04 00 00 00
: to deactivate the RS485 Alarm
A8 is type code and 01 means add CRC-16/MODBUS at the end, the 3
rd
byte is 06, means the next 6 bytes are the
command to be sent to the RS485 network, the final byte 00 means this command don’t need to acquire output.
Example 2
--> Configure with requesting uplink and original downlink command (
YY=FF
)
User in IoT server send a downlink command:
A8 01 06 0A 08 00 04 00 01 YY
RS485-LN got this downlink command and send
0A 08 00 04 00 01
to Modbus network. One of the RS485 sensor
in the network send back Modbus reply
0A 08 00 04 00 00
. RS485-LN get this reply and combine with the original
downlink command and uplink. The uplink message is:
A8
0A 08 00 04 00
01 06
0A 08 00 04 00 00
Page 24 / 38 - last modified by Bei Jinggeng on 2022/07/08 16:50