« Close

Datasheets and User Guides

App Notes

Software & Driver

 

3.2.1 - Streaming Digital Inputs, Timers, and Counters

There are special channel numbers that allow digital inputs, timers, and counters, 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 U6.

Table 3.2.1-1. Special Stream Channels

Channel #  
193 EIO_FIO
194 MIO_CIO
200 Timer0
201 Timer1
202 Timer2
203 Timer3
210 Counter0
211 Counter1
224 TC_Capture
230 Timer0 with reset
231 Timer1 with reset
232 Timer2 with reset
233 Timer3 with reset
240 Counter0 with reset
241 Counter1 with reset

Special Channels:

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.

194: Returns the input states of 16 bits of digital I/O. CIO is the lower 8 bits and MIO is the upper 8 bits.

200-203 and 210-211: Retrieves 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).

230-233 and 240-241: These channels perform the same operation as their 200-211 counterpart above, then reset the timer or counter.

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, timers, counter, or analog inputs, a channel 193 read will still be performed without error but the values from those bits should be ignored. The timers/counters (200-224) 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. There must always be at least 1 analog input in the stream scan list.

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 on the U6, 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.