128 times to get the most significant LED to change state just once.
Normally an 8 bit number has these significant values:
Bit #: | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
|
|
|
|
|
|
|
|
|
Value: | 128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 |
|
|
|
|
|
|
|
|
|
Say bits 7, 3, and 0 are on, all others are off. The value would then be 128 + 8 + 1 or 137.
Say instead bits 6, 5, 4 and 1 are on, all others are off. Our value would then be 64 + 32 + 16 + 2 or 114.
Our display is set up to read from 0.0 degrees to 127.5 degrees in 1/2 degree steps. What we do is stick in an imaginary decimal point to the left of the LSB (least significant bit) and then divide all the numbers by 2.
Bit #: | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
|
|
|
|
|
|
|
|
|
Value: | 128/2 | 64/2 | 32/2 | 16/2 | 8/2 | 4/2 | 2/2 | 1/2 |
|
|
|
|
|
|
|
|
|
Say instead bits 6, 5, 4 and 1 are on, all others are off. Our value would then be 32 + 16 + 8 + 1 or 57, which is 1/2 of 114.0. This means that we have a temperature reading of 57 degrees!
Now since we have used 8 bits for our counter, this is considered a single byte of data. This value, with the decimal point in place, is now called a
You may have heard of
Essentially take our number from before and divide by 256, or 144/256 = 0.445. DSPs do this to prevent math from overflowing in value as you multiply and accumulate. DSPs handle this math very quickly.
Bit #: | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
|
|
|
|
|
|
|
|
|
Value: | 128/256 | 26/256 | 32/256 | 16/256 | 8/256 | 4/256 | 2/256 | 1/256 |
|
|
|
|
|
|
|
|
|