LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

multiple voltage inputs and gated waveforms outputs? PCI-6251 and BNC-2110

I’m working on a VI that monitors four input lines coming in on a PCI-6251 linked BNC-2110.  Upon receiving a voltage change (e.g. from 0V to 1V) the VI is supposed to generates and send a sine wave to one of four outs on an external sound card.  We have been succesful at setting 1V vs. 2V inputs to trigger generation of two different waves, and playing that sound.

Currently we have two problems: 

1)        We would like to gate (i.e. amplitude modulate) the sine wave with either a linear or cosine function over 5 milliseconds at the start and again at the end of a 300 millisecond wave.

2)        Also, we are having problems with the current VI setup not picking up nearly-simultaneously activated input lines (two lines go high at nearly the same time; only one wave is generated, for the first line).  This is likely because we can not have two instances of the DAQassist, and don’t see how to get around this.

Does anyone know how to modify a generated signal to accomplish the amplitude gating?

Does anyone know how to monitor multiple lines in a more efficient way so that we do not miss simultaneous instances of signal changes?

 

Our current file is attached, with the first three instances still putting out a standard sine wave and the last of four our 'work-in-progress' attempt at log ramping the ends of the generated wave; we are running WindowsXP ServicePack2 on a 3.6GHz Pentium 4 with 1 GB RAM.

0 Kudos
Message 1 of 5
(2,968 Views)
Hi Awoolley,

This is a very interesting application and can be solve with hardware or software.
Hardware advantages: most efficient way to monitor changes in lines, immediate response and software easier to program.
Software advantages: reduce hardware cost.
Your program is a very good initial approach for monitoring the signals but I will try to explain why are you experiencing the "same time" problem:

You are acquiring 100 points at 1 kHz and therefore if your second signal gets activated after 100 ms (100/1k), then your signal will not be detected and you will have to wait until all the sound goes out the sound card until you can monitor again the line.

There are basic things you can do here and more advance things depending on your programming time and experience. Feel free to ask more for one of the following two solutions:
Pure software
1) Play with the numbers: number of points and frequency. If you acquire more points you will detect consecutive activated signals but you will delay the sound and vice versa.
The number of points you output to the sound card is also going to delay the next acquisition, so you can also play with them.

2) More advance is to use two parallel loops in configuration producer-consumer. You can send the acquire data to process to the second loop. This will not delay the next acquisition cycle and if your consumer loop can keep up, then you will have much better performance.
If you use this you will not loose acquisition samples for being processing the data.

There are two hardware solutions as well:
1) Get four cards and hardware trigger in each line.
2) Externally "add" all signals and acquire the sum in other channel. Then, trigger the acquisition with the reading from that channel. When triggered, you will only need to get a couple of samples to know which line was the one who triggered.
Hope this gives you a good starting point and feel free to post ask more about a specific solution.
Gerardo O.
RF SW Engineering R&D
National Instruments
0 Kudos
Message 2 of 5
(2,942 Views)

Thanks for the reply, Yardov; we’re interested in software option 2), running an aquisition loop simultaneous with sine wave production loops, where one follows the voltage and separate loops generate the sine wave (while the first continues to acquire other inputs).  We are having problems construction these loops and sending the data from one loop to the other.  By using a tunnel to send the data out, it is sent out as an array, however that’s not what we want. We also tried using a shift register to no avail.

We want the single element representing the value changes over time to be sent out of the first loop while this acquisition loop is still iterating (instead of storing data values in an array after each loop iteration through a tunnel, just send out the value at the current iteration).  Are there Examples available or specific methods usually employed to achieve this sort of communication?

0 Kudos
Message 3 of 5
(2,931 Views)
... we have now changed over to using voltage to activate digital lines and give boolean info....
0 Kudos
Message 4 of 5
(2,922 Views)
Hi Awoolley,

This is a good step you took. I imagine you can now "see" a digital pulse rising when your signal is in the condition you are looking for. Now you can use a change detection task to detect changes in digital lines (shipped example Read Dig Chan-Change Detection.vi) and send messages about which line was to a secondary loop. As I mention before, this is called a producer consumer loop and you can get a template of this loop by selecting File » New and in the window you will browse to : VI » From template » Framework » Design Pattern » Producer/Consumer Design Pattern (Data).
You can read about how it works online in this document. This is usually a recommended framework for experienced users in LabVIEW.

A more simplified approach (but not very efficient) is to use local variables to communicate between two loops. There is a shipped example called Stopping Parallel While Loops with Reset.vi that will help you visualize how to stop two loops using local variables.

Good luck with that,
Gerardo O.
RF SW Engineering R&D
National Instruments
0 Kudos
Message 5 of 5
(2,910 Views)