Sending PuTTY-like command through TCPIP or VISA

15 次查看(过去 30 天)
Hello all,
I am having issues with sending commands to a piece of hardware through MATLAB. I can easily PuTTY into it, and send the required commands, but when I try via MATLAB, not so much.
I initially did a system(command) to log into the device via PuTTY/Plink with echo on, and can send messages through the command window, but I wish to programattically do this. I noticed that the system function locks up matlab while it is executing, making sending any MATLAB commands impossible during the time that the system function is working.
a (somewhat) strange thing is that when I am waiting to send a command in the command window, if I highlight the command text, and hit F9, the command is sent through MATLAB into the PuTTY session.
Getting down to it - I want to send commands to my device that mimic these commands in PuTTY via TCPIP or VISA connection. I am able to successfully open a connection:
boxID = visa('ni','TCPIP0::<myIP>::<myPort>::SOCKET');
fopen(boxID);
when I send a SCPI command (box is not SCPI complient), I get a response that is a square character. I am assuming that this is the result of a response from the device.
fopen(boxID);
fprintf(boxID,'%s\n','*IDN?');
response = fscanf('boxID','%s\n');
fclose(boxID)
fprintf('Response = %s',response); % output = square shaped char
I have tried to change the *IDN? command to my commands, and they do not work. MATLAB, however, does not crash.
I am at a loss here. Anyone know how to mimic PuTTY commands in MATLAB via TCPIP or VISA? An examply command in putty is :
uv % get status
uw 0x00 % turn off
Any help is greatly appreciated.

采纳的回答

Vinod
Vinod 2019-9-17
If you can PuTTY into the box, then it is likely running an SSH server. Try using this:
specifically the ssh2* commands in it to see if it does what you want.
  2 个评论
Ruger28
Ruger28 2019-9-18
Thank you for your relpy.
I attempted to run this, and it is hung on something, which I am assuming is the SSH session.
When I step through, the br.readLine() command never finishes executing. If I supress the command response this isnt an issue, but my commands get sent and they do not control my hardware. Any idea on next steps?
Vinod
Vinod 2019-9-18
I'd reach out to the author of the submission and see if he can give you some troubleshooting tips.

请先登录,再进行评论。

更多回答(0 个)

产品


版本

R2018b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by