Number17
New Member
Hi
I've started using my pics today again, after about 2 months. I've compiled a small program just to refresh my memory again. Its a simple flashing led. It works fine, but when I add the command BTFSS it seems that the pic gets stuck there. No matter what I do, I can't get the pic to read the status on a port. The pic react as if the switch is open. I've added a 10k from the supply to RA0, and the switch from RA0 to ground.
Any help would be great
Here's the code
I've started using my pics today again, after about 2 months. I've compiled a small program just to refresh my memory again. Its a simple flashing led. It works fine, but when I add the command BTFSS it seems that the pic gets stuck there. No matter what I do, I can't get the pic to read the status on a port. The pic react as if the switch is open. I've added a 10k from the supply to RA0, and the switch from RA0 to ground.
Any help would be great
Here's the code
Code:
; INCLUDE PIC16F628A
LIST P=16F628A
INCLUDE <P16F628A.INC>
__CONFIG _BODEN_OFF&_CP_OFF&_PWRTE_OFF&_WDT_OFF&_XT_OSC&_LVP_OFF&_MCLRE_OFF
ERRORLEVEL -302
ERRORLEVEL -203
; GENERAL REGISTERS
CBLOCK
COUNT1
COUNT2
ENDC
; SETUP THE I/O PORTS ETC
BSF STATUS,5H
MOVLW B'01'
MOVWF TRISA
BCF STATUS,5H
CLRF PORTA
; START
START
BTFSS PORTA,0
GOTO START
BSF PORTA,1
CALL DELAY
BCF PORTA,1
CALL DELAY
GOTO START
; SUBROUTINES
DELAY DECFSZ COUNT1
GOTO DELAY
DECFSZ COUNT2
GOTO DELAY
RETURN
END