B&B Electronics MODSCAN32 - Manual User Manual
Page 48

48
Modbus_Addr = Modbus_Id(3) + StartAddress(3)
temp = m_svr.ModifyPollRequest(PollHandle(3), SlaveDevice, Modbus_Addr, 10)
End If
End Sub
Private Sub Form_Load()
‘
‘ Create the ModScan interface object
‘
Set m_svr = CreateObject("ModScan32.Document")
Modbus_Id(0) = 10000 'input status prefix
Modbus_Id(1) = 0 'coil status prefix
Modbus_Id(2) = 30000 'input register prefix
Modbus_Id(3) = 40000 'holding register prefix
‘
‘ create the four PollRequests using
‘ default values
‘
SlaveDevice = 1
For Counter = 0 To 3
StartAddress(Counter) = 1
Modbus_Addr = Modbus_Id(Counter) + StartAddress(Counter)
PollHandle(Counter) = m_svr.CreatePollRequest(SlaveDevice, Modbus_Addr, 10)
Next Counter
statusline = "** UNINITIALIZED **"
End Sub
Private Sub Form_Terminate()
‘
‘ Free allocated resources
‘
For Counter = 0 To 4
m_svr.DeletePollRequest (PollHandle(Counter))
Next Counter
End Sub
Public Sub StatusMsg(Index As Integer)
‘
‘ Generate text status message
‘
If Index = 0 Then statusline = ""
If Index > 0 And Index < 256 Then statusline = "Slave Device Exception Response"
If Index = 256 Then statusline = "Invalid Handle"
If Index = 257 Then statusline = "Modbus Message Overrun"
If Index = 258 Then statusline = "Invalid Address"