01-09-2006 03:38 AM
Hello Labview- Friends
I have a problem, which I think is quite easy to solve. However, I tried to work out, but did not manage it. I am using Labview 7.1 and want to acquire signals of a combustion engine. The vi attached works as far well, but I would like to have another feature.
à I acquire data by using a crank angle decoder. I start the acquisition by a digital start pulse (start trigger occurs once per revolution), and get a number of scans by an external scan clock (one per degree crank angle). I then get for example 7200 scans to make an average. I prefer to have the acquisition finite, means not using a while loop.
Now to my problem: I would like to get the speed of the engine at the same time. So, how can I acquire synchronously the digital pulse of the encoder (either from start trigger [50 Hz] or from sample clock [18 kHz])?
As I would like to compare the speed of the engine with analogue acquired data it needs necessarily to be synchronous.
Does anybody have a solution for this problem? I had already a look at some papers concerning “synchronised data acquisition” and forum entries, but I couldn’t modify any examples to my problem.
Thank you in advance for somebody’s help
Woodi
01-09-2006 08:18 AM
Sorry I cant see your code since I have 7.0 on the machine I am working on but typically you can synchronize the data acquisition by using a shared trigger, set your tasks (each is its own data acquisition task) to start on a digital edge trigger, then set the source of the digital edge to the trigger line, this can be an internal source or external source. when reading out you can multithread the read and read each as fast as possible or better read the expected number of points for each task and send the results to a second loop for processing. This will minimize the chance of falling behind on the acquisition cycle and causing buffer overruns.
Paul
01-10-2006 01:14 AM
Hello Paul
Thank you a lot for your reply. As I am quite new to Labview, I didn't get everything you wrote. What do you mean by “multithread reading”? Isn’t normally AIread a blocking call?
However, I keep trying…
Basically I used the “Cont Acq&Graph Voltage-Ext Clk-Dig Start.vi” from the Labview library, but deleted the while loop and changed to “finite” acquisition.
Greets, Woodi
01-10-2006 04:56 AM
01-10-2006 06:24 AM
Hello Ingo
You are totally right. I need to synchronize analogue inputs with digital inputs or counter inputs. The vi attached is just the one I use for the analogue input. There I would like to add a synchronized counter task, where I can use the start trigger of the analogue acquisition to get the frequency. I need a simultaneous acquisition, because I want to compare speed of the engine with the analogue acquired data.
I am using a card which supports counters (M-series PCI-6254).
I would be really glad if you had time to have another look at my vi.
01-10-2006 06:36 AM
Multithreading in labview could not be any easier, just use tow loops and communicate with a synchronize object like a queue. Look at the producer, consumer design pattern (LV 7.0 or greater), where the producer is a daq loop with no delays and runs as a blocking read (runs as fast as a read function or a timeout condition) and the consumer loop will process and present the data. the queue is used to send the data between the loops in a fifo manner.
Paul
01-10-2006 10:43 AM