Ruben J=F6nsson wrote: > I mean that you could do it to verify that the outputs are as > expected ... You should understand the read-modify-write issue and ways to deal with it, but geesh folks, get some perspective. I've done somewhere around 100 PIC projects and have used shadow registers maybe two or three times. Yes, you should always be aware of the issue, but most of the time it's not a problem. PIC port pins are rated at 25mA and are implemented as FETs, so they look mostly like resistors to Vdd or Vss. Let's say a pin is allowed to droop 1.5V at 25mA (too lazy to look it up right now). That implies a resistance of 60 ohms. Let's add a little margin and say a PIC output pin looks like a Vdd or Vss voltage source with 100 ohms in series. Even with a large capacitive load of 1nF, that comes out to a time constant of only 100nS. Two time constants gets you safely within the guaranteed logic one or zero input levels. PIC 16 (others have LAT registers) usually max out at 20MHz oscillator, which means 5MHz instruction rate, which means 200nS instruction period. So unless you've got a really messed up external circuit, R-M-W only matters within one instruction. There is one Q cycle between the write of one instruction and the read of the next. That's only 50nS and could be a problem. Two instructions later (a single NOP between write and read for example) gives you 250nS, which is going to be fine the vast majority of the time. So yes, keep R-M-W in mind, but it's a small niche problem and not something you need to hit with a sledge hammer like "always use shadow registers" which I hear way too often. ******************************************************************** 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