#include p16f88.inc
;----------memory data--------
program org 0x00
goto preparation
Preparation
bsf status,RP0
bsf trisb,trisb0 ; load port rb0 as input
bcf trisb,TRISB4 ; load port rb4 as output
bcf status,RP0
goto begin
;---------------begin---------------
begin
btfss portb,rb0
goto begin
goto on
on
bsf portb,rb4
goto begin
end
I mean I can do led on but i Can't do it off. What Must I add to do led off when I left to press the button ?
Best regards.
Edit : Now I add this to the code, but Led off When I push switch 3 or 4 times ?
program org 0x00
goto preparation
Preparation
bsf status,RP0
bsf trisb,trisb0 ; load port rb0 as input
bcf trisb,TRISB4 ; load port rb4 as output
bcf status,RP0
goto begin
;---------------begin---------------
begin
btfss portb,rb0
goto begin
goto on
on
bsf portb,rb4
btfsc portb,rb0 /* <---------- I add this part*/
goto begin /* <---------- for off the led*/
bcf portb, rb4 /* <---------- again*/
goto begin
end
Is it normal in proteus Or My code is ok ?