我需要检查按下了哪个按钮并将其与功能进行比较。例如,如果按下按钮 0($01),程序会将其与 OP,3 进行比较,如果两个条件都为真,则程序将重新启动 (init),否则如果其中一个条件为假,程序将循环再次通过子程序。目前它什么也没做,它应该比较按钮按下,但似乎没有。到目前为止,我已经这样做了:
;$01 == XOR button, $02 == NOR button, $04 == OR button, $08 == NAND button, $10 == AND button
button_pressed:
in temp2, PIND
xor_pressed:
cpi OP,3
cpi temp2, $01
brne button_pressed
rjmp init
nor_pressed:
cpi OP,4
cpi temp2,$02
brne button_pressed
rjmp init
or_pressed:
cpi OP,0
;cpi temp2,$04
brne button_pressed
rjmp init
nand_pressed:
cpi OP,2
cpi temp2,$08
brne button_pressed
rjmp init
and_pressed:
cpi OP,1
cpi temp2,$10
brne button_pressed
rjmp init