|
|
View previous topic :: View next topic |
Author |
Message |
forwardti Guest
|
How can I display the GPS data on the Debugger monitor? |
Posted: Mon Oct 23, 2006 7:00 am |
|
|
Now I'm using the ccs & ICD u40 to do the coding. Here is a GPS receiver and I wanna to get the GPS receiver data and to display just on the debugger monitor, how can I manage this? Thank you.
the following is the code I wrote. Is there any problem? There is some rubbish characters on the monitor.
Code: | #include<16f877A.h>
#fuses HS,NOWDT,NOPROTECT,NOLVP
#device ICD=TRUE
#use delay(clock=8000000)
#use RS232(baud=4800, xmit=PIN_C6, rcv=PIN_C7, stream=GPS)
#use RS232(baud=9600, xmit=pin_B3, rcv=pin_B3, stream=DEBUG)
void main ()
{
int i;
char GPS_packet[70];
char c;
while (1)
{
i = 0;
for (i = 0; i < 70; i++)
{
if (kbhit(GPS))
{
c = fgetc (GPS);
GPS_packet[i] = c;
}
}
for (i = 14; i <= 40; i++)
{
fprintf (DEBUG, "%C", GPS_packet[i]);
}
}
}
|
|
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Mon Oct 23, 2006 11:43 am |
|
|
Quote: |
for (i = 0; i < 70; i++)
{
if (kbhit(GPS))
{
c = fgetc (GPS);
GPS_packet[i] = c;
}
}
|
Your code above doesn't wait for the characters to come in.
Most of the time, kbhit(GPS) will return 0 and the if() statement
code won't execute. But the for(;;) loop will continue to execute
and it will quickly go through 70 times, but without doing anything.
You will get one character if you're lucky. |
|
|
|
|
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
|