10-18-2012 11:16 PM
Hi,
I am currrently using the command prompt in the windows to try to send a command to the microcontroller that is connected through TCP connection.
I am able to use the normal cmd.exe to send the command but am unable to send all the command successfully using labview.
The Vi. that I am using the the system exec.vi found in labview connectivity section.
Basically what I want to send is "telnet A1" in the cmd.exe to establish connection to the microcontroller, followed by "FOR A1 100 GO" which will be intepreted by the microcontroller to make the necessary motion. But currently, the problem is that I can only establish connection using the system exec.vi but am unable to send the second part of the message "FOR A1 100 GO".
My command line i tried typing is cme.exe /K telnet A1 & FOR A1 100 GO. it seems that labview is only able to execute the first command part. Is there any other alternatives?
Thanks everyone for your help.
Solved! Go to Solution.
10-19-2012 12:05 AM
Why not use the TCP VIs to communicate directly with the device? Its seems like an overly complicated method to use the systemexec call and a command line telnet.
10-19-2012 12:13 AM
Hi,
Yes, I have tried using TCP command, but the program is very unstable as sometimes I am unable to connect unless i restart my computer and network. It seems that somehow the port is used, but I can always access my microcontroller using the command prompt even when the error occurs. Do you happen to know what is the underlying problem? Thanks for your help.
Jh
10-19-2012 12:36 AM
Without seeing your code I would have no idea. Also, are you checking for errors and handling them?
10-19-2012 01:54 AM
Hi,
Thanks for the help, the picture shows 1 of the error which state Error 56, the error occurs occasionally whenever I have used the command prompt to send a message to the microcontroller.
Alternatively, there are times when no errors occur but my microcontroller does not move as well. It does move if I were to send the command through the cmd prompt.
And I have attached a picture of my program as well. I am currently using Labview 2010 32bit. Thanks.
Jh
10-19-2012 08:04 AM
I'd start by placing the Delay inside the Write-flat sequence. It's happened several times to me that a 50-100ms wait between write and reading the result solves the problem. Also run the code in Highlight mode, if it works then, it's definatly a timing issue.
/Y
10-19-2012 08:36 AM
10-19-2012 10:36 AM
I suspect that there are timing issues with this code. Forst, you should cleanup it up as it is very difficult to follow. Wires are hidden under objects, the whole thing is much larger than a typical display, and the code is generally very disorganized. I would also suggest you look into using a state machine as well as an event structure to catch the UI events such as the start button.
10-22-2012 03:12 AM
Hi,
Thanks for everyone help, after cleaning out the code, i realise that it actually the command send to the microcontroller that is the problem, as it require me to key in the enter key. And it was only possible after cleaning up the whole program and trying to isolate each event to run separately. Thanks everyone for your advice and help.