I am having a problem getting my TC74 into standby mode using the source code from the course.
There is minimal change (1.29mA to 1.28mA) in the current to the TC74 after "stand-by mode" appears in the LCD.
This is the relevant line of code: (Line numbers are from the program tc74_in_standby_mode.c source on the course CD.)
72// send 7 bit address and write bit (1)
73i2c_write(0b10010001);
Line 73 above is a read operation but I think it should be a write.
When I change this line to
72// send 7 bit address and write bit (0)
73i2c_write(0b10010000);
and run the program I get a current change from 1.28mA to 1.07mA (a difference of 0.210mA) which is roughly what the TC74 datasheet page 1 states:
normal operation quiescent current 0.2mA
standby operation quiescent current 0.005mA
a difference of 0.195mA
The code in tc74_in_standby_mode.c does not check ACK responses from the TC74 and the text "stand-by mode" appears if the TC74 is in stand-by mode or not.
The i2c_write statements on 79 and 85 are both not acknowledged by the TC74 (sspcon2:ackstat = 1) using the code from the course.
If you replace the code after line 92 with the following error checking code, 'error' is shown on the LCD if line 73 has the write bit set = (1).
If line 73 has the write bit cleared = (0), the LCD correctly shows 'stand-by mode' and the current to the TC74 drops from 1.28mA to 1.07mA.
91i2c_stop;
92
93// add error checking code
94lcd_locate(0,0);
95// check if error condition
96if (reply) lcd_printf("error ");
97else
98{
99// display standby mode
100lcd_locate(0,1);
101lcd_printf("stand-by mode");
102}
