I'm building a project to read servo drive parameters using an open source Modbus library called NModbus.
My VB.net project includes a reference to modbus.dll as well as log4net.dll.
I can call methods inside the namespace modbus, using intellisense, and get no errors. But when I run this code inside the IDE...
Imports System.IO.Ports
Imports Modbus
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim MyPort1 As New SerialPort("Com1")
MyPort1.BaudRate = 9600
MyPort1.DataBits = 8
MyPort1.Parity = Parity.None
MyPort1.StopBits = StopBits.One
MyPort1.Open()
Dim myMB As Device.ModbusSerialMaster
myMB = Device.ModbusSerialMaster.CreateAscii(MyPort1)
Dim slaveId As Byte = 1
Dim StartAddress As UShort = 100
Dim registers() As UShort
Dim NumberofRegisters As UShort = 5
registers = myMB.ReadHoldingRegisters(slaveId, StartAddress, NumberofRegisters)
End Sub
End Class
I get errors saying the types inside the Modbus namespace are undefined.
Why are the types defined while coding and I can use Intellisense to find my methods but they become undefined at runtime?