I am trying to play around with NI 9474 to learn how digital outputs work with labview. However, I cannot even get the basic part down. I have a 9v battery hooked up to the device, and have a resistor element hooked up to one of the output terminals of the device. So, I am just trying to get labview to output a digital output.
However, I am getting some error when I try to run the labview program. I tried searching my error on the knowledge base but was unable to find it. So, if anyone would help me on figuring out how digital output hardware works with labview, it would be great!
I have attached my block diagram!
Solved! Go to Solution.
Like the error says you need to configure a buffer for the data because your device doesn't support non-buffered hardware-timed tasks. How is your DAQ Assistant node configured?
You didn't attach your block diagram, you just sent a screenshot, so we have no way of knowing how the assistant was configured. In order to attach your code either upload the VI itself, or send a VI Snippet like this:
Slect the code on the block diagram, then go to Edit > Create VI Snippet from Selection. The latter is the easiest way to share simple code on the forums.
What data are you writing? There's nothing written to the data input in the VI you sent.
Here's a short article about that error with a USB DAQ. It seems to be related to not writing to the buffer before starting the task. I'm not sure how this works with the DAQ assistant, but this may be caused if you don't have an array of booleans written to the "data" input.
So I have a resistor connected to the output of the device. I am simply trying to turn on the digital output of the device so the resistor will have some voltage across it.
I am not trying to write any data. I am simply experimenting how DAQ works with labview and so I am just trying something out. So, I am not sure as to how digital outputs work with labview. I thought all you would need to do is to tell labview when to turn on the digital outputs and it would work?
Oh ok, so DAQmx works by reading and writing values from DAQ devices. Since you're trying to set digital output values on a device you need to "write" the values to that device's channels from LabVIEW. With digital inputs and outputs, LabVIEW understands the values in the form of booleans (on or off = True or False). You need to write a True boolean to your DAQ Assistant data input to turn on a specific channel.
To get familiar with how DAQmx works, I would actually suggest you use MAX (Measurement and Automation Explorer) which installs with LabVIEW. With that you can use the Test Panels to read and write from connected devices. This will help you get familiar with read and writing from devices.
Ah so all I need to do is wire a boolean value or a numeric constant to the data port. It makes sense, I am just new to labview and am trying to experiment with it!
Thank you for your help!
Hey, I am still having trouble. I cannot wire a true boolean constant to the data terminal of daq assistant. It says invalid data type, because the data type for daq assistant is array waveform.
Insert a Build Array node in to that wire. It probably requires an array of data, but you only need a single value, so you need to input an array of just a single element.
Scratch that, it looks like you have your DAQ Assistant set to Continuous mode, which means it's going to try to write a whole waveform with a set sample rate, etc. I don't think you want this if you're just trying to set On or Off. Instead, double-click your DAQ Assistant and set to 1 Sample (On Demand) and it will then take in a boolean array. The array is becuase you might want to write to multiple digital channels, but in your case it's just the one, so it'll be an arraywith one element.