hi! i'm tring to display numbers on a 7 segment (common anode) using a pic 16f877, the code is not workin as the desplay is showin 1 segment at the time and not the numbers! can an1 help? thanx
Code:
LIST p=16F877
#include <P16F877.inc>
__config _XT_OSC & _PWRTE_ON & _WDT_OFF &_LVP_OFF
;*****Equates**********************************************
status equ 03h
PortA equ 05h
PortD equ 08h
TRISA equ 85h
TRISD equ 88h
count0 equ 25h
count1 equ 26h
count2 equ 27h
digit equ 28h
pcl equ 02h
;******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
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'00000000' ;display 0
retlw b'00000000'
retlw b'11010111'
retlw b'11011101'
retlw b'10111001'
retlw b'01111101'
retlw b'00111111'
retlw b'11001001'
retlw b'11111111' ;display 8
retlw 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
Last edited: