EasyManua.ls Logo

Texas Instruments MSP430

Texas Instruments MSP430
413 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
130
In the main loop, we are using the Launchpad’s user button to alter TA0CCR0’s value and hence PWM
frequency or period. There are ten different time periods to select. The main code also displays
captured waveform time period vs expected time period on a LCD.
if((P1IN & BIT3) == 0)
{
P1OUT |= BIT0;
while((P1IN & BIT3) == 0);
i++;
if(i > 9)
{
i = 0;
}
P1OUT &= ~BIT0;
}
switch(i)
{
case 1:
{
TA0CCR0 = 9999;
LCD_goto(0, 1);
LCD_putstr("Period/ms: 20");
break;
}
case 2:
{
TA0CCR0 = 4999;
LCD_goto(0, 1);
LCD_putstr("Period/ms: 10");
break;
}
case 3:
{
TA0CCR0 = 1999;
LCD_goto(0, 1);
LCD_putstr("Period/ms: 4");
break;
}
case 4:
{
TA0CCR0 = 999;
LCD_goto(0, 1);
LCD_putstr("Period/ms: 2");
break;
}
case 5:
{
TA0CCR0 = 166;
LCD_goto(0, 1);
LCD_putstr("Period/us: 334");
break;
}
case 6:
{
TA0CCR0 = 1230;
LCD_goto(0, 1);

Table of Contents

Other manuals for Texas Instruments MSP430

Related product manuals