LIST P=P12F675 INCLUDE "P12F675.INC" __CONFIG _MCLRE_OFF & _CP_OFF & _WDT_OFF & _INTRC_OSC_NOCLKOUT CBLOCK 0x020 c0 c1 c2 c3 c4 c5 SAY ENDC ;------------------------------------------------ Start BCF STATUS,RP0 CLRF GPIO BCF OPTION_REG,7 ; 4)GPIO pull-ups: is enabled MOVLW 0x07 MOVWF CMCON BSF STATUS,RP0 CLRF ANSEL MOVLW B'01111110' MOVWF TRISIO BCF STATUS,RP0 CLRF GPIO ;------------------------------------------------ ;**************** Key Scan Process ******************** keyscan BTFSS GPIO, 1 ;GPIO, 5 GİRİŞ 1mi 0 mı 1 se atla call ptn0 ;Yes. Call Pattern 0 BTFSS GPIO, 2 ;GPIO, 5 GİRİŞ 1mi 0 mı 1 se atla call ptn1 ;Yes. Call Pattern 1 BTFSS GPIO, 4 ;GPIO, 5 GİRİŞ 1mi 0 mı 1 se atla call ptn2 ;Yes. Call Pattern 2 goto keyscan ;Retry ;------------------------------------------------ CONTROL BTFSS GPIO, 3 ;port,3 GİRİŞ 1mi 0 mı 1 se atla GOTO $+4 call loop1 BSF GPIO, 0 BTFSS GPIO, 3 ;port,3 GİRİŞ 1mi 0 mı 1 se atla goto keyscan GOTO $-3 ;------------------------------------------------ ptn0 BCF GPIO, 0 call delay1 BSF GPIO, 0 call delay11 return ;------------------------------------------------ ptn1 BCF GPIO, 0 call delay1 return ;------------------------------------------------ ptn2 BCF GPIO, 0 call delay1 BSF GPIO, 0 call delay11 BCF GPIO, 0 call delay11 BSF GPIO, 0 call delay11 return ;------------------------------------------------ loop1 movlw d'5' movwf SAY loop BSF GPIO, 0 call delay11 BCF GPIO, 0 call delay11 decfsz SAY,f goto loop return ;----------------------------------------------- ;----------------------------------------------- delay1 movlw d'90' movwf c1 lc1 BTFSS GPIO, 3 ;port,3 GİRİŞ 1mi 0 mı 1 se atla GOTO $+2 GOTO CONTROL movlw d'85' movwf c2 lc2 movlw d'50' movwf c3 lc3 decfsz c3,f goto lc3 decfsz c2,f goto lc2 decfsz c1,f goto lc1 return ;------------------------------------------------ delay11 movlw d'150' movwf c5 lc01 movlw d'150' movwf c4 lc11 decfsz c4,1 goto lc11 decfsz c5,1 goto lc01 return ;------------------------------------------------ end