arbitrary function generation with scpi commands in Matlab

Applications, development tools, FPGA, C, WEB
Post Reply
adam.polak
Posts: 37
Joined: Mon Jul 28, 2014 11:32 am

arbitrary function generation with scpi commands in Matlab

Post by adam.polak » Wed Jun 24, 2015 7:16 pm

Hello Redpitayans!

I have a quick question and I guess the answer is quite simple and it's only me somehow doing some stupid mistake leading me to dead end.

I'm trying to generate arbitrary signal from RF output to drive my hardware with voltage values of my choice. Up till now I was generating sine or triangle signals without any problems. Today I have prepared a vector of 16384 values between 0 and 1 corresponding to the voltage values I wish generated signal should follow.

in the Matlab I'm sending commands to create arbitrary function and the values for it as follows (where 'vector' is the name of matlab variable containing mentioned vector of values for this signal. )

fprintf(tcpipObj,'SOUR1:FUNC ARBITRARY');
fprintf(tcpipObj,'SOUR1:TRAC:DATA:DATA vector' );
fprintf(tcpipObj,'OUTPUT1:STATE ON');
fprintf(tcpipObj,'SOUR1:BURS:STAT ON');

but nothing is happening(of course there are other parts of code necessary - this is only the bit to define the signal generation). I tried to type some values manually as in the guide for SCPI commands, but still there is no signal generated - just flat line. I guess that I'm missing some of other commands , but I'm not sure what is wrong. If anybody could suggest working example for part of code for arbitrary signal generation based on values from an array I'd be grateful for help.

all the best!
Adam

Geoffrey
Posts: 5
Joined: Fri Jun 05, 2015 1:34 pm

Re: arbitrary function generation with scpi commands in Matl

Post by Geoffrey » Thu Jun 25, 2015 10:16 am

From the looks of it you are literally sending

'SOUR1:TRAC:DATA:DATA vector'

to the Red Pitaya. How would it know what 'vector' means? I haven't used this function but I would have thought you'd need to convert vector to a string format then concatenate it with 'SOUR1:TRAC:DATA:DATA ' and send that as a string.

Apologies if I am looking too basic but these things happen, like forgetting scpi-server &, which I trust you have also done.

adam.polak
Posts: 37
Joined: Mon Jul 28, 2014 11:32 am

Re: arbitrary function generation with scpi commands in Matl

Post by adam.polak » Thu Jun 25, 2015 2:25 pm

Thanks Geoffrey for your reply!

In my post I wrote only simple line. What I did was indeed to try this as mentioned, but then I quickly realized what you said - for scpi command word 'vector' is only a string and has nothing to do with the content of matlab array. I tried to Concatenate 'SOUR1:TRAC:DATA:DATA ' with the vector converted to string but if it did not help either. I thought that maybe the separators are different so I tried just to type some figures directly after DATA as in the example given in commands guide, but this also resulted with a flat line.. That's why, after going back to basics and no success anyway, I came to ask for help...

...and yes, scpi-server runs OK, RP is responding correct and I can easily generate other functions and acquire the data, only I'm not sure what I'm doing wrong with this arbitrary function...

anyway - thank you for fast reply!

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

Re: arbitrary function generation with scpi commands in Matl

Post by redpitaya » Wed Jul 01, 2015 11:54 am

Hi,
You can find example on this page
http://redpitaya.com/make-your-app/cust ... enerating/
Best, Red Pitaya

adam.polak
Posts: 37
Joined: Mon Jul 28, 2014 11:32 am

Re: arbitrary function generation with scpi commands in Matl

Post by adam.polak » Thu Jul 02, 2015 6:11 pm

Thank you! I was so 'mind fixed' on the word ARBITRARY that demo of generating custom wave somehow slipped my eye - another stupid mistake from my side..
thank you - now it works, actually i was doing the same but forgot to remove the end of the string and i think this was causing problems.. anyway - topic closed.
Thank you redpitaya!!!

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 91 guests