Receive serial data

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Hugh Janus

    #1

    Receive serial data

    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.DoE vents()

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

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

    End With

    Application.DoE vents()
    Debug.WriteLine ("Attempting read.")
    Application.DoE vents()

    Do

    Debug.WriteLine (GPSCom.ReadLin e)
    Application.DoE vents()

    Loop

    End Sub

  • tommaso.gastaldi@uniroma1.it

    #2
    Re: Receive serial data


    ..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:
    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.DoE vents()
    >
    Debug.WriteLine ("Creating COM Port")
    Dim GPSCom As New IO.Ports.Serial Port
    With GPSCom
    >
    .PortName = "COM1"
    .BaudRate = "2400"
    .DataBits = 8
    .Parity = IO.Ports.Parity .None
    .StopBits = IO.Ports.StopBi ts.One
    .NewLine = "$"
    .Open()
    >
    End With
    >
    Application.DoE vents()
    Debug.WriteLine ("Attempting read.")
    Application.DoE vents()
    >
    Do
    >
    Debug.WriteLine (GPSCom.ReadLin e)
    Application.DoE vents()
    >
    Loop
    >
    End Sub

    Comment

    • Dick Grier

      #3
      Re: Receive serial data

      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.


      Comment

      Working...