Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "LPC214x.h"
- #define PLOCK 0x400
- void init(void)
- {
- PLLCFG = 0x24;
- PLLFEED = 0xaa;
- PLLFEED = 0x55;
- PLLCON = 0x01;
- PLLFEED = 0xaa;
- PLLFEED = 0x55;
- while (!(PLLSTAT & PLOCK));
- PLLCON = 0x3;
- PLLFEED = 0xaa;
- PLLFEED = 0x55;
- MAMCR = 0x2;
- MAMTIM = 0x4;
- VPBDIV = 0x1;
- }
- void IRQ_Routine(void)
- {
- IODIR0 = 0xffffffff;
- IOSET0 = 0xffffffff;
- for(i=0;i<=100000;i++)
- ;
- IOCLR0 = 0xffffffff;
- for(i=0;i<100000;i++)
- ;
- }
- void FIQ_Routine(void)
- {
- while(1);
- }
- void SWI_Routine(void)
- {
- while(1);
- }
- int main(void)
- {
- init();
- T0TCR = 0x02;
- T0IR = 0xff;
- T0MCR = 0x333;
- T0MR0 = 0x03938700; // compare hit count
- VICVectCntl0 = 0x00000024;
- VICVectAddr0 = (unsigned)IRQ_Routine;
- VICIntEnable = 0x00001010;
- IODIR0 = 0xffffffff;
- IOCLR0 = 0xffffffff;
- T0TCR = 0X01; //enable timer0
- while(1);
- }
Advertisement
Add Comment
Please, Sign In to add comment