|
View:
New views
14 Messages
—
Rating Filter:
Alert me
|
|
|
|
|
|
Re: Will 'btfss RXREG, n' make 16F628 USART RGREG as read?-----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----- -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist |
|
|
Re: Will 'btfss RXREG, n' make 16F628 USART RGREG as read?> 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 -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist |
|
|
Re: Will 'btfss RXREG, n' make 16F628 USART RGREG as read?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 > > 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 -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist |
|
|
Re: Will 'btfss RXREG, n' make 16F628 USART RGREG as read?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. -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist |
|
|
Re: Will 'btfss RXREG, n' make 16F628 USART RGREG as read?> 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 -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist |
|
|
Re: Will 'btfss RXREG, n' make 16F628 USART RGREG as read?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. -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist |
|
|
Re: 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. -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist |
|
|
Re: Will 'btfss RXREG, n' make 16F628 USART RGREG as read?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. -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist |
|
|
Re: Will 'btfss RXREG, n' make 16F628 USART RGREG as read?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. -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist |
|
|
|
|
|
RE: Will 'btfss RXREG, n' make 16F628 USART RGREG as read?> -----Original Message----- > From: piclist-bounces@... [mailto:piclist-bounces@...] 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. ======================================================================= -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist |
|
|
RE: Will 'btfss RXREG, n' make 16F628 USART RGREG as read?> > -----Original Message-----
> > From: piclist-bounces@... [mailto:piclist-bounces@...] 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 -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist |
|
|
Re: Will 'btfss RXREG, n' make 16F628 USART RGREG as read?Olin Lathrop wrote:
> I'd be very surprised if a BTFSx wasn't considered reading the register. yep, definitely agreed! -- Ciao, Dario -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist |
| Free Forum Powered by Nabble | Forum Help |