Very new to assembly programing and im trying to make a blinking LED, here is my code:
#include p16f877a.inc
counter equ 0x20
org 0x00
goto main
org 0x04
goto ISR
main
bsf INTCON, GIE
bcf PIR1, TMR1IF
bsf STATUS, RP0
bcf STATUS,RP1
bsf PIE1, TMR1IE
clrf TRISB
bcf STATUS,RP0
;1 Second Hardware Delay.
Delay0.5SecondInitialization
movlw b’00110000′
movwf T1CON ; Set prescaler to 11(1:8), dont set TMR1ON (Bit 0) until you want timer to start.
DelayLoop
bsf T1CON,TMR1ON
movlw 0x0B
movwf TMR1H
movlw 0x0DC
movwf TMR1L; We initialized both registers of TMR1LOW,TMR1HIGH with 0x0BDC
;0.5 HW Delay is ready, we have to turn it on now.
finish goto finish
ISR
incf counter
movf counter,W
sublw 2
btfss STATUS,Z
goto DelayLoop
comf PORTB,F
bcf PIR1,TMR1IF
retfie
end
I notice that it runs and stays in goto finish, never going to the ISR.
Nothing really came to mind, I expect it to do a 1 second delay then complementing PORTB. What happens is it stays in the goto finish instruction and doesnt go to the ISR.
omar sweiss is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.