LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Control galvo in x-y directions

Hello, 

 

We are currently using a resonant-galvo scanner from Thorlabs (LSKGR-08) which is connected to NI PXie 6363 and NI PXie 1073. We are looking to control the scanner to move the mirror in the x and y directions. This is the code we have so far in which we are able to control the field size and alignment position. 

 

Any suggestions or help is greatly appreciated, thank you!

0 Kudos
Message 1 of 2
(421 Views)

It is painful to look at your code.  What I see is lots of code that looks like this:  Not very helpful, I'm sure you'llUseless Code.png

agree. 

  • Learn how to create sub-VIs and "bury the picky detail that we don't need to see while trying to understand the Big Picture in a sub-VI (give it a meaningful name, like "Current Field Size Position", or "Move to Field Size".
  • Use the Error Line "almost everywhere".  Try to never use the Frame Sequence (there are places it is useful, but an ordinary VI is usually not one of them.
  • You probably should be using something like the Queued Message Handler or a State Machine design, with the States being the "Things you want to do" or "the Decisions You Need to Make".
  • Put LabVIEW away and break out your Favorite Word Processor.  Write a one-page summary of what you what this program to do (don't worry about how it does it).  This might be "Get a set of parameters from the User describing where to start the Galvo", "Get a second set saying how to Move the Galvo, including how fast and where to", "Start the Movement", "Stop the Movement", maybe other things.
  • You should have an "army of sub-VIs" that do all of the Heavy Lifting.  Once you say "I want to go to 200, 340", you call "Move to X, Y" and give it a Cluster representing Where and maybe How Fast.  Just as you group "operations to do" into sub-VIs, you should think about organizing your Data into sensible "conglomerates" using Clusters (where you can assign "User-friendly" names like X, Y, X Velocity, Y Acceleration, etc.).
  • One (crude, but effective) way to get a sense of the quality of your code is to look at a typical VI or sub-VI.  Strive to get every Block Diagram to fit on a "typical Laptop Screen" (the Top Level VI of a Project I'm currently developing with a few hundred VIs and Controls is roughly 1000 x 700 pixels, and easily meets the "Labtop Screen" test), as do all the other VIs in this Project). 

Bob Schor

0 Kudos
Message 2 of 2
(360 Views)