---- START NEW MESSAGE --- Received: from cherry.ease.lsoft.com [209.119.0.109] by dpmail10.doteasy.com with ESMTP (SMTPD32-8.05) id A3B677C00070; Sun, 01 Feb 2004 10:21:42 -0800 Received: from PEAR.EASE.LSOFT.COM (209.119.0.19) by cherry.ease.lsoft.com (LSMTP for Digital Unix v1.1b) with SMTP id <5.00CC7D70@cherry.ease.lsoft.com>; 1 Feb 2004 13:21:37 -0500 Received: from MITVMA.MIT.EDU by MITVMA.MIT.EDU (LISTSERV-TCP/IP release 1.8e) with spool id 1086 for PICLIST@MITVMA.MIT.EDU; Sun, 1 Feb 2004 13:21:30 -0500 Received: from MITVMA (NJE origin SMTP@MITVMA) by MITVMA.MIT.EDU (LMail V1.2d/1.8d) with BSMTP id 1160; Sun, 1 Feb 2004 13:21:17 -0500 Received: from rs25s9.datacenter.cha.cantv.net [200.44.33.10] by mitvma.mit.edu (IBM VM SMTP Level 430) via TCP with ESMTP ; Sun, 01 Feb 2004 13:21:16 EST X-Comment: mitvma.mit.edu: Mail was sent by rs25s9.datacenter.cha.cantv.net Received: from carlos98 ([161.196.167.209]) by rs25s9.datacenter.cha.cantv.net (8.12.9/8.12.6/3.0) with SMTP id i11ILFLN026400 for ; Sun, 1 Feb 2004 14:21:17 -0400 X-Matched-Lists: [] References: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2600.0000 X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 Content-Transfer-Encoding: quoted-printable X-MIME-Autoconverted: from 8bit to quoted-printable by rs25s9.datacenter.cha.cantv.net id i11ILFLN026400 Message-ID: <001101c3e8f3$c42ebc40$0100a8c0@carlos98> Date: Sun, 1 Feb 2004 14:46:32 -0400 Reply-To: pic microcontroller discussion list Sender: pic microcontroller discussion list From: Carlos Marcano Subject: Re: [PIC:] AND, and OR To: PICLIST@MITVMA.MIT.EDU Precedence: list X-RCPT-TO: Status: U X-UIDL: 371856759 > Hello!! > > I have just subscribed to the mailing list, and want to try it out. Wise thing! > > Since I am relatively new to PIC-programming, and since I am not an exp= ert in mathematics (I'm still quite young!), > I wondered what really happens when you AND's to numbers. > Why is for example "50 AND 100 =3D 32" (decimal numbers) or > "0xAF AND 0xCC =3D 0x8C" ???? > - and what happens when you OR's to numbers? The AND operation is one of the most usefull, especially when working wit= h bits. The basics of this operation can be described with this chart: X | Y | Z FALSE | FALSE | FALSE FALSE | TRUE | FALSE TRUE | FALSE | FALSE TRUE | TRUE | TRUE where X and Y are two events and Z is the result of doing "AND" operation between them. If we translate this into "bit terms" then= we can have: X | Y | Z 0 | 0 | 0 0 | 1 | 0 1 | 0 | 0 1 | 1 | 1 This charts are known as "Truth Tables". You can find more about these tables in any Digital Electronics basic textbook, as Wakerly=B4s or other= .. You may also google for that too. You then will learn that this two operations, AND & OR, are usefull for "masking" a really basic and needed operation when working with microcontrollers. By the way take a look: 50 in binary is 0110010 100 in binary is : 1100100 50 AND 100 result: 0100000, that is 32 in decimal..... Take a look and try to figure it out. Good luck and keep asking.... Regards, *Carlos* > Without understanding this, I don't see what use I can get from the > ANDLW, ANDWF, IORWF, XORWF, IORLW, XORLW-commands. > > Are there anyone out there who can give an answer to this?? > I know this is a stupid question, but I still hope you will help me. > > Thank you > Ruben Undheim > > -- > http://www.piclist.com hint: PICList Posts must start with ONE topic: > [PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads > --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.572 / Virus Database: 362 - Release Date: 27/01/04 -- http://www.piclist.com hint: PICList Posts must start with ONE topic: [PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads .