NPEDUCATIONS, Electronic circuits development, electronics tutorials, microcontroller tutorials and projects, advanced microcontroller (ARM) based tutorials and projects, Embedded c development, Embedded c for ARM cortex M, Intel IoT based projects, IoT projects, CC3200 launch pad projects, MSP430 Launchpad tutorials and projects, Tiva C launch pad tutorials and projects, 8051 tutorials and projects, sensor interfacing with microcontroller tutorials, data communications and networking tutorials, peripheral interfacing with microcontroller, led message scrolling display, arduino based tutorials and projects, intel galileo based tutorials and project, ADC interfacing tutorials, LED Blinking, LCD interfacing, Embedded System tutorials and projects, B.tech projects, M.tech projects, online Embedded C training

TI MSP430 ADC10 TUTORIAL ( 4 IMPORTANT POINTS)- PART2

TI MSP430G2553 ADC10 tutorial – Part2   


In the last tutorial, we have seen the basics of ADC10 in MSP430 and written a simple program to sample the internal temperature sensor output and convert it into digital value using polling method.
Here, we are going to discuss about the unexplained concepts of ADC10 operation and its settings in the last tutorial.
1. Why a reference voltage of 1.5V is taken for the temperature sensor?
2. Why the sample and hold time for each sample is taken as 64 clock cycles?
3. How to convert the temperature in degrees from ADC output?
4. How to generate delay of 30useconds using timers in ADC?

1. Why a reference voltage of 1.5V is taken for the temperature sensor?
                When you look at the datasheet of MSP430G2553 on page number 38, the parameter VREF+ (positive built-in reference voltage) is given in the range 1.4V to 1.59V for REF2_5V. Not only had that, for commercial range of temperature the voltage from the sensor not exceeded 1.4V, so the 1.5V reference is appropriate. Otherwise the resolution of ADC10 would be lost. The time taken by reference to settle is 30useconds.
2. Why the sample and hold time for each ADC10 sample is taken as 64 clock cycles?
            It was already specified in the datasheet of MSP430G2553 in the page number 40. If channel 10 is selected, the sampling time (tsample) required is 30useconds. This time is same as the internal voltage reference settling time, why because the internal temperature sensor itself uses the internal voltage reference for the conversion. 30useconds are needed for the stabilization of the internal voltage reference. To save current, the reference is disabled automatically between the conversions. Therefore we need to provide a sampling period of 30useconds for every sample.
To achieve this sampling period, we have choose 64XADC10CLKs option by using ADC10SHT_3 bits in ADC10CTL0 register. And choose the clock source divided by 4 by using ADC10DIV_3 in ADC10CTL1 register. The default clock source for the ADC10 is ADC10OSC. The maximum frequency of ADC10OSC is 6.3MHz.
Therefore each ADC10 cycle (ADC10CLK) = 1/((Maximum Frequency of ADC10OSC)/3)
                                          = 1/((6.3MHz)/4) = 0.63useconds
64XADC10CLKs = 64xcycles = 64x0.8useconds = 40.6useconds.


3. How to convert the temperature in degrees from ADC output?
            From the transfer function of the ADC device,
Nadc = (2^N) * (Vin/Vref).
                        Where Nadc is ADC value after conversion, Vin is the voltage of the sensor and Vref is the reference voltage for the sensor.
Here the Vref is taken from the internal reference of the MSP430 (Vref = 1.5mV).
The Vin = Vtemp = TCsensor (273+T(0C)) given in the datasheet of MSP430G2553 of page 40.
TCsensor is temperature coefficient equal to 3.55mV/0C given in the datasheet.
Therefore Nadc = (2^N)*(Vtemp/Vref)
     Nadc = (2^N)*( TCsensor (273+T(0C))/Vref) = (2^N)*(3.55*(273+T(0C)/Vref) = (2^N) * (986 + 3.55*T(0C))
This can be written as
             T(0C) =  ((Nadc/(2^N))*Vref – 986)/3.55.

4. How to generate delay of 30useconds using timers in ADC?
Before going into discussion, I encourage you to read the tutorial “understanding Timers in MSP430 Launch Pad” and “understanding Basic clock system in MSP430 launch pad”
If the timer_A source select bits (TASSELx) are set to “10”, then the timer clock (TACLK) is driven with SMCLK, which in turn driven by DCO oscillator by default.
The timer cycle = 1/TACLK = 1/SMCLK = 1/1.2MHz = 0.833 useconds. For 30useconds we need the timer count = 30usecond/0.83useconds = 36.
Therefore, now initialize the timer compare register TACCR0 = 36. And set the compare mode interrupt (TACCTL0 |= CCIE).
Now Timer mode is set to up mode and wait in Lower power mode LPM0.
Timer_A ISR will be called after timerA reached the count. Wake up the processor from Low power mode LPM0 in the ISR routine by using LPM0_EXIT.

TACCR0 = 30;                              // count loaded into the timer register to produce 30useconds delay.
TACCTL0 |= CCIE;                          // Compare-mode interrupt.
TACTL = TASSEL_2 | MC_1;                  // timer_A is driven by TACLK in upmode
LPM0;                                     // Wait for delay until timer reached the value
       TACCTL0 &= ~CCIE;                         // Disable timer Interrupt

#pragma vector=TIMER0_A0_VECTOR
__interrupt void ta0_isr(void)
{
  TACTL = 0;
  LPM0_EXIT;                                // Exit from LPM0 mode
}


0 comments :

Post a Comment

Thanks for visiting NPEDUCATIONS. We will contact you soon

0 comments :

Post a Comment

Thanks for visiting NPEDUCATIONS. We will contact you soon

If you really like this tutorial, Don't forget to give the comment or please subscribe to the RSS feed by submitting your E-mail or like our Facebook page.
Related Posts Plugin for WordPress, Blogger...

 
Powered by Blogger