Advertisement
Guest User

Untitled

a guest
Feb 12th, 2013
224
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 2.13 KB | None | 0 0
  1. /******************************************************************************/
  2. /* Files to Include                                                           */
  3. /******************************************************************************/
  4.  
  5. #if defined(__XC)
  6.     #include <xc.h>         /* XC8 General Include File */
  7. #elif defined(HI_TECH_C)
  8.     #include <htc.h>        /* HiTech General Include File */
  9. #endif
  10.  
  11. #include <stdint.h>        /* For uint8_t definition */
  12. #include <stdbool.h>       /* For true/false definition */
  13. #include <stdio.h>
  14.  
  15. #include "system.h"        /* System funct/params, like osc/peripheral config */
  16. #include "user.h"          /* User funct/params, such as InitApp */
  17.  
  18. #pragma config FOSC = INTOSCIO
  19.  
  20.  
  21. /******************************************************************************/
  22. /* Function Prototypes                                                        */
  23. /******************************************************************************/
  24.  
  25.  
  26.  
  27. /******************************************************************************/
  28. /* User Global Variable Declaration                                           */
  29. /******************************************************************************/
  30.  
  31.  
  32.  
  33. /******************************************************************************/
  34. /* Main Program                                                               */
  35. /******************************************************************************/
  36. void main(void)
  37. {
  38.     /* Configure the oscillator for the device */
  39.     //ConfigureOscillator();
  40.  
  41.     /* Initialize I/O and Peripherals for application */
  42.     InitApp();
  43.  
  44.     //turn timer on
  45.     TMR1ON = 1;
  46.  
  47.     for(;;)
  48.     {
  49.         asm("NOOP");
  50.     }
  51. }
  52.  
  53. void interrupt TMR1_ISR()
  54. {
  55.     //if TMR1 int flag set
  56.     if(TMR1IF==1)
  57.     {
  58.         //turn off the timer
  59.         TMR1ON = 0;
  60.  
  61.         //invert PORTA
  62.         PORTA = PORTA ^ 0xFF;
  63.  
  64.         //reset TIMER1 counter registers
  65.         TMR1H = 0x00;
  66.         TMR1L = 0x00;
  67.  
  68.         //reset int flag bit
  69.         TMR1IF = 0;
  70.  
  71.         //turn back on the timer
  72.         TMR1ON = 1;
  73.     }
  74. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement