Ryan Pogge wrote:
{Quote hidden}>
> try bitwise and
>
> this is how it looks in PIC basic
> you will have to write something
> simmilar in asm.
>
> b1 = b0 & 0f 'mask lower bits
> b2 = b0 & f0 'mask upper bits
> B2 = b2 >> 4 'shift upper bits right 4 places
>
> then you have the 2 digit number stored in
> b0 split into two variables b1, and b2
>
> so now you can just display b1 on the first digit and b2 on the second digit
> of your display.
>
> hope that helps a little. sorry im still learning asm so thats all I can
> tell you
> right now.
>
movf two_digits,W
andlw 0x0f
movwf lower_digit
xorwf two_digits,W
movwf upper_digit
swapf upper_digit,F
or if you don't care about saving the original two_digits:
movf two_digits,W
andlw 0x0f
movwf lower_digit
xorwf two_digits,F
swapf two_digits,F ;upper digit is in lower nibble
Scott