CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

How can I display the GPS data on the Debugger monitor?

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
forwardti
Guest







How can I display the GPS data on the Debugger monitor?
PostPosted: Mon Oct 23, 2006 7:00 am     Reply with quote

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

View user's profile Send private message

PostPosted: Mon Oct 23, 2006 11:43 am     Reply with quote

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.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
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