ryan.reeve
Joined: 23 Jul 2006 Posts: 20
|
what wrong with rs232 |
Posted: Sat Oct 14, 2006 1:33 am |
|
|
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();
}
|
|
|