Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
01/23/04 10:17
Read: times


 
#63187 - RE: 24bit Hex to decimal
Responding to: ???'s previous message
Here is the code i use for 24bit to bcd conversion.

;---------------------------------------------------------------------------
; INPUT     :R1, R2, R3(LSB)
; OUTPUT    :R4, R5, R6, R7(LSB)
; USES      :COUNT, R0
;---------------------------------------------------------------------------
B24TOBCD
       MOV     COUNT, #24
       CLR     A
       MOV     R4, A
       MOV     R5, A
       MOV     R6, A
       MOV     R7, A
       CLR     C
LOOP24
       MOV     A, R3
       RLC     A
       MOV     R3, A
   
       MOV     A, R2
       RLC     A
       MOV     R2, A

       MOV     A, R1
       RLC     A
       MOV     R1, A

       MOV     A, R7
       RLC     A
       MOV     R7, A

       MOV     A, R6
       RLC     A
       MOV     R6, A

       MOV     A, R5
       RLC     A
       MOV     R5, A

       MOV     A, R4
       RLC     A
       MOV     R4, A
       DJNZ    COUNT, adjDEC
       RET
adjDEC
       MOV     R0, #07H
       CALL    adjBCD

       MOV     R0, #06H
       CALL    adjBCD

       MOV     R0, #05H
       CALL    adjBCD

       MOV     R0, #04H
       CALL    adjBCD
       SJMP    LOOP24
adjBCD
       MOV     A, #03H
       ADD     A, @R0
       JNB     ACC.3,$S1
       MOV     @R0, A
$S1:   MOV     A, #30H
       ADD     A, @R0
       JNB     ACC.7,$S2
       MOV     @R0, A
$S2:   RET



V.Nagarajan

List of 21 messages in thread
TopicAuthorDate
24bit Hex to decimal            01/01/70 00:00      
   RE: 24bit Hex to decimal            01/01/70 00:00      
   RE: 24bit Hex to decimal            01/01/70 00:00      
      RE: 24bit Hex to decimal            01/01/70 00:00      
         RE: 24bit Hex to decimal            01/01/70 00:00      
      RE: 24bit Hex to decimal            01/01/70 00:00      
         RE: 24bit Hex to decimal            01/01/70 00:00      
            RE: 24bit Hex to decimal            01/01/70 00:00      
   RE: 24bit Hex to decimal            01/01/70 00:00      
      RE: 24bit Hex to decimal            01/01/70 00:00      
      RE: 24bit Hex to decimal            01/01/70 00:00      
         RE: 24bit Hex to decimal            01/01/70 00:00      
   RE: 24bit Hex to decimal            01/01/70 00:00      
   RE: 24bit Hex to decimal            01/01/70 00:00      
   RE: 24bit Hex to decimal            01/01/70 00:00      

Back to Subject List