Tool/software: Code Composer Studio
#include <msp430.h>
void delay(unsigned long i)
{
for (i; i > 0; i--);
}
int main(void)
{
WDTCTL = WDTPW | WDTHOLD; // stop watchdog timer
//CONFIGURE LED
P1DIR |= BIT0;
//CONFIGURE PIN
P7SEL |= 0x01; //Set P7.0 to be ADC
ADC12CTL0 = ADC12SHT02 + ADC12ON; // 64 ADC12CLK cycles, ADC12_A is on.
ADC12CTL1 = ADC12SHP;
ADC12IE = 0x01;
ADC12CTL0 |= ADC12ENC; //enable conversion
TA0CCR0 = 1000-1; // Sets the PWM Period
TA0CCTL1 = OUTMOD_7; // CCR1 reset/set
TA0CCR1 = 0; // CCR1 PWM duty cycle
TA0CTL = TASSEL_2 + MC_1 + TACLR; // SMCLK, up mode
while (1)
{
ADC12CTL0 |= ADC12SC; // Start conversion
__bis_SR_register(LPM0_bits + GIE);
__no_operation(); // SET BREAKPOINT HERE
}
}
#pragma vector = ADC12_VECTOR
__interrupt void ADC12_ISR(void)
{
if(ADC12MEM0 < 2048 )
{
P1OUT &= ~BIT0;
delay(1000);
}
else if(2048 <= ADC12MEM0 < 3072)
{
if(TA0CCR1 < 100)
{
P1OUT |= BIT0;
delay(1000);
}
else
{
P1OUT &= ~BIT0;
}
}
else if(3072 <= ADC12MEM0 < 4200)
{
if(TA0CCR1 < 500)
{
P1OUT |= BIT0;
delay(1000);
}
else
{
P1OUT &= ~BIT0;
}
}
else
{
P1OUT|= BIT0;
delay(1000);
}
__bic_SR_register_on_exit(LPM0_bits); // Exit active CPU
}
I have written the above code to turn on LED according to the light applied on a photo resistor, but it is showing an error "#176-D expression has no effect". I don't have any idea what it is saying about, please help me with this.