LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Most efficient way to continously feed input commands into DAQ device (FEEDBACK LOOP)?

I'm currently developing a program which utilizes a Case Structure within a loop to read the output values of one device - which is not DAQ, just USB - and convert them to an input value for a DAQ I'm using to control another device.  It most definitely works exactly how I need it to, the only problem is that it doesn't work as quickly as I need it to.  I need a more rapid read/response out of this makeshift feedback loop and I was wondering how I could clean up my program.  Here is a picture of the Block Diagram, and I will attach the actual file itself as well to see if someone can help me make this more efficient; I'm willing to scrap any part of this design to make it a smoother running program.  Thanks!

 

feedbackmechanism.jpg

0 Kudos
Message 1 of 10
(2,894 Views)

Get rid of the autosetup of the scope and specify the capture parameters. As it is, you have no idea of the number of samples the scope is being configured for. It is also silly to do the autosetup each and every time the loop iterates. I also don't understand the point of doing waveform capture and then using just a single point of the waveform. Is this a dc signal you are trying to capture?

 

I also don't understand your logic for stopping the loop. If Stop is false, the loop continues. That is backwards from conventional coding.

Message 2 of 10
(2,888 Views)

Well, I'm fairly new to LabView, and any sort of programming or development for that matter, so upon the beginning of creating this, I merely downloaded an available .vi for this scope, removed the visual scope and left everything else.  I then put it in a loop from a .vi I had downloaded for a different device I was controlling that was not DAQ.  I just melded those two .vi's together and eventually changed the 2nd device to DAQ when I got it.  I'm not exactly sure about what certain aspects of the program do, I just know that it worked.  Do you think you could give me a little bit more insight on what I should do, or possibly even clean it up for me?  I'd greatly appreciate it!

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

It is a DC signal and I'd like the program to read the value that the scope is picking up at that instant.  I didn't know it could do that without capturing the entire waveform.  The original program was merely for having a visual oscilloscope on LabView.

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

If you are unsure what the program does, it's probably a good time to step back and review the LabVIEW tutorials and the scope manual. With the scope driver, you have a whole palette of functions to set the scope the way you want. Set it up manually and try to reproduce it with the driver functions. You can probably minimize the number of samples a great deal. Experiment.

Message 5 of 10
(2,877 Views)

Okay so I removed the autosetup feature and also brought the initializer out of the loop altogether.  It took 8 seconds off the loop time.  Now how can I get it to just produce the readout instead of the waveform?  I can't seem to figure that out but it would definitely save time to cut out those conversions.  Also, now that it isn't automatically set up to be continous, is it waiting for a trigger?  Looking into the SubVIs I found a trigger, I'm not sure if that is slowing down the program any further.

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

Actually it turns out I need the Auto; when I removed it I wasn't getting a different value each loop

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

Well, what I would recomend is that if you want to use Auto, use it once and then use the discrete functions to specifically set the capture parameters. The auto function is easy to use but probably not the most optimum settings for the scope to acquire as fast as possible. Look at the examples that come with the scope. Turn on Context Help and review the functions in the instrument driver.

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

Okay I looked into it and I tried to reconfigure the system without waveform acquisition as so:

 

Untitled.jpg

 

It initializes fine but then an error occurs at the Read Measurement vi which reads:

 

Tektronix TDS 200 1000 2000 Series.lvlib:Error Query.vi<ERR>
Instrument reports:
2228,"Measurement error, Positive Clipping; "
0,"No events to report - queue empty"
<b>Complete call chain:</b>
     Tektronix TDS 200 1000 2000 Series.lvlib:Error Query.vi
     Tektronix TDS 200 1000 2000 Series.lvlib:Read Measurement.vi
     Feedback Mechanism 4.5.vi

 

Not sure if this is configured correctly but I'm not sure where to go from here.  This may not even be the right .vi to use but I just want to acquire a number readout from the oscilloscope, not the waveform.

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

So, you set the scope for continuous acquisition but you still don't have anything else for the configuration - i.e. Configure Channel to set the vertical or Configure Timebase to set the horizontal. If you were happy with the way the autoset worked, then have that with the continuous acquisition. If not add the horizontal and vertical as necessary. The error message from the scope says it's not configured correctly.

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