Free chat pic exchange magick dating

(Writing that bit to the PORTx register may to do the right thing: that pin will -- eventually -- go high or low as commanded.But there are many cases -- such as when some other pin on that port is connected to an open-collector bus -- that writing to one bit of the the PORTx register will mess up the state of the other pins on that port, leading to difficult-to-debug problems).

Free chat pic exchange-75Free chat pic exchange-74Free chat pic exchange-12

See picture below in green: And when you read from PORTx, you're reading the actual I/O pin value.

See below in blue: PIC uses read-modify-write to write operations and this can be a problem, so they use this shadow register to avoid it.

There are a few situations where they can be different.

If you set the latch high, the latch will read high, but the port will read low because the voltage on the pin is still approximately ground.

This issue has vanished as soon as I was writing on LATx.