Introduction
This manual acts as a reference for the Digital Integration Features available on our various PCI Express Digital I/O products (and related cards!) .
It should be used as an adjunct to the standard product reference manual (.pdf) available on the product webpage or in the software install package.
The Digital Integration Features add advanced capabilities to the input and output bits of these Digital I/O products. Pulse Train Generation (including PWM), Pulse Width Measurement (including PWM/duty-cycle), Edge detection IRQs, and Edge-detection Counter with overflow IRQs are available on all applicable models.
In addition, all of these models provide their I/O registers in both the original "I/O Mapped" and new, faster, "Memory Mapped" modes.
Feature Description
Input Features
Advanced Change-of-State Detection IRQs
- 8 bits of individually enabled, edge-selectable, change-of-state detection latches and IRQs
Selectable-edge Counting with Overflow IRQ
- 8 individually enabled, edge-selectable 16-bit (0-65535) edge-transition counters
- Optional IRQ if 16-bit counter overflows
High- and Low-side Pulse Width Measurement
- 8 16-bit pulse duration counters for High- and Low-side pulse width measurement
- 8ns maximum measurement resolution, software divisible by a 32-bit global scalar
PWM Duty Cycle and Frequency Measurement
- Combine High- and Low-side pulse width measurements to determine waveform duty cycle and frequency
Output Features
Pulse Generation
- Generate a high- or low-going pulse with selectable active and inactive durations
- Supports individual or simultaneous pulse generation start
- 8ns per side max resolution, software divisible by a 32-bit global scalar
Pulse Train Generation
- Generate up to 65535 consecutive high- or low-going pulses via a per-output 16-bit counter
PWM and Frequency Generation
- Generate a continuous stream of pulses until stopped.
Note: | Not all models will support all of the above features, nor will all models meet the stated specifications. For example, trying to generate a 62.5MHz square wave using an electromechanical relay output is not going to work (what with relay activation times best measured in microseconds) — nor is it possible to generate output pulses if your model has no outputs. |
How To Use This Reference
First, read the entirety of this introduction.
Next, read the source code of one of our sample programs and refer to this document for the description of each register used, if needed.
Registers
Overview
PCI and PCI Express (and related) busses are Plug-and-Play, and use a standardized way of requesting resources like register space, IRQs, and DMA channels.
In older designs theses models request two "Base Address Registers" ("BAR"s): BAR[0] is for PEX8311 and PLX9052 compatibility and/or DMA-related registers, and BAR[2] is where all the DAQ-specific (Digital I/O interface) registers and IRQ features resided. Both of these BARs were requested in "I/O space" (aka "Port Memory") accessed via the Intel ASM In and Out instructions. The I/O instructions are inherently slow, designed in the era of the 4.7MHz ISA bus
The new Digital Integration Features versions of these models also requests a 3rd BAR, BAR[1], which contains a copy of the vast majority of the features available in the legacy BAR[2], as well as the new Digital Integration Features' registers, all implemented in "MEM address space" — accessed using pointers these registers can be accessed often as much as 10× faster than the legacy BAR[2] I/O registers.
The new Digital Integration Features consume four 32-bit registers for global control, plus 6 additional registers per-bit to control individual bits' advanced features — all of which are only available in the new, memory-mapped, BAR[1].
Register Map
In addition to the registers defined in each model's product manuals the following registers are available for using the Digital Integration Features (not all models support all registers).
Offset Hexadecimal | Name | Access Width1 | Description |
---|---|---|---|
+2C | PTG/PTM Clock Divisor | DW | Pulse Train Generation and Measurement features (including PWM I/O) operate in units of "ticks"; this 32-bit value divides the 125MHz base clock (8ns "ticks") down to slower speeds for more flexible pulse measurement and generation |
+30 | CoS IRQ Enables | DW/W/B | Copies of the per-bit Bits for enabling IRQ generation on detection of Falling- or Rising-edge input transitions ("Change of State" aka "CoS"), so you can read them simultaneously via a single read |
+40 | IRQ / Event: Status / Clear | DW/W/B | Copies of the per-bit Bits that indicate if a Rising- or Falling-edge CoS IRQ was generated, and the bits to clear latched IRQ bits, so you can access them simultaneously via a single read or write |
+50 | PTG Start / Status | DW/W/B | Copies of the per-bit Pulse Train (PWM) Generation "Go" bits, allowing multiple bits to have PWM or Pulse Trains started simultaneously |
+FC | Resets | B | Reset bits to return the configuration to the power-on defaults | Note: | 1 "Access Width" indicates if the register can be read or written using 32-bit ("DW"), 16-bit ("W"), or 8-bit ("B") accessess |
Per-bit registers are located at "Bit Offsets" starting at (BitIndex+1) × 100 (hexadecimal). For example, Bit 2's per-bit registers are located at (2 + 1) × 0x100 + Offset = +0x300 + Offset. Ex: Bit 12's per-bit registers' Bit Offset is (0x0C +1) × 0x100 = +0xD00. | |||
---|---|---|---|
Bit Offset + Offset Hexadecimal | Name | Access Width1 | Description |
+00 | CoS IRQ Enable and Status / Clear | DW/W/B | CoS Edge Detection IRQ Enable, Status, and Clear bits |
+04 | Event Configuration, Threshold Overflow Status / Clear | DW/W/B | Event Edge selection, and Event Counter-Overflow IRQ Enable, Status, and Clear bits |
+08 | Event Counter / PTG Count | DW/W/B | Event Detection Counter for Inputs. Pulses-to-generate Counter for Outputs. 16-bit value. Set PWM bit at BitOffset + 10 to generate pulses until stopped |
+10 | PTG Control / Status | DW/W/B | Pulse Train Generation starting level, finite-or-infinite (PWM) pulses generated, and "GO"/Status bit |
+20 | Pulse LOW Period | DW/W/B | 16-bit value. Pulse Width of measured Low-Side pulse for inputs. Low-Side Pulse Width to generate for outputs. |
+24 | Pulse HIGH Period | DW/W/B | 16-bit value. Pulse Width of measured High-Side pulse for inputs. High-Side Pulse Width to generate for outputs. | Note: | 1 "Access Width" indicates if the register can be read or written using 32-bit ("DW"), 16-bit ("W"), or 8-bit ("B") accessess |
Register Details
Global Digital Integration Feature Registers
Bit | 31-16 | 15 | 14 | 13 | 12 | 11 | 10 | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Use | unused | enFE7 | enFE6 | enFE5 | enFE4 | enFE3 | enFE2 | enFE1 | enFE0 | enRE7 | enRE6 | enRE5 | enRE4 | enRE3 | enRE2 | enRE1 | enRE0 | enFE[7:0] are IRQ enable bits for Falling-Edge CoS IRQs. enRE[7:0] are enables for Rising-Edge CoS IRQs |
Set bits to enable the corresponding IRQ. Clear bits to disable that IRQ. Read to see what CoS IRQs you currently have enabled.
Bit | 31-16 | 15 | 14 | 13 | 12 | 11 | 10 | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Use | unused | scFE7 | scFE6 | scFE5 | scFE4 | scFE3 | scFE2 | scFE1 | scFE0 | scRE7 | scRE6 | scRE5 | scRE4 | scRE3 | scRE2 | scRE1 | scRE0 | scFE[7:0] are IRQ Status and Clear bits for Falling-Edge CoS IRQs. scRE[7:0] are Status and Clear bits for Rising-Edge CoS IRQs. |
Read to see what IRQ types have been latched. Write a 1 to latched bits to clear the latch for that bit. Typically you would read this register and write the value read back to the register to clear all detected IRQ latches
Bit | 31-16 | 15 | 14 | 13 | 12 | 11 | 10 | 9 | 8 | 7-0 |
---|---|---|---|---|---|---|---|---|---|---|
Use | unused | PTG7 | PTG6 | PTG5 | PTG4 | PTG3 | PTG2 | PTG1 | PTG0 | unused |
Set PTG[7:0] to start the Pulse Generation on the corresponding bit(s). In PWM mode Clear the bit to halt PWM generation. In non-PWM the bit is auto-cleared when the Pulse Train Generation Counter (at + Bit Offset + 10) reaches 0. Read to see which PTG/PWM bits are currently outputting pulse trains/PWMs.
Bit | 31-3 | 2 | 1 | 0 |
---|---|---|---|---|
Use | unused | GRST | GRSTC | unused |
Per-Bit Digital Integration Feature Registers
Bit | 31-6 | 5 | 4 | 3 | 2 | 1 | 0 |
---|---|---|---|---|---|---|---|
Use | unused | scFE[n] | scRE[n] | unused | unused | enFE[n] | enRE[n] |
scFEn is the IRQ Status and Clear bit for Falling-Edge CoS IRQs. scREn is the Status and Clear bit for Rising-Edge CoS IRQs. | |||||||
enFEn is the IRQ Enable bit for Falling-Edge CoS IRQs. enREn is the IRQ Enable bit for Rising-Edge IRQs | |||||||
These bits are also available at (Global) +30 and +40 (hexadecimal) |
Read scFEn and scREn to see what IRQ types have been latched. Write a 1 to latched bits to clear the latch for that bit. Set enFEn or enREn to enable Falling- or Rising-Edge IRQs for bit n. Read these bits to see if either is enabled. Typically you would read this register and write the value read back to the register to clear the detected IRQ latch(es) while leaving the enabled IRQ sources enabled.
Bit | 31-7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
---|---|---|---|---|---|---|---|---|
Use | unused | scOverflow[n] | unused | enOverflow[n] | unused | unused | enFalling[n] | enRising[n] |
scOverflown is the IRQ Status and Clear bit for Event Counter Overflow IRQs. | ||||||||
enOverflown is the Enable bit for Event Counter Overflow IRQs. | ||||||||
enFallingn enables the Event Counter to count Falling-edge transitions. | ||||||||
enRisingn enables the Event Counter to count Rising-edge transitions. |
Read scOverflown to see if an Event Counter Overflow IRQ types has been latched. Write a 1 to clear the latch. Set enFallingn or enRisingn to enable Falling- or Rising-Edge Event Counting for bit n. Read these bits to see if either is enabled. Typically you would read this register and write the value read back to the register to clear the detected IRQ while leaving the Event enable and sources intact.
16-bit Count of enabled and detected Events for input bits, 16-bit number of pulses to generate for output bits (that are not set to PWM mode)
Bit | 31-3 | 2 | 1 | 0 |
---|---|---|---|---|
Use | unused | Rising[n] | PWM[n] | GO[n] |
Risingn: Set to cause generated Pulses Trains / PWMs to start with a high-level; clear to start with a low-level. Note: Setting or Clearing this bit causes the output bit to immediately change to the "inactive" state
PWMn: Set to engage PWM mode, wherein the Pulses are generated until stopped, instead of only generating the PTG Count entered at +BitOffset+8
GOn: Set to start PTG/PWM Generation. In PWM mode you can clear GOn to halt the PWM. Read this bit to determine if PTG/PWM Generation is active on bit n
16-bit value. For input bits read to determine the detected low-side pulse width. For outputs write the desired low-side pulse width. In either case the value is measured in number of PTG/PWM ticks. If +2C is configured for ÷1 (the default) this means you multiply the number by 8ns to determine the low-side pulse width in ns. If +2C was configured with a divisor of 125000 then you'd multiply this register value by 1ms to determine the low-side pulse width.
16-bit value. For input bits read to determine the detected high-side pulse width. For outputs write the desired high-side pulse width. In either case the value is measured in number of PTG/PWM ticks. If +2C ("PTG/PWM Clock Divisor") is configured for ÷1 (the default) this means you multiply the number by 8ns to determine the high-side pulse width in ns. If +2C was configured with a divisor of 125000 then you'd multiply this register value by 1ms to determine the high-side pulse width.
Example algorithms
Outputs
Generate n high-going Pulses
Generate PWM with 25% Duty Cycle
Card-specific differences
Overview
Not all cards are created equal. As a result some products won't have all these features available. For example, the M.2-II-4 has only four input bits and zero output bits: you cannot generate pulse trains or PWMs, and only 4 out of the 8 input bits are enabled.