AnsweredAssumed Answered

When and how to use *OPC and *OPC?

Question asked by edu_ct on Nov 9, 2009
Latest reply on Nov 9, 2009 by dnt
I'm making a visual basic software to manage an oscilloscope remotely, my intention is to capture two channels and save data to disk.
I use the following code:
With Osciloscopio
                .WriteString "*RST"
                .WriteString "*CLS"               
                .WriteString ":Channel1 ON"
                .WriteString ":Channel2 ON"
                .WriteString ":AUTOSCALE"
                .WriteString ":ACQ:MODE RTIME"
                .WriteString ":ACQUIRE:SRATE " & s_rate
                .WriteString ":ACQUIRE:POINTS " & puntos
                .WriteString ":ACQuire:BANDwidth " & band_width
                .WriteString ":Timebase:range " & t_adquisicion
                .WriteString ":TRIGger:EDGE:SLOPe EITHer"
                .WriteString ":RUN"
                 '.WriteString "*opc?"  
                 'result = .ReadString    
                 'MsgBox "Esta preparado: " & result
                 .WriteString ":DISK:SAVE:WAVEFORM CHANNEL1,""" & captura.Text & "_1_cap_" & num_cap & """,CSV,ON"
                 '.WriteString "*opc?"
                  .WriteString ":DISK:SAVE:WAVEFORM CHANNEL2,""" & captura.Text & "_2_cap_" & num_cap & """,CSV,ON"
            End With
'*****instructions * OPC? are commented out (I have disabled in my code)


My problem is that some times I get the error message -410 (Query Interrupted). I think you can solve with the instruction * OPC or * OPC? but not use them correctly in my code. Could it be that no time to finish some of the instructions that I have commanded it?
Should I make a loop with *OPC or *OPC? to know if I can continue running the following code?
We also feel the same when I create a directory and change the one created by default, can be for the same reason?
Sorry for my English;
I hope some answers and thanks in advance