Qcodes icon indicating copy to clipboard operation
Qcodes copied to clipboard

Add function for operation complete status check to VisaInstrument

Open GateBuilder opened this issue 6 years ago • 5 comments

This PR proposes a function in VisaInstrument class that checks the Operation Complete Query (OPC) bit and ensures that the operation is complete, i.e., the bit is set to 0. The suggested function repeatedly returns the content of the Event Status Register (ESR) and clears it.

Subsumes and closes #1168.

@jenshnielsen @astafan8

GateBuilder avatar Sep 25 '19 11:09 GateBuilder

Codecov Report

Merging #1733 into master will decrease coverage by 0.02%. The diff coverage is 41.66%.

@@            Coverage Diff             @@
##           master    #1733      +/-   ##
==========================================
- Coverage   70.38%   70.36%   -0.03%     
==========================================
  Files         152      152              
  Lines       18859    18870      +11     
==========================================
+ Hits        13274    13277       +3     
- Misses       5585     5593       +8

codecov[bot] avatar Sep 25 '19 12:09 codecov[bot]

I wonder what happens if this is used after a short command that has already finished by the time this is executed. In my understanding that would mean that the opc bit has already been set and is cleared by *ESR? and the instrument will then probably deadlock?

It seems to me that the correct way would be.

self.ask_raw("*ESR?")
self.write("startpotentiallyslowcmd")
while int(self.ask_raw("*ESR?").strip())%2==0:
     time.sleep(sleep_time)

This cannot be done easily since it's across multiple function calls in qcodes but perhaps the call to self.ask_raw("*ESR?") should simply not be here?

jenshnielsen avatar Sep 27 '19 09:09 jenshnielsen

@astafan8 This still needs testing on real instruments so i am bumping this to 0.10

jenshnielsen avatar Dec 09 '19 09:12 jenshnielsen

It seems like if this should be done it should be done using the pyvisa event handling https://pyvisa.readthedocs.io/en/latest/introduction/event_handling.html

jenshnielsen avatar Oct 30 '20 10:10 jenshnielsen

Hi guys! Thanks for finishing this. I am having problem to sign in to my account (Gatebuilder). Let me know if I need to do anything!

umithardal avatar Oct 30 '20 10:10 umithardal