Searching \ for '[PIC]:Easy Pic 'n' in subject line. ()
Help us get a faster server
FAQ page: www.piclist.com/techref/microchip/devices.htm?key=pic
Search entire site for: 'Easy Pic 'n'.

Exact match. Not showing close matches.
'[PIC]:Easy Pic 'n'
2001\02\25@194851 by

Hi, I am just learning to program PIC's.  I have been going through the Easy
Pic'n book which so far has been easy to follow and pretty simple.  I was
wondering if anyone who has this book could better explain the parts covered
on Page 71 (Bit manipulation using logic instructions) as the wording of
them does not make much sense and the examples on the next page seem pretty
useless.

Thanks,

Justin.

--
http://www.piclist.com hint: To leave the PICList
piclist-unsubscribe-requestmitvma.mit.edu

Justin,

No problem.   Here we go.

As you may or may not know, digital logic is based on boolean algebra.
In Boolean algebra, outputs depend on inputs being true.  So, if we call
"TRUE" a "1", and "FALSE" a "0", we can use binary digits (Bits) in our
logic expressions.

The expressions are as follows:

1.  AND      If any  input is FALSE, the output is FALSE
If all inputs are TRUE, the output is TRUE

2.  OR         If any or all input(s) is (are) TRUE, the output is TRUE
If all inputs are FALSE, the output is FALSE.

3.  XOR      If BOTH inputs are the same, the output is FALSE.
If BOTH inputs are different, the output is TRUE.

4.  NOT      If input is TRUE, output is FALSE.
If input is FALSE, output is TRUE.

With these postulations in mind, we can expand to the following:......

If we have  a "1" AND  "1" the output is "1" ....  A "1" AND "0" the output
is "0".

If we have  a "1" OR "1" the output is "1" .... A "1" OR "0" the output is
"1", and
a "0" OR "0" the output is is "0".

If we have a "1" XOR "1", the output is "0",  A "1" XOR "0", the output is
"1", and
a "0" XOR "0", the output is "0"

If we have a "1" NOT, the output is "0", and  a "0" NOT, the output is "1"

For instance we have binary 00010101 and we AND this with 11111000, ...

00010101     (0x15)
11111000     (0xF8)
----------------
00010000     (0x10)

If we OR 11111000 with this we get ...

00010101      (0x15)
11111000      (0xF8)
---------------
11111101      (0xFD)

If we XOR these....

00010101     (0x15)
11111000     (0xF8)
---------------
11101101     ((0xED)

And if we NOT the first number (00010101)

we get 11101010   (0xEA)

Hope this helps you out.  If not, don't hesitate to let me know
and I'll try to explain further.

Regards,

Jim

{Original Message removed}
Thanks Jim that did help.  That is how I remember logic gates but the book
leads you to believe that the output on an XOR is inverted, here is an
extract:

"
Change specific bit to it's complement

0 to 1 and 1 to 0

XOR    with an 8-bit binary number which is all zeros except the bit to be
changed to its complement (Exclusive OR).

XOR    With "1" changes bit to complement
XOR    With "0" results in no change

"

Now is it me or is this wording very unclear?  The initial description
sounds although he is describing a NOT gate as I understood that XOR was
Exclusive OR which has the logic properties that you described!

----- Original Message -----
From: "Jim Paul" <jamespINTERTEX.NET>
To: <PICLISTMITVMA.MIT.EDU>
Sent: Monday, February 26, 2001 1:55 AM
Subject: Re: [PIC]:Easy Pic 'n

{Quote hidden}

output
{Quote hidden}

> {Original Message removed}
An XOR gate with one line held low will act like a buffer.
An XOR gate with one line held high will act like an inverter.

When using the bitwise XOR function, any bit in the MASK that is a 0
will leave the corresponding data bit unchanged in the result.
Any bit in the MASK that is a 1 will cause the corresponding
data bit in the result to be inverted (complemented).

The XOR function can also be viewed as an "INEQUALITY"
function. The output will be a 1 whenever the two inputs
are opposites. In the PIC the XOR function is used by
providing a MASK with a 1 at each position you want to
complement.

There are different ways of looking at the XOR function,
but in practice it is most often used to toggle particular
bits and leave the rest untouched.

Fr. Tom McGahee

----- Original Message -----
From: Justin Fielding <j.fieldingBTINTERNET.COM>
To: <PICLISTMITVMA.MIT.EDU>
Sent: Monday, February 26, 2001 2:53 PM
Subject: Re: [PIC]:Easy Pic 'n

{Quote hidden}

> > {Original Message removed}

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