Part Number: MSP430I2041
Other Parts Discussed in Thread: MSP430I2041
Dear Mates,
I am using a SPI based DAC to control output current of an external DC circuit. The issue I have is that, I can send predefined values, and the output DC value corresponds to it, but when I use the the AC current measured by the MSP430i2041, I only get the maximum output DC current value.Regarding this, I have a few questions:
1> Is 'rms_current(ph)' the correct variable which contains the measured RMS Current?
2> If yes, then what's the variable type? If no, then which variable contains the correct RMS Current measurement, and what's its data type?
Attached below is the bit of the modified example code:
// line number 239 of emeter-main.c
#if NUM_PHASES == 1
calculate_phase_readings();
LED3_ON ();
static unsigned long CL = 0x2AAA; //4mA = 0x2AAA, the required offset
//CL = CL + (int16_t)(rms_current(1)/1000); // this yields the same result as the bottom one
CL = ((int)rms_current(0))/1000; // I have tried a lot of variations, but none seem to work
if (CL > 0xDA8E)
{
CL = 0xDA8E;
}
updateCurrentOutput( (unsigned short)(CL)); // function to send data to DAC through SPI
#else
calculate_phase_readings(ph);
LED3_OFF ();
Any help would be much appreciated.
Thanks in advance
With Warm Regards
Subhronil