Quote:
|
Originally Posted by squide
Thanks for the reply!
We're using an optical sensor to test for input without modifying the Default Code besides the printf statement. We put the sensor in Pin 6 (rc_dig_in06), so with the default configurations it should be okay. It also behaved the same in 8 & 10.
|
Lets try this tack then just to make sure it isn't a printf issue.
What does your printf look like and how are the variables you use in it declared? Just to make sure you are seeing the correct values.
The printf implementation will give you bad results that look right if you treat it as a normal C printf.
e.g.,
unsigned char digitalvalue;
unsigned int analogvalue;
digitalvalue = (unsigned char) rc_dig_in06;
analogvalue = (unsigned int) Get_Analog_Value(rc_ana_in01);
printf("My digital value %d, My analog value %d", (int) digitalvalue, (int)analogvalue);
We wrote our own print functions to get what we want, especially since printf takes up so much space. You can get the same functionality in 40 bytes rather than the 4000 or so printf takes up.