LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

ThorLabs Communication

Hello,

 

I am trying to communicate with a ThorLabs KCube controller. I am trying to do it just through VISA and not use any .NET or DLL stuff. I can connect just fine, but I am having trouble getting the commands syntaxed correctly... Does anyone know how I can send commands via VISA?

 

Attached is the User Manual for the software, it explains the syntax. Also attached is a screen shot of my code.

 

Thanks in advance for any help!

SM

Download All
0 Kudos
Message 1 of 25
(4,490 Views)

Start with the shipping example.  Help >> Find Examples, and search for Simple Serial.  This is a very basic VI that sends some data, waits, and then reads all the data waiting on the port.  You can right click the string and change it to a Hex view to see the raw data.

 

And in the future when posting code, actually post the code, not pictures of the code.  You wouldn't post an image of notepad on a text based language.  Images are not executable, but VIs and Snippets are.

Message 2 of 25
(4,484 Views)

Hooovahh,

 

Thanks for the reply. I looked at the example you mentioned. Similar to what I have, but still, the identification request is in the wrong syntax for a ThorLabs controller. Did you glance at the User Manual I attached in my initial post? Maybe you can make sense of how to send a string with the correct syntax.

 

Attached is my VI. You'll have to open up the README and go to "Connect" VI. That's where I am working.

 

Thanks for any help,

SM

Download All
0 Kudos
Message 3 of 25
(4,466 Views)

That's a big manual.  It would help if you pointed out which of those hundreds of pages you are looking at.

0 Kudos
Message 4 of 25
(4,456 Views)

Page 21 for example, just the identification request. How would I send that command in the correct syntax? I've tried just sending it as a string, as a byte array (type casted), and 1D string array. None of these worked.

 

Thanks,

SM

0 Kudos
Message 5 of 25
(4,453 Views)

Did you send the VI that you showed in the earlier image?  The attached VI is only a "tree" VI.

 

In your image, you have an array of integers.  Are they U8 or something else?  Are they set for hex display or decimal display?  The manual seems to show numbers like the 21 you have as being in hex display.  If you are in decimal display for that 21, it is a completely different byte.

0 Kudos
Message 6 of 25
(4,449 Views)

Yes, in the "tree" you will need to find the "Communications" section at the bottom and click on "srsrgac Conect" and I am working in the "default" case.

 

Yes they are U8. I ahven't done anything with display so whatever the default is, that's what it is. Does the display affect how the message gets sent?


Thanks,

SM

0 Kudos
Message 7 of 25
(4,446 Views)

I made the radix visible and saw it was "d" which means decimal.  You want to make it say "x".

 

It doesn't affect how the message gets sent.  But it does affect what message gets sent.  If you are supposed to be sending 21 hex, that is equal to a byte value of 33 decimal.  It should be entered as either 33 into a decimal display constant, or as 21 into a hex display constant.  If you are typing 21 into a decimal display constant, then you are sending 21 decimal.  Two completely different values.

0 Kudos
Message 8 of 25
(4,437 Views)

Ok I gotcha. I changed it to "x". It still won't work though. I also tried the request on page 107 in the manual, which is a controller specific command. That didn't work either. Basically my program just blocks at the "Write VISA" function and won't even let me abort the program...

 

Any other ideas?


Thanks,

SM

0 Kudos
Message 9 of 25
(4,427 Views)

Did you actually retype in the constants once you changed the display to "x"?  If you have 21 typed in as decimal, changing it to hex will show up as x15.  You need to retype in the 21 so it can be x21.

0 Kudos
Message 10 of 25
(4,418 Views)