DPRG
DPRG List  



[DPRG] Serial woes 2

Subject: [DPRG] Serial woes 2
From: scott at lighthouse21.com scott at lighthouse21.com
Date: Sun Feb 25 23:21:03 CST 2007

Hello all,

I'm trying to grab characters from a serial data stream coming into an
Atmega 88.  If I just debug print them to the LCD I can see the value come
through that I'm looking for but if I try to capture it with an IF the IF
never runs.  Here's the code snippet:

	  if (!(UCSR0A & (1 << RXC0))) // See if there's a character waiting
	  {
	     iFoo = ~iFoo; // do nothing if there's no char waiting
	  }
	  else
	  {
		 cFromUART = UDR0; // Get the character from the UART
		 if (cFromUART == 0xF1) // If its a time code message, catch it
		 {
		    sprintf (sTimeCode,"%cTIME%d",12,cFromUART);
			LCDBug (sTimeCode);
			while (1); // Show it on the LCD for ever and ever
		 }

This IF never actually comes through.  If I just run the data straight to
the LCD you can see 0xF1 go by a couple of times.

More information about the DPRG mailing list

Copyright © 1984 - 2006 Dallas Personal Robotics Group. All rights reserved.
Website Design by NCC

For the latest robot news visit robots.net