Receive serial data

H

Hugh Janus

I am trying to receive GPS data into a pocket PC 5.0. I am using the
device emulator. The main PC has a bluetooth dongle connected and is
bonded with the bluetooth GPS transmitter to COM8. In the device
emulator, I am mapping Serial Port 1 to COM8. The below code *should*
work as far as I can see but it does not. It hangs on the ReadLine
line. Any ideas anyone?
If I use hyperterminal on the main computer to read COM8 I can see the
GPS data so the GPS is working OK. Help!?!!


Private Sub ReadGPS

Debug.WriteLine("Starting")
Application.DoEvents()

Debug.WriteLine("Creating COM Port")
Dim GPSCom As New IO.Ports.SerialPort
With GPSCom

.PortName = "COM1"
.BaudRate = "2400"
.DataBits = 8
.Parity = IO.Ports.Parity.None
.StopBits = IO.Ports.StopBits.One
.NewLine = "$"
.Open()

End With

Application.DoEvents()
Debug.WriteLine("Attempting read.")
Application.DoEvents()

Do

Debug.WriteLine(GPSCom.ReadLine)
Application.DoEvents()

Loop

End Sub
 
T

tommaso.gastaldi

..BaudRate = Should be integer, I guess (not a string)

Try also with ReadChar to check receive. In case add line crlf.

Tommaso

Hugh Janus ha scritto:
 
D

Dick Grier

Hi,
I am mapping Serial Port 1 to COM8. The below code *should*
work as far as I can see but it does not. It hangs on the ReadLine
line. Any ideas anyone?
<<

You say that you are mapping Serial Port 1 to COM8. Are you sure this is
what you want? COM8 should be mapped to Serial Port 0 (COM1 on your PPC
emulator), Serial Port 1 is COM2, not COM1.

Dick

--
Richard Grier, MVP
Hard & Software
Author of Visual Basic Programmer's Guide to Serial Communications, Fourth
Edition,
ISBN 1-890422-28-2 (391 pages, includes CD-ROM). July 2004, Revised March
2006.
See www.hardandsoftware.net for details and contact information.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top