SCPI in MatLab using pLink

Applications, development tools, FPGA, C, WEB
Post Reply
GeorgB613
Posts: 13
Joined: Tue Mar 24, 2015 10:00 am
Location: Graz, Austria

SCPI in MatLab using pLink

Post by GeorgB613 » Wed Apr 15, 2015 12:34 pm

Hi guys,

For TCP/IP connection in MatLab there are some very good examples. However, these require the Instrument Control Toolbox from Mathworks. In order to overcome this, I established a "raw" plink connection with port 5000 (the same way it is explained for ssh connection http://wiki.redpitaya.com/index.php?tit ... plications).

Using PuTTY it works fine. I just need to type in the scpi command (btw: the scpi-server is running from start up).
In MatLab, my code works only if I create a txt file beforehand, from which I read the command I want to transmit.
The working code reads:

Code: Select all

command=['plink -raw 192.168.1.100 -P 5000 <FileWithCommand.txt'];
[c,data]=dos(command);
Does anybody know how PuTTY builds the protocol? What is the correct setup for my MatLab plink application to directly write the scpi command?

BR
Georg

Nils Roos
Posts: 1441
Joined: Sat Jun 07, 2014 12:49 pm
Location: Königswinter

Re: SCPI in MatLab using pLink

Post by Nils Roos » Wed Apr 15, 2015 1:10 pm

Hi Georg,

This is only a guess, but going by these examples, you could try putting double quotes around the command that you want to send to the scpi-server.

GeorgB613
Posts: 13
Joined: Tue Mar 24, 2015 10:00 am
Location: Graz, Austria

Re: SCPI in MatLab using pLink

Post by GeorgB613 » Wed Apr 15, 2015 1:27 pm

Hi Nils

This was also my first guess ... but unfortunately no.

GeorgB613
Posts: 13
Joined: Tue Mar 24, 2015 10:00 am
Location: Graz, Austria

Re: SCPI in MatLab using pLink

Post by GeorgB613 » Thu Apr 16, 2015 8:54 am

But beside this task, I have another question referring to the scpi APIs itself.
Where do I find the C code running on Red Pitaya?
rp_GenDutyCycle for instance does not set the PWM duty cycle properly. Instead, a sine waveform is generated.

Nils Roos
Posts: 1441
Joined: Sat Jun 07, 2014 12:49 pm
Location: Königswinter

Re: SCPI in MatLab using pLink

Post by Nils Roos » Thu Apr 16, 2015 6:04 pm

GeorgB613 wrote:Where do I find the C code running on Red Pitaya?
A couple of weeks ago, I asked the CTO of Red Pitaya that exact same question. I was told that the matter of open sourcing the API was still under discussion, and I haven't heard any news about that since.

GeorgB613
Posts: 13
Joined: Tue Mar 24, 2015 10:00 am
Location: Graz, Austria

Re: SCPI in MatLab using pLink

Post by GeorgB613 » Tue Apr 21, 2015 2:45 pm

GeorgB613 wrote: For TCP/IP connection in MatLab there are some very good examples. However, these require the Instrument Control Toolbox from Mathworks. In order to overcome this, I established a "raw" plink connection with port 5000
Hey guys,
I have to roll up my concurrent problem using pLink in MatLab.
I accepted to save my commands in a temporary file ... But now, I encountered the following phenomena with sending scpi commands via my MatLab workaround:
- 'SOUR1:VOLT 0.2' works fine to set the signal amplitude
- 'SOUR1:VOLT:OFFS 0.2' throws an ERR! message as response
- 'SOUR1:VOLT:OFFS 0' works fine, though
- SOUR1:DCYC 50' does not set the duty cycle but changes to signal to sine wave again

My framework to build the protocol is completely the same.
And the weirdest thing is that sending all these command directly from PuTTy command line window, it works.
I dispair :-(

User avatar
redpitaya
Site Admin
Posts: 912
Joined: Wed Mar 26, 2014 7:04 pm

Re: SCPI in MatLab using pLink

Post by redpitaya » Fri Apr 24, 2015 4:02 pm

Hi,

SOUR1:DCYC 50 its only for PWM waveform

For example:
'SOUR1:FUNC PWM' ​
- 'SOUR1:VOLT 0.2'
- SOUR1:DCYC 50'

If you wish to have a half of sine period then you must use BURST or ARBITRARY mode.
In week or two there will be new ecosystem with new SCPI commands and solved bugs (current BURST mode has some)

Regards

Post Reply
jadalnie klasyczne ekskluzywne meble wypoczynkowe do salonu ekskluzywne meble tapicerowane ekskluzywne meble do sypialni ekskluzywne meble włoskie

Who is online

Users browsing this forum: No registered users and 95 guests