Searching \ for 'Checking of BIT Values' 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=checking+bit+values
Search entire site for: 'Checking of BIT Values'.

Truncated match.
PICList Thread
'Checking of BIT Values'
1998\11\26@084210 by Paul Phillips

flavicon
face
Hi Friends

Thanks James Cameron for the info, I was not sure how to respond to a
arctile.  The flow chart was done in ten minutes (through my lunch break)
and didn't have did really think about the design.  Over the next week, I
going to do a better layout and with alot more information.

Anyway, another question (still regarding to the password routine code):

1. What is the best way of checking if all inputs from PORT B are not high?

2. What is the best way of checking the value from PORT B against the
working register to see if they are the same?


Any comments would be greatfull.


Paul Phillips
spam_OUTPICTakeThisOuTspamColindale.demon.co.uk

P.S If you didn't already guess, I have only have the basic knwoledge of
the PIC16F84 (only just to program the PIC a week ago).

1998\11\26@110315 by Chip Weller

flavicon
face
Paul Phillips wrote:


>Hi Friends
>
>Thanks James Cameron for the info, I was not sure how to respond to a
>arctile.  The flow chart was done in ten minutes (through my lunch break)
>and didn't have did really think about the design.  Over the next week, I
>going to do a better layout and with alot more information.
>
>Anyway, another question (still regarding to the password routine code):
>
>1. What is the best way of checking if all inputs from PORT B are not high?


   comf PORTB,w        ; complement bits, 0xFF -> 0x00
   bnz ALL_NOT_HIGH    ; bnz <label> is same as btfss STATUS,Z / goto
<label>
>
>2. What is the best way of checking the value from PORT B against the
>working register to see if they are the same?


   xorwf PORTB,w       ; W = W ^ PORTB, if same result is 0.
   bz MATCH

Chip

1998\11\27@151034 by mkeitz

picon face
On Thu, 26 Nov 1998 13:30:39 +0000 Paul Phillips
<.....paul.phillipsKILLspamspam@spam@CONSYSE.CO.UK> writes:
>Hi Friends
>
>Thanks James Cameron for the info, I was not sure how to respond to a
>arctile.  The flow chart was done in ten minutes (through my lunch
>break)
>and didn't have did really think about the design.  Over the next
>week, I
>going to do a better layout and with alot more information.
>
>Anyway, another question (still regarding to the password routine
>code):
>
>1. What is the best way of checking if all inputs from PORT B are not
>high?

In other words, to see if one or more bits of PORTB are low?  There's an
easy way to do that:

       comf    PORTB,w         ;Sets Z flag if PORTB =
11111111
       skpnz                   ;Skips if one or more bits are low.
Of course, the value in W is changed.

>2. What is the best way of checking the value from PORT B against the
>working register to see if they are the same?

       xorwf   PORTB,w
       skpz                    ;Skips if PORTB = W
Note that this routine also changes the value in W.

The xor method above can also be used to test only some of the bits in
PORTB by ANDLW'ing the result in W with a mask (containing ones
corresponding to the bits to be tested) before the SKPZ.

Also of course these tests work on RAM locations as well as ports.  It
may be an advantage to read the port only once and make a copy to RAM for
further tests in case the hardware connected to the port changes the
value in the middle of a sequence of tests.


___________________________________________________________________
You don't need to buy Internet access to use free Internet e-mail.
Get completely free e-mail from Juno at http://www.juno.com/getjuno.html
or call Juno at (800) 654-JUNO [654-5866]

1998\11\27@160240 by John Sanderson

flavicon
face
Hello Paul & PIC.ers,
..
>Date:    Thu, 26 Nov 1998 13:30:39 +0000
>From:    Paul Phillips <paul.phillipsspamKILLspamCONSYSE.CO.UK>
>Subject: Checking of BIT Values
>
><snippo>
>Anyway, another question (still regarding to the password routine code):
>
>1. What is the best way of checking if all inputs from PORT B are not high?
..
yey. mmm.  Do you mean:-

(a)         port_b  =  00000000b                         ;ie not one input is HI
or,
(b)         port_b  = 00000001b  to 11111110b  ;ie some, but not all, are HI

       ?

If (a), then the easiest I know is:
             movf      port_b,same                 ;this returns zero bit set i
f port_b = 0
             btfss      status,z
             goto       not_zero_case
             goto       zero_case

If (b), then the result of above ((a) operation) would be opposite.
..
>
>2. What is the best way of checking the value from PORT B against the
>working register to see if they are the same?
..
          subwf     port_b,w           ; zero bit gets set if port_b = w
          btfss       status,z
          goto        wasnt_equal
          goto         was_equal
..
Hope this improves the light.
..
Best regards,   John
..
email from John Sanderson at
JS Controls, PO Box 1887, Boksburg 1460, Rep. South Africa
Manufacturer & purveyor of laboratory force testing apparatus
and related products and services.
Tel/fax: Johannesburg 893 4154    Cellphone 082 453 4815

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