Author Topic: Rigol DG800 SCPI, VISA, MATLAB  (Read 316 times)

0 Members and 1 Guest are viewing this topic.

Offline gossamer

  • Contributor
  • Posts: 7
  • Country: ie
Rigol DG800 SCPI, VISA, MATLAB
« on: May 29, 2019, 06:44:01 am »
I am trying to send generated waveform from Matlab to DG800 and play it as an arbitrary waveform. Documentation is bit cryptic (because I am a newbie in SCPI automation) ..

After installing NI-VISA drivers on my computer I am able to connect to the DG800 and query *IDN?
 
Now the fun begins. I dont have a clue where to start from there and DG800 programming guide is completely useless for beginners .. there are no explanation on the sequences of the commands to load the function into the memory and output it on one of the channels..

I would appreciate if someone could give me an example on how to send and play the data points via SCPI

What I have now, but for some reason it just selects the "Sinc" function and plays that:

Code: [Select]
fprintf(obj1,'%s\r\n','*RST;*CLS;*OPC?');
fprintf(obj1,'%s\r\n',':SOUR1:APPL:ARB 500');
fprintf(obj1,'%s\r\n',':SOUR1:DATA VOLATILE,-0.5, 0.8, 1.2, 0.7, 0.4');
fprintf(obj1,'%s\r\n','OUTP1 ON');

 |O
 

Offline gossamer

  • Contributor
  • Posts: 7
  • Country: ie
Re: Rigol DG800 SCPI, VISA, MATLAB
« Reply #1 on: May 30, 2019, 07:03:42 am »
I was able to resolve this.
I used the Rigol waveform generator application (Ultrastation). I generated some random curve using few points and sent it over to the DG800 via USB NI-VISA driver.
Before that, of course, I installed this sniffer https://desowin.org/usbpcap/index.html and enabled tracing on the usb controller.
After sending the waveform with Ultrastation, I opened the dump file in Wireshark and voila, protocol was there. Its not really in the nicely readable format, but its easy to connect the dots (pun intended). ::)
 
The following users thanked this post: thm_w

Offline thm_w

  • Super Contributor
  • ***
  • Posts: 1194
  • Country: ca
Re: Rigol DG800 SCPI, VISA, MATLAB
« Reply #2 on: May 31, 2019, 08:19:18 am »
I was able to resolve this.
I used the Rigol waveform generator application (Ultrastation). I generated some random curve using few points and sent it over to the DG800 via USB NI-VISA driver.
Before that, of course, I installed this sniffer https://desowin.org/usbpcap/index.html and enabled tracing on the usb controller.
After sending the waveform with Ultrastation, I opened the dump file in Wireshark and voila, protocol was there. Its not really in the nicely readable format, but its easy to connect the dots (pun intended). ::)

I wonder if they purposefully left this out of the programming guide.

Can you post some of your code here in case someone else needs to perform the same task?
Thanks
 

Offline gossamer

  • Contributor
  • Posts: 7
  • Country: ie
Re: Rigol DG800 SCPI, VISA, MATLAB
« Reply #3 on: May 31, 2019, 05:35:39 pm »
Quote
Can you post some of your code here in case someone else needs to perform the same task?

What I end up with is this template:

Code: [Select]
fprintf(obj1,'%s\r\n',':SOURCE1:APPL:SEQ');
fprintf(obj1,'%s\r\n',':SOURCE1:FUNC:SEQ:FILT STEP');
fprintf(obj1,'%s\r\n',':SOURCE1:TRACe:DATA:DAC16 VOLATILE,END,#23200001c2cac4231529e534141ca1ac0e53fb967aff6e1b22699d6a2dd00000a');
fprintf(obj1,'%s\r\n',':SOURCE1:VOLT:UNIT VPP');
fprintf(obj1,'%s\r\n',':SOURCE1:VOLT 4');
fprintf(obj1,'%s\r\n',':SOURCE1:FUNC:SEQ:SRAT 20000');
fprintf(obj1,'%s\r\n','OUTP2 OFF');
fprintf(obj1,'%s\r\n','OUTP1 ON');

Documentation is really bad as from the documentation I would never guess which function should I select if I want to play arbitrary wave (first two commands).
Command 3 is bit cryptic in the beginning, but it makes sense when you read between the lines of the guide :)
For shorter waveforms (minimum is 16 points), command needs to have an "END" flag.

Data parameter starts with #. (#23200001c2cac4231529e534141ca1ac0e53fb967aff6e1b22699d6a2dd00000a) then it has numeric number, which represents the number of digits of the size of the data ( :palm: ) in my case it was 2 as I have 32 bytes of data (3 and 2).
And after number of bytes (numeric value as well), data points are in HEX (4 characters per point; 2 bytes). Also there seems to be an error in the documentation because it says that values for the points can be between 0000 and 3fff, which is 14 bit value, not the 16 bit! And what Rigol software generated and can be seen in the stream I attached, has points (d6a2 dd00) that are 16 bit ?!
« Last Edit: May 31, 2019, 05:46:50 pm by gossamer »
 
The following users thanked this post: thm_w


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf