LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to use Labview to control motorized stage?

Solved!
Go to solution

Hello

We have a Zeiss imager M2m microscope in our lab and are trying to build a code that controls the z axis of the stage. We currently have an Olympus microscope which is controlled by a VI built a while back and is connected to a different computer. I tried to copy that already existing VI to the new computer which is connected to the Zeiss microscope but it is not working as I expected. The connection from both microscopes to the computers is RS232 serial port to a USB and the new computer does detect the microscope. Somehow there is no ‘Bytes at the port’ and no data is read.

I have attached some figures of the operating VI that has strings to write and read. What happens to the new VI is that once ‘2LOG IN’ is written, nothing is read back and the bytes to read is 0. The only differences between the working setup and nonworking setup is the computer and the microscope. I am thinking that because the manufacturer of the microscope is different maybe some settings should be changed. I did changed to baud rate to different values such as 57600 but the same problem occurred. I have also downloaded the Zeiss driver which has its own version to handle NI-VISA on the national instrument website but that didn’t work as well. The drivers provided are for imager M1 and Z1 and we have M2 so that could be the cause…

Lastly I found out that Data Set Ready (DSR) for the working setup is Asserted but the nonworking one is  unasserted and I cannot change that option. Maybe this is why the VI is not operating?

Can anyone give me any suggestions about this?

Thanks in advance!

Message 1 of 9
(4,320 Views)

Particularly when you have a Device (in this case, a Serial device) whose characteristics (Baud Rate, parity, etc) you don't know and you don't fully understand its messaging/command system, the first thing to do is to forget LabVIEW and fire up NI-MAX, the Measurment and Automation eXplorer.  Plug your device into a Serial (or USB) port and see if MAX recognizes it.  Let's say that a Port seems to identify itself as connected to your device (look in Devices and Interfaces on the left-hand pane).  Go ahead and open it.  You should see some options for setting VISA parameters.  Pick some that you think are appropriate, and try sending a message (it helps if you know what kind of message your device expects).  If that seems to succeed, try reading back what's in the buffer.

 

With luck, at some point, you'll see "meaningful dialog" with your device.  You now know the parameters that VISA expects, and also know something about the messages you send and receive.

 

Your device probably sends messages back to you with a termination character (often New Line, <CR><LF>).  It's a Good Idea to configure VISA to use Termination Characters, which means that a VISA Read will take bytes until it sees the Terminator, at which point it stops (and you don't have to wait for it to Time Out, or guess how many bytes to take).  Do not use "Bytes at Port" -- instead, read 1000 bytes (with Termination turned on).  You'll get, in fact, many fewer (maybe a dozen?), but they'll come quickly and they'll be a "complete message" (and your code will be so much neater and will work).

 

Bob Schor 

Message 2 of 9
(4,300 Views)

I hope this isn't terribly out of topic -- does NI-MAX support tcp/ip "probing" of a networked device?

0 Kudos
Message 3 of 9
(4,264 Views)

It depends.  Real-Time systems are generally connected via TCP/IP, and they show up as "remote systems" in MAX.  I have Video Cameras that use TCP/IP, and they show up as "Networked Devices".  We also have some serial Balances that are connected to us via a TCP/IP "concentrator", and it shows up as a VISA device.

 

Not sure how this generalizes ...

 

Bob Schor

0 Kudos
Message 4 of 9
(4,255 Views)

Okay so I tried a few things and here is what I found out.

 

On the NI-MAX 'Measurement & Automation explorer' I selected the port where the microscope is connected and run a simple VISA write and read test.

With the current settings, writting has no error but reading does. It is a 'Hex 0xBFFF0015 Timeout error. Even tried to lower the number of bytes to read and changed the Baud rate but didn't work.

Do you have any suggestions to fix this?

0 Kudos
Message 5 of 9
(4,241 Views)
Solution
Accepted by topic author drummerboy0415

The reason you got no response is that *IDN?\n is not a command that your device recognizes.  That (if memory serves) is the "Who are you?" command sequence that many GPIB devices (which yours probably is not) recognize.

 

For example, I happen to have the manual for a Mettler Balance on my desk.  Its commands are typically one or two letters, with parameters given with space separators, terminated with <CR><LF> (from the Balance manual).  For example, "@<CR><LF>" is the Reset command, while "UPD 10<CR><LF>" means Update the Output information at 10 Hz.

 

I noticed that your earlier post had examples of what looked like commands to the Stage.  I don't have the manual for your microscope, but look at your manual, see how the commands are structured, and try to give a "Reset" or "Initialize" or a "Who Are You" command, appropriate for your instrument.  Then try to read a response.

 

Bob Schor

0 Kudos
Message 6 of 9
(4,228 Views)

Do you have a reason (i.e. manufacturer's documentation) to expect that the Zeiss and Olumpus microscope stages both have the same command sets? Otherwise I'd assume they're different and that the Olympus software will require changes before it'll work with the Zeiss. The receive timeout error you got in MAX doesn't tell you much, basically just that nothing happened when you sent your command, because it isn't valid for this equipment.

0 Kudos
Message 7 of 9
(4,221 Views)

After trying different things, I finally got it working.

 

Zeiss has a driver based on labview on the following link.

 

http://sine.ni.com/apps/utf8/niid_web_display.download_page?p_id_guid=0125C823B14F0E46E0440003BA7CCD...

 

They are a library of labview files that control the micrsocope. I realized that there were some files reading the current z position and moving it to a specific hight. By modifying those files I was able to build to VI the way I wanted. People from Zeiss recommended me to find commands using c++ or c# but didn't look into that option thoroughly. 

Thank you.

 

 

 

0 Kudos
Message 8 of 9
(4,163 Views)

I just tried to use the Olympus one since it was already working and for similcity.

0 Kudos
Message 9 of 9
(4,162 Views)