Program which demonstrates the usage of the TIMER peripheral. Program sets TIMER 2 to blink the LED on the pin P0.9. This is a more sophisticated way of blinking an LED.
Dependencies: mbed
main.c
- Committer:
- 71GA
- Date:
- 2015-05-02
- Revision:
- 0:e83c998e1cfd
File content as of revision 0:e83c998e1cfd:
#include "LPC4088-ioconfig.h" #include "LPC4088-gpio.h" #include "LPC4088-timer.h" #include "LPC4088-system.h" int main(){ //omogocimo timer 2, ki ob zagonu ni prizgan tako kot timerja 0,1 PCONP = (PCONP | (1<<22)); //timer 2 izhod MAT3 preusmerimo na pin P0_9 IOCON_P0_9 = (IOCON_P0_9 & !(0x7FF)); IOCON_P0_9 = (IOCON_P0_9 | 0x183); //resetiramo vse interrupte za timer 2 IR = (IR | 0x3F); //nastavimo izhod MAT3 na "toggle" EMR = (EMR | (0x3<<10)); //match register 3 nastavimo na 1/4 najvecje vrednosti timerja 2 MR1 = 0x3FFFFFFF; //omogocimo timer 2 TCR = (TCR | (1<<0)); while(1); }