list p=16F877, f =inhX32, x=off
#include <P16F877.inc>
__CONFIG _CP_OFF & _XT_OSC & _PWRTE_ON & _WDT_OFF & _LVP_OFF
errorlevel -302, -207
;NOTE: using PORTD as LED output
;.gfedcba
;76543210 pins on D
;High 1 = segement lit
;*****Equates**********************************************
count0 equ 25h
count1 equ 26h
count2 equ 27h
digit equ 28h
digcnt equ 29h
;******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
main:
movlw 0x0a
movwf digcnt
movlw 0x00
movwf digit
start
movf digit,w
call Table
movwf PORTD
call delay
incf digit,f
decfsz digcnt,F
goto start
goto main
Table
addwf PCL,f
retlw b'00111111' ;b'00000000' ;display 0
retlw b'00000110' ;b'00000000'
retlw b'01011011' ;b'11010111'
retlw b'01001111' ;b'11011101'
retlw b'01100110' ;b'10111001'
retlw b'01101101' ;b'01111101'
retlw b'01111100' ;b'00111111'
retlw b'00000111' ;b'11001001'
retlw b'01111111' ;b'11111111' ;display 8
retlw b'01101111' ;'b'11101111' ;display 9
delay
movlw 03h
movwf count2
Loop
decfsz count0,1
goto Loop
decfsz count1,1
goto Loop
decfsz count2,1
goto Loop
return
end