Quantcast
Channel: Microcontrollers
Viewing all articles
Browse latest Browse all 4923

Problem with Timer0 interrupt

$
0
0
Hi, I am trying to toggle an led using the rollover of timer0 but nothings happening. I have added the code I have used.
Code (Text):
  1. #include <pic16f1939.h>
  2. #include <xc.h>
  3. #define _XTAL_FREQ 500000 //1ms delay
  4. void interrupt delay(void);
  5. void main()
  6. {
  7.     ANSELA=0;
  8.     TRISA=0;
  9.     PORTA=0;
  10.     OPTION_REG = 0b10001000; //WPU's disabled    No Prescaler
  11.     INTCONbits.GIE = 1;
  12.     INTCONbits.PEIE = 1;
  13.     while(1)
  14.     {
  15.     ;      
  16.     }
  17. }
  18.  
  19. void interrupt delay()
  20. {
  21.    
  22.     TMR0 = 0x00;...
Problem with Timer0 interrupt

Viewing all articles
Browse latest Browse all 4923

Trending Articles