Jump to content

Custom Front Panel for Data Acquisition


Recommended Posts

Hello everyone,

I have a question about designing a customizable front panel for data acquisition cards. I already have 3 virtual instruments, one which will display waveform of input signal, one which will display numeric values of input signal (peak-to-peak, +peak, -peak, DC, RMS), and third one which shows numeric values and waveforms of input signal. Those three block diagrams are similar to examples which can be found in LabVIEW Help tab (Help->Find Examples...). But, the problem is next.

Now I need to create a front panel which will ask me how many inputs do I have (it can vary from 1 to 8), then it should ask me what do I want to see (numeric values, waveforms, or both) for every single channel, and in the end it should show me my preferences in a new (or same) front panel.

For example, I select four inputs, then I select waveforms for input 1 and 2 (because I want to see waveforms of signal on inputs 1 and 2), and numeric values for inputs 3 and 4, and then my front panel should be divided into four sections, on the left side there are waveforms for inputs 1 and 2, and on the right side there are numeric values for inputs 3 and 4 of my DAQ card. Any ideas how to achieve this?

Thanks.

Link to comment

Dynamic (or semi-dynamic) UIs in LabVIEW can be a pain for sure.  Years ago I attempted something called Multi Panel Interface.  Don't look into using it, it was just a proof of concept.  But my point is that the amount of development in making this UI was a decent amount of work.  

For this I'd suggest starting with just one UI that combines all three views of a single signal into a window.  Then you can use a transparent tab with each of the three UIs that you have now on their own separate tab.  Your code can run and update the UIs on all three tabs all the time, but the user will only be shown one at a time depending on what they selected at the start.  Next I'd look into using this in subpanels.  So your one UI that works on a single signal can be reentrant and spawn all the clones you need.  For your single UI that beings them all together you can have 8 subpanel controls that get moved and resized with property nodes.  Or another solution might be to create 8 separate VIs each with one more subpanel than the previous, and depending on the number of channels selected, that VI can be selected.  The benefit of this is you can have them all evenly spaced with splitting panes and have them fit to the pane so resizing of the main UI is already taken care of for you.  Without this resizing would have to involve looking at the new UI size and resizing all the subpanels with properties again.

Link to comment

An expert could probably do it in a day or less.  Someone new to LabVIEW might spend months and not get anywhere.  It really depends on experience level and training.  Think of it less as a front panel and more of a test application.  How long would it take for someone to come up with a test application in other programming languages?  Well if they have no experience in any programming language I'd say a very long time.  The easiest solution is usually the least modular, scaleable, reusable, extensible, and eventually the most bug ridden and hardest to manage because requirements will change.

Link to comment
Quote

For this I'd suggest starting with just one UI that combines all three views of a single signal into a window.  Then you can use a transparent tab with each of the three UIs that you have now on their own separate tab.  Your code can run and update the UIs on all three tabs all the time, but the user will only be shown one at a time depending on what they selected at the start.

When you say transparent tab, you mean Tab control in Controls Palette? How do you mean 'depending on what they selected at the start'? Which step is necessary to do selection at the start?

 

Quote

Next I'd look into using this in subpanels. So your one UI that works on a single signal can be reentrant and spawn all the clones you need.  For your single UI that beings them all together you can have 8 subpanel controls that get moved and resized with property nodes.

If I am right, using subpanels can make this easier, and I can select what type of display do I want, and then simply get that view in a new Front Panel. But how does a single signal can be reentrant and spawn all the clones I need? I don't get it, in fact I am not sure if I understand what did you want to say.

 

Quote

Or another solution might be to create 8 separate VIs each with one more subpanel than the previous, and depending on the number of channels selected, that VI can be selected.

8 separate VI's includes 8 VI's (first for one channel, second for two channels, third for three channels and so on...)? Do I have to select channels somewhere before, or just click on the button and VI is opening according to my selection?

Link to comment

Demo time.  So attached is what I was thinking.  There are multiple ways of doing it I just went with the one I knew would work but might not be the best solution.  Especially if the number of signals is more than 8.

Run the Main Selection Window.vi.  Then pick the number of signals between 1 and 3 (sorry I didn't do all 8 but I think you get the idea).  Then for each of the 1 to 3 signals select the signal that it should be reading, and the viewing option which is either Graph, Value, or Value With Other Data which in my case is the running mean of the signal.  Then click start.  It will insert 1 of 3 VIs into the subpanel depending on the number of signals shown.  In each VI is 1, 2, or 3 subpanels which inserts the core VI Signal Signal View 1, 2, or 3 times.  This is the only VI that is reentrant.  The benefit of this design is window resizing works nice.  If you resize the main window all the sub windows get resized in real time and work pretty well without any extra code.  I also included a queue to send messages to the independently running VIs.  Right now the only command is quit but you could use this to send any data to one window, or multiple depending on how it is coded.  Now actually getting your data being read in multiple instances may also require yet another parallel running task.  If you have something like DAQ tasks all running on the same hardware, then you will likely need to publish that to a more global data space, so that each of the parallel running VIs can grab the signal they care about.  In my demo I just used randomly generated data so each of them can run in parallel without having any hardware resource locking issues.

Main Selection.png

Signal Selection Demo.zip

  • Like 1
Link to comment
  • 11 months later...

Hello, I tried to test my VI in lab, you can see it attached to this post. Although it is executable with no errors, it doesn't work what it is supposed to do. It only works when one signal is being manipulated on DAQ card, but not if more of them. I guess it's because DAQmx can't handle more then one DAQmx Task at a time. Is there quick fix for this problem or I should do a completely new thing from scratch?

 

 

Version1.rar

Link to comment

I think most (if not all) AI DAQ hardware have a single hardware timer inside them for triggering the analog to digital converter.  This is why only one task can be running at a time.  That single task can be configured to read N channels of course at the same sample rate.  So one solution might be to create an asynchronous task that has the sole purpose of reading all the DAQ channels in a single task, and throw them into a global.  Then the reentrant VI clones just read from that global.  Attached is an update which works with my simulated hardware.  It will read the first 8 analog signals on "Dev1" device in a loop at 100hz.  4 times a second it will read 25 samples from each of the 8 channels and then push them to a global that limits the amount of data stored.  Then in the reentrant VI instead of randomly generating data it reads it from that global.  So now you can display 8 things from up to 8 channels but they could all be from channel 1.  Now you can have a graph, and a digital display of channel 1, and maybe graphs of channels 2 through 7.  If your hardware only has 4 analog inputs you can change the array subset function to that, and then update the enum for signal selection.

Signal Selection Demo.png

Signal Selection Demo 8 Way With DAQ.zip

Link to comment

Thanks for the info, I will try to test it sooner rather than later. If I want to add a high voltage probe ratios (voltage dividers) into account, I guess I should add a case structure in Main Selection Window.vi (lower section of the block diagram which encompasses DAQmx, more precisely inside the while loop)?

Link to comment
  • 5 weeks later...

Start small, launch a test panel in MAX and see if you see the signal you want.  If you do write a VI (or open an example) that just reads the signal and see if it look right there.  These reentrant clone like UI's make debugging more difficult and you don't want simple problems related to the setup or channel config taking up your time, when you are debugging the interface.

Link to comment

I launched a test panel in MAX and saw a signal from a 1.5V AAA battery. I saw the same signal from battery when I opened LabVIEW built-in example 'Voltage-Continuous Input.vi'. And after all that I launched this Main Selection Window and saw a 1.5V reading on it, so now I'm confused why I haven't seen a signal when I was trying to acquire a signal from a wall socket using high-voltage probes.

Edit: When I launched built-in example 'Voltage-Continuous Input.vi', I have seen a signal from a wall socket, but I haven't seen it when I launched this Main Selection Window.

Edited by Progression
Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.