Problem displaying data from GPS module & using 16f877a


Closed Thread
Results 1 to 11 of 11
  1. #1

    Exclamation Problem displaying data from GPS module & using 16f877a

    Hi, I am having problem showing data on hyperterminal using my GPS module and 16F877A
    GPS module EM406A DEFAULT TO BAUD 4800
    GPS is working as I connected it to PC without uC and I am getting the data. Problem is displaying it using PIC

    Connections are as follow -:

    PortC.4 ----Gps Tx (TTL 0-5V)
    PortC.6 ----- MAx232 pin11
    Max232 pin14 ----- Rs232 pin 2 (Pc Rx)
    Gnd common

    FOLLOWING IS THE CODE:
    All pins digital, comparator off, analog channels off.

    sms var byte[35]
    Include "modedefs.bas"
    DEFINE DEBUG_REG PORTC
    DEFINE DEBUG_BIT 6
    DEFINE DEBUG_BAUD 4800
    DEFINE DEBUG_MODE 0

    ab:
    HIGH RED
    serin2 portc.4,4800,[WAIT("$GPRMC"),STR sms\35]
    DEBUG STR sms\17,13
    pause 3000
    LOW RED
    goto ab

    Is somthing wrong with the code or the hardware? Thanks
    ___________________
    WHY things get boring when they work just fine?

  2. #2
    Join Date
    Dec 2005
    Posts
    1,073


    Did you find this post helpful? Yes | No

    Default

    If the GPS works connected to a PC, it means its output is inverted.

    You need to modify your
    Code:
    serin2 portc.4,4800,[WAIT("$GPRMC"),STR sms\35]
    Reread the manual for SerIn2 - your mode value is incorrect.

  3. #3


    Did you find this post helpful? Yes | No

    Exclamation

    Quote Originally Posted by dhouston View Post
    If the GPS works connected to a PC, it means its output is inverted.

    You need to modify your
    Code:
    serin2 portc.4,4800,[WAIT("$GPRMC"),STR sms\35]
    Reread the manual for SerIn2 - your mode value is incorrect.
    Thanks for the input but could you help me advising what baud should I use, I am little confused about this. The datasheet of the module does says 4800 is default (Datasheet attached) and manual also has only one option for 4800 baud.

    I also want to say that I connected the gps module via MAX232 to the PC.Thanks
    Attached Images Attached Images
    ___________________
    WHY things get boring when they work just fine?

  4. #4
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    I always wondered why the manual does not list all of the modes??? Save some paper???
    http://www.melabs.com/resources/ser2modes.htm
    Dave
    Always wear safety glasses while programming.

  5. #5


    Did you find this post helpful? Yes | No

    Question

    Thanks for the info. I added the statement:
    baud1 con 16572
    and changed the following statement:
    serin2 portc.4,baud1,[WAIT("$GPRMC"),STR sms\35]

    Still no luck. Please help.
    ___________________
    WHY things get boring when they work just fine?

  6. #6
    Join Date
    May 2008
    Location
    Italy
    Posts
    825


    Did you find this post helpful? Yes | No

    Default

    Code:
    serin2 portc.4,baud1,[WAIT("$GPRMC"),STR sms\35]
    Which is the value of baud1?

    When you use wait string, remember that they are case sensitive "$GPRMC" is different from "$gprmc"

    I already suggested you, in another thread, to use a timeout sequence. Your serin2 instruction will wait for the identifier and then it will wait for a string of 35 characters. If your GPRS will send only 34, serin2 will remain there waiting forever.

    One turn around is the use of the timeout:


    Code:
    GPRSLoop:
    sms[0]=0
    serin2 portc.4,baud1,500,GPRSTest,[WAIT("$GPRMC"),STR sms\35]
    GPRSTest:
    If sms[0]<>0 then goto label ??     ' here you check byte[0] for data presence 
    goto GPRSLoop
    Al.
    Last edited by aratti; - 23rd October 2009 at 02:28.
    All progress began with an idea

  7. #7
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by financecatalyst View Post
    Thanks for the info. I added the statement:
    baud1 con 16572
    and changed the following statement:
    serin2 portc.4,baud1,[WAIT("$GPRMC"),STR sms\35]

    Still no luck. Please help.
    If a RS232 chip was needed to talk to a PC then baud1 should be 188.
    Dave
    Always wear safety glasses while programming.

  8. #8


    Did you find this post helpful? Yes | No

    Talking

    Thanks guys. Itīs up and running now. Love this Forum
    Last edited by financecatalyst; - 23rd October 2009 at 18:03.
    ___________________
    WHY things get boring when they work just fine?

  9. #9
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by financecatalyst View Post
    Thanks guys. Itīs up and running now. Love this Forum
    In case someone else has a similar problem... What was the fix?
    Dave
    Always wear safety glasses while programming.

  10. #10


    Did you find this post helpful? Yes | No

    Red face

    Quote Originally Posted by mackrackit View Post
    In case someone else has a similar problem... What was the fix?
    The array was too small to hold the sequence of characters and code was kinda stuck there. I changed it to the following :

    Baud con 188
    sms var byte[65]
    start:
    serin2 portc.4,baud,500,start,[WAIT("$GPRMC"),STR sms\65\13] ' added 13 as well
    If sms[0]<>0 then goto display
    goto start

    These are the only corrections I have done and it fired up.
    ___________________
    WHY things get boring when they work just fine?

  11. #11
    Join Date
    Apr 2010
    Posts
    6


    Did you find this post helpful? Yes | No

    Default

    Could u please provide the full program ?

Similar Threads

  1. Using Nokia LCD
    By BobP in forum mel PIC BASIC Pro
    Replies: 300
    Last Post: - 3rd May 2018, 05:47
  2. Read/Write Problem
    By Tobias in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 10th February 2010, 02:51
  3. Big characters on HD44780 4x20
    By erpalma in forum mel PIC BASIC Pro
    Replies: 23
    Last Post: - 7th January 2007, 03:21
  4. LCD + bar graph
    By DynamoBen in forum mel PIC BASIC Pro
    Replies: 13
    Last Post: - 5th October 2005, 15:50
  5. Sinus calculating !
    By Don Mario in forum mel PIC BASIC Pro
    Replies: 29
    Last Post: - 29th November 2004, 00:56

Members who have read this thread : 1

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