03-28-2021 11:30 PM
Hi Labview experts!
I have the following problem: the attached code switches periodically on and off a group of laser diodes and detects/records their signals passing though four optical fibre bobbins. It basically works as I log one signal at a time but as I try with more than one simultaneously, I detect and visualise the nth with an additional offset on the wave graph chart. Could anyone please advise?
Solved! Go to Solution.
03-28-2021 11:51 PM - edited 03-29-2021 12:03 AM
I point out that by carrying out the measurement with a code based on the use of the DAQ assistant I succeed to visualise and read simultaneously multiple signals (in the uploaded example I have two signals). In this case, signals are read by input ports 0 and 7 (and both are grounded). As I try to do the same thing with the code above I get the 2nd signal with an extra offset of 0.3 V. Where am I wrong?
03-30-2021 06:16 PM
Can anyone please advise me?
03-30-2021 08:30 PM
So in the "working" VI, you use Referenced Single Ended physical connections.
In the first VI, you don't specify the "input terminal configuration".
This means you'll get the default.
From the detailed help:
NI 60xx (E Series), NI 62xx (M Series), NI 63xx (X Series), NI ELVIS II, NI PCI-6010, NI USB-6001, NI USB-6002, NI USB-6003, NI USB-6008, NI USB-6009, and NI TC01 | For devices with eight channels: differential for the first four channels, referenced single-ended for the next four channels. For devices with 16 channels or more: differential for eight channels followed by referenced single-ended for eight channels. For instance, channels 0-7, 16-23, and 32-39 are differential. Channels 8-15, 24-31, and 40-47 are referenced-single ended. |
The USB-6001 has 8 channels, so channels 0-3 are differential by default.
If you want to use RSE, then you need to specify this at the DAQmx Create Virtual Channel node.
As follow-on notes, if you're going to use DAQmx rather than DAQ Assistant (generally a good choice to do so), then you shouldn't go back to using the Dynamic Data Type (DDT, the thick blue wires).
You can split an array of waveforms using Index Array, and removing the DDT wires will remove a lot of opportunities for unexpected and difficult to "immediately see" bugs.
Beyond that, you're carrying out the same operation on each of your 4 channels - you could replace your separate Offset <N> (and perhaps Reader <N>) controls/indicators with arrays, and then directly process (perhaps with a for loop).
The operation you're carrying out can be done using Mean.vi (or Add Array Elements, rather than the For loops).
If you're autoindexing a For loop (the [ ] marks on the input tunnel) then you don't usually need to also wire N, in this case it makes no difference (and in some cases it produces undesired behaviour - a For loop will execute until the first stop condition is reached - so the shortest autoindexed array, or N, even if other conditions are 'larger').
03-30-2021 08:43 PM
Here's a version with a somewhat tidied top loop. I didn't change any of the functionality except by moving the controls/indicators into arrays as I mentioned in the previous post, and setting the configuration to RSE.
Note that although I could have the Offsets be autoindexed, that could give an unexpected behaviour if there are fewer than 4 offsets set (for 4 input channels).
That's because then the For loop would iterate fewer times (shortest autoindexed array) and the output would only be a subset of the input waveforms.
With this code (manually Indexing the Offsets array) you get an offset of 0 by default.
You could also change the Waveform Graph displays and put them all on one graph, if you wanted...
03-31-2021 07:47 AM
Thank you cbutcher!
Very clear!
I'll try it out and let you know!
04-08-2021 08:34 PM - edited 04-08-2021 08:45 PM