I have a problem at the printf() function. I am using AT89C52 chip. and I am sending the data to the serial port. For instance when using the code below,
and data taking from the serial port(rx/tx) like this:
1251A3C....
but, data that I need should be like this:
0102051A3C....
I used all printf function but same problem.
awaiting for your reply
regards
kamil
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I'd also consider to continue using printf_tiny() because it is so cute
and write an extra function like puthex(); where you need an output format
that printf_tiny() does not support.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Yes, you are right. I dont need using printf_fast_f() but when I used printf()function I am getting some message!
>>>>>>>>>>>>>>>>>>>>>>>>
?ASlink-Error-Could not get 21 consecutive bytes in internal RAM for area DSEG.
>>>>>>>>>>>>>>>>>>>>>>>>
What does it mean?
kamil
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I have a problem at the printf() function. I am using AT89C52 chip. and I am sending the data to the serial port. For instance when using the code below,
unsigned char value1,value2,value3,value4,value5;
value1=0x01;
value2=0x02;
value3=0x05;
//
value4=0x1A;
value5=0x3C;
//
printf_tiny ("%x%x%x%x%x",value1,value2,value3,value4,value5);
and data taking from the serial port(rx/tx) like this:
1251A3C....
but, data that I need should be like this:
0102051A3C....
I used all printf function but same problem.
awaiting for your reply
regards
kamil
use "%02x%02x" with the printf function.
(printf_tiny does not support field width)
Beaten to it! As frief says, printf("%02x%02x", value1, value2); is the answer.
can I use printf_fast_f() function instead of printf()?
kamil
> can I use printf_fast_f() function instead of printf()?
Do you really need floating point???
Your code snippet gives no indications for that.
See section 3.16 about printf in the manual and check which flavour you need.
Of course:
http://sdcc.svn.sourceforge.net/viewvc/sdcc/trunk/sdcc/device/lib/printf_fast.c?view=markup
(or your local copy) would be the authoritative answer.
I'd also consider to continue using printf_tiny() because it is so cute
and write an extra function like puthex(); where you need an output format
that printf_tiny() does not support.
Dear Frieder ,
Yes, you are right. I dont need using printf_fast_f() but when I used printf()function I am getting some message!
>>>>>>>>>>>>>>>>>>>>>>>>
?ASlink-Error-Could not get 21 consecutive bytes in internal RAM for area DSEG.
>>>>>>>>>>>>>>>>>>>>>>>>
What does it mean?
kamil
Does someone know what is the meaning of error below?
?ASlink-Error-Could not get 21 consecutive bytes in internal RAM for area DSEG
this error appear when I used printf() function!!!
kamil
It means that printf is larger than printf_tiny and you now have run out of data memory.