Last active
February 13, 2017 08:12
-
-
Save Steffo99/d141a3a3cf64fa810e5daaaf64e6ff9f to your computer and use it in GitHub Desktop.
l'ennesimo programma con l'msp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <msp430.h> | |
| int on = 0; | |
| int period = 1000; | |
| float dutycycle = 0.3f; | |
| void startTimer(int period) | |
| { | |
| TA0CTL = TASSEL__SMCLK | ID__1 | MC__UP | TACLR; | |
| TA0CCR0 = period; | |
| TA0CCR1 = (int) (period * dutycycle); | |
| TA0CCTL1 = OUTMOD_6; | |
| P1DIR |= BIT2; | |
| P1SEL |= BIT2; | |
| } | |
| int main() | |
| { | |
| WDTCTL = WDTPW | WDTHOLD; | |
| startTimer((int) (period * dutycycle)); | |
| while(1) continue; | |
| return 0; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment