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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
01/08/99 16:25
Read: times


 
#135 - RE: Converting Hex to Decimal
Hi Dave,
Its very easy.
Below is the routine.
Hope, it is usefull to you.

Please acknoledge my message by
sending mail to:
bdeven@vsnl.com

;----------------------------------------------------------
;BIN_BCD: Routine to convert the 3 nibble binary stored
; in ADC_0 and ADC_1 into corresponding BCD
; stores the o/p in ADC_BCD_H and ADC_BCD_L
;----------------------------------------------------------
BIN_BCD:
PUSH ACC
MOV A,ADC0
ANL A,#0FH
MOV TEMP_2,A
MOV A,ADC1
ANL ADC0,#0F0H
ORL A,ADC0
SWAP A
MOV TEMP_1,A

MOV A,TEMP_1
MOV B,#0AH
DIV AB
MOV TEMP_3,A
MOV A,B
SWAP A
ORL A,TEMP_2
MOV B,#0AH
DIV AB
MOV TEMP_5,B
MOV TEMP_4,A
MOV A,TEMP_3
MOV B,#0AH
DIV AB
SWAP A
MOV TEMP_3,A
MOV A,B
SWAP A
ORL A,TEMP_4
MOV B,#0AH
DIV AB
MOV TEMP_6,B
ORL A,TEMP_3
MOV B,#0AH
DIV AB
MOV TEMP_7,B
MOV TEMP_8,A
MOV A,TEMP_6
SWAP A
ORL A,TEMP_5
MOV ADC_BCD_L,A
MOV A,TEMP_8
SWAP A
ORL A,TEMP_7
MOV ADC_BCD_H,A
POP ACC
RET








List of 2 messages in thread
TopicAuthorDate
Converting Hex to Decimal            01/01/70 00:00      
RE: Converting Hex to Decimal            01/01/70 00:00      

Back to Subject List