Searching \ for '[PIC] Will 'btfss RXREG, n' make 16F628 USART RGRE' 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/microchip/ios.htm?key=usart
Search entire site for: 'Will 'btfss RXREG, n' make 16F628 USART RGRE'.

Exact match. Not showing close matches.
PICList Thread
'[PIC] Will 'btfss RXREG, n' make 16F628 USART RGRE'
2008\07\11@002107 by Pekka Siiskonen

flavicon
face
With PIC16F628 is it possible to test a bit from the RXREG first and after that mov the very same data byte, or will testing of a bit be considered as reading the register and clearing it to make space for the next in the pipeline?

pekka



     __________________________________________________________
Not happy with your email address?.
Get the one you really want - millions of new email addresses available now at Yahoo! http://uk.docs.yahoo.com/ymail/new.html

2008\07\11@004821 by Christopher Head

picon face
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Pekka Siiskonen wrote:
| With PIC16F628 is it possible to test a bit from the RXREG first and
after that mov the very same data byte, or will testing of a bit be
considered as reading the register and clearing it to make space for the
next in the pipeline?
|
| pekka
|

I suspect the answer to this is most likely no: reading a register is
reading a register, no matter what the core decides to do with the
register after the read.

You could do an experiment to find out!

Chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.9 (GNU/Linux)
Comment: GnuPT 2.7.2
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkh25foACgkQiD2svb/jCb4gygCdGDJn3oh2SnptxOgAbtFrcytu
o8oAn3e7k/WOgSzquBf3Fxblz8Wj/rWd
=7r8j
-----END PGP SIGNATURE-----

2008\07\11@010712 by Jinx

face picon face
> With PIC16F628 is it possible to test a bit from the RXREG first
> and after that mov the very same data byte, or will testing of a bit
> be considered as reading the register and clearing it to make space
> for the next in the pipeline?

Pekka, good question !!

A bit test might count as a read. AIUI the register is fetched and tested.
For example using BSF on a port causes the port to be read, modified
and written back to the pins, even though a read wasn't actually the
intent (eg like movf port,w) and the BSF 'appears' to the user as simply
an output operation

Had a look through this

Asynchronous Communications with the PICmicro® USART

http://ww1.microchip.com/downloads/en/AppNotes/00774a.pdf

but it doesn't go further than the datasheet in that regard



2008\07\11@075547 by Rolf

face picon face

Pekka Siiskonen wrote:
> With PIC16F628 is it possible to test a bit from the RXREG first and after that mov the very same data byte, or will testing of a bit be considered as reading the register and clearing it to make space for the next in the pipeline?
>
> pekka
>
>
>
>       __________________________________________________________
> Not happy with your email address?.
> Get the one you really want - millions of new email addresses available now at Yahoo! http://uk.docs.yahoo.com/ymail/new.html
>
>  
Based on the documentation for Read-Modify-Write issues, *all* bit
manipulation instructions first read the entire byte, then do the
manipulation, then store the byte.

It would have to imply that any bitwise operation on any register will
in fact 'read' it.

Run it through MPSIM to check, then do it through the actual device too!

From the mid-range reference:

29.3.3 Bit Manipulation
All bit manipulation instructions will first read the entire register,
operate on the selected bit and
then write the result back (read-modify-write (R-M-W)) the specified
register. The user should
keep this in mind when operating on some special function registers,
such as ports.

Rolf

2008\07\11@081150 by Jan-Erik Soderholm

face picon face
Rolf wrote:

> Based on the documentation for Read-Modify-Write issues, *all* bit
> manipulation instructions first read the entire byte, then do the
> manipulation, then store the byte.

But BTFSS/BTFSC never *store* anything back, do they ?

Not that it changes the original question, but anyway...

Jan-Erik.

2008\07\11@084558 by Jinx

face picon face
> But BTFSS/BTFSC never *store* anything back, do they ?

Don't think so. The question is - does a fetch qualify as a read, as
Microchip would define it, in the context of a UART ?

Or say you used MOVFF RCREG,RCREG. On the face of it
that would appear to be a read, although nothing's changed or
gone anywhere. At one level. It did pass through the processor

2008\07\11@085429 by olin piclist

face picon face
Pekka Siiskonen wrote:
> With PIC16F628 is it possible to test a bit from the RXREG first and
> after that mov the very same data byte, or will testing of a bit be
> considered as reading the register and clearing it to make space for
> the next in the pipeline?

I'd be very surprised if a BTFSx wasn't considered reading the register.

********************************************************************
Embed Inc, Littleton Massachusetts, http://www.embedinc.com/products
(978) 742-9014.  Gold level PIC consultants since 2000.

2008\07\11@090854 by Alan B. Pearce

face picon face
> But BTFSS/BTFSC never *store* anything back, do they ?

Umm, yes, that is why a bit operation on a Port register can have weird side
effects on other bits. The whole byte is read, the bit checked, and then the
whole byte is written back. It does the same operation as a bit set or
reset, but without doing the set or reset. There was quite a discussion
about this a good few years ago, and someone came up with some code that
proved the case.

For the OP, the only way to do what you want is to have a temporary register
that you read the Rx register into, and THEN do the bit check on the
temporary register, and if needed transfer the contents of that register
where you want.

2008\07\11@093939 by Jan-Erik Soderholm

face picon face
Alan B. Pearce wrote:

>> But BTFSS/BTFSC never *store* anything back, do they ?
>
> Umm, yes, that is why a bit operation on a Port register can have weird side
> effects on other bits. The whole byte is read, the bit checked, and then the
> whole byte is written back.

It does ?
Right, in that case, R-M-W problems are the same with
these instructions...

Jan-Erik.

2008\07\11@095017 by olin piclist

face picon face
Alan B. Pearce wrote:
> Umm, yes, that is why a bit operation on a Port register can have
> weird side effects on other bits. The whole byte is read, the bit
> checked, and then the whole byte is written back.

Really?  I didn't think there was a write back for BTFSx.  I also don't
remember hearing or of bumping into a BTFSx problem on port bits, which I
thought was because there is no write back.


********************************************************************
Embed Inc, Littleton Massachusetts, http://www.embedinc.com/products
(978) 742-9014.  Gold level PIC consultants since 2000.

2008\07\11@134505 by Pekka Siiskonen

flavicon
face
Thankyou for comments -- must really check with real hardware then.

pekka



     __________________________________________________________
Not happy with your email address?.
Get the one you really want - millions of new email addresses available now at Yahoo! http://uk.docs.yahoo.com/ymail/new.html

2008\07\14@160212 by Michael Rigby-Jones

picon face


> -----Original Message-----
> From: spam_OUTpiclist-bouncesTakeThisOuTspammit.edu [.....piclist-bouncesKILLspamspam@spam@mit.edu] On
Behalf
> Of Alan B. Pearce
> Sent: 11 July 2008 14:09
> To: Microcontroller discussion list - Public.
> Subject: Re: [PIC] Will 'btfss RXREG, n' make 16F628 USART RGREG as
read?
>
> > But BTFSS/BTFSC never *store* anything back, do they ?
>
> Umm, yes, that is why a bit operation on a Port register can have
weird
> side
> effects on other bits. The whole byte is read, the bit checked, and
then
> the
> whole byte is written back. It does the same operation as a bit set or
> reset, but without doing the set or reset. There was quite a
discussion
> about this a good few years ago, and someone came up with some code
that
> proved the case.
>
> For the OP, the only way to do what you want is to have a temporary
> register
> that you read the Rx register into, and THEN do the bit check on the
> temporary register, and if needed transfer the contents of that
register
> where you want.

I'm almost certain the bit test instructions don't write anything back
to the register they are testing, and the midrange reference manual
seems to agree as it shows no operation in the 4th Q cycle for BTFSS and
BTFSC. Instructions that do write back do so in the 4th Q cycle.

Regards

Mike

=======================================================================
This e-mail is intended for the person it is addressed to only. The
information contained in it may be confidential and/or protected by
law. If you are not the intended recipient of this message, you must
not make any use of this information, or copy or show it to any
person. Please contact us immediately to tell us that you have
received this e-mail, and return the original to us. Any use,
forwarding, printing or copying of this message is strictly prohibited.
No part of this message can be considered a request for goods or
services.
=======================================================================

2008\07\14@161632 by Bob Blick

face
flavicon
face
> > -----Original Message-----
> > From: piclist-bouncesspamKILLspammit.edu [.....piclist-bouncesKILLspamspam.....mit.edu] On
> Behalf
> > Of Alan B. Pearce
> > Sent: 11 July 2008 14:09
> > To: Microcontroller discussion list - Public.
> > Subject: Re: [PIC] Will 'btfss RXREG, n' make 16F628 USART RGREG as
> read?

I'm pretty sure as far as the USART's RCREG is concerned, a bit test is
the same as a read, so if a new byte comes into the serial port it will
overwrite what you just tested. But that is just my gut feeling based on
how bit tests would work on a normal register, I have not tested it and
it isn't explicitly stated in any data sheets I've read.

Cheerful regards,

Bob

--
http://www.fastmail.fm - One of many happy users:
 http://www.fastmail.fm/docs/quotes.html


'[PIC] Will 'btfss RXREG, n' make 16F628 USART RGRE'
2008\08\17@105047 by Dario Greggio
face picon face
Olin Lathrop wrote:

> I'd be very surprised if a BTFSx wasn't considered reading the register.

yep, definitely agreed!

--
Ciao, Dario

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