Searching \ for 'separating digits' in subject line. ()
Make payments with PayPal - it's fast, free and secure! 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.
PICList Thread
'separating digits'
1999\03\24@015423 by Stewart Pye

flavicon
face
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

1999\03\24@110412 by Ryan Pogge

flavicon
face
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.




>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
>

1999\03\24@124938 by Scott Dattalo

face
flavicon
face
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

1999\03\25@021415 by w. v. ooijen / f. hanneman

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

----------
> From: Stewart Pye <spam_OUTstewTakeThisOuTspamUQ.NET.AU>
> To: .....PICLISTKILLspamspam@spam@MITVMA.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...