CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

BCD Conversion

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
pctprogrammer



Joined: 04 Aug 2004
Posts: 6

View user's profile Send private message

BCD Conversion
PostPosted: Wed Aug 04, 2004 2:30 pm     Reply with quote

Couple questions. Using the CCP C programming language, what is the best way to convert from binary to a decimal value using BCD addition? Also, the software im using will not allow me to store a 16-bit (or larger) value to EEPROM. Is there a way? Also, does anyone have and hints on how to maximize EEPROM space when doing calculations and storage? All these are tied together because I am working on a program where I want to store data (8bit and/or 16 bit) then once I am done sampling, go back and recalculate my values and for this I need 0-9 digit values thus the BCD addition method. Also, some of the calculations I need to preform return a 'float' value, which cant be stored to EEPROM with the commands avaiable. Any hints/tips/suggestions welcomed.
Thanks.
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Wed Aug 04, 2004 2:48 pm     Reply with quote

See this FAQ answer regarding storing float values to EEPROM:
http://www.ccsinfo.com/faq/?24

See the end of this thread for bcd-to-binary and binary-to-bcd functions.
http://www.ccsinfo.com/forum/viewtopic.php?t=18830&highlight=bin2bcd+bcd2bin

See this post for code to read/write a 16-bit word to internal eeprom.
http://www.ccsinfo.com/forum/viewtopic.php?t=17205&highlight=word+eeprom

--------
You can find other code examples by using the Search function of
this board, and from the CCS FAQ: http://www.ccsinfo.com/faq/
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
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