asic1984
Full Member level 5

timer0 in pic16f877?
hi
i tried to run a code in pic16f977 and simulate it ...but seems that the timer0 is not initialize well ......can u help me in finding the mistake?
thanks
hi
i tried to run a code in pic16f977 and simulate it ...but seems that the timer0 is not initialize well ......can u help me in finding the mistake?
Code:
PROCESSOR 16F877
#INCLUDE "P16F877.INC"
ORG 0X00
GOTO START
ORG 0X04
GOTO INT_HANDLER
ORG 0X06
START BSF STATUS,5
MOVLW 0X00
MOVWF TRISB
BCF STATUS,5 ;BANK 0
MOVLW 0XFF
MOVWF PORTB ;PORTB INITIALLY 1`S
MOVLW 0XA0
MOVWF INTCON ;ENABLE TIMER0 AND CLEAR THE FLAG OF THE TIMER
movlw 0x00
movwf OPTION_REG
LOOP GOTO LOOP
INT_HANDLER MOVLW 0X00
MOVWF INTCON
MOVFW PORTA
XORLW 0XFF
MOVWF PORTA
MOVLW 0XA0 ;RENABLE INTERRUPTS
RETFIE ;RETURN FROM INTERRUPT
END
thanks