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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
06/09/04 07:58
Read: times


 
#72150 - RE: 16bit Binary to BCD with decimal
Responding to: ???'s previous message
There is another aspect of looking at binary values. For simplicity, let's assume one byte, the value from 0 to 255. We can normalize the value - find the relation to the base of 1 byte, and it's 256 (similar like 0 to 9 belong to 10's base).

The normalized value, ie. binvalue/256 is >= 0, and is always < 1. I used the normalized values to convert the binary values from ADC to the physical values - without using the floating point routines.

How to get the normalized value in assembler ? It's very simple: multiply the byte with 10, take the higher result as d1, multiply the lower result with 10, take the higher result as d2, and so on.

binvalue/256 = 0 . d1 d2 ...

Of course, the same can be made for 1.5 or 2 bytes.

Perhaps this is what Sajid ment when he said decimal points.

List of 5 messages in thread
TopicAuthorDate
16bit Binary to BCD with decimal            01/01/70 00:00      
   RE: 16bit Binary to BCD with decimal            01/01/70 00:00      
   RE: 16bit Binary to BCD with decimal            01/01/70 00:00      
   RE: 16bit Binary to BCD with decimal            01/01/70 00:00      
   RE: 16bit Binary to BCD with decimal            01/01/70 00:00      

Back to Subject List