Measurement Studio offers two controls for handshaking and pattern I/O. Use the Measurement Studio Digital Input (CWDI) ActiveX control to perform buffered handshaking and pattern input operations, and the Measurement Studio Digital Output (CWDO) ActiveX control to perform buffered handshaking and pattern output operations.
||Begin by placing either the CWDI or CWDO control on the user interface form. Use the CWDI control for digital input operations and the CWDO control for digital output operations. Right click on the control and select Properties. This section explains how to use the property pages to configure the controls for handshaking and pattern I/O. The rest of this application note uses examples to demonstrate how to control digital data transfers programmatically.
Configuring Your Device and Digital Operation
Use the General property page to select a digital device, the ports for the data transfer, and the buffer size and duration (continuous or finite) of the data transfer, as shown in Figure 1. The configuration in Figure 1 sets a CWDI control to input a continuous buffer of data through ports 0 and 1 on a PCI-DIO-32HS board.
Note Make sure your device can perform buffered digital data transfers
Configuring Your Device and Operation
Use the Channel string property to specify the group (or list of ports) involved in the data transfer. In this example, the CWDI control is retrieving data from ports 0 and 1. You can specify multiple ports with a comma-delimited list.
Note: Search for ChannelString in the Measurement Studio Reference for information about which ports can be used for buffered digital I/O.
Continuous indicates that the data will be transferred in a buffer and Measurement Studio will continue reading or writing data until the Reset method is called or an error occurs.
The Number of patterns property specifies the number of patterns per port that are stored in the buffer. For two or more port operations, the buffer size is calculated as (Number of patterns)* (number of ports specified in Channel string). For example, if Number of patterns is 1000 and there are two ports, the buffer contains a total of 2000 patterns.
According to the configuration shown in Figure 1, as soon as the buffer contains the requested number of patterns, the AcquiredData event is generated and the whole buffer of data is returned to the event. Alternatively, you can use the Progress event with the CWDI or CWDO control to return an intermediate number of patterns that have been transferred from or written to the buffer.
When you are reading from two or more ports, keep in mind that data is interleaved by port. For example, if you want to process data from only one port in a two-port operation, extract one item, skip the next, extract the next, and so on.
If you are writing data to two or more ports, you must interleave the data by port. For example, imagine that you are generating 100 patterns of data for ports 0 and 1 in an array named Waveform. Waveform needs to be an array of 200 points. During the first update, Waveform(0) is written to port 0 and Waveform(1) is written to port 1. During the next update, Waveform(2) is written to port 0 and Waveform(3) is written to port 1, and so on.
Setting Handshaking Properties
Use the Handshaking property page to set the handshaking mode and properties for timing and behavior of the control lines. For example, Figure 2 sets handshaking properties for leading-edge handshaking with a 100 ns delay in the Acknowledge pulse.
Setting Handshaking Properties
Note: You don’t need to set any properties on this page if you are using pattern I/O.
The following list describes the handshaking properties you need to set on this property page:
- Signal mode specifies the handshaking protocol as Level, Edge, 8255 emulation, or burst mode. If you set signal mode to Edge, you must specify Edge mode and Acknowledge modify mode, as listed in the following table. Edge mode indicates whether the leading or trailing edge of the pulse on the control line will initiate data transfer.
Acknowledge modify mode
||Delay pulse or No modification
||Delay pulse or No modification
||Leading or Trailing
- With the Acknowledge modify mode property, you can delay the acknowledge pulse or change its duration. Set the delay time in Acknowledge pulse delay and the pulse duration in Acknowledge pulse duration. The delay occurs at different times depending on the protocol. Refer to Application Note 131, Digital I/O Applications, for information about the programmable delays for different protocols.
Note: To configure a long pulse protocol, select
Edge signal mode and specify the duration of the ACK signal.
If you want to set the acknowledge pulse delay or the acknowledge pulse duration programmatically, use the
AcknowledgeModifyAmount property, as in the following examples:
'Delay Acknowledge pulse by 100 ns
CWDI1.Handshake.AcknowledgeModifyMode = cwdioAckModeDelay
CWDI1.Handshake.AcknowledgeModifyAmount = cwdioAckAmt100ns
'Set the acknowledge pulse duration to 200 ns
CWDI1.Handshake.AcknowledgeModifyMode = cwdioAckModeDuration
CWDI1.Handshake.AcknowledgeModifyAmount = cwdioAckAmt200ns
- Acknowledge polarity and Request polarity specify the polarity of the Acknowledge and Request handshaking signals as either an active high signal or an active low signal. Refer to the documentation for your peripheral device to select a setting that is compatible with the device. The 8255 emulation protocol defines the polarities, so you can’t set or modify properties for 8255 emulation.
- Ack Req Exchange puts the ACK signal on the REQ pin and the REQ signal on the ACK pin to facilitate transfer between two NI 6533 devices. On one group, exchange the ACK and REQ lines so that ACK lines on each device can be connected together and the REQ lines on each device can be connected together.
- Clock Reverse changes the PCLK from its default setting for burst mode. The default setting of the PCLK is internal for burst mode input operations and external for burst mode output operations. You can programmatically set ClockReverse to True if your application requires an external PCLK for burst mode input operations or internal PCLK for burst mode output operations. For an external PCLK, connect a clock signal to the PCLK pin on the I/O connector. The following input example uses an internal PCLK frequency of 10 MHz:
CWDI1.Handshake.SignalMode = cwdioSignalBurst
CWDI1.Handshake.ClockReverse = False
CWDI1.Handshake.PCLKFrequency = cwdioPCLK_10MHz