;
;************************************************* *******************
; Binary To BCD Conversion Routine
;
; This routine converts the 8 bit binary number in the W Register
; to a 2 digit BCD number.
; The least significant digit is returned in location akalThoklan and
; the most significant digit is returned in location aktharlThoklan.
;
;************************************************* ******************
;
akalThoklan equ 10
aktharlThoklan equ 11
;
BinBCD
clrf aktharlThoklan
movwf akalThoklan
tenth movlw .10
subwf akalThoklan,W
BTFSS STATUS,C
goto over
movwf akalThoklan
incf aktharlThoklan, F
goto tenth
over retlw 0
;************************************************* ******************
أي رقم تريد تحويله يوضع في w
مثلا
movlw 63
ثم نستدعي
call BinBCD
ستجد الناتج في
akalThoklan
و
aktharlThoklan
أكبر رقم يمكنك إستخدامه 99 عشري .
بالتوفيق