Last active
April 17, 2016 13:26
This file contains 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 <lpc17xx.h> | |
#include "stdutils.h" | |
#include "gpio.h" | |
#include "timer.h" | |
#define LED1 P2_0 | |
#define LED2 P2_1 | |
void myTimerIsr_0(void) | |
{ | |
GPIO_PinToggle(LED1); /* Toggle the LED1 (P2_0) */ | |
} | |
void myTimerIsr_1(void) | |
{ | |
GPIO_PinToggle(LED2); /* Toggle the LED2 (P2_1) */ | |
} | |
int main (void) | |
{ | |
SystemInit(); | |
GPIO_PinDirection(LED1,OUTPUT); /* Configure the pins as Output to blink the Leds*/ | |
GPIO_PinDirection(LED2,OUTPUT); | |
TIMER_Init(0,100000); /* Configure timer0 to generate 100ms(100000us) delay*/ | |
TIMER_Init(1,500000); /* Configure timer1 to generate 500ms(500000us) delay*/ | |
TIMER_AttachInterrupt(0,myTimerIsr_0); /* myTimerIsr_0 will be called by TIMER0_IRQn */ | |
TIMER_AttachInterrupt(1,myTimerIsr_1); /* myTimerIsr_1 will be called by TIMER1_IRQn */ | |
TIMER_Start(0); /* Start the Timers */ | |
TIMER_Start(1); | |
while(1) | |
{ | |
//do nothing | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment