Host Engineering Forum

General Category => DirectSOFT => Topic started by: bhubb on April 06, 2010, 01:31:15 PM

Title: Modbus DLL Serial Communication w/ DL205
Post by: bhubb on April 06, 2010, 01:31:15 PM
I'm trying to communicate with the serial port on a dl205. My Ethernet communication works fine,
however, I'm getting a timeout exception with serial. I'm trying to access a memory location (v2000)
and read the status numeric value. I have already trimmed off the first character and converted it to
decimal. I've done some testing and the port is open, but times out. I'll provide my directserialconnect
block of code written in VB.NET. Any suggestions would be appreciated.

Private ControlDirectEthernet As ModbusTcpMaster
    Private DirectSerialCommunication As ModbusSerialMaster

Private Function DirectSerialConnect() As Boolean
        Dim DirectSerialPort As System.IO.Ports.SerialPort  

        DirectSerialPort = New System.IO.Ports.SerialPort()
        DirectSerialPort.PortName = "COM1"
        DirectSerialPort.BaudRate = 9600
        DirectSerialPort.Parity = IO.Ports.Parity.Odd
        DirectSerialPort.DataBits = 8
        DirectSerialPort.StopBits = IO.Ports.StopBits.One
        DirectSerialPort.ReadTimeout = 2000
        DirectSerialPort.Open()

        Try
            DirectSerialCommunication = Modbus.Device.ModbusSerialMaster.CreateAscii(DirectSerialPort)

            Return True
        Catch ex As Exception
            Return False
        End Try
    End Function