LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

A program to control a Zaber linear slide

Hi, I would like to control a linear slide provided from Zaber, it is a position controlled equipment. The vi now is to enter request then shows the position responses.

 

I want to make a graph of the request No. and the position responses to give a better visual control. This graph is expected to look like fig 1.

 

Fig 2 shows the code, now I want to unbind the responses then capture the position value from it. Could anyone tell me how to do?

Download All
0 Kudos
Message 1 of 8
(4,684 Views)

Hi Starga, it looks like you should be able to wire the data value from each response to a waveform chart, and that will build the display you described. If you use the First Response output from the Request Command VI and wire it to the chart inside the loop, then I think it will update the display as the commands execute. I haven't used charts and graphs myself, but there's a description here:

http://digital.ni.com/public.nsf/allkb/95FEE9F5B252507E862562BA00007657

To see how to unbundle the response and get the data value, see the Zaber example called Intermediate - Read Response Data.

 

yours,

Don Kirkby

Zaber Technologies

0 Kudos
Message 2 of 8
(4,663 Views)

Thank you Don, that's really useful. Now I get a chart of the response.

 

However, I want to record the data of two linear slides individually. It seems that I still have to unbundle the response and get the value. I got some problem when trying the example Read Response Data, I have attached the picture and the error. Could anyone explain the error for me, please? What should I do?

 

In addition, I am also confused with the description "this example introduces the Unbundle By Name function". Where is the name function? Thank you.

0 Kudos
Message 3 of 8
(4,640 Views)

It looks like you have added an extra field to the Request.ctl type definition in the Zaber instrument driver (probably by accident). You can either reinstall the Zaber instrument driver, or go in and remove the extra field. Either way, you'll probably get some broken wires in the VIs you wrote that now expect the extra field. Just remove the extra field from any constants or bundling operations in your VIs and they should work again. Then you'll be able to run your VIs and run the examples that we included in the instrument driver.

To remove the extra field, open any wiring diagram with the Request Command VI on it. Then double click on the Request Command VI. Once that's open, you should see the Request bundle near the top left of the panel. Right click inside the Request bundle and choose Open Type Def. You should then be able to see the duplicate field named Response Count 2 and delete it. Once you save the changes, the example VIs should work again.

There is a function called "Unbundle By Name" that lets you pull a single value out of a bundle and selects that value by its name. In the Read Response Data example, the Unbundle By Name function is just above the note that says "current position" and it pulls the data value out of the response. You can find the Unbundle By Name function in the functions palette under Programming: Cluster & Variant.

0 Kudos
Message 4 of 8
(4,628 Views)

Thanks Don, yes I did add an extra field before. Now the error has been solved. Thank you.

 

I have tried the Unbundle by Name and now I could get a chart with a series of data. However, I would like to sort the data by its device name. What should I do? I attached a chart of the program. Should I sort the responses by the device name into a 2D array? Look forward to your reply. Thank you very much.

0 Kudos
Message 5 of 8
(4,619 Views)

Sure, a 2D array sounds good. You should be able to use the device number as an index into that array. I think you can start with a 2D "position array" set to zeros (one column, and a row for each device) and then pass that array through a shift register in the main loop. On each iteration, figure out which device responded, update that entry in the position array, and wire the position array to the waveform chart.

I read in the waveform chart documentation that it also supports a waveform datatype that includes a time stamp. You might want to experiment with that as well. You also might find it easier to build the complete array of data and just use a graph at the end of the execution instead of updating the chart as it runs.

0 Kudos
Message 6 of 8
(4,612 Views)

Hi,

 

I have a new device which a linear slide attached with a metal plate and there's an electric wire upon it. Initially, the wire is not contacted with the metal plate. When the device is moving, the electric wire will touch the metal and I want the slide can stop immediately when a signal is captured. So far, I have made a program which the slide will stop when the signal is captured. However, it seems that it doesn't stop immediately as a result it will still move a bit then stop.

 

Can anyone give me some suggestions? The programme is attached. Cheers!

0 Kudos
Message 7 of 8
(4,583 Views)

Can you be more specific about how much it moves before stopping and how many milliseconds it keeps moving?

 

From looking at your screenshot, it seems like there could be two possible sources of delay: time to detect the signal, and time to send or execute the stop command.

I'm more familiar with the Zaber side of things, so I'll start with the time to send or execute the stop command. Check your acceleration setting. If it's below 50, you might notice some movement while it's decelerating. The default setting is 111 on most devices.

 

http://www.zaber.com/wiki/T-Series/Compilation/All_Commands#Set_Acceleration_-_Cmd_43

 

I can't think of any other delays that would occur on that side; I think I've timed round trip communication to Zaber devices at around 6ms, so I can't imagine that would be noticable.

For detecting the signal, the only thing I can suggest is to check your sample rate.

To see which side is introducing the delay, try adding an indicator LED to your front panel and light it in the same section where you're sending the Zaber request. If the light comes on immediately after the plate makes contact, then the delay is probably on the Zaber side. If the stage stops immediately after the light comes on, then the delay is probably on the detection side.

0 Kudos
Message 8 of 8
(4,573 Views)