11-04-2009
07:59 PM
- last edited on
11-06-2009
08:28 AM
by
Support
Hello,
I'm working with my professor on an optics experiment and we are trying to control a fast steering mirror with LabVIEW. We bought the mirror and power supply from piezosystemjena. They provided a LabVIEW code that works.
The problem is that right now, the code can only be controlled manually. We wish to have LabVIEW control it based on inputs received from other sources. The LabVIEW code is controlled in either one of two ways. A knob can be used to change the value of the voltage to move the mirror. Also, a command can be sent to control the voltage. In both cases, the "channel" is specified. In our situation, we have two channels, a X and a Y channel for the axes of the mirror.
The knob is not convienient for this situation, because we wish to have a numeric control. When I try and simply "replace" the knob with a numeric control, many things go wrong. There are other references, property nodes, and sub VI's dependent on that the control is by a knob.
Is there any way around this and to have it as a numeric control?
The other way to control the mirror is with the "command." This simply uses a string to send a command to the mirror and works well. However, in order to specify the channel and voltage value, the string needs to read as, "set,0,20.5" where 0 is a channel and 20.5 is a voltage (examples). I would like labview to change the string to coincide with different values calculated by other sources and have the mirror move. However, the code needs the string to be in "control" form. The only way I can see to have the string function where i can change the inputs, would be to use a concatenated string, however then it becomes an indicator instead of a control.
Is there any way to get a concatenated string to function as a control, where I wouldn't have to physically type something in, but instead have LabVIEW determine the values?
I'm attaching the VI's for reference. The VI from the company is quite complicated, so I'm hoping I won't have to alter it too much. I'm sure there's a simple answer just using the sub VI.
Thank you all for your help.
11-05-2009 01:11 AM
Hi R0B0T,
I don't quite get your problem, there is a litte numeric window right under the knob, so where is the problem?
Also, you could just feed values to the knob to control your application, just use property nodes to do so.
And another thing is, as you bought the code, are you sure you are allowed to post it on the internet?
I mean if a company did this code and they earn their money with it I am sure they have some sort of copyright.
Cheers,
11-05-2009 04:59 AM
Hi R0B0T,
Here is some example code to get you started.
There are two vis: Control.vi and app sim.vi The “control vi” simulates your “trying to control with concatenated string.vi” and the “app sim.vi” simulates your d-drive application.
To use these vis, open both front panels. Run the Control vi and change the control values. See how the data is received by the app sim vi.
Notice in the Control.vi how I generate a value change event for the concatenate function using a value signaling property node. This is required by the receiving app to be able to detect that a change has occurred.
Also note that I passed through a stop event to close the app sim vi. The d-drive application does not have an input for this and that is a problem. To cleanly stop the d-drive app you will need to add this functionality (or live with having to stop both vis separately). You will have to read the stop value in two places – in the event structure (lower loop) and also in the while loop (upper loop). I decided at the last moment to include this functionality in the app sim vi so you could see what that might look like.
Note that in the app sim vi I have a comment about dealing with your knob vs numeric issue. This should give you an idea of what you are up against. It really isn’t too hard if you are able to understand these examples.
steve
11-05-2009 07:47 PM
thank you... i linked the numeric with the knob in a test VI and it worked, however, i'm having some trouble in the actual program. it seems like I will have to do something like steve has suggested.
good point about the software. is there any way to edit my post and take the attachment off? i can't find a way to do so.
11-05-2009 11:01 PM
R0B0T wrote:good point about the software. is there any way to edit my post and take the attachment off? i can't find a way to do so.
You can only edit a post within 10 minutes or so of posting it. You can send a message to the moderator by clicking on the Options menu that appears all the way on the right within the message title.