LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

How do I write out a single digital bit in LabWindows/CVI 7.0?

I am simply trying to toggle a pin on my application using Labwindows. This seems like it shouldn't be difficult, but I'm having trouble. The only functions I can find that are related seem to give errors like "argument too small". Can anyone provide some insight?

I am using LabWindows V7.0 and an E-series DAQ card (PCI-MIO-16XE-10).

Thanks!
0 Kudos
Message 1 of 3
(3,366 Views)
Hello Irwin,

Let�s make sure I fully understand what you are trying to do. You want to toggle a single digital line on your DAQ card, from either high to low or low to high, without affecting any of the other digital lines?

If I understand your issue correctly, the simplest way to do it is to use the �WriteToDigitalLine� function. As parameters it takes the device, port, line, and high or low value you want to write. I�ve attached a simple program I wrote to test this function.

You can also use the �WriteToDigitalPort� function to write multiple bits to multiple lines. There are many ways of doing this, however, depending on what you are trying to do. An excellent example is �WriteDigPort.prj� found in the NI Example Finder.

If non
e of these suggestions help, or if I�m not fully understanding your issue, please post the applicable portions of your code, and any other information that may help, and I�ll be happy to look further into it.

Have a nice day!

Robert M
Applications Engineer
National Instruments
Robert Mortensen
Software Engineer
National Instruments
Download All
0 Kudos
Message 2 of 3
(3,366 Views)
Robert,

Thanks for your response. Yes, you understand correctly what I'm trying to do. The WriteToDigitalLine function seems fantastic, except that it doesn't seem to play well with my other functions. When I try to read other lines later, I get an error ("...Requested operation could not be performed because the specified digital lines are either reserved or the device is not present in NI-DAQmx...Status Code: -200587") The problem seems to be related to the fact that the WriteToDigitalLine function doesn't specify a Task Handle, so it is impossible to stop it DAQmxStopTask or DAQmxClearTask. Is this the case?

However, I have discovered that I am able to use the function DAQmxWriteDigitalU8. At first I didn't think that this would work because it w
as writing to all of my digital lines, but then I realized it can be configured for only one line (such as "Dev1/port0/line1") and this seems to be working.

Irwin
0 Kudos
Message 3 of 3
(3,366 Views)