2.1.3.3 General-purpose input/output
General-purpose input/output
The Commander core has a number of general-purpose inputs and outputs: configurable digital I/O, analog inputs and PWM outputs. There is a built-in function that will allow a joystick connected to the analog input to be used for control of the X and Y axes.
Joystick Control
The Commander core has 32 general-purpose configurable digital I/O available. The IO command can be used to access the current configurable I/O status. The value must be a 32-bit integer.
Configurable digital I/O can also be accessed one bit at a time using the IO[1-32] commands. Note that the indexes are 1-based for the bit references. For example, IO1 refers to bit 0, not bit 1.
In order to set a configurable digital I/O as an input or output, use the IOCFG command. If a bit in the 32-bit IOCFG value is set to 0, the corresponding configurable digital I/O will be defined as an input. If the bit is 1, the configurable digital I/O will be defined as an output.
The initial state of the configurable digital I/O can be defined by setting the 32-bit IOBOOT register to the desired initial configured output value. The IOBOOT value will only be applicable to configurable I/O defined as outputs by the IOCFG command. The IOBOOT value must be a 32-bit value. The value is stored to flash memory once the STORE command is issued. The settings take effect on the next power cycle.
The 2-bit IOP command can be used to toggle the polarity of the configurable I/O. See table IOP command below.
|
Bit |
Description |
Setting |
|
|
0 |
Logic of input setting |
0 - Negative logic Active Low |
1 - Positive logic Active High |
|
1 |
Logic of output setting |
0 - Negative logic Active Low |
1 - Positive logic Active High |
IOP command
The Commander core has two 10-bit analog inputs available. The AI[1-2] command can be used to read the current analog input value. The return value is in milliVolts and can range from 0 to 3300.
The voltage supplied to the analog inputs should stay within the 0V to 3.3V range.
|
ASCII |
|
|
Standalone |
AI[1-2] |
Joystick Control
Joystick control is available on the Commander core for the X and Y axis. When this mode is enabled, the pulse speed and direction outputs for the X and Y axes can be controlled by the corresponding analog input. See the Section 2.5.1 Joystick operation (Analog input control) for more information.
The Commander core has two pulse-width modulated (PWM) outputs available. The PWM outputs are 500Hz and can range from a 1% to 99% on-time duty cycle. The PWM[1-2] command is used to set the value, listed as a percentage, and can range from 1 to 99.
|
ASCII |
|
|
Standalone |
PWM[1-2] |
< Previous Section | Topic Home | Home | Next Section >