Skip to content

Instantly share code, notes, and snippets.

@Steffo99
Last active February 13, 2017 08:12
Show Gist options
  • Select an option

  • Save Steffo99/d141a3a3cf64fa810e5daaaf64e6ff9f to your computer and use it in GitHub Desktop.

Select an option

Save Steffo99/d141a3a3cf64fa810e5daaaf64e6ff9f to your computer and use it in GitHub Desktop.
l'ennesimo programma con l'msp
#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