Groups
Sign in
Groups
TI Launchpad
Conversations
About
Send feedback
Help
generating pulse by msp430 launchpad
577 views
Skip to first unread message
Jitendra Soni
unread,
Apr 3, 2013, 1:46:31 AM
4/3/13
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to ti-lau...@googlegroups.com
hi,
i m new to msp430 launchpad i want to generate pulse using msp430
please send me programme in c for this purpose....n pls tell me the method
how can i controll the pulse.....n also tell me how can i see the pulse on CRO
help me out please......
Peter Johansson
unread,
Apr 9, 2013, 7:44:58 PM
4/9/13
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to ti-lau...@googlegroups.com
Not sure if this is what you are looking for, but here goes nonetheless:
/*
* How to use all available PWM outputs on MSP430G2553
*
* Timer_A #0 has only 1 PWM output
* it can be sent to pins P1.1 or P2.6 (or both)
* (P2.6 is also the LF-XTAL, so it is best to force the VLO to the RC clock)
*
* Timer_A #1 has two 2 PWM outputs
* output #1 can be sent to P2.1 or P2.2
* output #2 can be sent to P2.4 or P2.5
* There are many abbreviations for the timer control ports, and this can make things
* very confusing. I suggest *always* using the long versions.
*
* CCR0 == TACCRO == TA1CCRO
*
*/
#include "msp430.h"
int main(void)
{
WDTCTL = WDTPW + WDTHOLD;
// Stop WDT
/*
* Set DCO to 16 MHz factory calibration values
* (not required for this demo)
*/
BCSCTL1 = CALBC1_16MHZ;
// 16 MHz
DCOCTL = CALDCO_16MHZ;
// 16 MHz
/*
* Timer_A #0 block
*/
P1DIR |= BIT2;
// P1.2 to output
P1SEL |= BIT2;
// P1.2 to TA0.1
BCSCTL3 = (BCSCTL3 & ~(BIT4+BIT5)) | LFXT1S_2;
// use internal VLO for ACLK
P2SEL &= ~(BIT6+BIT7); // PxSEL=0, PxSEL2=0 for I/O use
P2SEL2 &= ~(BIT6+BIT7); // PxSEL=0, PxSEL2=0 for I/O use
P2DIR |= BIT6;
// P2.6 to output
P2SEL |= BIT6;
// P2.6 to TA0.1
TA0CCR0 = 64;
// PWM Period
TA0CCR1 = 48;
// Timer_A 0 CCR1 PWM duty cycle 1
TA0CCTL1 = OUTMOD_7;
// CCR1 reset/set
TA0CTL = TASSEL_2 + MC_1;
// SMCLK, up mode
/*
* Timer_A #1 block
*/
P2DIR |= BIT1;
// P2.1 to output
P2SEL |= BIT1;
// P2.1 to TA1.1
P2DIR |= BIT2;
// P2.2 to output
P2SEL |= BIT2;
// P2.2 to TA1.1
P2DIR |= BIT4;
// P2.4 to output
P2SEL |= BIT4;
// P2.4 to TA1.2
P2DIR |= BIT5;
// P2.5 to output
P2SEL |= BIT5;
// P2.5 to TA1.2
TA1CCR0 = 64;
// PWM Period
TA1CCTL1 = OUTMOD_7;
// CCR1 reset/set
TA1CCTL2 = OUTMOD_7;
// CCR1 reset/set
TA1CCR1 = 32;
// Timer_A 1 CCR1 PWM duty cycle 1
TA1CCR2 = 16;
// Timer_A 1 CCR1 PWM duty cycle 1
TA1CTL = TASSEL_2 + MC_1;
// SMCLK, up mode
/*
* Now just sleep forever...
*/
for (;;) {
_BIS_SR (LPM0_bits);
// Enter LPM0
}
// NOTREACHED
}
Reply all
Reply to author
Forward
0 new messages