Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
07/12/05 05:56
Modified:
  07/12/05 06:08

Read: times


 
#97121 - Yep!
Responding to: ???'s previous message
Vinay said:
I just found this feature in SDCC

The same applies to Keil and, I imagine, any other ANSI 'C' compiler.

int e=128;
printf("%d",e);
will call putchar as follows
putchar('1');
putchar('2');
putchar('8');
thus the printf function can also be used to convert INT TO BCD .

Note that the above is not an int-to-BCD conversion - the result is a sequence of ASCII-coded characters; not BCD.

By clever use of the putchar() function u can parse any data to bytes to store in the EEPROM.

So long as you want ASCII-coded bytes.

List of 5 messages in thread
TopicAuthorDate
ANY DATATYPE TO STRING/CHAR CONVERSION            01/01/70 00:00      
   Thanks for that            01/01/70 00:00      
   printf() to multiple devices            01/01/70 00:00      
   Yep!            01/01/70 00:00      
   Here's one I prepared earlier...            01/01/70 00:00      

Back to Subject List