Showing results for 
Search instead for 
Did you mean: 

best design idea for parallel DAQ (via GPIB), PID control and watchdog system



I am a starter programmer in LabView, I already understand the basic ideas, and design patterns, like producer/consumer, events state machine, functional global variables, and so on, so the basics...


I started a project a few weeks ago, and first I wrote and tested all of the necessary subvi-s for my project, like the ones initializing my GPIB devices (a Keithley mux and a dvm), controlling/reading out the measured voltage/resistancy values from them, subvi for my Static Analog Output card (I have to drive 7 analog output channels, 4 has to be PID controlled regarding to some of the measured values from the GPIB devices), and another subvi for the analogue card, sending TTL watchdog signals out to my experiment in every 2 seconds.


Any idea is welcomed about suggesting the best design pattern for my project.


The main features of my program would be:


After starting the user interface the program starts with a start-up state, initializes the DAQmx channels and the GPIB devices. The program starts to read out different values from the GPIB devices, including 4 temperature values in every 3 seconds.


In the same loop (?), using PID control, the program sets the DC voltage values of 4 channels (3 to heating wires, 1 to a Peltier-heat pump) on the Static Waveform Analogue output card, the remaining 3 values are constants.


I have to send digital TTL watchdog signal to some relays from the same output card, changing its state in every 2 seconds (not the same rate as the GPIB values are read out).


When the 4 temperatures and the power values regarding to the heating wires are equilibrated after a few hours, the program goes into another state, and signals to the user, that the measurement can be started. During a measurement, I write out all of the measured values to a TDMS file, and there is also some basic calculations "on the fly", like a moving average.


After the measurement done, the user can swap samples, and the program goes into the above state, waiting for equilibration . and so on...


Do you think I should use a Producer/Consumer pattern with events? Or someone would recommend me a better design idea?

Thanks very much!


ps.: I read out lots of values from the Keithleys, so I put them in a cluster. I made a small test vi (attached without the GPIB comm subvi-s), just to test the GPIB comm. So this is the recent state of my project. (all other subvi-s tested and ready to use as I wrote above, like the DAQmx output part)



0 Kudos
Message 1 of 4

maybe my question is too general... One important thing I would like to know for example:


when my GPIB and analogue-output/PID  loop is running, with a full lets say 10 sec cycle time, I need to send the watchdog signals parallel but with 2 sec cycle time accurately. Should I use notifiers for this? I mean, when some problem happens in the PID part (hangs or whatever), I want to stop the watchdog loop running parallel...


0 Kudos
Message 2 of 4

Okey 🙂

I think it is a better approach if I work first, and after I ask 🙂

I go with small steps. For first, now I just want to make a DAQ analog output loop, and parallel a watchdog loop sending out TTL in every 2 seconds.

The main loop in my project will iterate with approx. 10-15 seconds.

I want to check in my watchdog loop, if my main loop hangs up (in that case the PID control stops, but the danger is if the output voltages stay on).

After some readings, I have decided to use a functional global variable.

I have attached the vi, can someone give me advice, what would be the good solution for this purpose?

(I know it is a bit silly what I messed up with the shift registers in the bottom loop, it was some experimenting).


Thanks in advance!

0 Kudos
Message 3 of 4

Nice chat with myself 🙂

Anyway, in my previous post I gave I think an unnecessary overcomplicated example vi.

I have revised my vi, I have attached it. I think if there is a proper error handling in the top loop, then I do not need to check its state from the bottom loop.


So my final question regarding to watchdog: is my vi safe? For my application it is very important to stop the watchdog signals in the case of any malfunction. (otherwise i can get my heating wires overheated)

Thanks for advice! 

0 Kudos
Message 4 of 4