LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to generate and read current signals using DAQ modules

Solved!
Go to solution

Hello,

I am very new to NI modules and LabVIEW and currently struggling on a fairly simple problem.

Before I dive into the actual project, I wanted to use a current output module (NI 9265) and voltage input module (NI 9201) to generate and read signals in real time (continuously).

To generate voltage signals for the voltage input module, I've setup a very simple circuit with a 100 ohm resistor, so that if I generate 0.01A of current, the voltage module should read 1V.

As I have only been instructed to use 'DAQ Assistant' for using the modules, the best I was able to do was as below.

gathanokos_0-1679519718056.png

The problem is that even if I change the control value from 0.01 to something like 0.02, the indicator stays at the same value (1V).

Only when I stop it and run it again, it changes to 2V. I have confirmed this by running it continuously, and stopping it every time I change the control value, then the indicator changes.

gathanokos_1-1679519974354.png

 

However, this is not how it should work, where what I want is the value to change without manually stopping the continuous run (hopefully I wouldn't have to run the whole model continuously, only run it once and let the while loop do the work). 

 

I was wondering if this had something to do with how the NI 9265 assistant was set. So I went into the properties and deselected "use waveform timing" to match the samples to read and rate as same as the NI 9201 assistant.

gathanokos_2-1679520041640.png

However, doing this caused an error as shown below.

gathanokos_3-1679520118346.png

I am too new to this to even understand what the problem is and resolve the issue.

I would really appreciate some help.

Thank you.

 

 

 

0 Kudos
Message 1 of 7
(2,938 Views)
Solution
Accepted by gathanokos

Are you absolutely must only use DAQ assistant? Most users will tell you to avoid using DAQ Assistant and go with the DAQmx API. There are some good shipping examples that you can start with. They are available at Help >> Find Examples... >> Hardware Input and Output >> DAQmx.

See Learn 10 Functions in NI-DAQmx and Handle 80 Percent of Your Data Acquisition Applications to learn more.

 

Based on the error reported, your problem is with the timing configuration. What is your timing type, sample rate and the number of samples per channel? Can you provide a screenshot of the DAQ assistant configuration?

See Understanding and Avoiding NI-DAQmx Overwrite and Overflow Errors to learn more.

-------------------------------------------------------
Control Lead | Intelline Inc
0 Kudos
Message 2 of 7
(2,915 Views)

Thank you for the help. I will definitely look at the examples as I am not bound to Assistants if they are not good for applications. I was only using them as my lab member taught me.

 

For the error, the first screen shot is the read module setup and the second is the output module setup:

gathanokos_0-1679597023073.png

gathanokos_1-1679597056198.png

 

Would you be able to give me some intuition on how to set the "Samples to Write" and "Rate" for my application?

Thank you very much.

0 Kudos
Message 3 of 7
(2,876 Views)

Specifying Number of Samples When Continuously Acquiring with NI-DAQmx for LabVIEW explains the concept very well.

-------------------------------------------------------
Control Lead | Intelline Inc
0 Kudos
Message 4 of 7
(2,869 Views)

Your output configuration all wrong if you want to output and hold a single value!  Just use single sample on demand and write your scalar data point to the DAQ Assistant. 

 

The configuration you show (Continuous) requires that 100 (your setting for samples to write) sample points (or a waveform with 100 y values) be written to the device buffer before starting the task.  Wiring a 100 element array or waveform to the DAQ Assistant data input would work if you had to use the dreaded DAQ Assistant. 


"Should be" isn't "Is" -Jay
0 Kudos
Message 5 of 7
(2,862 Views)

Actually, my intension is to read on a continuous manner, which is probably why LabVIEW automatically creates the loop. 

One of my question is that if the DAQ module can generate at 100 kS/s (NI 9265) and read at 500 kS/s (NI 9201), which are the specs given by NI, why is generating 100 samples causing errors?

0 Kudos
Message 6 of 7
(2,805 Views)

@gathanokos wrote:

Actually, my intension is to read on a continuous manner, which is probably why LabVIEW automatically creates the loop. 

One of my question is that if the DAQ module can generate at 100 kS/s (NI 9265) and read at 500 kS/s (NI 9201), which are the specs given by NI, why is generating 100 samples causing errors?


Searching NI.com or Googling NI 9265, NI 9201 will turn up links to those user's manuals and specifications.   Feel free to post those links and ask questions if you cannot understand specific terminology.


"Should be" isn't "Is" -Jay
0 Kudos
Message 7 of 7
(2,779 Views)