Nmea Module

General discussion relating to the library modules supplied with the compiler

Moderators: David Barker, Jerry Messina

Post Reply
Mast
Posts: 65
Joined: Wed Aug 29, 2007 6:24 am
Location: France

Nmea Module

Post by Mast » Thu Sep 27, 2007 8:49 am

Hi David,
i don't andestand your exemple. You write the result "USART.Write(field)" on the PC screen. But it's not possible. It's on the lcd screen i want write it. Sorry , but i need light

Code: Select all

// import modules...
Include "NMEA.bas"
Include "Usart.bas"
Include "Convert.bas"

' local variables
Dim NMEAItem As TNMEA
Dim Field As String

' program start
USART.SetBaudrate(br4800)
While True
   If NMEA.GetItem(NMEAItem) And NMEAItem.Valid Then
      NMEA.GetField(NMEAItem,0,Field)
      If Field = "$GPRMC" Then
         USART.Write(Field)
         NMEA.GetField(NMEAItem, 9, Field)
         USART.Write(" [Date ", Field, "]")
         NMEA.GetField(NMEAItem, 1, Field)
         USART.Write(", [Time ", Field, "]", 13, 10)
         USART.Write(13, 10)         
      EndIf  
   EndIf
Wend

User avatar
David Barker
Swordfish Developer
Posts: 1214
Joined: Tue Oct 03, 2006 7:01 pm
Location: Saltburn by the Sea, UK
Contact:

Post by David Barker » Thu Sep 27, 2007 11:37 am

It would be a very simple code change. Take a look at the LCD sample 'write.bas'. Basically...

Code: Select all

// set LCD options
#option LCD_DATA = PORTD.4
#option LCD_RS = PORTE.0
#option LCD_EN = PORTE.1
Include "LCD.bas" // import module

...

LCD.WriteAt(1,1, Field) // example call

Mast
Posts: 65
Joined: Wed Aug 29, 2007 6:24 am
Location: France

Post by Mast » Thu Sep 27, 2007 1:51 pm

Sorry but with this code, nothing on the screen. but with Me, i find a code work fine, so i'm sure th e connexion is good. if i change "IF Field = "$GPRMC" THEN" for "IF Field <> "$GPRMC" THEN", it's same problem. :cry:

Code: Select all

// device and clock
DEVICE = 18F452
CLOCK = 20

#OPTION LCD_DATA@ = 4
#option LCD_DATA = PORTD.4
#option LCD_RS = PORTD.2
#option LCD_EN = PORTD.3

/// import modules...
INCLUDE "NMEA.bas"
INCLUDE "Usart.bas"
INCLUDE "Convert.bas"
INCLUDE "lcd.bas"

' local variables
DIM NMEAItem AS TNMEA
DIM Field AS STRING

' program start
USART.SetBaudrate(br4800)
WHILE True
   IF NMEA.GetItem(NMEAItem) AND NMEAItem.Valid THEN
      NMEA.GetField(NMEAItem,0,Field)
      IF Field = "$GPRMC" THEN
      
        LCD.WriteAt(1,1, "OK")
                
      ENDIF  
   ENDIF
WEND

User avatar
David Barker
Swordfish Developer
Posts: 1214
Joined: Tue Oct 03, 2006 7:01 pm
Location: Saltburn by the Sea, UK
Contact:

Post by David Barker » Thu Sep 27, 2007 2:07 pm

This works fine for me...

Code: Select all

// device and clock
Device = 18F452
Clock = 20

// PROTON development board...
#option LCD_DATA = PORTD.4
#option LCD_RS = PORTE.0
#option LCD_EN = PORTE.1

// BRGH is low speed...
#option USART_BRGH = false

/// import modules...
Include "NMEA.bas"
Include "Usart.bas"
Include "Convert.bas"
Include "lcd.bas"
Include "utils.bas"

' local variables
Dim NMEAItem As TNMEA
Dim Field As String

' program start
ADCON1 = 15
LCD.Cls
LCD.WriteAt(1,1,"WAITING...")
USART.SetBaudrate(br4800)
While True
   If NMEA.GetItem(NMEAItem) And NMEAItem.Valid Then
      NMEA.GetField(NMEAItem,0,Field)
      If Field = "$GPRMC" Then
         LCD.WriteAt(2,1, "GPRMC Received")
      EndIf 
   EndIf
Wend 

Mast
Posts: 65
Joined: Wed Aug 29, 2007 6:24 am
Location: France

Post by Mast » Thu Sep 27, 2007 3:09 pm

Thanks David, with this this line it's ok.

Code: Select all

#option USART_BRGH = false
i go to see what's this

User avatar
octal
Registered User
Registered User
Posts: 586
Joined: Thu Jan 11, 2007 12:49 pm
Location: Paris IDF
Contact:

Post by octal » Thu Sep 27, 2007 3:19 pm

Mast wrote:Thanks David, with this this line it's ok.

Code: Select all

#option USART_BRGH = false
i go to see what's this
you should look at the post http://www.sfcompiler.co.uk/forum/viewtopic.php?t=367

This was discussed recently (2 or 3 days ago) "warmly" (hehe :o ).

Regards
octal

User avatar
David Barker
Swordfish Developer
Posts: 1214
Joined: Tue Oct 03, 2006 7:01 pm
Location: Saltburn by the Sea, UK
Contact:

Post by David Barker » Thu Sep 27, 2007 5:51 pm

This might provide some interesting reading...

http://www.sfcompiler.co.uk/wiki/pmwiki ... er.Options

Mast
Posts: 65
Joined: Wed Aug 29, 2007 6:24 am
Location: France

Post by Mast » Thu Sep 27, 2007 6:50 pm

i can't see all posts.
(Désolé, mais le web traduction ne fonctionne pas).J'en rajoute en francais, comprendra qui pourra. je me bats seul depuis 2 jours pour faire fonctionner un module gps avec sf. je trouve un code (Me) que je modifie simplement et qui fonctionne pour moi. Je prefere travailler avec sf, mais le module proposé ne fonctionne pas. je pense qu'il aurait été simple d'y rajouter cette option dans le module ! sinon ok, je devrais comprendre l'anglais parfaitement, savoir lire parfaitement le datasheet afin de ne pas poser des questions betes. désolé.... j'essayerai de faire mieux la prochaine fois. (je suis legerement en colere)
octal wrote:
Mast wrote:Thanks David, with this this line it's ok.

Code: Select all

#option USART_BRGH = false
i go to see what's this
you should look at the post http://www.sfcompiler.co.uk/forum/viewtopic.php?t=367

This was discussed recently (2 or 3 days ago) "warmly" (hehe :o ).

Regards
octal

Post Reply