Academic Company Events NI Developer Zone Support Solutions Products & Services Contact NI MyNI

Document Type: Example Program
NI Supported: Yes
Publish Date: Sep 6, 2006


Feedback


Yes No

Related Categories

Related Links - Developer Zone

Related Links - Products and Services

DI SingleBuffered ExternalTrigger Synchronized with DO.

2 ratings | 1.00 out of 5
Print

Downloads

Filename: dipatternsynchwithdo.zip
Requirements: View

This program outputs a pattern from a buffer to port 0 and simultaneously reads a pattern back on port 2. The most significant bit of the output port is wired to the ACK line of the input port and is used as a Start Trigger. Therefore, the first write of the output port must be the binary value "1xxxxxx". Port 0 outputs on the rising edge of the internal clock. This signal is avaibable on REQ1 and should be wired to REQ2. Port 2 uses this signal as an external clock and begins to input data on the falling edge.

Notice that input port begins to input data on the second falling edge of the clock. It ignores the first one. Therefore, if you wire directly from the output port to the input port to test it, you must do some data manipulation to align the values in the buffer.

In this program piBuffer is used as the output buffer, and piBuffer2 is used as the input buffer. The least significant byte of piBuffer(0) is used as the trigger. The most significant byte of piBuffer(0) will be read into the least significant byte of piBuffer2(0). Then, the least significant byte of piBuffer(1) will be read into the most significant byte of piBuffer(0). This process continues until the input port has read all the values specified by UlCounts2.

Be sure to output one more 16-bit value than you input, since the input port ignores the first byte. If you don't, the input port will wait for one more rising edge of the clock that it will never receive. Because the group size is 1, make ulCount 2 larger than ulCount2 (the 32HS only does 16-bit transfers).

EXAMPLES OF TASK TYPES:
BUF, NCH, HANDSHK, EXTTRIG, ASYNC

LIST OF KEY PARAMETERS:
iGroup, iGroupSize, iDir, iStartTrigON, ulCount, iResource, ulAlignIndex, ulRemaining

NOTE:
Since variables are hardcoded, there is no guarantee that this program will work for your configuration. This example is simply presented as a code snippet of how you can use NI-DAQ functions to perform a task.

LIST OF NI-DAQ FUNCTIONS USED IN THIS EXAMPLE:
DIG_Grp_Config, NIDAQErrorHandler, DIG_Block_PG_Config,
DIG_Trigger_Config, Align_DMA_Buffer, DIG_Block_In,
DIG_Block_Check, NIDAQYield, DIG_Block_Clear, DIG_Grp_Mode
NOTE: For further details on each NI-DAQ function, refer to the NI-DAQ Online Help (NIDAQPC.HLP).

I/O CONNECTIONS:
Connect your digital input signals to port 2. Connect the ground reference to the digital ground pin. Connect DIOA7 to ACK2. Connect REQ1 to REQ2. Refer to the hardware user manual for more I/O connection details.

For more information about how to run this example, refer to the NI-DAQ Examples Online Help (NIDAQEx.HLP).

Requirements


Filename: dipatternsynchwithdo.zip

Software Requirements


Language(s): Visual Basic .NET
Additional Software: Visual Basic 6.0

Hardware Requirements


Hardware Group: Digital I/O (DIO)
Driver: Traditional NI-DAQ (Legacy) 6.9.0

 
2 ratings | 1.00 out of 5
Print

Reader Comments | Submit a comment »

 

Legal
This example program (this "program") was developed by a National Instruments ("NI") Applications Engineer. Although technical support of this program may be made available by National Instruments, this program may not be completely tested and verified, and NI does not guarantee its quality in any way or that NI will continue to support this program with each new revision of related products and drivers. THIS EXAMPLE PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND AND SUBJECT TO CERTAIN RESTRICTIONS AS MORE SPECIFICALLY SET FORTH IN NI.COM'S TERMS OF USE (http://ni.com/legal/termsofuse/unitedstates/us/).