GPS clock timing !


Results 1 to 12 of 12

Threaded View

  1. #1
    Join Date
    Jul 2006
    Posts
    22

    Default GPS clock timing !

    Dear Forum:

    I'd like to build a small Clock with GPS time-sync, look, I'm using the Darrel instant interrups to drive the Timer 1 clock, it works great ! (Thanks Darrel !), but when I tried to read the GPS data (over Pin RB1) there is a lot of missed/corrupted bytes in my buffer, something like this:

    the first lcd line is the RMC message data (corrupted in this case) and the second line display the RTC registers, (plese note tha my LCD was broken so the lower line is wrong )

    this is the code
    Code:
    '''''''''''''' INCLUDES ''''''''''''''''''''''''''''''''''''	
    	DEFINE OSC 4 
    	INCLUDE "DT_INTS-18.bas"
    	INCLUDE "ReEnterPBP-18.bas"
    	INCLUDE "Elapsed_INT-18.bas"  
    	INCLUDE "LCDPICDEM2.BAS"		' it runs on PIDEM2 PLUS Board
    
    ''''''''''''' VARIABLES ''''''''''''''''''''''''''''''''''''	
    		j    var byte
    		rmc  var byte[100]	' this gets RMC data
    		led1 var  portb.2
    		b0   var byte
    		adcon1 =$07
    		trisa.2 = 0
    		trisa.4 = 1
    		trisb.1 = 1
    		trisb.2 = 0
    		trisb.0 = 1
    		trisc.2 = 0
    	    porta.2 = 0
    		gps var portb.1
    	 	spk    var portc.2
    
    ''''''''''''' CODE ''''''''''''''''''''''''''''''''''''	
    	
    init:	
    	ASM
    	INT_LIST  macro    ; IntSource,        Label,  Type, ResetFlag?
    	        INT_Handler   TMR1_INT,  _ClockCount,   PBP,  yes
    	        endm
    	INT_CREATE                 
    	ENDASM
    	T0CON = %10011010
    	@    INT_ENABLE  TMR1_INT      
    	GOSUB ResetTime
    	GOSUB StartTimer           
    	hours = 11 : minutes = 30: seconds = 0
        
    Start:
    	LCDOUT $FE,1                    ' Initialize LCD
    	PAUSE  200	
    	lcdout $fe,2,"Starting ..." : pause 500
    
    Main:
     
    	serin2 gps,188,1000,no_gps,[wait("MC"),str rmc\15\10]	'15 bytes only for testing () wait for RMC message
     
    	lcdout $fe,$c0,"Time : ",dec2 hours,":",dec2 minutes,":",dec2 seconds
     
    	lcdout $fe,2,"$",str rmc\15 :pause 500						' these are the bytes as captured !
    	goto main
    
    no_gps:
    	lcdout $fe,2,"Np Gps stream ": pause 500
    	goto  main
    '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
    my first idea to fix it,was stop the timer just before get the gps data stream, like this:

    Code:
    	gosub stoptimer
    	serin2 gps,188,1000,no_gps,[wait("MC"),str rmc\15\10]	'15 bytes only for testing () wait for RMC message
    	gosub starttimer
    using above lines my LCD looks like this:

    looks good !!!


    but here, I have a problem with the time !, this make delay on the RTC, If I just was updated my clock register each ten minutes or so, that work out very well, but I want to keep my RTC all the time, (for logging timed-stamp GPS locations by example).

    I knew this is a time issue (software generated timing "serin2"), another plan is to use the internal UART build in my pic (i'm using a18f452), but my GPS only outputs TTL levels this create interfacing problems, how can I get working this project?

    Thanks !!!
    Last edited by bethr; - 1st July 2008 at 18:44.

Similar Threads

  1. GPS $GPRMC to PIC16F684. Need help with SERIN2
    By xnihilo in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 27th November 2009, 09:47
  2. Shiftout/in
    By BobEdge in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 23rd August 2007, 11:48
  3. Help with sound command in 2 programs
    By hyperboarder in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 5th July 2007, 20:36
  4. Replies: 2
    Last Post: - 28th April 2006, 12:10
  5. GPS Receiver
    By lester in forum Adverts
    Replies: 2
    Last Post: - 22nd February 2006, 12:47

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