GEX protocol documentation
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
gex-docs/UNIT_DO.md

57 lines
1.7 KiB

# Digital Output
- Direct output access to one or more pins of a port.
- All selected pins are written simultaneously.
6 years ago
- Supports generating output pulses of a precise length.
6 years ago
Pins are ordered in a descending order (DOWNTO) and described in a packed format,
e.g. if pins 1 and 4 are selected (`0b10010` on the port), the control word has
6 years ago
two bits `(4)(1)` and e.g. `0b10` means pin 4, `0b11` both. This makes accessing
the block of pins easier, e.g. when using them to drive a parallel bus. For single-pin units, the control word is always `1`.
## Commands
### WRITE (0)
Write a value to all defined pins.
6 years ago
*Request:*
- u16 - new value (packed)
### SET (1)
Set pins high
6 years ago
*Request:*
- u16 - pins to set high (packed)
### CLEAR (2)
Set pins low
6 years ago
*Request:*
- u16 - pins to set low (packed)
### TOGGLE (3)
Toggle selected pins (high - low)
6 years ago
*Request:*
- u16 - pins to toggle (packed)
### PULSE (4)
Send a pulse.
The start will be aligned to 1 us or 1 ms (based on pulse length) of the internal timebase to ensure the highest length precision. This alignment reduces jitter in the pulse duration. A jitter of the pulse start time is less significant, as there's already some unpredictable delay caused by the USB connection and the PC OS scheduler.
6 years ago
*Request:*
- u16 - pins to generate the pulse on (packed)
- u8 - pulse active level (0, 1)
- u8 - range (0 - milliseconds, 1 - microseconds)
- u16 - duration in the selected range
*NOTE:* The microsecond range supports durations only up to 999 us, higher
numbers will be divided by 1000 and use the millisecond range instead.
6 years ago
An ongoing pulse is stopped by any command affecting the pin.
## Events
*No events defined for this unit type.*