Truncated match.
PICList
Thread
'How do I NOT a number?'
1998\04\30@115639
by
Hearn
Dear all,
I need to NOT a number for a control project my school is doing. However,
the instruction set for the PIC chip does not have a NOT. I think you can
do it using XOR but i'm not sure how that works.
Please help,
Michael Hearn and Tom Furlong (Fallibroome High School, England)
1998\04\30@123009
by
Keith Howell
Michael Hearn wrote:
>
> I need to NOT a number for a control project my school is doing. However,
> the instruction set for the PIC chip does not have a NOT. I think you can
> do it using XOR but i'm not sure how that works.
Sure.
result = your_number XOR -1
or in assembler, where W contains your number:
xorlw -1
This inverts all the bits in the W reg.
1998\04\30@123017
by
John Halleck
On Thu, 30 Apr 1998, Michael Hearn wrote:
> Dear all,
>
> I need to NOT a number for a control project my school is doing. However,
> the instruction set for the PIC chip does not have a NOT. I think you can
> do it using XOR but i'm not sure how that works.
The answer to the question as asked:
XOR with a constant that has bits set
is equivalent to
NOT of each position that has a one bit set.
But I suspect that's not the question you really want.
>
> Please help,
> Michael Hearn and Tom Furlong (Fallibroome High School, England)
>
1998\04\30@123021
by
n Midgley
Hah! A question I can answer!
COMF f,d complements f and puts the result in d.
Regards
John M
1998\04\30@123730
by
Sean Breheny
At 04:29 PM 4/30/98 +0100, you wrote:
>Dear all,
>
>I need to NOT a number for a control project my school is doing. However,
>the instruction set for the PIC chip does not have a NOT. I think you can
>do it using XOR but i'm not sure how that works.
>
>Please help,
>Michael Hearn and Tom Furlong (Fallibroome High School, England)
>
NOT x is equivalent to XOR x 0xFF if x is 8 bits long, but the PIC does
have a comf f,d instruction which accomplishes this same thing. f is the
address of the ram location you want to not, and d=1 to store the result
back in that location, d=0 to store the result in the W register(without
affecting the ram location). As far as I know,all pics have this instruction.
Good luck,
Sean
+--------------------------------+
| Sean Breheny |
| Amateur Radio Callsign: KA3YXM |
| Electrical Engineering Student |
+--------------------------------+
Fight injustice, please look at
http://www.all.org
Personal page: http://www.people.cornell.edu/pages/shb7
spam_OUTshb7TakeThisOuT
cornell.edu
Phone(USA): (607) 253-0315
1998\04\30@123801
by
Mike Keitz
On Thu, 30 Apr 1998 16:29:33 +0100 Michael Hearn
<.....michael.hearnKILLspam
@spam@FALLIBROOME.CHESHIRE.SCH.UK> writes:
>Dear all,
>
>I need to NOT a number for a control project my school is doing.
>However,
>the instruction set for the PIC chip does not have a NOT.
Yes it does; the instruction is 'comf' (Complement F). It inverts all
bits in a byte. It is very similar to 'clrf' and 'movf' in that the
result can be sent to W or back to RAM.
Of course you can also complement using xor. Xoring with 0xff inverts
all bits. This is useful to complement ('NOT') W without needing to copy
to RAM first. Just use xorlw h'ff' (Hexadecimal FF is binary 11111111).
(W= 01011100 before)
xorlw h'ff'
(Now W = 10100011)
_____________________________________________________________________
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
Or call Juno at (800) 654-JUNO [654-5866]
1998\04\30@125349
by
andre
Michael:
Pic has every thing you need .
for example how to do NOT function.
movlw b'1' ; load 1 in w
movwf temp ; save it here
movwf portb ; send it to portb rb0 is 1 you can use led
comf temp,w ; complement temp ( NOT)
movwf portb ; now portb rb0 is 0
hope this helps
Andre
Michael Hearn wrote:
{Quote hidden}> Dear all,
>
> I need to NOT a number for a control project my school is doing. However,
> the instruction set for the PIC chip does not have a NOT. I think you can
> do it using XOR but i'm not sure how that works.
>
> Please help,
> Michael Hearn and Tom Furlong (Fallibroome High School, England)
--
==========================================
= http://www.compufire.com =
= andre
KILLspamcompufire.com =
= .....mcu-engineeringKILLspam
.....compufire.com =
= Andre Abelian: Engine Electronics, Inc.=
= Tel 909-589-5485 Fax 909-598-5695 =
==========================================
'How do I NOT a number?'
1998\05\01@050654
by
Jason Bent
1998\05\01@091846
by
Walter Banks
----------
> From: Jason Bent <@spam@mbcjabtKILLspam
MAIL1.MCC.AC.UK>
> There are at least THREE ways. Other people have covered XOR and
> COMF, which you use 99% of the time. Another litle trick is
>
> 255 - A = NOT A
>
This is the 8 bit version of the more general case of
NOT A = -A -1 on any two's compliment processor.
This will work on any word size. It is a compiler
optimization that is very useful in some cases.
Walter Banks
More... (looser matching)
- Last day of these posts
- In 1998
, 1999 only
- Today
- New search...