11-30-2015 10:05 AM
Hi
I am controlling a stepper motor using the example Basic Serial Write and Read.vi through string commands to the VISA Write. The programmable drive allows me to insert a string where all paramenter of motion are encapsulated (distance, speed, acceleration, etc.). I can modify the string by breaking it down and then append its parts to input the complete string using controls, but after the motion I would like to send automatically a "current position string" command to the drive so the drive sends me back the motor position when it ends the motion. How can I write a structure such that a string can be sent to VISA Write automatically after execution of the first string? I have attached the block diagram. Thanks for any feedback.
Solved! Go to Solution.
11-30-2015 10:09 AM
Hi fjimenez,
doing one thing first followed by a different thing second is quite easy…
1) The quick&dirty way is to copy your code and execute it one after the other.
2) The more reliable way is to use a loop to execute code more than once. Combine it with LabVIEWs "autoindexing" feature of loop tunnels and an array of commands you want to send…
11-30-2015 10:13 AM
11-30-2015 10:15 AM
Hi GerdW, thanks for your prompt reply. Could you recommend me a particular loop to accomplish this? I was thinking of a for loop, but couldn't manage to do it.
Thanks,
Francisco
11-30-2015 10:19 AM
Thanks for your reply, I will have to read about it as I am a new labview user and don't know what a state machine is and didn't know there could be a problem wih configuring the port each time I send a string. Thanks, Francisco.
11-30-2015 10:40 AM - edited 11-30-2015 10:41 AM
Hi Francisco,
as you state you're new to LabVIEW and judging from your questions I recommend to take all those free resources offered by NI for LabVIEW beginners!
There are (lots of free) online courses!
Using "loops" isn't LabVIEW specific, they are the same in every programming language.
And "state machines" aren't LabVIEW specific too, you also find them implemented in nearly all programming languages. But LabVIEW comes with a ready-to-use example state machine…
11-30-2015 10:47 AM
The Simple State Machine template that ships with LabVIEW is really the best way for new developers to get familiar with LabVIEW while utilizing a semi-scalable architecture.
Here's a broad example of how a state machine works:
"Give me six hours to chop down a tree and I will spend the first four sharpening the axe." - Abraham Lincoln
The free tutorials for beginners that others have mentioned can be found in the Unofficial Rules and Guidelines link in my signature.
Thanks are best given in the form of Kudos and Marked Solutions. You received assistance from some top-tier LabVIEW experts here (Dennis and GerdW = top of the top), whom I'm sure would appreciate your gratitude. Marked Solutions help others find this post when they have the same issue and Kudos motivate us all to keep coming back to help!
Cheers
--------, Unofficial Forum Rules and Guidelines ,--------
'--- >The shortest distance between two nodes is a straight wire> ---'