Hi,
I am using an external temperature probe (MCP9700-E/TO) and msp430g2553
And this code
void checktemp(void)
{
ADC10CTL0 &= ~ENC; // Disable ADC
ADC10CTL0 = SREF_0 +SREF_1 + ADC10SHT_3 + REFON + ADC10ON + ADC10IE; //+REF2_5V// Use reference, 1v5 (2v5 disabled)
// 16 clock ticks, internal reference on
// ADC On, enable ADC interrupt, Internal = 'ref'
ADC10CTL1 = ADC10SSEL_3 + INCH_6; // Set chan6, SMCLK
__delay_cycles (30); // Delay to allow Ref to settle, was 20
ADC10CTL0 |= ENC + ADC10SC; //enable and start conversion
temp=(ADC10MEM);
}
The code is over sampled 12 time per reading and is pretty stable with temperauture increasing/decreasing/remaining constant. The probe also has decoupling caps on.
The problem comes when I switch an external heating element on/off with the msp430. This is through a transistor, another transistor then an ssr.
Turning the output off causes the adc to decrease about 10 units, even with the over sampling. This causes the output to oscillate on/off/on etc and also the temperature readout to fluctuate somewhat wildly.
Am I doing something wrong or is the internal reference going to be that unstable during switching?