list p=16F877
#include <P16F877.inc>
__config _XT_OSC & _PWRTE_ON & _WDT_OFF &_LVP_OFF
;*****Equates**********************************************
count0 equ 25h
count1 equ 26h
count2 equ 27h
digit equ 28h
;******Main Program****************************************
org 00h
bsf STATUS,RP0
movlw B'11111111' ; set portA as input
movwf TRISA
movlw B'00000000' ; set PortD as outpout
movwf TRISD
movlw D'6'
movwf ADCON1
bcf STATUS,RP0
clrf digit
start movfw digit
call Table
movwf PORTD
call delay
incf digit,F
movfw digit
xorlw d'10'
btfsc STATUS,Z
clrf digit
goto start
Table
addwf PCL,F
retlw b'11101111' ;display 0
retlw b'10001001' ;display 1
retlw b'11010111'
retlw b'11011101'
retlw b'10111001'
retlw b'01111101'
retlw b'00111111'
retlw b'11001001'
retlw b'11111111'
retlw b'11101111'
delay ;delay routine
movlw 03h
movwf count2
Loop decfsz count0,1
goto Loop
decfsz count1,1
goto Loop
decfsz count2,1
goto Loop
return
end