Want to Add 1 on portB by timer1 Interrupt, Code not working pic16f877A

Status
Not open for further replies.

Noman93

Newbie level 1
Joined
Mar 20, 2014
Messages
1
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
4
Code:
Org 0x00
include <p16f877a.inc>
goto main
org 0x04
movlw d'1'
addwf portb
bcf pir1,tmr1if
retfie

main:
Banksel trisb
movlw b'00000000'
movwf trisb
banksel t1con
movlw b'00111101'
movwf t1con
banksel intcon
movlw b'11111110'
movwf intcon
banksel pie1
movlw b'00000001'
goto main
end
 
Last edited by a moderator:

You are not telling it to put the result back in portb.

from the data sheet:

However, it would be more sensible to use 'incf portb,f' instead.

Brian.
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…