|
|
View previous topic :: View next topic |
Author |
Message |
mjscott
Joined: 20 Apr 2004 Posts: 2
|
Printf |
Posted: Tue Apr 20, 2004 8:59 am |
|
|
I'm seeing an error with printf using signed int16. I'm always getting the last number to be returned as binary.
Example
(led_putch is an LED output routine)
signed int16 temp;
temp = 215;
printf(ledputch, "\n%ld", temp);
What I get passed to led_putch is '\n', '0x32', '0x31', '0x05'
If I change the format to "\n%lu" everything returns as ascii.
Anyone else seeing this? |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Tue Apr 20, 2004 12:58 pm |
|
|
You didn't give your compiler version, which can make all
the difference in the world.
The following test program works OK with PCM vs. 3.190.
It produces this output on the terminal window:
Code: | #include <16F877.h>
#fuses XT, NOWDT, NOPROTECT, BROWNOUT, PUT, NOLVP
#use delay(clock = 4000000)
#use rs232(baud=9600, xmit=PIN_C6, rcv=PIN_C7, ERRORS)
void ledputch(char c)
{
putc(c);
}
//=====================
main()
{
signed int16 temp;
temp = 215;
printf(ledputch, "\n%ld", temp);
while(1);
} |
|
|
|
|
|
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
|