The I/O pins of the ETH32 are grouped into what are called ports. There are four ports 8-bit ports (eight I/O lines per port) and two 1-bit ports. Please see the ETH32 user manual for further description of the ports and the pinout of the connectors.
Each digital I/O pin can be individually configured as an input or output pin. Each port has a direction register which controls which of its bits are inputs and which are outputs. Functions are provided that can read or write the entire 8-bit direction register of a port or alternatively one bit at a time. When a direction register for a port is modified, that setting remains in effect until either you change it again, you reset the device, or the device is powered off. At powerup or reset, all I/O pins are configured as inputs.
The input value of a port indicates the status (high or low) of each bit of the port. If a bit is in output mode, the input value is still available and will be the same as the output value (with the possible exception of the pin being shorted or loaded much more than it should be).
The output value of a port controls the output voltage of the port's pins when the pins are in output mode. The output value also has a second purpose. When the pins are in input mode, any 1-bit in the output value will enable a weak pullup resistor on that pin. A 0-bit will disable the pullup resistor. A function is also provided that can read back the output value from the ETH32 device, regardless of whether the pins are in input mode or output mode.
Task | C / C++ | .NET Languages | Visual Basic 6 |
---|---|---|---|
Write direction register | |||
Read direction register | |||
Write output value | |||
Read back output value | eth32_readback | Readback Method | Readback Method |
Read input value |