【发布时间】:2013-04-21 03:11:11
【问题描述】:
我总是在 PIC16F628A 的 PORTB 上闪烁 LED。
现在我需要在 PORTA 上执行此操作,因为我正在 PORTB 上尝试键盘矩阵。
下面的代码在 PORTB 的 RB3 上完美运行,但我在 PORTA 中没有。
这是 PORTA 中的示例。 我已经测试过,问题出在 BTFSS 和 BTFSC 功能上……因为如果我手动关闭或打开 led 运行良好。 (我也省略了 delay_1s_routine 代码)
main
;*********CONFIGURACION LED**********
clrf Puerto_Led
movlw 0x07
movwf CMCON
bsf STATUS,RP0
clrf TRISA
bcf STATUS,RP0
loop
call prende_apaga_Led
call delay_1s_routine
goto loop
prende_apaga_Led
btfsc PORTA,RA1 ;si esta en 0 salta el GOTO
goto $+3
bsf PORTA,RA1 ;Pongo en '1' el bit del Led Verde
return
bcf PORTA,RA1 ;Pongo en '1' el bit del Led Verde
return
感谢您的建议!!
已编辑:为代码赋予真正的价值
PD:单独测试了这条指令,效果很好 - bsf PORTA,RA1 - bcf PORTA,RA1
【问题讨论】:
标签: output pic microchip blink