I need to extract the digits from a binary number.
For example, I have 62 number in decimal and the two digits are 6 and 2. In binary:
62 = 00111110 --> 8 bit value
digit 6 = 0110 --> 4 bit value
digit 2 = 0010 --> 4 bit value
I need an algorithm to extract the digits and I'm using the asm for pic16f628a microcontroller.
There is an example of I want:
ORG 0x00
MOVLW B'00111110' ; 62
MOVWF 0X30
; ... CODE TO EXTRACT THE DIGITS FROM VALUE IN REGISTER 0X30
; The register 0X31 is loaded with '00000110' (digit 6)
; The register 0X32 is loaded with '00000010' (digit 2)
But it can also be with C or C ++.