rasool4
Newbie level 1
- Joined
- Feb 11, 2015
- Messages
- 1
- Helped
- 0
- Reputation
- 0
- Reaction score
- 0
- Trophy points
- 1
- Activity points
- 8
hi
i use 16f877a programmer for programming and for showing 3digit number in 7segment i use decimal to bcd code my code it work well when i use goto for calling decimal to bcd code but when i use call instruction for calling this code itis not work well . this is my program
but when i use call instruction for calling this part it is not work
i use 16f877a programmer for programming and for showing 3digit number in 7segment i use decimal to bcd code my code it work well when i use goto for calling decimal to bcd code but when i use call instruction for calling this code itis not work well . this is my program
Code:
.
.
.
PAGESEL DECIMAL
CALL DECIMAL ;CONVERT IDECIMAL TO BCD
PAGESEL $
.
.
.
DECIMAL
SWAPF MATH_HIGH,W
ANDLW 0FH
ADDLW 0F0H
MOVWF THOUSANDS
ADDWF THOUSANDS,F
ADDLW 0E2H
MOVWF HUNDREDS
ADDLW 32H
MOVWF ONES
MOVF MATH_HIGH,0
ANDLW 0FH
ADDWF HUNDREDS,F
ADDWF HUNDREDS,F
ADDWF ONES,F
ADDLW 0E9H
MOVWF TENS
ADDWF TENS,F
ADDWF TENS,F
SWAPF MATH_LOW,W
ANDLW 0FH
ADDWF TENS,F
ADDWF ONES,F
RLF TENS,F
RLF ONES,F
COMF ONES,F
RLF ONES,F
MOVF MATH_LOW,W
ANDLW 0FH
ADDWF ONES,F
RLF THOUSANDS,F
MOVLW 07H
MOVWF TENK
MOVLW 0AH
LB1
ADDWF ONES,F
DECF TENS,F
BTFSS 3,0
GOTO LB1
LB2
ADDWF TENS,F
DECF HUNDREDS,F
BTFSS 3,0
GOTO LB2
LB3
ADDWF HUNDREDS,F
DECF THOUSANDS,F
BTFSS 3,0
GOTO LB3
LB4
ADDWF THOUSANDS,F
DECF TENK,F
BTFSS 3,0
GOTO LB4
RETURN
i dont now why when i use below code for callind decimal part it works well
PAGESEL DECIMAL
goto DECIMAL
PAGESEL $
comebakdecimal
.
.
.
Last edited by a moderator: