SCPI commands on Siglent scope  - Page 1
Forum section: electronics / testgear

author: PatrickB
author_rank: Regular Contributor
timestamp: May 05, 2023, 03:27:20 pm
content: 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 workedHere 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 1mbSession.RawIO.Write("C1:TRSL POS"); // program the trigger on rising edgembSession.RawIO.Write("SCDP"); // screen dumpbyte[] aDataScope = mbSession.RawIO.Read(768067); // returns the data of bmp fileMemoryStream streamImageReceived = new MemoryStream(aDataScope);PBx_TraceScope.Image = Image.FromStream(streamImageReceived); // display bmp file from scope on my PC screenEach 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 1mbSession.RawIO.Write("C1:TRSL POS"); // trigger on rising edgeThread. Sleep(500);// 500ms delaymbSession.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.

author: tv84
author_rank: Super Contributor
timestamp: May 05, 2023, 03:47:02 pm
content: 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.

author: PatrickB
author_rank: Regular Contributor
timestamp: May 05, 2023, 04:07:43 pm
content: 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.

author: colorado.rob
author_rank: Frequent Contributor
timestamp: May 05, 2023, 04:41:24 pm
content: Quote from: PatrickB on May 05, 2023, 04:07:43 pmSo *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.

author: tv84
author_rank: Super Contributor
timestamp: May 05, 2023, 08:18:49 pm
content: Quote from: PatrickB on May 05, 2023, 04:07:43 pmDon't use just OPC.Use the full *ESR? likehere.Study the different states where you are successful and not, and you'll see how to do it.

author: tautech
author_rank: Super Contributor
timestamp: May 05, 2023, 09:00:43 pm
content: 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

author: tv84
author_rank: Super Contributor
timestamp: May 05, 2023, 09:29:34 pm
content: That international link isn't so international here in Europe...https://www.siglenteu.com/resources/documents/

author: tautech
author_rank: Super Contributor
timestamp: May 05, 2023, 09:32:30 pm
content: Nor is a EU link for those in the US.https://siglentna.com/resources/documents/

author: tv84
author_rank: Super Contributor
timestamp: May 05, 2023, 09:35:10 pm
content: But these Siglent manuals don't include*ESR?command...

author: dobsonr741
author_rank: Frequent Contributor
timestamp: May 06, 2023, 12:04:41 am
content: I think it's mandatory to implement.

author: PatrickB
author_rank: Regular Contributor
timestamp: May 06, 2023, 08:22:19 am
content: 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.pdfThere 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.

author: PatrickB
author_rank: Regular Contributor
timestamp: September 15, 2023, 07:52:43 am
content: 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.

author: SparkyM8
author_rank: Newbie
timestamp: September 15, 2023, 01:33:59 pm
content: 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.

author: tautech
author_rank: Super Contributor
timestamp: September 15, 2023, 08:43:34 pm
content: Quote from: SparkyM8 on September 15, 2023, 01:33:59 pmNot the case now.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.pdfhttps://int.siglent.com/u_file/download/23_07_25/ProgrammingGuide_EN11D.pdf

author: colorado.rob
author_rank: Frequent Contributor
timestamp: September 15, 2023, 09:25:18 pm
content: It looks like OP just needs to use the INR? query to determine when the data has been captured before executing the SCDP command.