Searching \ for 'separating digits' in subject line. ()
Help us get a faster server
FAQ page: www.piclist.com/techref/index.htm?key=separating+digits
Search entire site for: 'separating digits'.

Truncated match.
'separating digits'
1999\03\24@015423 by

Hi,

Can anyone give me an idea how to separate the digits from a two digit
number so they can be displayed on two 7 segment LED's.

Thanks,
Stewart Pye

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

hope that helps a little.  sorry im still learning asm so thats all I can
tell you
right now.

>Hi,
>
>Can anyone give me an idea how to separate the digits from a two digit
>number so they can be displayed on two 7 segment LED's.
>
>Thanks,
>Stewart Pye
>

Ryan Pogge wrote:
{Quote hidden}

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

A simple way is to count to 10 in two different variables....

----------
> From: Stewart Pye <stewUQ.NET.AU>
> To: PICLISTMITVMA.MIT.EDU
> Subject: separating digits
> Date: Wednesday, March 24, 1999 07:49
>
> Hi,
>
> Can anyone give me an idea how to separate the digits from a two digit
> number so they can be displayed on two 7 segment LED's.
>
> Thanks,
> Stewart Pye

More... (looser matching)
- Last day of these posts
- In 1999 , 2000 only
- Today
- New search...