Table of Contents
The Cortex has 12 Digital Ports, with 11 interrupts shared between them (Ports 4 and 10 share an interrupt). Digital Ports can be used either as inputs or outputs. Digital Ports have two states: High and Low.
Usage as an input
If the internal output driver is placed in a high impedance state, then whatever is connected to the pin will determine its current value. Voltages near the I/O voltage (3.3V) will cause a logic “1”, and voltages near 0 V will cause a logic “0”. The high or low value can be read in software, using a function like “digitalRead()”.
The VEX Digital Ports are 5V tolerant, so their input range may range from 0V to 5V.
Unused input pins may cause increased power consumption if the input voltage floats about halfway in between the low and high states, along with spurious value changes. To avoid erratic behavior, the Cortex has a weak pull-up resistor in processor to cause the Digital ports to float high by default.
Digital ports can be configured in three different ways on the Cortex, either as floating inputs (both pull-up and pull-down resistors disabled), an input with the weak pull-up resistor enabled, and an input with the weak pull-down resistor enabled. The default configuration for the digital ports varies depending on the programming language used.
EasyC leaves all digital ports as floating until configured by the user program. RobotC and PROS configure all digital ports as inputs with the pull-up resistor until configured by the user program. As a result, an unplugged digital port will read as HIGH.
Configuring the digital ports as inputs with the pull-up resistor enabled results in ~1V visible to the sensors plugged in, which is what causes pneumatics to fire randomly when the Cortex boots up. More information about that in particular can be found here
Usage as an output
Each GPIO pin also features an output driver, which can set the pin to either a high or low value in software using a function like “digitalWrite()”. A logic “1” is represented by a voltage close to the I/O voltage of the microcontroller, while a logic “0” is near 0 V.
The Cortex can output a 2V high into 2k-ohms to ground or a 0.8V low into 7k-ohms to 3.3v.
The actual values of these voltages may vary depending on what type of load is connected to the microcontroller. Pins with high output drive are affected less by the power draw of the connected device. For this reason, devices driven directly by GPIOs should have short wires and low power requirements.