chipo312
Newbie level 2
- Joined
- Dec 17, 2014
- Messages
- 2
- Helped
- 0
- Reputation
- 0
- Reaction score
- 0
- Trophy points
- 1
- Activity points
- 12
Code:
INCLUDE <P16F877A.INC>
COUNT_1 EQU 0X20
COUNT_2 EQU 0X21
CNT_RTC EQU 0X22
DISP1 EQU 0X23
DISP2 EQU 0X24
DISP3 EQU 0X25
DISP4 EQU 0X26
NUM EQU 0X27
TIME EQU 0X28
ORG 0
MAIN BSF STATUS,RP0
MOVLW B'00010100'
MOVWF OPTIONR
MOVLW B'00000000'
MOVWF TRISC
MOVLW B'00000000'
MOVWF TRISD
BCF STATUS,RP0
CLRF PORTC
CLRF PORTD
CLRF DISP1
CLRF DISP2
CLRF DISP3
CLRF DISP4
SIJAK CALL DISPLAY
DIGIT4 CALL SEC
INCF DISP4
MOVF DISP4,W
XORLW B'00001010'
BTFSS STATUS,ZF
GOTO DIGIT3
CLRF DISP4
INCF DISP3
DIGIT3 MOVF DISP3,W
XORLW B'00000110'
BTFSS STATUS,ZF
GOTO DIGIT2
CLRF DISP3
INCF DISP2
DIGIT2 MOVF DISP2,W
XORLW B'00001010'
BTFSS STATUS,ZF
GOTO DIGIT1
CLRF DISP2
INCF DISP1
DIGIT1 MOVF DISP1,W
XORLW B'00000110'
BTFSS STATUS,ZF
GOTO DISP_RTN
CLRF DISP1
NOP
DISP_RTN CALL DISPLAY
GOTO DIGIT4
WAIT MACRO TIME
MOVLW (TIME/5)-1
MOVWF NUM
CALL WAIT5U
ENDM
WAIT5U NOP
NOP
DECFSZ NUM,F
GOTO WAIT5U
RETLW 0
SEC CLRF RTCC
MOVLW .237
MOVWF CNT_RTC
BCF STATUS,CF
LOOP1 BTFSS RTCC,7
GOTO LOOP1
CLRF RTCC
CALL DISPLAY
DECFSZ CNT_RTC
GOTO LOOP1
RETURN
DISPLAY
MOVF DISP4,W
CALL FND_TABLE
MOVWF PORTD
BSF PORTC,3
WAIT .20
CLRF PORTC
MOVF DISP3,W
CALL FND_TABLE
MOVWF PORTD
BSF PORTC,2
WAIT .20
CLRF PORTC
MOVF DISP2,W
CALL FND_TABLE
MOVWF PORTD
BSF PORTC,1
WAIT .20
CLRF PORTC
MOVF DISP1,W
CALL FND_TABLE
MOVWF PORTD
BSF PORTC,0
WAIT .20
CLRF PORTC
RETURN
FND_TABLE
ADDWF PCL
RETLW B'11000000' ;0
RETLW B'11111001' ;1
RETLW B'10100100';2
RETLW B'10110000';3
RETLW B'10011001';4
RETLW B'10010010';5
RETLW B'10000010';6
RETLW B'11011000';7
RETLW B'10000000';8
RETLW B'10010000';9
RETLW B'11000000';0
RETURN
END
7segment is not working ---------------where is wrong???
simulation program was proteus
[ 0 0 ] [ 0 0 ]
min sec
Last edited by a moderator: