xpress_embedo
Advanced Member level 4
- Joined
- Jul 5, 2011
- Messages
- 1,154
- Helped
- 161
- Reputation
- 396
- Reaction score
- 189
- Trophy points
- 1,353
- Location
- India
- Activity points
- 10,591
Hello!! I am using ADS1118 with atmega2560 micro-controller, to sense its internal temperature.
But i tried each and every method, but in all cases i am getting very large temperature values.
The above is my configuration register and the values i am obtaining are as follow:-
DA8 = 3496 which on multiplication 3496 * 0.03125 = 109.25 deg C
D7C = 3452 which on multiplication 3452 * 0.03125 = 107 deg C
I am doing something wrong in calculation.
- - - Updated - - -
************************************************************************
I saw post on this forum.
https://e2e.ti.com/support/data_converters/precision_data_converters/f/73/p/231496/835608#835608
Why shifted two times.
If i shift my data two times, then it will be correct and will result in around 27 deg C
DA8 shifting two times 36A = 874 which on multiplication with 0.03125 = 27.3125 deg C
D7C shifting two times 35F = 863 which on multiplication with 0.03125 = 26.9687 deg C
But i tried each and every method, but in all cases i am getting very large temperature values.
Code C - [expand] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 /* * Config Bytes to Read Internal Temperature * * SS = 1 (single-shot) - NOTE: Always reads back as '0' (default). * MUX = 000 (default) * PGA = 010 (full-scale is +/-2.048V) * MODE = 1 (power-down and single-shot, default) * DR = 100 (128 samples per second, default) * TS_MODE = 1 (read from internal temperature sensor) * PULL_UP = 1 (pull-up enabled) * NOP = 01 (must be 01 to update the Config Register, no-operation otherwise) * NOT_USED = 1 (not used, always reads 1) */ #define TC_TEMP 0x859B // the Config bytes to read the internal temperature from ADS1118
The above is my configuration register and the values i am obtaining are as follow:-
DA8 = 3496 which on multiplication 3496 * 0.03125 = 109.25 deg C
D7C = 3452 which on multiplication 3452 * 0.03125 = 107 deg C
I am doing something wrong in calculation.
- - - Updated - - -
************************************************************************
I saw post on this forum.
https://e2e.ti.com/support/data_converters/precision_data_converters/f/73/p/231496/835608#835608
Code C - [expand] 1 2 3 4 5 6 7 8 9 10 if(step==0) { SPIWrite(0x08); SPIWrite(0xA2); res=(data_high<<8)|data_low; res = res>>2; Res_val=res * 0.03125; refTemp = Res_val; }
Why shifted two times.
Code C - [expand] 1 res = res>>2;
If i shift my data two times, then it will be correct and will result in around 27 deg C
DA8 shifting two times 36A = 874 which on multiplication with 0.03125 = 27.3125 deg C
D7C shifting two times 35F = 863 which on multiplication with 0.03125 = 26.9687 deg C