initial
This commit is contained in:
55
src/main.cpp
Normal file
55
src/main.cpp
Normal file
@ -0,0 +1,55 @@
|
||||
/*
|
||||
* main.cpp
|
||||
*
|
||||
* Created on: 30.05.2014
|
||||
* Author: wn
|
||||
*/
|
||||
|
||||
#include <msp430g2553.h>
|
||||
#include <stdint.h>
|
||||
#include <intrinsics.h>
|
||||
#include <isr_compat.h>
|
||||
|
||||
void delay(uint16_t c) {
|
||||
volatile uint16_t i = c;
|
||||
while (i--);
|
||||
}
|
||||
|
||||
/*
|
||||
#pragma vector = TIMER0_A0_VECTOR
|
||||
__interrupt void TA0_ISR() {
|
||||
*/
|
||||
ISR(TIMER0_A0, TA0_ISR) {
|
||||
static uint8_t state = 0;
|
||||
|
||||
switch (state) {
|
||||
case 0:
|
||||
P1OUT = BIT0;
|
||||
state = 1;
|
||||
break;
|
||||
case 1:
|
||||
P1OUT = BIT6;
|
||||
state = 0;
|
||||
break;
|
||||
default:
|
||||
state = 0;
|
||||
}
|
||||
}
|
||||
|
||||
int main() {
|
||||
WDTCTL = WDTPW | WDTHOLD;
|
||||
|
||||
P1DIR |= BIT6 | BIT0;
|
||||
P1OUT = 0;
|
||||
|
||||
TACCR0 = 49999;
|
||||
TACCTL0 = CCIE;
|
||||
TACTL = MC_1 | ID_3 | TASSEL_2 | TACLR;
|
||||
__enable_interrupt();
|
||||
|
||||
while (1) {
|
||||
__bis_status_register(LPM0_bits);
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user