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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
07/17/09 19:36
Read: times


 
Msg Score: -2
 -2 Answer is Wrong
#167518 - Check this
Responding to: ???'s previous message
Here's what can help you buddy.

In order to convert from decimal to hex you'll need to do this:

x=(x % 10) + ((x/ 10)<<4);

where x is the variable which contains the number in decimal.

when you read back from the RTC the hex value will be read and you'll need to do this in order to convert it back to decimal from hex:

y=(y & 0x0F)+((y>>4)*10);

here y is the variable which contains the hex value and will be converted to decimal so that you can display it.

cheers

List of 14 messages in thread
TopicAuthorDate
Convert BCD, hex and decimal in C (DS1307 related)            01/01/70 00:00      
   Keyboard?            01/01/70 00:00      
   Another thought about that keyboard...            01/01/70 00:00      
      Re:Another thought about that keyboard...            01/01/70 00:00      
         Wrong approach?            01/01/70 00:00      
            Re: Wrong approach?            01/01/70 00:00      
               Division            01/01/70 00:00      
               Not a shortcut?            01/01/70 00:00      
                  Re: Not a shortcut?            01/01/70 00:00      
                     Basics (edited)            01/01/70 00:00      
                        addition to the above            01/01/70 00:00      
                           Look at the DS1307 datasheet            01/01/70 00:00      
   Check this            01/01/70 00:00      
      Incorrect            01/01/70 00:00      

Back to Subject List