Sending PuTTY-like command through TCPIP or VISA

19 Ansichten (letzte 30 Tage)
Ruger28
Ruger28 am 13 Sep. 2019
Kommentiert: Vinod am 18 Sep. 2019
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.

Akzeptierte Antwort

Vinod
Vinod am 17 Sep. 2019
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 Kommentare
Ruger28
Ruger28 am 18 Sep. 2019
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 am 18 Sep. 2019
I'd reach out to the author of the submission and see if he can give you some troubleshooting tips.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Produkte


Version

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by