LIST P=PIC16F84A
__CONFIG_XC_OSC
STATUS EQU 0X03
PORTA EQU 0X05
PORTB EQU 0X06
TRISA EQU 0X85
TRISB EQU 0X86
SAYAC EQU 0X0C
BSF STATUS,5 ;BANK1
BSF TRISB,0 ; PORTB,0 input
CLRF TRISA ; PORTA output
BCF STATUS,5 ;BANK0
CLRF SAYAC
CLRF PORTA
GENEL
CLRWDT ;not let wdt to reset my program
BTFSS PORTB,0 ; button makes 1 or 0
GOTO GENEL ;button not pushed
MOVF SAYAC,W ;when button pushed
CALL TABLO
MOVWF PORTA ; change output
INCF SAYAC,F
GOTO TEST
TEST ; to avoid unintended increase when button pushed i made this loop
CLRWDT
BTFSS PORTB,0
GOTO GENEL
GOTO TEST
TABLO
ADDWF PCL,F ;PCL(program counter) + W >>PCL
RETLW B'00111111' ;segmen data 0 >> W (PCL+0)
RETLW B'00000110' ;segmen data 1 >> W (PCL+1)
RETLW B'01011011' ;segmen data 2 >> W (PCL+2)
RETLW B'01001111' ;segmen data 3 >> W (PCL+3)
RETLW B'01100110' ;segmen data 4 >> W (PCL+4)
RETLW B'01101101' ;segmen data 5 >> W (PCL+5)
RETLW B'01111101' ;segmen data 6 >> W (PCL+6)
RETLW B'00100111' ;segmen data 7 >> W (PCL+7)
RETLW B'01111111' ;segmen data 8 >> W (PCL+8)
RETLW B'01101111' ;segmen data 9 >> W (PCL+9)
CLRF SAYAC
RETURN GENEL
END ; directive 'end of program'