07-13-2010 10:01 AM
Hello all,
I am afairly new at using LabVIEW... I have only the basic subset of skills thus far. So I would like to respectfully request that when you respond to be a all-encompassing as possible please. In fact, an example project with lots of explanation would be absolutely fantastic.
Essentially, I have a Kollmorgan AKD motor controller device (specifically the AKD-x00306 model) that controls a servo controller. It uses the TELNET protocol, amongst others, to communicate with it. Thus far, I have been able to use MS TELNET service and Kollmorgans workbench to communicate with the device with great success. Although the Kollmorgan workbench is a good program, I am looking for more accurate control.
Here is the question:
What is the best method of sending mulitple commands like that of the TELNET protocol (to where I can enter one command, have the Kollmorgan execute, enter another command, execute,... for multiple iterations of this... with out disconnecting)? In other words, I want to be able to enter several commands, one at a time, and the Kollmorgan execute each command after each time the enter key has been hit (with out having to restart the application... due to the disconnection). So far, I have set up a while loop (with no success) and a for loop (with no success).
With out the involvement of a loop, I can send a command and have it execute just fine... the connection just gets disrupted/disconnected. Attached is my working model of the program with out the loop. You will find that it only allows for one execution (using the "run once"). if you use the "continuous run" button, the buffer is overrun (as you most likely know).
Thanks in advance.
Solved! Go to Solution.
07-13-2010 10:13 AM - edited 07-13-2010 10:15 AM
A for loop should work just fine if you create an array of commands and pass it through the for loop. A for loop auto-indexes an array input. In other words, for each iteration, the next element of the array is read from the array until all elements have been read. The for loop iteration count is equal to the number of elements in the array.
Next time you have a problem, post the code that you are having a problem with - i.e. the code with a loop. Much easier to fix something when someone can see what you have done.
07-13-2010 10:37 AM
Okay... so a couple of questions please. What type of array are you suggesting?
I originally tried this for a WHILE and a FOR loop. When using the FOR loop in trying to connect the "telnet connection out" from the "telnet write" to the "telnet close connection" , I get a broken wire symbol on both the TELNET CONNECTION and the ERROR IN. Essentially it is an "indexing error." I am not sure what is going on here. Would you mind explaining this please?
Thank you much.
07-13-2010 10:46 AM
The type of array is exactly what is shown - a string array. It's a string you are trying to write, correct?
By default, a for loop will auto-index every output. That means it will create an array. Just right click on the exit tunnel and select 'Disable indexing'.
07-13-2010
12:21 PM
- last edited on
05-09-2025
07:58 PM
by
Content Cleaner
And of course, there's always the help...
For Loop and While Loop Structures
07-13-2010 12:56 PM
I gotcha! What you say makes sense; however, when I "highlight the execution," the data is shown to pass from the array and the TELNET connection to the outside walls of the loop. Once there, the connection stops and I get timed out. This is very interesting because without the loop, it works (and so long as there is only one character string that is being inputted).
Please take a look at my setup and tell me what I am doing wrong.
Again, thank you.
07-13-2010 01:05 PM
You have 2 problems:
07-13-2010 03:30 PM
Thank you for all your help. You know... it is always the simplest things that we overlook that cause the majority of the problem. I was able to get it to work with the FOR loop. Thank you tons for the insight.