Sending PuTTY-like command through TCPIP or VISA
18 次查看(过去 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.
采纳的回答
更多回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!