> >Carey Fisher - NCS > >> If you always read from PORTx and always write to LATx, you >won't get >> bit by the Read-Modify-Write situation. Right? > >Well, yes, but note that some instructions >both reads and write to the same FSR in the same >instruction, like BCF/BSF. If you concider those >as "write-only" instructions, then yes. :-) >-----Original Message----- >From: Jan-Erik Soderholm [mailto:jan-erik.soderholm@TELIA.COM] >Sent: 12 March 2004 08:12 >To: PICLIST@MITVMA.MIT.EDU >Subject: Re: [PIC:] My first program, 18F452, please critique > > >And, you still might have the case of capacitive loading >on (output) pins that makes the READ from PORTx reading >the wrong state (that is, not what's in LATx). If you >have this rece condition, you might still need the >shadow register to hold a "copy" of your output status. The only time I could imagine wanting to do this is perhaps in some kind of safety critical code where you need to confirm the pin is actually set the same as the ouput latch, in which case reading the port a suitable time after setting the LATx register would be the only real way to achieve this. 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. ======================================================================= Any questions about Bookham's E-Mail service should be directed to postmaster@bookham.com. -- http://www.piclist.com hint: PICList Posts must start with ONE topic: [PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads