MSP430F2013 SD16 A Magnetic Sensor Reading

From emboxit
Jump to: navigation, search

Design

  • We have to read a very low voltage at very high resolution
  • Avoid a single stage amplifier with high gain (~500 needed).The high-gain-single-stage could create unpredictable stability issues.
  • MSP430 Programmable Gain Amplifier PGA with GAIN set x32 combined with external instrumentation amplifier with gain set to ~15 give total gain ~500
  • Resolution of MSP430 SD16_A is 16 BITS, higher than usual CPU ADC.
  • Resolution can be increased if special (software controlled) filtering is applied. SLAA220
  • Programmable gain and programmable filtering provide flexibility and could solve possible problems in the future


Reference Application notes

  • MSP430F42x Single Chip Weigh Scale SLAA220 Read a sensor bridge with 6mV Full scale and 0.15uV resolution without external amplifier, using SD16 module
  • SLAA220 home
SLAA220 source code is a single .c file total 360 lines for MSP430F427 and Softbaugh board, build with IAR EW version 3.20A at 2004
from slaa220 source code, how to measure with 18 bits accuracy
#pragma vector = SD16_VECTOR

__interrupt void SD16_ISR(void)
{
long CurrentResult;

GET_RESULT(CurrentResult);                    // Read SD16 result, clear IFG

if (VoltageSettleCtr)                         // Wait for voltages to settle
{
VoltageSettleCtr--;                         // Decrement counter
return;                                     // Exit ISR
}

SD16Temp += CurrentResult;                    // Sum up results

if (++SD16TempCtr >= 256)
{
SD16Result = SD16Temp >> 8;                 // Div 256
SD16CCTL0 &= ~SD16SC;                       // Disable conversions
P2OUT &= ~BRIDGE_SUPPLY;                    // Power down bridge voltage

if (ProgramMode == PM_MEASURE)
if (Flags & FLAG_UPDATE_DISPL || LastADCValue != SD16Result)
{
Flags &= ~FLAG_UPDATE_DISPL;            // Reset flag
LastADCValue = SD16Result;              // Store new value

Disp_Signed_Long(((long)SD16Result - CalMin) * CAL_MIN_MAX_SPAN /
        (CalMax - CalMin));
}

__bis_SR_register_on_exit(LPM3_bits);       // Enter LPM3 on ISR exit
}


from slau144h page 606
An external voltage reference can be applied to the VREF input when SD16REFON and SD16VMIDON are both reset.  //NX from slau144h page 606
 <i>Tips on Magnetic sensor C code</i>
//NX An external voltage reference can be applied to the VREF input when SD16REFON and SD16VMIDON are both reset.
//NX SD16CTL = SD16VMIDON + SD16REFON + SD16SSEL_1;// 1.2V ref, SMCLK
SD16CTL = SD16SSEL_1;             // NX External Reference, SMCLK









Source <-----Code last update 2011.09.20.17:28