My code is seen as below, I am trying to use a push button to turn an LED on and off. So pressing it once will turn it on, and it will stay on, until the button is pressed again.
However, I get one error during compilation - "address label duplicated or different in second pass" The error points to the second occurence of the line starting with "check BTFSS".
What am I doing wrong here?
Thanks in advance. :)
;Program name: T code
;CPU Configuration
processor 16F84A
include <p16f84a.inc>
__config _XT_OSC & _WDT_OFF & _PWRTE_ON
;Register Label Equates
PORTA equ 05
PORTB equ 06
Count equ 0C
;Register Bit Label Equates
Input equ 4 ;PUSH BUTTON INPUT RA4
LED1 equ 0 ;LED OUTPUT RB0
;*****Program Start*****
org 0
;Initialize (Default = Input)
movlw B'00000000' ;Define Port B output
tris PORTB ; and set bit direction
goto check
;Main Loop
check BTFSS PORTA,Input ;If button is OFF, goto check, and keep waiting for button HIGH condition.
goto check ;
bsf PORTB,LED1 ;Turn the LED ON
check BTFSS PORTA,Input ;Assuming the LED is currently ON, keep checking for a button press...
goto check
bcf PORTB,LED1 ;Turn the LED OFF
goto check ;repeat always
END
check, which is confusing the assembler. Perhaps you should label themcheck1andcheck2.