B4R Code Snippet ModBus RTU

OGmac

Member
Licensed User
ModBusB4R.png


Modbus Function Code Support

Function CodeRegister Type
1Read Coil
2Read Discrete Input
3Read Holding Registers
4Read Input Registers
5Write Single Coil
16Write Multiple Holding Registers


B4R:
    ' initial Paramter
    Modbus.Initial(5,6,2,9600)
    ' Set Registers
    Modbus.CO(0)  = True      ' Coil Register     00000
    Modbus.DI(0)  = True      ' Discrete Input    10001
    Modbus.IR(0)  = 25        ' Input Register    30001
    Modbus.HR(0)  = 50        ' Holding Register  40001
    Modbus.HR(7)  = 100       ' Holding Register  40008
You can use Radzio! Modbus Master Simulator

monitor.png
 

Attachments

Last edited:
Top