cancel
Showing results for 
Search instead for 
Did you mean: 

Methods for reading & writing to a port

brian4
Associate II
Posted on March 26, 2003 at 08:36

Methods for reading & writing to a port

2 REPLIES 2
brian4
Associate II
Posted on March 25, 2003 at 04:49

Page 44 of the ST72324J states that BSET & BRES should not be used to read and write to ports.

What is the best method to set an output or read the state of an input pin.

I can find an application note for ST6 port reading/writing but nothing on the ST7.
poo
Associate II
Posted on March 26, 2003 at 08:36

This refers specifically to mixed ports, ie Input and Output on the same port. If the port is all output then you can use the Bit Set and Reset commands with no problems. If however you have mixed ports, the suggested method is to use a shadow register, do the bit manipulation on that then write it to the port data register. Don't worry about overwriting any data on any port bits set to input as the port settings will cause these to be ignored in the data register.