At 05:43 10/23/2001 -0700, Allen Mahurin wrote: > > This type of code is not recommended... > > > > movwf PortB ; Now, display the > > new digit > > bsf PortB,0x07 ; Enable the first > > display > > call Delay1 ; Brief pause > > > > Try... > > > > movwf PortB ; Now, display the > > new digit > > goto $ + 1 ; equals 2 NOP's > > bsf PortB,0x07 ; Enable the first > > display > > call Delay1 ; Brief pause > >Why is it not recommended to BSF the PortB pin just >after writing to PortB? Granted, I'm new to all of >this, so I just don't understand the reasonnig for the >caution (haven't heard this before). Bit write instructions are so-called "read-modify-write" instructions: they read the port (or register), modify a bit, write it back. If you do this immediately after a port write to the same port (or another bit write instruction), the ports may not yet be at their final voltage (capacities etc.) This could result in modifying a port that you just changed in the write operation and didn't intend to change in the bit operation, because the "read" part of the "read-modify-write" does not yet read what has just been written, but instead the value before the write -- and the "write" part then writes this value back instead of the intended one. This has been discussed quite a bit, you surely can find lengthy threads about this on the PIClist, and probably an app note or two, too. ge -- http://www.piclist.com hint: To leave the PICList mailto:piclist-unsubscribe-request@mitvma.mit.edu