Other Parts Discussed in Thread: MSP430F6736
Hello everyone, I have a sinewave of 50HZ 500mVPP and 500mV DC offset. I want to measure it through ADC of MSP430F6736. The problem i am facing is my ADC doesnt go according to sampling rate i want because of following reasons.
1. Using internal clock of ADC shows range of 4.6 to 5.4 MHZ. How to get exactly 5 MHZ ?
2. To give negative terminal to AVSS. wont it make your ground connection oscillate too ? And with that i will have my ADC conversion values wrong.
3. Any suggestions about getting sampling such that i get 120 points per period ? i will have 156microseconds per sample and 128 samples in 20 mseconds(50Hz).
Following code is basically just a check to see if i get repeating values of Sinewave. But instead , i get overflows in ADC and constant values for many conversions .. in range of 37 and 40
#include "msp430f6736.h"
volatile unsigned int ADC_Result[200];
static char i=0;
void main(void)
{
WDTCTL = WDTPW+WDTHOLD; // Stop watchdog timer
P9SEL |=BIT1; // Enable A/D channel A5.
/* Initialize ADC12_A */
ADC10CTL0 = ADC10ON+ADC10SHT_12+ADC10MSC; // Turn on ADC12, set sampling time
// set multiple sample conversion
ADC10CTL1 = ADC10SHP+ADC10CONSEQ_2 + ADC10DIV_7; // Use sampling timer, set mode
ADC10MCTL0 |= ADC10INCH_5;
ADC10IE = 0x01; // Enable ADC12IFG.0
ADC10CTL0 |= ADC10ENC; // Enable conversions
ADC10CTL0 |= ADC10SC; // Start conversion
__bis_SR_register(LPM4_bits + GIE); // Enter LPM4, Enable interrupts
__no_operation(); // For debugger
}
#pragma vector=ADC10_VECTOR
__interrupt void ADC10ISR (void)
{
while (i<200 && ADC10IFG0)
{
ADC_Result[i] = ADC10MEM0; // Move results
i++; // Increment results index, modulo; Set Breakpoint1 here
}
}
Any help would be great. Later on i ll take FFT and then will perform Power Calculations. I did all this in MATLAB very quickly, MSP430 is whole new ball game. Please suggest something .
Thnx