From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Digital I/O

cancel
Showing results for 
Search instead for 
Did you mean: 

USB-6289 Setting Digital output signals

Solved!
Go to solution

I am using a USB-6289. I am writing a CVI application which uses this device. I need to set the Digital I/O pins as outputs. In the CVI application I know that I can create these tasks with Tools->Create/Edit DAQmx Tasks. It created this:

 

int32 CreateDAQTaskInProject(TaskHandle *taskOut1)
{
 int32 DAQmxError = DAQmxSuccess;
    TaskHandle taskOut;

 DAQmxErrChk(DAQmxCreateTask("DAQTaskInProject", &taskOut));

 DAQmxErrChk(DAQmxCreateDOChan(taskOut, "USB-6289/port0",
  "DigitalOut", DAQmx_Val_ChanForAllLines));
 DAQmxErrChk(DAQmxSetChanAttribute(taskOut, "DigitalOut", DAQmx_DO_InvertLines, 0));

    *taskOut1 = taskOut;

Error:
 return DAQmxError;
}

 

 

So this sets it up but doesn't write the data out. My question is what is the command to write the data out?

 

Also I was wondering if there any example source code which shows how these commands are done? Is there a way to configure the bits individually? I only need to use 5 of these pins as outputs so t would be coll if I could write to only bits D0-D4.

 

Are there any documents written on these commands and how they are used?

 

 

thanks in advance

 

0 Kudos
Message 1 of 2
(2,936 Views)
Solution
Accepted by topic author DPearce

A DAQmxWrite writes the data.

 

Go to Help>Find Examples>Hardware Input and Output>DAQmx>Digital Generation.

 

If you specify lines instead of a port, you can use however many bits as you want.

 

First look at the CVI help.

0 Kudos
Message 2 of 2
(2,922 Views)