sreejith2904

interrupt.c

Apr 3rd, 2011
316
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.94 KB | None | 0 0
  1. #include "LPC214x.h"
  2. #define PLOCK 0x400
  3.  
  4.  
  5. void init(void)
  6. {
  7.     PLLCFG = 0x24;
  8.     PLLFEED = 0xaa;
  9.     PLLFEED = 0x55;
  10.     PLLCON = 0x01;
  11.     PLLFEED = 0xaa;
  12.     PLLFEED = 0x55;
  13.    
  14.     while (!(PLLSTAT & PLOCK));
  15.    
  16.     PLLCON = 0x3;
  17.     PLLFEED = 0xaa;
  18.     PLLFEED = 0x55;
  19.    
  20.     MAMCR = 0x2;
  21.     MAMTIM = 0x4;
  22.    
  23.     VPBDIV = 0x1;
  24. }
  25.  
  26. void IRQ_Routine(void)
  27. {
  28.    
  29.     IODIR0 = 0xffffffff;
  30.    
  31.     IOSET0 = 0xffffffff;
  32.  
  33.     for(i=0;i<=100000;i++)
  34.             ;
  35.  
  36.     IOCLR0 = 0xffffffff;
  37.  
  38.     for(i=0;i<100000;i++)
  39.             ;
  40.  
  41.    
  42. }
  43.  
  44.  
  45. void FIQ_Routine(void)
  46. {
  47.     while(1);
  48.  
  49. }
  50.  
  51. void SWI_Routine(void)
  52. {
  53.     while(1);
  54. }
  55. int main(void)
  56. {
  57.        
  58.     init();
  59.    
  60.     T0TCR = 0x02;
  61.     T0IR = 0xff;
  62.     T0MCR = 0x333;
  63.     T0MR0 = 0x03938700;     // compare hit count
  64.    
  65.     VICVectCntl0 = 0x00000024;              
  66.     VICVectAddr0 = (unsigned)IRQ_Routine;    
  67.     VICIntEnable = 0x00001010;              
  68.    
  69.     IODIR0 = 0xffffffff;
  70.     IOCLR0 = 0xffffffff;
  71.    
  72.     T0TCR = 0X01;    //enable timer0
  73.    
  74.    
  75.     while(1);
  76. }
Advertisement
Add Comment
Please, Sign In to add comment