Hi, I got a follow up question, I need to get latitude and longitude from this string
$GPRMC,053740.000,A,250.6319,N,12136.0099,E,2.69,7 9.65,100106,,,A*53. How can I achieve it using SERIN?
thanks,
mbox
Hi, I got a follow up question, I need to get latitude and longitude from this string
$GPRMC,053740.000,A,250.6319,N,12136.0099,E,2.69,7 9.65,100106,,,A*53. How can I achieve it using SERIN?
thanks,
mbox
You would be better off using SERIN2.
Here is a snippet from something .
Code:SERIN2 PORTB.2,16572,[WAIT("$GPGGA"),WAIT(","),DEC2 H,DEC2 M,DEC2 S,_ WAIT(","),DEC2 ND,DEC2 NM,WAIT("."),DEC3 NMD,WAIT(",N,"),_ DEC3 WD,DEC2 WM,WAIT("."),DEC3 WMD]
Dave
Always wear safety glasses while programming.
Hi, I'm trying to understand SERIN2 command. why this code do not work when I entered "hello"?
regards,Code:Include "modedefs.bas" main: Serin2 PORTC.7, T9600, error, [WAIT("hello")] serout2 PortC.6, T9600, ["Valid"] goto main error: serout2 PortC.6, T9600, ["Invalid"] goto main end
mbox
I imagine many are thinking, "have you read the manual?".
Include "modedefs.bas"
Does nothing with SERIN2/SEROUT2.
T9600
Is for SERIN/SEROUT. "T" is for true mode anyways so if you are connecting directly to a PC you want INVERTED mode.
Appendix A from the manual has the modes for SERIN2. At 9600 baud the mode will be 16468. To see how that is calculated look here. http://www.picbasic.co.uk/forum/cont...SERIN2-SEROUT2
You will also want to specify a time for the GOTO LABEL "error".
Try this
The above will wait for 100 milliseconds, then GOTO "error" if "hello" is not received.Code:SERIN2 PORTC.7, 16468,100, error, [WAIT("hello")]
Dave
Always wear safety glasses while programming.
Hi mackrackit, thanks for the help, appreciated very much. I manage to run this code MCU to PC and use this guide http://melabs.com/resources/ser2modes.htmI know u have given me an example, but dont really get it ,Code:main: SERIN2 PORTC.7, 84,200, error, [WAIT("Hello")] serout2 PortC.6,84, ["Valid",10,13] goto main error: serout2 PortC.6, 84, ["Invalid",10,13] goto main end
Is there a way I could receive this value "$GPRMC,053740.000" and place it on a variable?
thanks and regards,
mbox
Last edited by mbox; - 2nd November 2010 at 01:00.
[WAIT("$GPRMC"),WAIT(","),DEC2 H,DEC2 M,DEC2 S]Code:H VAR BYTE 'HOURS M VAR BYTE 'MINUTES S VAR BYTE 'SECONDS [WAIT("$GPRMC"),WAIT(","),DEC2 H,DEC2 M,DEC2 S]
Waits for GPRMC
[WAIT("$GPRMC"),WAIT(","),DEC2 H,DEC2 M,DEC2 S]
Waits for ","
[WAIT("$GPRMC"),WAIT(","),DEC2 H,DEC2 M,DEC2 S]
Places the first two digits into VAR H
[WAIT("$GPRMC"),WAIT(","),DEC2 H,DEC2 M,DEC2 S]
Places the middle two digits into VAR M
[WAIT("$GPRMC"),WAIT(","),DEC2 H,DEC2 M,DEC2 S]
Places the last two digits into VAR S
"$GPRMC,053740.000"
053740 =
H = 05 Hours
M = 37 Minutes
S = 40 Seconds
Dave
Always wear safety glasses while programming.
If you have not seen this it might be handy
http://aprs.gids.nl/nmea/
Dave
Always wear safety glasses while programming.
Bookmarks