??? 01/10/07 23:51 Read: times |
#130609 - No, that's wrong Responding to: ???'s previous message |
Tomas Dabasinskas said:
MSB LSB |X|X|X|X|X|X|X|1| |0|1|0|0|1|1|0|1| X- 7 MSB bits are being ignored 1 in MSB means that reading is negative (0 would be positive) Last bit of LSB (which is 1) means that there's .5 to the reading so here's what we get -||,5 => 01001101(negative bin) = 10110010+1(positive bin) => 10110011(postive bin) => 179(dec) -|01001101|,5 = -|179|,5 => -179,5 you won't be quite getting anything like this as ds1620 can only do -55c to +125c No, that's wrong. Take another look at the examples in the datasheet, and you'll see that it doesn't work! The nine used bits form a 2's complement number; The least-significant bit, b0, has a "weight" of 0.5; b1 has a "weight" of 1; b2 has a "weight" of 2; b3 has a "weight" of 4; b4 has a "weight" of 8; b5 has a "weight" of 16; b6 has a "weight" of 32; b7 has a "weight" of 64; b8 has a "weight" of -128. So your example is: b8 b7 b6 b5 b5 b3 b2 b1 b0 -128 64 32 16 8 4 2 1 0.5 | 1 | 0 | 1 | 0 | 0 | 1 | 1 | 0 | 1 | And the temperature value is -128+32+4+2+0.5 = -90.50C |