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

what wrong with rs232

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
ryan.reeve



Joined: 23 Jul 2006
Posts: 20

View user's profile Send private message

what wrong with rs232
PostPosted: Sat Oct 14, 2006 1:33 am     Reply with quote

Whats wrong with this code.i cant get any character from the serial port.

Code:
#include<stdio.h>
#include<stdlib.h>
#include<string.h>

#define SIZE 80
#define CR 0x0d
#define COMMA 0x2C

#use rs232(baud=9600, xmit=PIN_C6,rcv=PIN_C7, stream=GPS)

void parse();
void rmc();
void gga();
unsigned int j,k;
unsigned char *pChar,LastComaPos;
unsigned char inStr[SIZE] ;
unsigned char c;
int8 index=0;
 

#INT_RDA
void gps_isr(void)
{

 c =fgetc(GPS);
 printf(lcd_putc,"\%c",c); //just for debugging
 if(c=='$')
 {
   
   inStr[index]=c;
   index++;
   if (index==CR) index=0;
 }
}

void main()
{

    lcd_init();

    WHILE(TRUE)
    {
      parse();
    }
}

void parse()
{
   if(inStr[0]!='$')
    printf(lcd_putc,"No Valid Data");
   if(inStr[3]=='R' && inStr[4]=='M' && inStr[5]=='C')
      rmc();
    else if(inStr[3]=='G' && inStr[4]=='G' && inStr[5]=='A')
          gga();

}


PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Sat Oct 14, 2006 2:02 am     Reply with quote

At a minimum, you need to enable INT_RDA interrupts and also
GLOBAL interrupts.

Use the program in this post as a guide:
http://www.ccsinfo.com/forum/viewtopic.php?t=27156&start=1
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