|
|
View previous topic :: View next topic |
Author |
Message |
mbogucki Guest
|
ADC values negative in range of (127 to 255) |
Posted: Sat Mar 19, 2005 9:49 pm |
|
|
Hi All,
We've been attempting to solve a "simple" mystery. In the process of creating a simple datalogger, we've used the ex_admm.c example as our base code.
When using the example outright, everything looks good, but the output is in hex. We've changed the code from:
printf("\n\rMin: %2X Max: %2X\r\n",min,max);
to
printf("\n\rMin: %2d Max: %2d\r\n",min,max);
in order to see everything in decimal.
When running, the output is fine when our range is from 0 to 127, but when we go beyond this, the values are now -127 -- 0...
Can anyone shed some light on this mystery?
In terms of hardware, we are using a pic 16f876. and our compiler is version
PCM compiler version 3.163
Thank you very much for your time and support.
--Mike Bogucki |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Sat Mar 19, 2005 10:13 pm |
|
|
In CCS, to display unsigned 8-bit values with printf(), you use: "%u"
To display unsigned 16-bit or 32-bit values, you use: "%lu" |
|
|
mbogucki Guest
|
ADC negative values.... THANKS!!! :) |
Posted: Tue Apr 05, 2005 7:50 am |
|
|
Hi PCM Programmer,
Sorry for the long delayed response...
Thank you very much for the suggested solution. It worked like a charm!!!
--Mike
|
|
|
|
|
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
|