I've always blinked leds on PORTB in PIC16F628A.
Nowdays i need to do that on PORTA because I'm trying keypad matrix on PORTB.
The code below runs perfectly on RB3 of PORTB, but I doesn't in PORTA.
Here is the example in PORTA. I've tested and the problem is in BTFSS and BTFSC function... Because if I turn led off or on manually is functioning well. (also I've ommited delay_1s_routine code)
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
Thanks in Advice!!
EDITED: Put real values on code
PD: Tested this instruction separately and works great - bsf PORTA,RA1 - bcf PORTA, RA1