Hello everyone,
i am a beginner to ccs v4 and msp430 kit. please pardon my innocence in any minute details that has to be remembered.
I am trying to execute ADC project in ccs v4 using MSP430F6638IPZR kit with a MSP430 USB-Debug-Interface MSP-FET430UIF. the maximum software configurable supply voltage that this USB-Debug-Interface can handle is between 1.8 V to 3.6 V at 100 mA.
Fortunately the code has been successfully executed but we could not find the output. I am trying to read the output of the project in registers ADC12MEM0 as per the documents and information provided in TI forum. But the problem is the value in ADC12MEM0 change every time i run the project after debugging it. Following snapshot is
following is the snapshot where value in ADC12mem0 changed after running again.
the code for ADC project is
#include <msp430f6638.h>
int i;
long temp;
volatile long IntDegF;
volatile long IntDegC;
void main(void)
{
WDTCTL = WDTPW + WDTHOLD; // Stop WDT
REFCTL0 &= ~REFMSTR; // Reset REFMSTR to hand over control to
// ADC12_A ref control registers
ADC12CTL0 = ADC12SHT0_8 + ADC12REFON + ADC12ON;
// Internal ref = 1.5V
ADC12CTL1 = ADC12SHP; // enable sample timer
ADC12MCTL0 = ADC12SREF_1 + ADC12INCH_10; // ADC i/p ch A10 = temp sense i/p
ADC12IE = 0x001; // ADC_IFG upon conv result-ADCMEMO
for(i=0;i<30;i++) // Delay to allow Ref to settle
ADC12CTL0 |= ADC12ENC;
while(1)
{
ADC12CTL0 &= ~ADC12SC;
ADC12CTL0 |= ADC12SC; // Sampling and conversion start
__bis_SR_register(LPM4_bits + GIE); // LPM0 with interrupts enabled
__no_operation();
// Temperature in Celsius
// ((A10/4096*1500mV) - 680mV)*(1/2.25mV) = (A10/4096*666) - 302
// = (A10 - 1858) * (666 / 4096)
IntDegC = ((temp - 1858) * 666) / 4096;
// Temperature in Fahrenheit
// Tf = (9/5)*Tc + 32
IntDegF = ((temp - 1858) * 1199) / 4096 + 32;
__no_operation(); // SET BREAKPOINT HERE
}
}
#pragma vector=ADC12_VECTOR
__interrupt void ADC12ISR (void)
{
switch(__even_in_range(ADC12IV,34))
{
case 0: break; // Vector 0: No interrupt
case 2: break; // Vector 2: ADC overflow
case 4: break; // Vector 4: ADC timing overflow
case 6: // Vector 6: ADC12IFG0
temp = ADC12MEM0; // Move results, IFG is cleared
__bic_SR_register_on_exit(LPM4_bits); // Exit active CPU
case 8: break; // Vector 8: ADC12IFG1
case 10: break; // Vector 10: ADC12IFG2
case 12: break; // Vector 12: ADC12IFG3
case 14: break; // Vector 14: ADC12IFG4
case 16: break; // Vector 16: ADC12IFG5
case 18: break; // Vector 18: ADC12IFG6
case 20: break; // Vector 20: ADC12IFG7
case 22: break; // Vector 22: ADC12IFG8
case 24: break; // Vector 24: ADC12IFG9
case 26: break; // Vector 26: ADC12IFG10
case 28: break; // Vector 28: ADC12IFG11
case 30: break; // Vector 30: ADC12IFG12
case 32: break; // Vector 32: ADC12IFG13
case 34: break; // Vector 34: ADC12IFG14
default: break;
}
}
while debugging , executing the project we did not give any external analog input voltage to the target (msp430).
Do i need to give any external input voltage or will it be taken from the target(msp430) itself?
Please anyone help me with this query where i have been stuck for long time.
Thanks in advance.