Advertisement
Guest User

Untitled

a guest
Sep 2nd, 2014
193
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.85 KB | None | 0 0
  1. /*
  2. ===============================================================================
  3.  Name        : main.c
  4.  Author      :
  5.  Version     :
  6.  Copyright   : Copyright (C)
  7.  Description : main definition
  8. ===============================================================================
  9. */
  10.  
  11. #ifdef __USE_CMSIS
  12. #include "LPC17xx.h"
  13. #endif
  14.  
  15. int contador1000=1, compara=0;
  16.  
  17. int main(void) {
  18.    
  19.     // TODO: insert code here
  20.     LPC_GPIO0->FIODIR |= (1 << 22); // P0[22] COMO SALIDA
  21.  
  22.     SysTick_Config(SystemCoreClock/1000);
  23.  
  24.     while(1) {
  25.  
  26.         if(!contador1000)
  27.         {
  28.             if(LPC_GPIO0->FIOPIN&(1 << 22))
  29.  
  30.             {
  31.                 LPC_GPIO0->FIOCLR = (1 << 22);// P0[22] = 0
  32.             }
  33.             else
  34.             {
  35.                 LPC_GPIO0->FIOSET = (1 << 22); // P0[22] = 1
  36.             }
  37.             contador1000 = 0;
  38.         }
  39.     }
  40.     return 0 ;
  41. }
  42.  
  43. void SysTick_Handler(void)
  44. {
  45.  
  46.     contador1000 = (contador1000+1)%1000;
  47.  
  48.  
  49. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement