I am still getting up to speed on the TS-7260. I am trying to read a
GPS data from the serial port. It reads the data from the first
burst coming from the GPS (several messages). I get $GPSRMC and a
few other messages and then it pauses for a while and then just
keeps outputing "buff= ". I would like to read the stream
continuosly. Any idea what is screwed up?
Thanks
Charlie
#include <fcntl.h>
#include <termios.h>
#include <stdio.h>
#define BAUDRATE B9600
#define MODEMDEVICE "/dev/ttyAM1"
#define _POSIX_SOURCE 1 /* POSIX compliant source */
main()
{
int fd;
struct termios oldtio,newtio;
char buf[512];
fd = open(MODEMDEVICE, O_RDWR | O_NOCTTY );
if (fd <0) {perror(MODEMDEVICE); exit(-1); }
tcgetattr(fd,&oldtio); /* save current serial port settings */
bzero(&newtio, sizeof(newtio)); /* clear struct for new port
settings */
newtio.c_cflag = BAUDRATE | CRTSCTS | CS8 | CLOCAL | CREAD;
newtio.c_iflag = IGNPAR | ICRNL;
newtio.c_oflag = 0;
newtio.c_lflag = ICANON;
tcflush(fd, TCIFLUSH);
tcsetattr(fd,TCSANOW,&newtio);
while (1)
{
read(fd,buf,512);
printf("buf = %s\n" ,buf);
}
tcsetattr(fd,TCSANOW,&oldtio); // restore the old port settings
}
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/ts-7000/
<*> Your email settings:
Individual Email | Traditional
<*> To change settings online go to:
http://groups.yahoo.com/group/ts-7000/join
(Yahoo! ID required)
<*> To change settings via email:
<*> To unsubscribe from this group, send an email to:
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
|