Hello,
Interesting; things look ok and consistent with your description, where you seem not to be seeing the event you are waiting for:
25. viEnableEvent (0x00180FF8, 0x3FFF200B, 1, 0)
26. viDiscardEvents (0x00180FF8, 0x3FFF200B, 1), with Status: 0x3FFF0004 (VI_SUCCESS_QUEUE_EMPTY)
27. viWrite (0x00180FF8, "*CLS;*SRE 1", 11, 11)
28. viWaitOnEvent (0x00180FF8, 0x3FFF200B, 0, NULL, NULL)
.
.
.
1000. viWaitOnEvent (0x00180FF8, 0x3FFF200B, 0, NULL, NULL)
The viDiscardEvents() operation discards all pending occurrences of the specified event types and mechanisms from the specified session; in particular here, it returns with a VI_SUCCESS_QUEUE_EMPTY which means that the operation completed successfully, but the queue was already empty. Thus, I don't think it discards the event you are waiting for, however, you are correct that it seems to never come thereafter. There are a list of events in the NI-VISA Help; do you know which event you are waiting on? Since this is on your host (PC) side, you are expecting a notification of some kind (an event) from your scope. Thus, it would seem that although your scope is receiving the actual trigger signal, and performing the acquisition, the scope is not causing the expected event to occur (which indicates to your host PC that the action has completed). Perhaps, in fact, the acquisition is not completing; is it possible you are specifying a continuous acquisition and that your scope is simply never done? I realize you said this only happens sometimes, so my suspicion is that we have some kind of a programmatic issue. For example, perhaps the exact sequence of operations you are specifying is leaving the instrument in a state where it cannot give notification of the event after some period of execution. If there are examples with the driver, try taking a look at them and following the programming model as closely as possible. Also, I don't have the scope you are using, but if you can identify which driver VI is causing the error, perhaps I can download just the driver and take a closer look.
Try taking the above, albeit long, paragraph into consideration with respect to your program; hopefully it will provide you clues as to what is causing the issue.
If you continue to have problems, feel free to repost with any additional information you have and/or answers to questions or inquiries above!
Thank you,
JLS