Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

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:
ADDWF Add W and f
Syntax: [ label ] ADDWF f,d
Operands: 0 ≤ f ≤ 127
d ∈ [0,1]
Operation: (W) + (f) → (destination)
Status Affected: C, DC, Z
Description: Add the contents of the W register
with register ‘f’. If ‘d’ is ‘0’, the
result is stored in the W register. If
‘d’ is ‘1’, the result is stored back
in register ‘f’.

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

Brian.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top