Hi I am having the following problem. I am inputting two voltage signals to change my output waveform however the registers say that the two pins are 7FFF which is my voltage limit even though nothing is applied, why is that? Here is my code:
#include <msp430x20x3.h>
void main(void)
{
WDTCTL = WDTPW + WDTHOLD; // Stop WDT
P1DIR |= 0xFE; // Only P1.0 is an input
SD16AE = SD16AE0; // Disables A0 (P1.0) an digal input alowwing pure analog
SD16CTL = SD16REFON + SD16SSEL0;
SD16CCTL0 |= SD16DF; // set values from 0 - 7FFF
SD16INCTL0 = SD16INCH_0 + SD16GAIN_1;
SD16CCTL0 |= SD16SC ; // START CONVERSION
int a = 0;
a = SD16MEM0;
P1DIR = 0xFD; // Only P1.1 is an input
SD16AE = SD16AE1; // Disables A1 (P1.0) an digal input alowwing pure analog
SD16CTL = SD16REFON + SD16SSEL1;
SD16CCTL0 |= SD16DF; // set values from 0 - 7FFF
SD16INCTL0 = SD16INCH_1 + SD16GAIN_1;
SD16CCTL0 |= SD16SC ; // START CONVERSION
int b = 0;
b = SD16MEM0;
//OutputPWM(a);
BCSCTL1 = 0x80;
BCSCTL2 = 0x04;
P1DIR = 0x04; // P1.2 output
P1SEL = 0x04; // P1.2 TA1/2 options
a = (a / (0x7FFF/9));
CCR0 = a; // PWM Period
CCTL1 = OUTMOD_4; // CCR1 reset/set
int x = CCR0/x;
CCR1 = CCR0/2; // CCR1 PWM duty cycle
TACTL = TASSEL_2 + MC_1; // SMCLK, up mode
_BIS_SR(CPUOFF); // Enter LPM0
}