This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

CCS/MSP430FR6889: CCS/MSP430FR6889:

Part Number: MSP430FR6889

Tool/software: Code Composer Studio

hello everyone

I am trying to understand water meter code but i can not understand some parts in TSM_Auto_cal function.  Why did they check is math_temp bigger than 12?


do
{

FindDAC(); // using 12 bit sucessive approx. method

DAC0_sum2 = ESIDAC1R0;
DAC1_sum2 = ESIDAC1R2;
DAC2_sum2 = ESIDAC1R4;

// channel 0
if(!(Cal_status&Ch0_finish))
{
if (DAC0_sum2 > LC_Threshold_TSM_CAL)
{
if (DAC0_sum2 > DAC0_sum1)
{math_temp = DAC0_sum2 - DAC0_sum1;}
else
{math_temp = DAC0_sum1 - DAC0_sum2;}

Ch0_counter += 1;

if (math_temp > 12)
{
if (Ch0_counter > cycle_width)
{
for (i= 0; i< Ch0_counter / 2 ; i++)
{ ESITSM3 -= 0x0800; }

Cal_status |= Ch0_finish;
}

else
{Ch0_counter = 0;
DAC0_sum1 = DAC0_sum2;
}
}
else
{
DAC0_sum1 = DAC0_sum2;
}
}

  • Hello,

    Although there appears to be some code missing, the number 12 should represent the number of bits captured here by the successive approximation method to represent an analog signal by a 12-bit digital value. When "math_temp" exceeds 12, this means that the conversion has completed.

    According to page 10 in the LC Sensor Rotation Detection With MSP430™ Extended Scan Interface (ESI) app note, "the captured signal is then measured by a function "FindDAC()" to find its voltage level, by using the comparator and the DAC as reference voltage. With this setting, only the peak level is measured. In the reference design, an inverter is enabled to invert the output of comparator so that the crisis of LC signal is measured. If plotting the value of the measured level into a graph, an envelope of the signal with a stair-case-shaped curve is obtained. When the signal level has reached the pre-defined level "LC_Threshold_TSM_CAL", an optimal delay is obtained at a point which is the mid-way to the next crisis".

    Regards,

    James

    MSP Customer Applications

  • Hi James, im sorry but your answer did not help me,
    i think it is not about using 12 bit DAC, there is something different

    Regards,

    Başak

**Attention** This is a public forum