gastonanthony
New Member
my code doesn't do what it is supposed to do.the program is for the pic to increment for every closing of the switch(5 volts input to rb0). it just continuously count up to 9 and then back to zero(binary). can someone help me wiht this code or schematic? here's the code
and here's the schematic:
Code:
PROCESSOR 16f84a
#include "P16f84a.inc"
org 0x00
COUNT EQU 0X0c
TEMP EQU 0X0d
goto main
org 0x04
movwf TEMP
incf COUNT,1
movlw 0x0a
subwf COUNT,0
btfss STATUS,0
goto carry_on
goto clear
carry_on
bcf INTCON,0X01
movlw TEMP
retfie
clear
clrf COUNT
bcf INTCON,1
retfie
main
bsf INTCON,7
bsf INTCON,4
bsf INTCON,1
bsf STATUS,5
movlw 0X01
movwf TRISB
movlw 0X10
movwf TRISA
bcf STATUS,5
loop
movf COUNT,0
movwf PORTA
goto loop
end
and here's the schematic: