Author Topic: SCPI commands on Siglent scope  (Read 2879 times)

0 Members and 1 Guest are viewing this topic.

Offline PatrickBTopic starter

  • Contributor
  • Posts: 48
  • Country: fr
SCPI commands on Siglent scope
« on: May 05, 2023, 03:27:20 pm »
I am writing software (with Visual Studio C#) for remote control of my SDS1204X-E.
I had already made a similar program for my old DS1102Z-E but with much less functions, but it worked

Here are a few lines of code in my program, with explanations of their functions:
    mbSession.RawIO.Write("TRSE EDGE,SR,C1");               //  program the trigger on edge of channel 1
    mbSession.RawIO.Write("C1:TRSL POS");                     //  program the trigger on rising edge
    mbSession.RawIO.Write("SCDP");                                // screen dump
    byte[] aDataScope = mbSession.RawIO.Read(768067);  // returns the data of bmp file
    MemoryStream streamImageReceived = new MemoryStream(aDataScope);
    PBx_TraceScope.Image = Image.FromStream(streamImageReceived);  // display bmp file from scope on my PC screen

Each of these instructions (mbSession.RawIO.Write) work if executed separately.
But placed one after the other, the "SCDP" instruction does not return the update of the 2 previous lines.
The scope screen is updated correctly but not the display on my PC.

The solution would be this:
mbSession.RawIO.Write("TRSE EDGE,SR,C1");            // trigger on edge of channel 1
mbSession.RawIO.Write("C1:TRSL POS");                  // trigger on rising edge
Thread. Sleep(500);                                                    // 500ms delay
mbSession.RawIO.Write("SCDP");                             
...

I find that this solution is not the best because  I am not sure that the delay will be sufficient with another programming of the scope. It may depend on different parameters of the scope such as the speed of the time base, the number of points of forms, ...
Of course, a delay of several seconds would be the solution, but I find it annoying to wait for the reaction of a program after having clicked on a button.

My explanation would be that the Siglent does not completely <<finish>>  SCPI instruction before starting the next one. :--

I hope I have been clear with my explanations and if anyone has already encountered this problem, solved or not, has experience with C#, SCPI Siglent, thank you for your feedback.
 

Offline tv84

  • Super Contributor
  • ***
  • Posts: 3345
  • Country: pt
Re: SCPI commands on Siglent scope
« Reply #1 on: May 05, 2023, 03:47:02 pm »
You need to query the SCPI state machine in order to see if the previous SCPI command has already finished.

It can be done in a loop and as soon as you get an OK, then you can proceed with the next SCPI command.
 

Offline PatrickBTopic starter

  • Contributor
  • Posts: 48
  • Country: fr
Re: SCPI commands on Siglent scope
« Reply #2 on: May 05, 2023, 04:07:43 pm »
That's what I thought at first too.

I did a while loop with the command *OPC? ((Operation Complete), but the return is still 1. It doesn't work.
 

Offline colorado.rob

  • Frequent Contributor
  • **
  • Posts: 420
  • Country: us
Re: SCPI commands on Siglent scope
« Reply #3 on: May 05, 2023, 04:41:24 pm »
I did a while loop with the command *OPC? ((Operation Complete), but the return is still 1. It doesn't work.
So *OPC? before SCDP returns 1 and the SCDP command fails? That sounds like a bug. Contact Siglent. SiglentNA has been responsive when reporting similar SCPI problems in the past. Hopefully they can provide a work-around while they fix it.
 

Offline tv84

  • Super Contributor
  • ***
  • Posts: 3345
  • Country: pt
Re: SCPI commands on Siglent scope
« Reply #4 on: May 05, 2023, 08:18:49 pm »
I did a while loop with the command *OPC? ((Operation Complete), but the return is still 1. It doesn't work.

Don't use just OPC.

Use the full *ESR? like here.

Study the different states where you are successful and not, and you'll see how to do it.
 

Online tautech

  • Super Contributor
  • ***
  • Posts: 29810
  • Country: nz
  • Taupaki Technologies Ltd. Siglent Distributor NZ.
    • Taupaki Technologies Ltd.
Re: SCPI commands on Siglent scope
« Reply #5 on: May 05, 2023, 09:00:43 pm »
FYI, command set documents can be sourced here after navigating to the instrument in use download page:
https://int.siglent.com/download/documents/

For SDS1*04X-E:
https://int.siglent.com/u_file/document/SDS1000%20Series&SDS2000X&SDS2000X-E_ProgrammingGuide_PG01-E02D.pdf
Avid Rabid Hobbyist.
Some stuff seen @ Siglent HQ cannot be shared.
 

Offline tv84

  • Super Contributor
  • ***
  • Posts: 3345
  • Country: pt
Re: SCPI commands on Siglent scope
« Reply #6 on: May 05, 2023, 09:29:34 pm »
That international link isn't so international here in Europe...

https://www.siglenteu.com/resources/documents/
 

Online tautech

  • Super Contributor
  • ***
  • Posts: 29810
  • Country: nz
  • Taupaki Technologies Ltd. Siglent Distributor NZ.
    • Taupaki Technologies Ltd.
Re: SCPI commands on Siglent scope
« Reply #7 on: May 05, 2023, 09:32:30 pm »
Nor is a EU link for those in the US.  :P
https://siglentna.com/resources/documents/
Avid Rabid Hobbyist.
Some stuff seen @ Siglent HQ cannot be shared.
 

Offline tv84

  • Super Contributor
  • ***
  • Posts: 3345
  • Country: pt
Re: SCPI commands on Siglent scope
« Reply #8 on: May 05, 2023, 09:35:10 pm »
But these Siglent manuals don't include *ESR? command...  :-//  :palm:
 

Offline dobsonr741

  • Frequent Contributor
  • **
  • Posts: 706
  • Country: us
Re: SCPI commands on Siglent scope
« Reply #9 on: May 06, 2023, 12:04:41 am »
I think it's mandatory to implement.
 

Offline PatrickBTopic starter

  • Contributor
  • Posts: 48
  • Country: fr
Re: SCPI commands on Siglent scope
« Reply #10 on: May 06, 2023, 08:22:19 am »
If I understand what is happening with my problem, my oscilloscope does not handle the SCPI command input queue very well.
It begins to process an order while the previous one has not been completely completed.

I can say this because the SCDP instruction returned a second time allows the display to be updated correctly on my PC with the correct programming of the trigger.

I wonder if this is a bug of the SDS1000 series...

The Siglent programming manual for the SDS1204X-E is not complete, a lot of instructions are missing.
@tv84 sent me a useful link and I just found the full Siglent manual for the SDS1000 series:
https://int.siglent.com/upload_file/user/SDS1000CFL/SDS1000_RemoteManual_RC01012-E02B.pdf
There are many instructions for status and error registers (ESR, ESE, STB, CMR, ....). The explanations are not always very clear  and understandable but I will try to do something about it.
 

Offline PatrickBTopic starter

  • Contributor
  • Posts: 48
  • Country: fr
Re: SCPI commands on Siglent scope
« Reply #11 on: September 15, 2023, 07:52:43 am »
In order to have a solution and an explanation, I contacted Siglent Europe a long time ago. For your information, here is the latest explanation I received:

The process of sending from scpi to machine to complete this operation:
1, SCPI send -> 2, configuration layer (synchronous message), SCPI at that layer that is returned -> 3, bottom layer take effect (synchronous message) about 50ms, UI update (asynchronous message) about 200ms.
The current mechanism of OPC is to return the register status bit after judging the completion of command sending. Therefore, the image returned by the SCDP command is the image of the machine that has not been operated (the user interface has not been refreshed). If the OPC mechanism is changed to return after refreshing the user interface, the program will run much slower. The reason we say this is not a problem is that similar machines from other brands use the same mechanism.
 
The following users thanked this post: tv84

Offline SparkyM8

  • Newbie
  • Posts: 7
  • Country: gb
Re: SCPI commands on Siglent scope
« Reply #12 on: September 15, 2023, 01:33:59 pm »
You will find that many of the cheaper scopes do not implement SCPI fully.
Only the bare minimum to control and get data is present.
Many of the registers just don't exist.
You will never get a 0 response to *OPC?
Think I mentioned this in a DS1054Z post a good while back.
Siglent used to have one dreadful programming manual for all scopes that they just kept adding to. Finding out what applied to a particular scope was difficult.
Good luck.
 

Online tautech

  • Super Contributor
  • ***
  • Posts: 29810
  • Country: nz
  • Taupaki Technologies Ltd. Siglent Distributor NZ.
    • Taupaki Technologies Ltd.
Re: SCPI commands on Siglent scope
« Reply #13 on: September 15, 2023, 08:43:34 pm »
Siglent used to have one dreadful programming manual for all scopes that they just kept adding to. Finding out what applied to a particular scope was difficult.
Not the case now.  :P

The low value DSO's do share a common one and the higher value units have model specific programming manuals but with a supported models list.
Couple of examples:
https://int.siglent.com/u_file/document/SDS1000%20Series&SDS2000X&SDS2000X-E_ProgrammingGuide_PG01-E02D.pdf
https://int.siglent.com/u_file/download/23_07_25/ProgrammingGuide_EN11D.pdf
Avid Rabid Hobbyist.
Some stuff seen @ Siglent HQ cannot be shared.
 

Offline colorado.rob

  • Frequent Contributor
  • **
  • Posts: 420
  • Country: us
Re: SCPI commands on Siglent scope
« Reply #14 on: September 15, 2023, 09:25:18 pm »
It looks like OP just needs to use the INR? query to determine when the data has been captured before executing the SCDP command.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf