; *************************************************************
; HexToDec: Converts an Hexa in W in 3 decimals.
; Args: W with Hexa
; Returns:
; Ones
; W Tens from 0 to 25
; Tens
; Hund
; *************************************************************
HexToDec:
MOVWF Ones
CLRF Tmp2
; Get the Units
HexToDec1:
MOVLW .10
SUBWF Ones,W
BTFSS _carry
GOTO HexToDec2
MOVWF Ones
INCF Tmp2,F
GOTO HexToDec1
HexToDec2:
MOVF Tmp2,W
MOVWF Tens
CLRF Hund
HexToDec3:
MOVLW .10
SUBWF Tens,W
BTFSS _carry
GOTO HexToDec4
MOVWF Tens
INCF Hund,F
GOTO HexToDec3
HexToDec4:
MOVF Tmp2,W
RETURN
For more conversions, visit:
http://www.piclist.com/techref/microchip/math/radix/index.htm
© 2024 Created by PML. Powered by
You need to be a member of Personal Mechatronics Lab to add comments!
Join Personal Mechatronics Lab