Digital I/O

cancel
Showing results for 
Search instead for 
Did you mean: 

Need DIO (NI 9403) Example Code

CVI 2019, Win10. 

 

Can somebody send me some example code for a DIO card/module, in particular how to set bits or nibbles for different directions.  C language, DAQmx function calls please.  The only vaguely related information I have seen so far is old, like 2008, and I don't trust it.  (Talks about reserving a task)  I have not seen anywhere how to select bits or nibbles.

 

Is it true that for a DIO module such as the 32-ch 9403 one has to create both an input task and an output task, that one task to do reads and writes does not work?

 

I understand the function calls to create a task, set up the 32-bit path as a single channel for reads, and separately for writes, start the task, and how to read and write 32-bit UINTs to the device.

0 Kudos
Message 1 of 5
(1,332 Views)

Not a CVI guy, but used DAQmx a lot.

 

A digital line can be an output or an input but cannot be both. Channels/lines configured as output must go into a Digital Output task and similarly inputs to Digital Input task (yes, they are separate).

 

Next, no, you cannot write to an input task or read from an output task because the functionality is fixed during DAQmx task creation.

 

High Speed 655x and Digital Pattern 657x instruments have on the fly direction change ability at the cost of adding a digital output and input resource in the hardware design for every line.

Santhosh
Soliton Technologies

New to the forum? Please read community guidelines and how to ask smart questions

Only two ways to appreciate someone who spent their free time to reply/answer your question - give them Kudos or mark their reply as the answer/solution.

Finding it hard to source NI hardware? Try NI Trading Post
0 Kudos
Message 2 of 5
(1,321 Views)

Hi,

Open CVI,

Go to Help menu.

Go to find examples.

 

RaviShrigiri_0-1642963294720.png

 

There are various examples for analog and digital channels.

Alternatively on the bottom left side you can enter your hardware details and then do a specific search wrt your hardware controls.

 

Hope this helps.

 

Ravi

 

0 Kudos
Message 3 of 5
(1,297 Views)

Hi Ravi,

 

is there any examples for state change ?

 

Thanks,

Pavan

0 Kudos
Message 4 of 5
(1,264 Views)

Hi,

 

I think you meant state change of D I/O.

 

Do a search of digital read or digital write :

RaviShrigiri_0-1645526752548.png

Hope this helps.

 

Ravi

 

0 Kudos
Message 5 of 5
(1,238 Views)