Searching \ for '[PIC]: W Register' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: massmind.org/techref/microchip/devices.htm?key=pic
Search entire site for: 'W Register'.

Exact match. Not showing close matches.
PICList Thread
'[PIC]: W Register'
2002\01\13@232227 by Sean Alcorn - Avion Sydney

flavicon
face
Hi Guys,

Another simple question (I am sure) from a Newbie, but I have searched and
can not find an answer anywhere. Probably scanned passed it a dozen times, I
am sure!

If I use any byte instruction and place the result back into the file, is my
W register cleared or does it maintain it's original value for further use?

Example;

MOVF   GPIO, W     ; Read Port
ANDLW  B'00000111' ; Mask out unwanted bits & store in W
IORWF  TEST1, F    ; Store result original TEST1 file AND masked GPIO
MOVF   CHECK       ; Store masked version of GPIO

Can this be done?

Regards,

Sean

--
http://www.piclist.com hint: The list server can filter out subtopics
(like ads or off topics) for you. See http://www.piclist.com/#topics


2002\01\13@233932 by Peter Wintulich

flavicon
face
It keeps it origenal value.

>>> spam_OUTsdalcornTakeThisOuTspamAVION.COM.AU 01/14/02 02:48PM >>>
Hi Guys,

Another simple question (I am sure) from a Newbie, but I have searched and
can not find an answer anywhere. Probably scanned passed it a dozen times, I
am sure!

If I use any byte instruction and place the result back into the file, is my
W register cleared or does it maintain it's original value for further use?

Example;

MOVF   GPIO, W     ; Read Port
ANDLW  B'00000111' ; Mask out unwanted bits & store in W
IORWF  TEST1, F    ; Store result original TEST1 file AND masked GPIO
MOVF   CHECK       ; Store masked version of GPIO

Can this be done?

Regards,

Sean

--
http://www.piclist.com hint: The list server can filter out subtopics
(like ads or off topics) for you. See http://www.piclist.com/#topics
--
http://www.piclist.com hint: The list server can filter out subtopics
(like ads or off topics) for you. See http://www.piclist.com/#topics


2002\01\13@234245 by David Duffy

flavicon
face
At 03:18 PM 14/01/2002 +1100, you wrote:
>Hi Guys,
>
>Another simple question (I am sure) from a Newbie, but I have searched and
>can not find an answer anywhere. Probably scanned passed it a dozen times, I
>am sure!
>
>If I use any byte instruction and place the result back into the file, is my
>W register cleared or does it maintain it's original value for further use?

It is not affected - it still have the old value.

>Example;
>
>MOVF   GPIO, W     ; Read Port
>ANDLW  B'00000111' ; Mask out unwanted bits & store in W
>IORWF  TEST1, F    ; Store result original TEST1 file AND masked GPIO
>MOVF   CHECK       ; Store masked version of GPIO

Do you mean MOVWF for the last instruction? If so, then yes.
For better readability I'd probably do the IORWF last though.
The MOVWF doesn't actually 'move' the byte - just copies it
to the specified register. W reg still contains the byte as well.
Regards...

--
http://www.piclist.com hint: The list server can filter out subtopics
(like ads or off topics) for you. See http://www.piclist.com/#topics


2002\01\13@235231 by Sean Alcorn - Avion Sydney

flavicon
face
Hi David and Peter,

Thanks for your responses to my silly question.

>> MOVF   CHECK       ; Store masked version of GPIO
>
> Do you mean MOVWF for the last instruction? If so, then yes.

Yes. I did, sorry.

> For better readability I'd probably do the IORWF last though.

OK, Thanks.

> The MOVWF doesn't actually 'move' the byte - just copies it
> to the specified register. W reg still contains the byte as well.

Yes, I had assumed as much, but could not actually find it in black and
white. Thought it best to check with the list gurus rather than assume.

Still waiting for "PIC Programming for Dummies" to be published. :-)

Thanks again,

Sean

--
http://www.piclist.com hint: The list server can filter out subtopics
(like ads or off topics) for you. See http://www.piclist.com/#topics


2002\01\14@003515 by Kevin Olalde
flavicon
face
Look into Easy PIC'n

> Still waiting for "PIC Programming for Dummies" to be published. :-)

--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.


2002\01\14@143819 by John

flavicon
face
Hello Sean & PIC.ers,

w won't be changed, but for the future be advised
that the much-under-rated MPSIM part of MPLAB is extremely
useful for answering these queries.
This *really* starts to matter when you get to 16bit manipulation,
arithmetic & the like.

Just write a very small stretch of code, including your target sequence.
Load the watch window with relevant fregisters,
compile..run..edit initial conditions..compile..run..edit   etc, etc,

This might not seem very scientific, but can rescue your sanity.



{Quote hidden}

my
{Quote hidden}

       bestos,   John

e-mail from the desk of John Sanderson, JS Controls.
Snailmail:          PO Box 1887, Boksburg 1460, Rep. of South Africa.
Tel/fax:            Johannesburg  893 4154
Cellphone no:   082 741 6275
email:                jsandspamKILLspampixie.co.za
Manufacturer & purveyor of laboratory force testing apparatus, and related
products and services.

--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.


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