PIC data to VB app via com port

Data transfer from a PIC to a VB app through serial port

Page 1 of 1

1 Replies - 4298 Views - Last Post: 16 July 2007 - 12:04 PM Rate Topic: -----

#1 ngoagr   User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 4
  • Joined: 16-July 07

PIC data to VB app via com port

Post icon  Posted 16 July 2007 - 03:50 AM

I am on a project at this time that uses a PIC microcontroller to collect data from an accelerometer and a thermosensor. PIC joins the results from each sensor and sends them to serial port. I have used the Windows Terminal to check the results that I am getting from PIC and all is correct.

The string that PIC sends to com port is: T15X537Y379Z234
And it sends it continuously, i.e.: ....T15X537Y379Z234T15X537Y379Z234T15X537Y379Z234T15X537Y379Z234....

Would it be better if PIC sends a {return} character after each string???
i.e.:
T15X537Y379Z234
T15X537Y379Z234
T15X537Y379Z234

The purpose of the app that I’m trying to write is to get those values then separate each other and then set the corresponding variables to do some math.
i.e.: temp = 15 , x_accel = 537 , y_accel = 379 , z_accel = 234

But I have no idea of how I can do it. Any help would be appreciated!!
(I have added mscomm control to the form)

Is This A Good Question/Topic? 0
  • +

Replies To: PIC data to VB app via com port

#2 ngoagr   User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 4
  • Joined: 16-July 07

Re: PIC data to VB app via com port

Posted 16 July 2007 - 12:04 PM

finaly since morning I made it to read the string from the microcontroller!!!!

Option Explicit
Public bolComOpen As Boolean

Private Sub cmdStart_Click()
	MSComm1.PortOpen = True
	bolComOpen = True
	Do
		With MSComm1
			txtSerial.Text = Trim(Right(txtSerial.Text & .Input, 100))
		End With
		DoEvents
	Loop Until Not bolComOpen
	MSComm1.PortOpen = False
End Sub

Private Sub cmdStop_Click()
	bolComOpen = False
End Sub


but still I haven't figured out how I can get the numeric values after each letter and set the corresponding variable as I mentioned in the example above.

any help??

This post has been edited by ngoagr: 16 July 2007 - 12:06 PM

Was This Post Helpful? 1

Page 1 of 1