LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

DAQ Occurrence Config

I am trying to upgrade the Traditional NI-DAQ in my project to NI-DAQmx.  I am running into the problem with the DAQ Occurrence Config.vi .  There doesn't seem to be an equivalent VI in NI-DAQmx.  All the reading that I have done says that I should use a Timed Loop instead, but I just don't know how to fit a Timed Loop into this VI so that it works the same as before.  The True/False Case Structure, the Stacked Sequence Structure, and the location of the Wait on Occurence function being outside the Case Structure all make this a difficult upgrade.

 

I am at a complete loss and have been pulling my hair out over this.  Please somebody show me how to upgrade this project.

 

Thank you very much in advance.

0 Kudos
Message 1 of 10
(3,023 Views)
No, a timed loop does not sound appropriate.

There are occurrences in LabVIEW as well as DAQmx events. Either might be what you need but it is difficult to know from just the image. Do you have any documentation on the program itself or on what it supposed to do?
0 Kudos
Message 2 of 10
(3,017 Views)

I have attached a more complete picture of the block diagram.  Hopefully it will help.

 

As to what this VI does, I'm not 100% certain.  It starts by opening a file and checking if there are 4 or 8 channels.  It then opens the front panel(s) that the User sees based on the number of channels.  It also seems to set the gain and/or zeros out the pots on the hardware.  I believe that there is normally a calibration file that is used to set those values on the hardware.  I think it may also acquire measurements to pass on to the subVIs, but I could be wrong.

 

What the for loop is doing is where I am really confused.  The DAQ Occurrence Config.vi is waiting for 10 events to happen.  What these events are I am not certain.  Once it has counted 10 events it generates the occurrence and the rest of the code in the for loop can execute.

 

I hope that this info helps.

0 Kudos
Message 3 of 10
(2,996 Views)

Have you tried following the example posted here: http://digital.ni.com/public.nsf/allkb/2D3F6E2F9AAA7B2A86256D600075B88E yet?  If not, that seems like a solid starting point.  It also explains a bit about the DAQ Occurrence VI, why it existed, and why it was removed in DAQmx.

0 Kudos
Message 4 of 10
(2,938 Views)

I have been looking at the problem more and think that I need to use the Set Occurrence and Generate Occurrence functions, but I'm not certain how to do the timing.  The DAQ Occurrence Config.vi was setup to wait for 10 Events to happen and then it generated the occurrence.

 

What I don't know is how to determine the length of time it took those 10 events to happen.  Timing is very important.  I can't just generate 10 events and then set the occurrence.  There must be a way to determine what the amount of time that the DAQ Occurence Config.vi waited and then I can setup a timer to wait that same amount of time and generate the new occurrence.

 

Any help with figuring this out would be greatly appreciated.

0 Kudos
Message 5 of 10
(2,925 Views)

What is it about the occurrence functions that makes you feel they're important to your application?  They were designed more to ensure a thread-safe application than the timing you sound more worried about.  With thread-safe calls, protecting your thread is no longer a concern.

 

Events can require any amount of time to take place.  It's unlikely anyone here is going to be able to tell you the exact amount of time that expired between occurrence calls.

0 Kudos
Message 6 of 10
(2,896 Views)

Hi Jeff,

 

Thank you for your excellent question.  I will do my best to answer it.

 

I am still very new to LabVIEW.  Everything that I know has been self taught by reading the book LabVIEW for Everyone by Jeff Travis and Jim Kring plus reading the help files.  I have taken over the maintenance of several programs that were written by someone who left the company 7 years ago.  No one else in our company knows how to write LabVIEW code and everything that I have learned, I learned while on the job.

 

My task is to upgrade the programs that are using Traditional NI-DAQ to NI-DAQmx making everything 64-bit compatible.  I have successfully done this with one project:

 

     http://forums.ni.com/t5/LabVIEW/Traditional-NI-DAQ-to-NI-DAQmx/m-p/2944596#M850161

 

That project was a little easier because everything had an equivalent function plus there were some great examples to be found.

 

 

For this current project what the program does is the researcher has some muscle tissue in a bath solution.  A current stimulus is applied to the muscle tissue at different times and different intensities/lengths.  The program needs to record the expansions and contractions of the muscle tissue 1s before, during, and 1s after the stimulus.

 

     http://www.catamountresearch.com/products/myograph.htm

 

It is very important for the program to be recording the data at the right times.

 

The program itself is huge containing about 50+ VIs.  The myoCMD.vi is the top most VI.  There are three other sub VIs that also have Traditional NI-DAQ in them, but I figured I should start at the top.

 

The truth is that I don't fully know why the DAQ Occurrence Config.vi was used.  I believe that it was used to synchronize with a different portion of the program.  So I am trying to just duplicate the code in NI-DAQmx and hope that I don't break something.

 

Looking at the code the DAQ Occurrence Config.vi is inside a Stacked Sequence which is inside a Case Structure and the Wait on Occurrence is outside all of that.  I don't see how I could use the recommended Timed Loop to replace it.

 

 

Sorry if this answer was long winded.  I looking forward to any help that you can provide.

 

Gary

0 Kudos
Message 7 of 10
(2,871 Views)

The longer answer helped give a big-picture view of your application.  I'm curious, though.  Was it your idea to challenge yourself with this type of transition or something someone asked of you?   It's a bit of a project for someone new to LabVIEW. 

 

Let's get into the application itself.  You've got some hardware being controlled by LabVIEW.  The primary tasks are:

Output current - used to stimulate muscle

Input voltage(?) - determines number of contractions

 

With these two tasks, we need to implement timing that controls both actions at set intervals.  You've mentioned several subVIs exist in addition to the main VI.  What hardware makes this system?  It looks like you're controlling most of this inside the AI Config and AI Start subVIs.  If it's not NI hardware, do you understand how the code is interfacing between LabVIEW and the instrument?  

 

From your posts, it appears like you have some programming experience and are trying to translate those skills into LabVIEW to update a project you weren't acquainted with prior to taking on the challenge.  If this is the case, the better we both understand the application itself, to include all hardware and software components, the better we can work towards your desired goal.  It sounds like you've gained a pretty solid understanding of the intent of the original program while working with it.  That leaves getting a firm understanding of how we're interacting with the hardware and how to leverage LabVIEW to perform the desired task.  Is it safe to assume your development system is independent of the system using Traditional DAQ so we're able to work without interfering with the original system?

 

0 Kudos
Message 8 of 10
(2,850 Views)

Well as often happens my focus has been changed.  We are shelving this upgrade for now.  Possibly permanently.  I'm a little disappointed because I thought that I was making progress.

 

I want to thank you for all of the help that you have provided and for taking the time to try and help me.  I consider your time just as valuable as mine and the fact that you were willing to help means a lot.

 

Thank you for everything you did.

Gary

0 Kudos
Message 9 of 10
(2,842 Views)

Gary,

 

Sorry we couldn't find a quick solution for you.  You'd have learned a lot working through this upgrade.  Hopefully you'll find your other task rewarding.

0 Kudos
Message 10 of 10
(2,832 Views)