Quantcast
Channel: VBForums
Viewing all articles
Browse latest Browse all 15589

RS485 two wire communication

$
0
0
I am trying to communicate with a device over RS485. I am having issues with reading however. After sending the write command I only get F3 as a response. What I am thinking is due to the way the device communicates there may be something special that is needed.

https://imgur.com/a/uYjttWZ

Shows the communication between the computer and the device with the device on and off. Due to the speed of the response I'm thinking that may be causing the error. The baud rate is 2,500,000.


Below shows how I am communicating with it. I have another program that can communicate correctly, so I know everything is connected right. Also, the scope looks the same between either, so I know it is sending the command and the device is receiving it correctly. That makes me believe the issue has to be with reading the data back.

Code:

While charArray.Length <> 9
      OpenPort()
      _serialport.Write({&H2}, 0, 1)
      rec = _serialport.ReadExisting()
      _serialport.Close()

      charArray = rec.ToCharArray

      If loop_amount = 10 Then
            MessageBox.Show("Failed to communicate")
            Exit Sub
      End If
      loop_amount = loop_amount + 1
End While


Viewing all articles
Browse latest Browse all 15589

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>