Ok, this is my first pic assembly code i have ever written, so there are surly some errors in there. But what I want to to is this:
I have two buttons, one connected to pin 1 and the other to pin 2. When one of the buttons are pushed, it will drag the pin it is onnected to low, the pic will then detect wich button is pushed (or both at once) and send the correct output to 2 output pins.
I'm not able to test this myself cause I haven't got my pic yet.
Cheers!
Lac.
I have two buttons, one connected to pin 1 and the other to pin 2. When one of the buttons are pushed, it will drag the pin it is onnected to low, the pic will then detect wich button is pushed (or both at once) and send the correct output to 2 output pins.
I'm not able to test this myself cause I haven't got my pic yet.
Cheers!
Lac.
Code:
LIST P=16F628, F=INHX8M
include "P16F628.inc"
__CONFIG 0x3DED
ORG 0x0000
STATUS equ 03h
TRISA equ 85h
PORTA equ 86h
COUNT1 equ 08h
COUNT2 equ 09h
bsf STATUS,5
movlw 00011
movwf TRISA
bcf
check1 BTFSC PORTA,0
goto check4
goto check2
check2 call delay
BTFSC PORTA,1
goto BANK1
goto BANK3
check3 call delay
BTFSC PORTA,0
goto BANK2
goto BANK3
check4 BTFSC PORTA,1
goto check1
goto check3
BANK1
MOVLW 00000
MOVWF PORTA
call delay
call delay
call delay
end
BANK2 MOVLW 00100
MOVWF PORTA
call delay
call delay
call delay
end
BANK3 MOVLW 01000
MOVWF PORTA
call delay
call delay
call delay
end
Delay
Loop1
decfsz COUNT1,1
goto Loop1
decfsz COUNT2,1
goto Loop1
return
end