bigdogguru
Administrator
- Joined
- Mar 12, 2010
- Messages
- 9,821
- Helped
- 2,350
- Reputation
- 4,694
- Reaction score
- 2,272
- Trophy points
- 1,413
- Location
- Southwest, USA
- Activity points
- 62,394
yes a bit clearer now.. I will just use PORTB instead in my future I/O programs...
A better plan would be to read from PORTB when you are sensing a change on the lines due to some attached device and to read from LATB when you are using the previously written value to LATB in some calculation, for example when you are walking a lit LED back and forth from pin 0 to pin 7 using a logical shift right then left on the previous value of LATB to obtain the next value in the sequence.
By the way this is also an example of why you would use a shadow register, to hold the previous value in stable storage and not relying on the pins of a PORT to act as storage and be unknowing altered by an external event.
Ciao