« Close

Datasheets and User Guides

App Notes

Software & Driver

 

3.2.2 - Streaming Digital Inputs, Timers, and Counter0

There are special channel numbers that allow digital inputs, timers, and Counter0, to be streamed in with analog input data. Note that you must always have at least 1 AIN channel in the stream list for the UE9.

Table 3.2.2-1. Special Stream Channels

Channel#  
193 EIO_FIO
194 MIO_CIO
200 Timer0
201 Timer1
202 Timer2
203 Timer3
204 Timer4
205 Timer5
210 Counter0
224 TC_Capture

Channel number 193 returns the input states of 16 bits of digital I/O. FIO is the lower 8 bits and EIO is the upper 8 bits. This channel is generally used to acquire digital input data in stream mode. Channel 194 is the same thing for the CIO and MIO lines (Control firmware V1.69 or higher). The CIO are in the lower byte and the MIO are in the upper byte.

Channels 200-205 and 210 retrieve the least significant word (LSW, lower 2 bytes) of the specified timer/counter. At the same time that any one of these is sampled, the most significant word (MSW, upper 2 bytes) of that particular timer/counter is stored in an internal capture register (TC_Capture), so that the proper value can be sampled later in the scan. For any timer/counter where the MSW is wanted, channel number 224 must be sampled after that channel and before any other timer/counter channel. For example, a scan list of {200,224,201,224} would get the LSW of Timer0, the MSW of Timer0, the LSW of Timer1, and the MSW of Timer1. A scan list of {200,201,224} would get the LSW of Timer0, the LSW of Timer1, and the MSW of Timer1 (MSW of Timer0 is lost).

Adding these special channels to the stream scan list does not configure those inputs. If any of the FIO or EIO lines have been configured as outputs, they will need to be reconfigured as inputs to provide proper reads. The timers/counters must be configured before streaming using normal timer/counter configuration commands.

The timing for these special channels is the same as for normal analog channels. For instance, a stream of the scan list {0,1,200,224,201,224} counts as 6 channels, and the maximum scan rate is determined by taking the maximum sample rate at the specified resolution and dividing by 6.

It is not recommended to stream timers configured in mode 2 or 3 (32-bit period measurement). It is possible for the LSW to roll, but the MSW be captured before it is incremented. That means that only the LSW is reliable, and thus you might as well just use the 16-bit modes.

Mode 11, the upper 32 bits of the system timer, is not available for stream reads. Note that when streaming with the internal scan trigger, the timing is known anyway (elapsed time = scan rate * scan number) and it does not make sense to stream the system timer modes 10 or 11. With external triggering, there might be reasons to stream the available timer mode 10.