|
|
View previous topic :: View next topic |
Author |
Message |
Papi
Joined: 08 Dec 2012 Posts: 36
|
|
Posted: Sun Jan 27, 2013 6:29 pm |
|
|
I'm back again guys, so far am trying to test my gps. I am getting RMC data on my hyper terminal like this:
-------------------------------------------------------------------------------------
$GPRMC,160612.00,A,2456.4010,N,06705.1067,E,000.1,083.8,191009,000.4,E,A*35
$GPRMC,160613.00,A,2456.4011,N,06705.1065,E,000.1,083.8,191009,000.4,E,A*37
$GPRMC,160614.00,A,2456.4012,N,06705.1063,E,000.1,083.8,191009,000.4,E,A*35
$GPRMC,160615.00,A,2456.4013,N,06705.1061,E,000.1,083.8,191009,000.4,E,A*37
$GPRMC,160616.00,A,2456.4013,N,06705.1060,E,000.0,083.8,191009,000.4,E,A*34
$GPRMC,160617.00,A,2456.4013,N,06705.1058,E,000.0,083.8,191009,000.4,E,A*3E
$GPRMC,160618.00,A,2456.4013,N,06705.1056,E,000.1,083.8,191009,000.4,E,A*3E
$GPRMC,160619.00,A,2456.4013,N,06705.1053,E,000.2,083.8,191009,000.4,E,A*39
$GPRMC,160620.00,A,2456.4013,N,06705.1050,E,000.1,083.8,191009,000.4,E,A*33
$GPRMC,160621.00,A,2456.4016,N,06705.1047,E,000.1,083.8,191009,000.4,E,A*31
$GPRMC,160622.00,A,2456.4016,N,06705.1045,E,000.1,083.8,191009,000.4,E,A*30
$GPRMC,160623.00,A,2456.4016,N,06705.1042,E,000.1,083.8,191009,000.4,E,A*36
-------------------------------------------------------------------------------------
Now I want to read that data in microcontroller and display it on the LCD.
Can anyone tell me or anyone have simple code?? or instructions on where to start or even code which I can modify to what I want??
I have tried to search here but didn't find anything yet.
As your advice before, I have changed my PIC and the one I have now have two serial ports... |
|
|
ezflyr
Joined: 25 Oct 2010 Posts: 1019 Location: Tewksbury, MA
|
|
Posted: Sun Jan 27, 2013 7:56 pm |
|
|
Hi Papi,
You want to use an interrupt driven 'circular buffer' to receive the serial data from the GPS. The folks at CCS have kindly provided an example that shows how to do this called 'ex_sisr.c', which can be found in the examples folder.
You will want to 'filter' the incoming data to exclude all NMEA string except the one you want. A 'state machine' construct is one of the easiest ways to do this. Alternatively, you may be able to configure you GPS module to only output the desired NMEA sentence, eg. $GPRMC.
John |
|
|
Papi
Joined: 08 Dec 2012 Posts: 36
|
|
Posted: Tue Jan 29, 2013 5:09 pm |
|
|
ezflyr wrote: | Hi Papi,
You want to use an interrupt driven 'circular buffer' to receive the serial data from the GPS. The folks at CCS have kindly provided an example that shows how to do this called 'ex_sisr.c', which can be found in the examples folder.
You will want to 'filter' the incoming data to exclude all NMEA string except the one you want. A 'state machine' construct is one of the easiest ways to do this. Alternatively, you may be able to configure you GPS module to only output the desired NMEA sentence, eg. $GPRMC.
John |
Alright thank you for your reply I will check around and try to write the code and see how it goes, do you have any simple code which will help me to start?? |
|
|
bkamen
Joined: 07 Jan 2004 Posts: 1615 Location: Central Illinois, USA
|
|
Posted: Tue Jan 29, 2013 5:16 pm |
|
|
Papi wrote: |
Alright thank you for your reply I will check around and try to write the code and see how it goes, do you have any simple code which will help me to start?? |
CCS includes an example in the Examples directory of the CCS compiler install directory called EX_SISR.c
-Ben _________________ Dazed and confused? I don't think so. Just "plain lost" will do. :D |
|
|
ezflyr
Joined: 25 Oct 2010 Posts: 1019 Location: Tewksbury, MA
|
|
Posted: Tue Jan 29, 2013 6:03 pm |
|
|
Hi Papi,
A year ago, I was in your position of wanting to extract the time and date from a GPS module. I wanted to use this information to obtain an accurate time for setting a clock project. I started with 'ex_sisr.c', as I suggested you do, and I built on this code to suit my own needs. No one is going to just hand you the complete code for your project, you have to write it yourself. We'll be here to help along the way when you get stuck, but you've got to show a lot more initiative or it's doubtful you'll get any help at all.
Here is my GPS project:
http://dangerousprototypes.com/forum/viewtopic.php?f=56&t=3976&p=39787#p39787
Good Luck!
John |
|
|
Papi
Joined: 08 Dec 2012 Posts: 36
|
|
Posted: Wed Jan 30, 2013 6:26 am |
|
|
bkamen wrote: | Papi wrote: |
Alright thank you for your reply I will check around and try to write the code and see how it goes, do you have any simple code which will help me to start?? |
CCS includes an example in the Examples directory of the CCS compiler install directory called EX_SISR.c
-Ben |
I have seen it, I will start with that... |
|
|
Papi
Joined: 08 Dec 2012 Posts: 36
|
|
Posted: Wed Jan 30, 2013 6:32 am |
|
|
ezflyr wrote: | Hi Papi,
A year ago, I was in your position of wanting to extract the time and date from a GPS module. I wanted to use this information to obtain an accurate time for setting a clock project. I started with 'ex_sisr.c', as I suggested you do, and I built on this code to suit my own needs. No one is going to just hand you the complete code for your project, you have to write it yourself. We'll be here to help along the way when you get stuck, but you've got to show a lot more initiative or it's doubtful you'll get any help at all.
Here is my GPS project:
http://dangerousprototypes.com/forum/viewtopic.php?f=56&t=3976&p=39787#p39787
Good Luck!
John |
Yeah that's what am doing now, I have started writing the code already, actual when am stuck I will ask where am going wrong..... |
|
|
Papi
Joined: 08 Dec 2012 Posts: 36
|
|
Posted: Fri Feb 01, 2013 9:59 pm |
|
|
Hi guys, because the project am doing inside the building so my gps Nmea they are not changing, I was planning to to add manual on my code for LONG and LAT, what about this will be good idea?? instead of waiting for gps to give me new data for every second....
Any advice? |
|
|
ezflyr
Joined: 25 Oct 2010 Posts: 1019 Location: Tewksbury, MA
|
|
Posted: Fri Feb 01, 2013 11:28 pm |
|
|
Hi Papi,
Hmmm, you're going to have to make this work eventually, right? A GPS receiver will typically transmit NMEA sentences regardless of having a "fix" or not. The only difference is that the data will be invalid. Thus, you should be able to fully code your receive routines regardless of whether your GPS can get a valid fix or not. Of course, once that is done and tested, you could proceed using a fixed Lat/Long that you hard code for further testing purposes.
John |
|
|
Papi
Joined: 08 Dec 2012 Posts: 36
|
|
Posted: Sat Feb 02, 2013 5:15 pm |
|
|
ezflyr wrote: | Hi Papi,
Hmmm, you're going to have to make this work eventually, right? A GPS receiver will typically transmit NMEA sentences regardless of having a "fix" or not. The only difference is that the data will be invalid. Thus, you should be able to fully code your receive routines regardless of whether your GPS can get a valid fix or not. Of course, once that is done and tested, you could proceed using a fixed Lat/Long that you hard code for further testing purposes.
John |
Hi John,
Thank you for your explanation, ok I will do that first any question I will ask here no problem at all.. |
|
|
Papi
Joined: 08 Dec 2012 Posts: 36
|
|
Posted: Wed Feb 27, 2013 4:34 pm |
|
|
Hi guys am back again, actual the good news is that now am 60% ahead, I appreciate for your support and help.
So before I was using PIC16F877A and decided to change to PIC18F46K22 so since I ordered the PIC18 instead of sitting around and wasting time I was using PIC16 to play around with GPS and I have done a lot and to display LAT and LONG on the LCD, so that part is done for now next part I will move on to GSM.
Also am having problem at the movement so I will be happy if someone could tell me where am doing wrong..
Actual I have received my PIC18F46K22 so what I did I just removed PIC16F877A and put PIC18, I haven't done any changes with my board and still am using the same 20mhz,
The problem I have now, I have created simple code just for blinking LED, but the code I can compile fine with successful and I have set my MPLAB in debug mode but I can't RUN the code so I have tried to search and find out but am not too sure what is the problem.
I have attached the code below and what is the problem with it? and what about the fuses??
Code: | #include <18f46k22.h>
#Fuses INTRC_IO,NOPLLEN,PRIMARY_ON,NOFCMEN,NOIESO,PUT,
#Fuses BROWNOUT,BORV29,NOWDT,
#Fuses CCP2C1,NOPBADEN,CCP3B5,
#Fuses NOHFOFST,TIMER3B5,NOMCLR,
#Fuses NOSTVREN,NOLVP,NOXINST,NODEBUG
#Fuses NOPROTECT,NOCPB,NOCPD,NOWRT,NOWRTC
#Fuses NOWRTB,NOWRTD,NOEBTR,NOEBTRB
#use delay( clock=2000000, // clock changed to 2000000
#define LED1 PIN_B4
#define LED2 PIN_B5
#define DELAY 500
void main()
{
//Example blinking LED program
while(true)
{
output_low(LED1);
delay_ms(DELAY);
output_high(LED2);
delay_ms(DELAY);
output_low(LED2);
delay_ms(DELAY);
output_high(LED1);
delay_ms(DELAY);
}
} |
Also before I was using Picki2 but with PIC18 is not working with Pickit 2 so I have to use pickit3
Last edited by Papi on Thu Feb 28, 2013 12:36 pm; edited 1 time in total |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9272 Location: Greensville,Ontario
|
|
Posted: Wed Feb 27, 2013 5:38 pm |
|
|
Not to sure if this line ...
#use delay( clock=2000000, // clock changed to 80000
.. will actually compile properly.
I'm not clear what speed you really want 80KHz may not be possible, 2MHz seems slow as well.
I use white breadboards and usually run at 16MHz or 64MHz.
I will confirm that a PICkit3 will program a PIC18F46K22.
Be sure to have 'release' and not 'debug' if you plan to actually test the PIC/program in the 'real world' and NOT the MPLAB simulation/debugging tool.BTW you have NODEBUG selected, so I don't think you'll be able to debug with MPLAB. Others will know as I always test in the real world.
hth
jay |
|
|
Papi
Joined: 08 Dec 2012 Posts: 36
|
|
Posted: Wed Feb 27, 2013 5:57 pm |
|
|
temtronic wrote: | Not to sure if this line ...
#use delay( clock=2000000, // clock changed to 80000
.. will actually compile properly.
I'm not clear what speed you really want 80KHz may not be possible, 2MHz seems slow as well.
I use white breadboards and usually run at 16MHz or 64MHz.
I will confirm that a PICkit3 will program a PIC18F46K22.
Be sure to have 'release' and not 'debug' if you plan to actually test the PIC/program in the 'real world' and NOT the MPLAB simulation/debugging tool.BTW you have NODEBUG selected, so I don't think you'll be able to debug with MPLAB. Others will know as I always test in the real world.
hth
jay |
Thank you Jay,
Yeah that line was suppose to be 20MHz and not 8MHz that is my mistake, also am using veroboard with 20MHz, ok fine I will have look what you said then I will be back, I never had any issue with PIC16,yeah pickit3 seems is working fine...also another thing when I set to Programmer worked fine without any problem... |
|
|
Papi
Joined: 08 Dec 2012 Posts: 36
|
|
Posted: Thu Feb 28, 2013 1:44 pm |
|
|
Am still having problem with PIC18, I haven't find solution yet after long day..
Am using MPLAB IDE V8.63
Compiler 4.138
that is the error am getting
PICkit 3 detected
Connecting to PICkit 3...
Firmware Suite Version...... 01.26.43
Firmware type......................PIC18F
PICkit 3 Connected.
CAUTION: Check that the device selected in MPLAB IDE (PIC18F46K22)
is the same one that is physically attached to the debug
tool. Selecting a 5V device when a 3.3V device is connected
can result in damage to the device when the debugger checks
the device ID.
Device ID Revision = 00000004
Programming...
The following memory regions failed to program correctly:
Debug Executive
Programming failed
Why this happening, Never had this issue with PIC16 any advice? |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Thu Feb 28, 2013 2:59 pm |
|
|
Pickit 3 is a Microchip product. It's not a CCS issue. I'll show you how
to use Google to search the Microchip forum. Copy and paste the
following line into the Google search box:
Quote: | site:microchip.com/forums pickit3 18F46K22 Debug Executive Programming failed |
Note how this confines the search to the Microchip forums and searches
for your exact problem. You'll quickly find the answer.
Short answer: Upgrade MPLAB IDE, preferably to the latest version. |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|