":STOP;:WAV:SOUR CHANnel1;MODE RAW". Is this what I'm supposed to use instead of "\n"? How do I know which commands can be chained with ";" and which cannot?
- I would use ":STOP;:WAV:SOUR CHANnel1;:MODE RAW\n". ':' before a commands starts interpreting the command from the root of the commands tree. Otherwise, the command starts from the last branch. '\n' must be the terminator.
- Not sure how many and which commands can be sent on the same line. I saw this technique usually for sending multiple settings before executing a command, but for other instruments, not for Rigol scope, e.g. send the start frequency, stop frequency, amplitude, etc, all on the same line, then start a frequency sweep in frequency generator instrument on the next line. For Rigol scope, I just tried ":stop;:wav:form byte;:wav:form?\n" and it returned "BYTE\n"
(SCPI-99) doesn't say anything about state machines and ready states and responses to the commands. E.g. Am I supposed to receive something in the response to the ":STOP" command?
- If there is no state machine in SCPI-99, then I might have read about it somewhere else. I did a lot of googling when I start learning about SCPI.
- For the ':STOP\n' command no. Usually, for (correct) commands you don't receive an SCPI response. Only for queries. The difference between commands and queries is described in the SCPI standard.
Could you point me to a document which describes this basic stuff?
- I am not sure if such a thing exists. At least I couldn't find it, but after a few days of googling and reading various documents you will have a good grasp about SCPI.
From memory, what seemed most important to me at that time:
- I remember some manuals from Agilent instruments had good explanations and charts with status registers, enabling registers, etc. e.g.:
http://cp.literature.agilent.com/litweb/pdf/ads2001/pdf/vsaprog.pdf- Sometimes, when you send an invalid command (mostly because of a wrong parameter) you might receive something like "Command error". Parameter validation is not guaranteed, so if you send something wrong, it might be just ignored.
- There are a lot of SCPI registers, some mandatory, some others are instrument dependent. You need to test the status of your instrument before sending something.
- The most important is to test if the previous operation completed (*OPC?) and if there are errors. Even the simplest commands like :STOP might take a very long time, or might fail.
- Some queries will have an answer with the length of the expected reply, i.e. the :WAV:DATA? will send a header that contains the length of the binary data and will end in \n
====================================================
Long story short, it is not trivial to write a full program for SCPI, but this is not the point for the moment. We were testing how fast can your buffering method download the data on both Linux and Windows.
I will do all the scope settings manually, then run your test program. Try to write just the part for setting the start, stop, receiving/saving data and timing the whole loop. Don't bother treating errors for the moment, just make sure you received all the data you requested. If you feel you don't need this test any more, it's OK from my side.