Here's another program which does receive the same data from the PIC. Only it displays it vertically instead of in BYTES across the ListBox. Anyone know how to modify this to display the BYTES properly?
This is how the data appears in the ListBox v's the serial Communicator which displays them properly.
Here's the program, this maybe the one to adapt / work on as it's nearly there:Code:VB has the numbers 1 3 5 * * 2 0 3 * And Serial Communicator has them 135 203
Thanks for any help.Code:Imports System Imports System.ComponentModel Imports System.Threading Imports System.Windows.Forms Public Class Form1 'Buffer for receievd data*** Private Delegate Sub AddListBoxItemInvoker(ByVal item As Object) Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load SerialPort1.PortName = "COM1" SerialPort1.Parity = IO.Ports.Parity.None SerialPort1.BaudRate = 2400 SerialPort1.DataBits = 8 SerialPort1.StopBits = 1 End Sub Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click If SerialPort1.IsOpen = False Then SerialPort1.Open() If SerialPort1.IsOpen = True Then MsgBox("com1 port opened sucessfully") End Sub Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click If SerialPort1.IsOpen = True Then SerialPort1.Close() If SerialPort1.IsOpen = False Then MsgBox("com1 port closed sucessfully") End Sub Private Sub SerialPort1_DataReceived(ByVal sender As Object, ByVal e As System.IO.Ports.SerialDataReceivedEventArgs) Handles SerialPort1.DataReceived Me.AddListBoxItem(SerialPort1.ReadExisting) End Sub Private Sub AddListBoxItem(ByVal item As Object) If Me.ListBox1.InvokeRequired Then 'We are on a secondary thread so delegation is required. Me.ListBox1.Invoke(New AddListBoxItemInvoker(AddressOf AddListBoxItem), (item)) Else 'We are on the primary thread so add the item. Me.ListBox1.Items.Add(item) End If End Sub End Class
Dave




Bookmarks