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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
05/14/07 23:43
Read: times


 
#139255 - Not BCD
Responding to: ???'s previous message
Hendryawan said:
1C8 hex. converted to BCD 456

No.

BCD = Binary-Coded Decimal. That's a representation where each binary nibble (4 bits) represents one decimal digit, 0-9.

Thus the Decimal number 456 would be represented in BCD as 010001010110 = 0x456
Decimal Digit: 4    5    6
Bits (Binary): 0100 0101 0110

strictly speaking, that's 8-4-2-1 weighted BCD - you could actually use any other 4-bit encoding (eg, Gray) of the ten decimal digits...

convert BCD to ASCII
(4 + 48) = 52 for '4'
(5 + 48) = 53 for '5'
(6 + 48) = 54 for '6'

You didn't explain where this "magic number" 48 comes from;
Fortunately, Joseph has explained it: http://www.8052.com/forum/read.phtml?id=139235

you can write to LCD one by one i.e. 52 then 53 then 54

Assuming that your LCD scrolls characters from the right...




List of 12 messages in thread
TopicAuthorDate
Display number on LCD 2x16            01/01/70 00:00      
   How far have you got?            01/01/70 00:00      
   perhaps reading the datasheet would help            01/01/70 00:00      
      Andy & Richard            01/01/70 00:00      
         Sorry!            01/01/70 00:00      
         Apologies where due, I guess I missed that.            01/01/70 00:00      
   A bit of help            01/01/70 00:00      
      See Code Library            01/01/70 00:00      
   convert to ASCII            01/01/70 00:00      
      Not BCD            01/01/70 00:00      
   Thanks            01/01/70 00:00      
      LCD asm printf function            01/01/70 00:00      

Back to Subject List