= Motenc Driver [[cha:montec-driver]] (((Motenc Driver))) //// ATTENTION TRANSLATORS before translating this document copy the base document into this copy to get the latest version. Untranslated documents are not kept up to date with the English documents. Do not translate anchors or links, translate only the text of a link after the comma. Anchor [[anchor-name]] Link <> Make sure the documents build after translating. //// Vital Systems Motenc-100 and Motenc-LITE The Vital Systems Motenc-100 and Motenc-LITE are 8- and 4-channel servo control boards. The Motenc-100 provides 8 quadrature encoder counters, 8 analog inputs, 8 analog outputs, 64 (68?) digital inputs, and 32 digital outputs. The Motenc-LITE has only 4 encoder counters, 32 digital inputs and 16 digital outputs, but it still has 8 analog inputs and 8 analog outputs. The driver automatically identifies the installed board and exports the appropriate HAL objects. Installing: ---- loadrt hal_motenc ---- During loading (or attempted loading) the driver prints some useful debugging messages to the kernel log, which can be viewed with dmesg. Up to 4 boards may be used in one system. == Pins In the following pins, parameters, and functions, is the board ID. According to the naming conventions the first board should always have an ID of zero. However this driver sets the ID based on a pair of jumpers on the board, so it may be non-zero even if there is only one board. * '(s32) motenc..enc--count' - Encoder position, in counts. * '(float) motenc..enc--position' - Encoder position, in user units. * '(bit) motenc..enc--index' - Current status of index pulse input. * '(bit) motenc..enc--idx-latch' - Driver sets this pin true when it latches an index pulse (enabled by latch-index). Cleared by clearing latch-index. * '(bit) motenc..enc--latch-index' - If this pin is true, the driver will reset the counter on the next index pulse. * '(bit) motenc..enc--reset-count' - If this pin is true, the counter will immediately be reset to zero, and the pin will be cleared. * '(float) motenc..dac--value' - Analog output value for DAC (in user units, see -gain and -offset) * '(float) motenc..adc--value' - Analog input value read by ADC (in user units, see -gain and -offset) * '(bit) motenc..in-' - State of digital input pin, see canonical digital input. * '(bit) motenc..in--not' - Inverted state of digital input pin, see canonical digital input. * '(bit) motenc..out-' - Value to be written to digital output, seen canonical digital output. * '(bit) motenc..estop-in' - Dedicated estop input, more details needed. * '(bit) motenc..estop-in-not' - Inverted state of dedicated estop input. * '(bit) motenc..watchdog-reset' - Bidirectional, - Set TRUE to reset watchdog once, is automatically cleared. == Parameters * '(float) motenc..enc--scale' - The number of counts / user unit (to convert from counts to units). * '(float) motenc..dac--offset' - Sets the DAC offset. * '(float) motenc..dac--gain' - Sets the DAC gain (scaling). * '(float) motenc..adc--offset' - Sets the ADC offset. * '(float) motenc..adc--gain' - Sets the ADC gain (scaling). * '(bit) motenc..out--invert' - Inverts a digital output, see canonical digital output. * '(u32) motenc..watchdog-control' - Configures the watchdog. The value may be a bitwise OR of the following values: [width="90%", options="header", cols="2*^1,^6"] |======================================== |Bit # | Value | Meaning |0 | 1 | Timeout is 16ms if set, 8ms if unset |1 | 2 | |2 | 4 | Watchdog is enabled |3 | 8 | |4 | 16 | Watchdog is automatically reset by DAC writes (the HAL dac-write function) |======================================== Typically, the useful values are 0 (watchdog disabled) or 20 (8ms watchdog enabled, cleared by dac-write). * '(u32) motenc..led-view' - Maps some of the I/O to onboard LEDs. == Functions * '(funct) motenc..encoder-read' - Reads all encoder counters. * '(funct) motenc..adc-read' - Reads the analog-to-digital converters. * '(funct) motenc..digital-in-read' - Reads digital inputs. * '(funct) motenc..dac-write' - Writes the voltages to the DACs. * '(funct) motenc..digital-out-write' - Writes digital outputs. * '(funct) motenc..misc-update' - Updates misc stuff.