polling information in rs-232


Closed Thread
Results 1 to 15 of 15

Hybrid View

  1. #1
    Join Date
    Feb 2008
    Posts
    8

    Question polling information in rs-232

    Hi all,

    i'm new to your community and in search of a (probably) simple answer to my problem.

    pardon my inexperience, but to learn i guess the best way is to start asking for help (after doing a big search everywhere; OF COURSE ).


    my problem:

    i have a strip of data from a gps unit in NMEA

    $GPGGA,150126,4521.3660,N,07317.9876,W,1,03,102.3, ,,-032.30,M,,*1D

    i use a 16f877a (to receive it's no problem)

    the problem is that i want to re-send that information ($GPGGA, etc....) every second while i still watch the next incoming data.

    here's a simple example:

    ' This will set the serial port 4800
    DEFINE HSER_RCSTA 90h
    DEFINE HSER_TXSTA 20h
    DEFINE HSER_BAUD 4800
    GPS VAR byte
    char var byte


    main:
    ' receive from GPS unit
    Hserin [char] ' <- works!
    GPS = GPS + char '<<<< that part is causing the problem >>>>
    ' send to computer
    hserout [GPS]
    goto main:

    what i really want to achieve is that the part "hserout [char]" would transmit to the PC every second while i still check the incoming "Hserin [char]" from GPS unit

    i know there might be a much simpler way to do this, so i need a bit of your experience please.

    Tried to lower the baudrate, tried with interrupt, etc... the "GPS = GPS + char" cause some garble characters in the receiving process...
    If i use a LOOP in the "hserout [GPS]" i prevent the reception of new data from GPS unit.

    there might be a way while reading the RECREG , but i don't know how....


    Awaiting your help
    Last edited by Tondunard; - 8th February 2008 at 15:55.

  2. #2
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Are you trying to receive the whole string at one time and retransmit the same whole string at once?
    Code:
    GPS = GPS + char '<<<< that part is causing the problem >>>>
    What is this line supposed to accomplish?

  3. #3
    Join Date
    Feb 2008
    Posts
    8


    Did you find this post helpful? Yes | No

    Cool the whole line

    i guess i didn't expose my problem clearly as i can see

    yes i want to transmit the whole line (si i need to store it in a variable in some way)


    to tell the truth, i have this radio that has GPS capabilities but it has to be "polled" so as far i can say , it does not transmit every second (the radio that is),.
    so the radio transmit it's position every time i "poll" it.

    after that i need to take that information and resend it to a gps software every second (to simulate a directly connected GPS)

    plus i need to check for incoming data while this second by second transmit to the pc is done.( next strip of NMEA)

    i guess it's better explained that way

    thanks for the concern, looks like a real good place to learn picbasic
    Last edited by Tondunard; - 8th February 2008 at 15:51.

  4. #4
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Tondunard View Post
    i guess i didn't expose my problem clearly as i can see
    yes i want to transmit the whole line (si i need to store it in a variable in some way)
    to tell the truth, i have this radio that has GPS capabilities but it has to be "polled" so as far i can say , it does not transmit every second (the radio that is),.
    so the radio transmit it's position every time i "poll" it.
    after that i need to take that information and resend it to a gps software every second (to simulate a directly connected GPS)
    plus i need to check for incoming data while this second by second transmit to the pc is done.( next strip of NMEA)
    i guess it's better explained that way
    thanks for the concern, looks like a real good place to learn picbasic
    The holy GREEN MANUAL describes how to handle strings using HSERIN/HSEROUT quite well.
    And you might even find a use for WAIT in there too.

  5. #5
    Join Date
    Feb 2008
    Posts
    8


    Did you find this post helpful? Yes | No

    Wink

    Quote Originally Posted by skimask View Post
    The holy GREEN MANUAL describes how to handle strings using HSERIN/HSEROUT quite well.
    And you might even find a use for WAIT in there too.
    i'll check again (guess i haven't looked too well

    Still searching.....

  6. #6
    Join Date
    Mar 2006
    Location
    Pennsylvania, USA.
    Posts
    130


    Did you find this post helpful? Yes | No

    Default

    As you already have the hardware uart connected to the GPS unit, I'll ask how do you have the PC connected? 4800 baud is standard for a GPS unit, so you're good there. Skimask has correctly suggested that you will find that PicBasic's Hserin command does let you accept an entire string at once, instead of reading in a single character at a time and building a string like you are trying to do. You'll have to declare an array variable big enough to accept all of the characters in your string.
    I would use an interrupt to capture the incoming string from the GPS unit, and then either DEBUG or SEROUT to send the string out to the PC. There are a few serial interrupt example programs on the MicroEngineering Labs website, and there are a lot of examples on this forum, and debug and serout or serout2 are explained well in the manual.

    Jerry.
    If your oscilloscope costs more than your car...

Similar Threads

  1. RS 485 wireless communication
    By Armadus in forum mel PIC BASIC Pro
    Replies: 22
    Last Post: - 26th January 2006, 19:30
  2. Displaying Trend Information
    By Mike M. in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 3rd November 2005, 03:21
  3. RS 485 using 16F84A
    By ngeronikolos in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 18th May 2005, 14:46

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts