Programmatically Gate Measurements Rigol DHO4000 Scopes - Page 1
Forum section: electronics / testgear

author: macdaddy_mays
author_rank: Newbie
timestamp: September 18, 2025, 06:13:15 pm
content: Via SCPI commands, does anybody know how to gate the measurements of a DHO4000 series scope from Rigol, i.e. specify via cursors the exact time range over which the scope is to calculate a measurement? Back in the day, one would send to a Tek scope "MEASUrement:GATing " + "OFF" | "SCREEN" | "CURSOR" to specify how the measurement ranges are to be banded. One would then simply specify the exact time 'location' of Cursor A and Cursor B. I cannot find/identify SCPI commands in the "DHO_programming_manual.pdf" that would enable me to do so. My DHO4204 will allow me to manually specify cursor based measurements, BUT the interface is painful AND I cannot seem to access the measurement cursors via a SCPI command.If I do the remote control thing via a web browser, I can manually set the cursors, so if I could figure out specifically what text is sent to what HTML'ey type thing, maybe I can circumvent SCPI commands and issue HTML'ey commands (<<SHUDDER>>).Thanks.

author: 2N3055
author_rank: Super Contributor
timestamp: September 18, 2025, 07:39:37 pm
content: When I was trying to explain to Rigol advocates how Rigol new series DHO 12 bit scopes are really very basic scopes that are missing many measurement capabilities I was attacked and accused as Siglent shill. And downplayed as playing specmanship games. It slowly becomes obvious that I was attacked by people that don't really use scope and are not trying to use it for real work.DHO4000 does not have measurement gates. None of the 12 bit Rigols have it. It does not support them as it does not support many other things that even cheapest SDS800xHD has.So unfortunately, you are having a wrong scope for what you want to accomplish.

author: norbert.kiszka
author_rank: Frequent Contributor
timestamp: September 18, 2025, 07:52:57 pm
content: Currently I don't have DHO4000, but DHO800/DHO900 series are based on DHO4000 - including firmware. I did reverse engineering on both. SCPI works badly and code (deassembled and decompiled) is also extremely bad. Fixing or modifying anything SCPI related is a extremely crazy idea. It can be done, but this is very far from anything easy.I have plans to rewrite whole firmware (without FPGA) from scratch - based on already done reverse engineering and by using another and more modern operating system that works properly on my DHO924S. Since DHO4000 is not very different to DHO800/900, it should be quite easy to make it work also for DHO1000 and DHO4000.SCPI instructions are not a big deal to make. Bigger problem is with amount of instructions. 1000 instructions can take (I guess) 1000 hours of work.

author: macdaddy_mays
author_rank: Newbie
timestamp: September 18, 2025, 08:57:47 pm
content: 2N3055: I am sorry people gave you grief regarding scope choices. For the record I did not give you grief. At the end of the day, I am kinda stuck with whatever I have for the a long while. Frankly, I have always been a big fan of Tek scopes. Ahem, Tek scopes have their fair share of warts, so I do not consider Tek scopes the final answer on anything. My DHO4000 scope does allow one to choose cursors for measurement "area", but I cannot change the measurement area programmatically.{sigh} I have found that my Rigol DHO4204 is not stable. Quite often when I mess with the measurement area cursors, the scope loses its ability to calculate a measurement(?!?!).norbert.kiszka: Uh-h-h, do you write scope firmware?

author: 2N3055
author_rank: Super Contributor
timestamp: September 18, 2025, 09:14:49 pm
content: Quote from: macdaddy_mays on September 18, 2025, 08:57:47 pmIt was not directed at you. Just general complaining. You were just proverbial shoulder to cry on.Thank you for listening and sorry to burden you.I am genuinely sorry for you having problems. I am sorry to be bearer of bad news.Only way I can help you is to give you the facts so you know it is not something you are doing wrong.That is what my gripe is, that I keep warning people about what reality is, but it gets shrugged off.It is limited platform and it is unstable if you are really try to use it for real.I hope you will find a way to make what you have to work for you somehow.But as I said, even 500USD Siglent scope has all capability you mentioned and much more.That platform would be better fit for you.But it is what it is.My best,

author: macdaddy_mays
author_rank: Newbie
timestamp: September 18, 2025, 09:41:13 pm
content: Thanks. I realize people get a tad over-zealous when it comes to stuff like this. I guess one could engage in a heated debate over a sports team or over a scope brand or who was the better lead singer of AC/DC or Van Halen. Regarding my Rigol, I am not quite ready to claim Brick Status, even though I am becoming more and more aware of its warts.The goal now is to identify a plan "B". I can save the binary waveform to a thumb drive (LAST RESORT!), but surely there is a reasonable way to access the raw data via Ethernet. The scope has the WAVEFORM commands, but I can only get data starting with the first data point. I cannot access 'random' sections of data. For example, I can get data points 1 to 1000, but I cannot get data points 1001 to 2000, etc... Gee, does that mean I will have to choke down all 100 million data points all at once?Steve.

author: thm_w
author_rank: Super Contributor
timestamp: September 19, 2025, 12:22:17 am
content: So you need to set the cursors remotely and using a mouse via the web interface is not suitable? Is it a one time thing or it has to be constantly adjusted? If its a one time thing then you could try saving and restoring the config.For data transfer you can experiment with sigrok:https://www.eevblog.com/forum/testgear/new-sigrokpulseview-hardware-support-(siglent-sds-hd-rigol-dho800-)/Its not quite clear what the use case is though, explaining that might help with targeted advice.

author: norbert.kiszka
author_rank: Frequent Contributor
timestamp: September 19, 2025, 01:15:35 am
content: Quote from: macdaddy_mays on September 18, 2025, 08:57:47 pmAs You can see in my footer I did firmware mod for DHO800/900 series and a separate operating system (Debian based) for those scopes.Oscilloscopes are just computers with a very fast audio card. Nothing fancy, unless we speak about those with >30 GHz bandwidth...

author: macdaddy_mays
author_rank: Newbie
timestamp: September 19, 2025, 09:05:27 pm
content: norbert.kiszka: After I sent my reply I did check out a link you had in your footer and saw that, indeed, one puts Debian on scopes. Who knew? It would be cool to have Debian on my scope, but the scope really belongs to my company, etc... Still... So-o-o, I have been dying to ask, with Debian on the scope, can one, for example, SSH into the scope?thm_w: I am working on building some utilities on the PC (hence the "Programmatically Gate Measurements..."), so I wish to programmatically move the measurement cursors. If there is a non-SCPI way to tell the measurement cursors specifically where to go, that would be fine. I downloaded the sigrok source code (or libsigrok, whatever) and I do not see how/where the measurement cursors are moved. Likewise I do not see where/how the sample data is extracted. I am not entirely certain what I can get from libsigrok.The application is to move the measurement cursors programmatically so I can control exactly which samples are used for measurement calculations.Thanks.

author: 2N3055
author_rank: Super Contributor
timestamp: September 19, 2025, 09:15:23 pm
content: Quote from: macdaddy_mays on September 19, 2025, 09:05:27 pmYou didn't understand what I said. That scope does not have measurement gating capability.Scope does not have that at all, it is not SCPI control that is missing, it is measurement gates completely.All measurements are performed on full buffer and there is no way to limit the bounds, in any way.

author: macdaddy_mays
author_rank: Newbie
timestamp: September 19, 2025, 09:32:18 pm
content: 2N3055: Forgive me if I misunderstand what you are trying to tell me. My DHO4204 has a (kinda flaky) feature where the measurement region can be specified as "Main", "Zoom", or "Cursor". My screenshot makes it difficult to see the cursors behind the "Measure" window. CA and CB are vertical purple'ish lines.Okay, how do I attach screenshots to posts? Hopefully I managed to attach a screenshot to this post. If I fail to attach a screenshot to this post, perhaps I can follow up with ASCII art representing my scope screen.

author: thm_w
author_rank: Super Contributor
timestamp: September 19, 2025, 09:42:04 pm
content: Quote from: macdaddy_mays on September 19, 2025, 09:05:27 pmStill not enough information.For production line use? bench debugging? At what bandwidth and how many channels are required?If you had *fixed* setups with fixed measurement intervals they can be saved to .stp files. The region measurements cursors are in the .stp file under:Code:<ServiceID28>...<cursorA>500</cursorA><cursorB>600</cursorB>QuoteYou'd have to read that thread, sigrok (in that thread specifically) downloads the data from the scope and displays it on the PC.If your goal is to do a bunch of programming/analysis with scope data, then you may be better off with something headless that has python SDK or similar. Maybe picoscope, or a DAQ depending on BW.

author: 2N3055
author_rank: Super Contributor
timestamp: September 19, 2025, 10:02:26 pm
content: Quote from: macdaddy_mays on September 19, 2025, 09:32:18 pmOh thank you for the explanation. I stand corrected. So it does have something in that regard. It is just very badly implemented and completely badly documented. Sorry for my misunderstanding.

author: thm_w
author_rank: Super Contributor
timestamp: September 19, 2025, 10:08:51 pm
content: OK found it thanks tothis post, enjoy:Set measurement to cursor modeCode::MEAS:AREA CURS:MEAS:AREA?CURSSet cursor start and end positionsCode::MEAS:CREG:CAX 1.00000E-4:MEAS:CREG:CBX 2.00000E-4:MEAS:CREG:CAX?1.000000E-4There is also :MEAS:EPOS:SA and SB, not sure what that is.

author: macdaddy_mays
author_rank: Newbie
timestamp: September 19, 2025, 10:47:38 pm
content: thm_w: Excellent find! Thanks! The ":CREG" sub-commands are NOT in the DHO1000/DHO4000 Programming Guide. I guess it is worth scouring other Rigol o'scope programming guides for 'inspiration'. I will study as much of that post as I can.I realize you did express the ":EPOS" as a sub-query, but I decided to try it as a query: ":MEAS:EPOS:SA?". I received an error from the scope. Oh, well. Hopefully I will not need it for anything. I suppose I could check other programming guides...I am just trying write an automation application for my own uses that does the stuff I want/need it to do. At some point I will likely involve an SQL database, so I do not care to involve any more canned software than absolutely necessary. Honestly, the measurement capability of my Rigol DHO4204 is so flaky, it is possible I will not be able to depend on gated measurements.My next challenge is to figure out how to extract the binary waveform data via SCPI commands. Yes, I have the SCPI commands to do it, but the raw binary data from the scope very much appears to be garbage. I am personally probably misinterpreting what I am seeing. I am attempting to compare it so .bin waveform files I get from the scope, which I am thinking is probably wrong.I know I am a bad and wrong person, but I cannot figure out Python. I can kind of fumble through Python, but that is about it.2N3055: "badly implemented and completely badly documented" Yeah... I do not usually bother to read scope manuals. I have found piddling with the knobs to be more productive. Their "Measure" window is very cumbersome and poorly set up.

author: thm_w
author_rank: Super Contributor
timestamp: September 19, 2025, 11:26:53 pm
content: Its usually easier to copy someone else who has already figured it out, which is why I linked that sigrok thread. The code is well commented.The waveform data format is explained on page 412 of the programming guide.https://github.com/fredzo/libsigrok/blob/master/src/hardware/rigol-ds/protocol.chttps://github.com/MasterJubei/pydho800