我的代码如下所示,我正在尝试使用按钮来打开和关闭 LED。因此,按一次它会打开它,它会一直亮着,直到再次按下按钮。
但是,我在编译过程中遇到一个错误 - “地址标签在第二遍中重复或不同” 该错误指向以“检查 BTFSS”开头的行的第二次出现。
我在这里做错了什么?
提前致谢。:)
;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