Products > Test Equipment
SCPI process to wait for long command to complete
Ross:
Hi,
I am using a Siglent SSA 3015X and my aim is to trigger a scan and then get some indication of the scan completing via SCPI commands. I am using Python PyVisa and want to know when the scan is complete so I can do something else in the python program.
A web search came up with the sequence (generic not specific to my device):
*CLS
*TRG
*OPC?
This sequence is supposed to clear any event or status registers, trigger a scan and the OPC command is supposed to return 1 when the previous command is complete. What actually happens is the scan starts but the scan takes 10 seconds or so and the OPC query times out.
Alternative option is:
*CLS
*OPC
*TRG
*ESR?
This sequence should clear status and event registers, trigger the scan and then polling the event status register to look for bit zero to be true. What actually happens is the scan is triggered but the *ESR? response is always zero. I thought it might have been my python program so I tried the commands in the web SCPI command terminal of the analyzer and the same thing happens.
What my question to the community is am I using the correct sequence of commands and if I am is the Siglent device not honoring them?
Thanks,
Ross
tautech:
Are you working from this programming guide Ross ?
https://int.siglent.com/u_file/document/ProgrammingGuide_PG0703P_E02B.pdf
There are some App notes on the US site:
https://siglentna.com/application-notes/ssa3000x-plus/
And BTW, your model is SSA3015X Plus. ;)
alm:
I don't own or have used this specific instrument, but I have dealt with slow SCPI commands quite a lot. Here's a couple of possible solutions that I've used:
* Increase the timeout. This is something you might be able to set on the transport layer you use to transport the GPIB commands. For example for VXI-11, the Device and Instrument classes in python-vxi11 have a timeout attribute.
* For status registers like ESR you often have to configure a bit mask of which events trigger it if you want certain bits to be set. Sometimes this even goes two layers deep: set bitmask y so a bit in the Y register is set, and then set bit mask x so the bit corresponding to register Y in the X register are set. Check the manual. These commands might be called something like ESE or MESE. (Programming) manuals will normally show the bits of the various status registers and how they interact between registers.
* You can often program an instrument to send an SRQ interrupt when a command is complete. How you listen to SRQ depends on the transport you use. I don't think python-vxi11 supports SRQ, so I have not used them recently.
* Sometimes the best solution is to just insert a sleep if you know the command is going to take at least two minutes, just sleep for two minutes before you do your status query. The downside is that if a command fails, it will take two minutes to find out. But for hobby, where you're not blocking a production line, this is usually not a problem.
Ross:
--- Quote from: tautech on April 06, 2023, 03:06:47 am ---Are you working from this programming guide Ross ?
https://int.siglent.com/u_file/document/ProgrammingGuide_PG0703P_E02B.pdf
There are some App notes on the US site:
https://siglentna.com/application-notes/ssa3000x-plus/
And BTW, your model is SSA3015X Plus. ;)
--- End quote ---
Thanks for the resources, I have been working with the programming guide before posting and have found it light on detail when it comes to the registers. The application notes do have some useful information, but not about this issue.
Ross:
--- Quote from: alm on April 06, 2023, 09:59:51 am ---I don't own or have used this specific instrument, but I have dealt with slow SCPI commands quite a lot. Here's a couple of possible solutions that I've used:
* Increase the timeout. This is something you might be able to set on the transport layer you use to transport the GPIB commands. For example for VXI-11, the Device and Instrument classes in python-vxi11 have a timeout attribute.
* For status registers like ESR you often have to configure a bit mask of which events trigger it if you want certain bits to be set. Sometimes this even goes two layers deep: set bitmask y so a bit in the Y register is set, and then set bit mask x so the bit corresponding to register Y in the X register are set. Check the manual. These commands might be called something like ESE or MESE. (Programming) manuals will normally show the bits of the various status registers and how they interact between registers.
* You can often program an instrument to send an SRQ interrupt when a command is complete. How you listen to SRQ depends on the transport you use. I don't think python-vxi11 supports SRQ, so I have not used them recently.
* Sometimes the best solution is to just insert a sleep if you know the command is going to take at least two minutes, just sleep for two minutes before you do your status query. The downside is that if a command fails, it will take two minutes to find out. But for hobby, where you're not blocking a production line, this is usually not a problem.
--- End quote ---
Thanks for your ideas. As far as I can tell there is SRO in this instrument. I checked the ESE and have set it to 255, but still the same result. I am now using:
*CLS
*ESE 255
*OPC
*TRG
But it still doesn't work. I have done more googling regarding the sequence in general and I think I have it right which leads me to think that the analyzer is not doing what it should. I guess I will have to implement a delay.
Navigation
[0] Message Index
[#] Next page
Go to full version