06-15-2018 11:18 AM
Dear sir,
Thanks for your continuous help. I have attached my modified code here (Sensing_DAQmx). Still facing some problems. All measured values are negative (pic attached_sensing DAQmx). But when I used DAQassistant using same NI USB and same connection, that showed accurately measurements (pic attached_sensing DAQassistant). I also attached DAQassistant codes here. I think it's not the connection problem. Maybe I did some mistake in coding.
Would you check, please?
06-15-2018 11:43 AM - edited 06-15-2018 11:45 AM
@Chowdhury_Milon wrote:
Dear sir,
Thanks for your continuous help. I have attached my modified code here (Sensing_DAQmx). Still facing some problems. All measured values are negative (pic attached_sensing DAQmx). But when I used DAQassistant using same NI USB and same connection, that showed accurately measurements (pic attached_sensing DAQassistant). I also attached DAQassistant codes here. I think it's not the connection problem. Maybe I did some mistake in coding.
Would you check, please?
In your DAQ Assistant version you use RSE pin configuration for your analogue inputs. When you use the DAQmx version, you HAVE to change the cabling as I mentioned in an earlier post! Did you connect the cables properly???
edit: you can easily check if this is the problem or not: change the "Differential" constant into "RSE" in the DAQmx code. So you do not need to change pin cabling...
06-15-2018 12:33 PM
Dear Sir,
Thanks for your quick reply. I have changed the "Differential" constant into "RSE" in the DAQmx code and it works perfectly. I have added a "data write file" in the code (pic attached) but the code saves one data per seconds. How can I save 100/1000 data per sec into the saving file?
Maybe it's my last question regarding this issue. Thanks in advance.
06-15-2018 04:04 PM
How can I save 100/1000 data per sec into the saving file?
Can you explain what is your goal? You mean you want to save 100 data points per 1000 sec? So one data point per 10 seconds?
06-15-2018 08:11 PM
Dear Sir,
I want to acquire 100 or 1000 readings per seconds. Using the current DAQmx code, it works. But, when I add "Write Meas File" to save those data, only 1 reading or data saved per second (1 data/sec).
My question was, How can I save 100 or 1000 readings/data in every second?
06-16-2018 02:17 AM
Dear Chowdhury_Milon,
It appears as though at present you're making what are described as "on-demand" measurements - your While loop runs once per second (because of the Wait function) and makes a single measurement as it is currently configured (N channels, 1 samples)
You might want to take a look at the "DAQmx Timing" VI, which allows you to setup sampling in various ways. For your setup, you probably want to consider "Continuous Samples" - the default (the connection is on the top of the VI) is "Finite Samples". Reading the Detailed Help, available either from the Context Help (mentioned earlier in this thread, and with the shortcut Ctrl+h to toggle) or by right clicking on the node and choosing "Help" will give you more information about the inputs to the function.
This method, looking at the detailed help, is often very useful for functions you're unfamiliar with, especially with DAQmx.
If you start making multiple samples per loop iteration in the Producer loop, you're likely to want to use N Channels, N Samples for the Read node, and then you're going to have an extra array dimension going into your Channel. This might complicate the Consumer - you'll need to handle a 1D array of data for each operation (but the same nodes should work. Just be careful with your Index Array functions!
You might consider modifying the Consumer loop to handle your scaling using Array multiplication. This could simplify reading the code in that loop 🙂
06-16-2018 02:44 AM - last edited on 07-11-2024 03:40 PM by Content Cleaner
There might be a problem with DAQmx timing, if you use a single Producer loop for the 4 USB-6009 devices! The problem can happen because you request continuous sampling, and the 4 tasks might interfere with each other timing wise, so you might get errors. This is just a guessing, I never tried this though.
Maybe the finite timing mode could work. But do not forget, if you want to get 100 samples per channel, with 100 Hz speed, for the 4 devices in a single loop, due to the serialised FOR loop, it will take 4 times longer one iteration. So I imagine in this case, you could set 100 samples per channel per device, and 400 Hz sampling rate. So you produce 100 samples for all channels across all devices in every second.
What would be very interesting to see, what happens if you configure the FOR loop in the Producer for parallel execution. Would it work? I have no idea! 🙂
EDIT: actually I am interested why you want this higher sampling rate? If for averaging reason, due to noisy signals, try to use proper cable shielding and grounding. Moreover, do not use RSE, usually Differential pin configuration gives you better signal "quality". But of course, it depends on your sensors, you can read more about these matters here: https://www.ni.com/en/shop/data-acquisition/measurement-fundamentals/analog-fundamentals/grounding-c...
Another thing is that, you measure moisture, temperature, etc. These kind of physical parameters do not really change fast! So I do not see too much point in to sample at higher frequencies (ok, if the higher sampling is done to improve signal it is another thing...)
06-16-2018 02:53 AM