imnimn
Junior Member level 3
i wrote this code and i want you to help me if there somehting wrong in it
Code:
include "p16f877.inc"
org 0x00
goto Initialize
T0_delay: movlw 0x28;0x21
banksel TRISC
movwf OPTION_REG
banksel TMR0
;movlw 0x6a
;movwf TMR0
clrf TMR0
banksel INTCON
chIF:btfss INTCON,2
goto chIF
return
display: call Table
banksel PORTC
movwf PORTC
return
sec_delay: movlw 0xc9;
banksel temp
movwf temp
calling: call T0_delay
clrf INTCON
decfsz temp
goto calling
return
Table
MOVF digits,W ; Get count
ADDWF PCL ;
RETLW B'00111111' ; Code for '0'
RETLW B'00000110' ; Code for '1'
RETLW B'01011011' ; Code for '2'
RETLW B'01001111' ; Code for '3'
RETLW B'01100110' ; Code for '4'
RETLW B'01101101' ; Code for '5'
RETLW B'01111101' ; Code for '6'
RETLW B'00000111' ; Code for '7'
RETLW B'01111111' ; Code for '8'
RETLW B'01101111' ; Code for '9'
RETLW B'01110111' ; Codefor 'A'
RETLW B'01111100' ; Code for'B'
RETLW B'00111001' ; Code for C'
RETLW B'01011110' ; Code for D'
RETLW B'01111001' ; Code for E'
RETLW B'01110001' ; Code for 'F'
org 0x300
Initialize:clrf digits
banksel TRISC
movlw 0x00
movwf TRISC
banksel TRISA
movlw 0x1f
Movwf TRISA
temp equ 0x19
Digits equ 0x20
#DEFINE rst PORTD,'1'
#DEFINE step PORTD,'0'
temp equ 0x19
digits equ 0x20
banksel PORTC
call display
chrst: btfss rst
goto ckstep
goto Initialize
ckstep:btfss step
goto chrst
incf Digits
call display
call sec_delay
banksel INTCON
clrf INTCON
banksel PORTC
goto chrst
end