Description: modbus
Public Sub Build_Request()
Dim CRCWord As Long
ReqLen = 0
With Main
Slave Address
.Request.Text = .Slave_Addr_Hex.Text + " "
RequestStr(ReqLen) = Val("&H" + .Slave_Addr_Hex.Text)
ReqLen = ReqLen + 1
Function Code
.Request.Text = .Request.Text + FC$ + " "
RequestStr(ReqLen) = Val("&H" + FC$)
ReqLen = ReqLen + 1
Data Address
Temp = Val("&H" + .Hex_Data_Address.Text)
If Temp < 0 Then Temp = Temp + 65536
RequestStr(ReqLen) = Int(Temp / 256) High Byte
.Request.Text = .Request.Text + Hex$(RequestStr(ReqLen)) + " "
ReqLen = ReqLen + 1
RequestStr(ReqLen) = ((Temp / 256) - Int(Temp / 256)) * 256 Low Byte
.Request.Text = .Request.Text + Hex$(RequestStr(ReqLen)) + " "
ReqLen = ReqLen + 1
To Search:
File list (Check if you may need any files):
mbus.txt