09-24-2015 09:20 AM
If this event structure is in the same loop as your data acquisition, the aquisition will grind to a halt because it will wait indeifinitely for each event. if you use a timeout in the event structure to avoid this, you have effectively returned to polling.
Why do you feel you need to flush the VISA I/O buffer? Just a precaution? If this "solves" a problem, the it's likely you are not communicating correctly with the unit. Which, of course, could be the reason behind the timeout.
Depending on what you mean by "high sample rate", this architecture might not work for you at all, as it appears that data acqusition and processing are happening in the same loop.
This code, IMHO, seems very fragile and can break down in so many ways. That's why I recommend starting from scratch, using an appropriate design pattern so we can help you build a robust solution instead of fixing one thing only to break or expose another (worse yet, to leave something unexposed and lurking). "Winging it" hardly ever produces good code.
09-24-2015 10:07 AM
First of all ... i´ve tried the "case"less eventstructure which works fine. But anyway no data....
Yep the event and the daq are in the same loop .... The reason why i erase the buffer.... Sensors from another part of my system run permanent, so i get a defined start point ?! (This is only first half of the entire program 😄 )
I removed that but ... doesn´t change anything...
The Samplerate is around 1kHz per Sensor and the daq recieves the data from 6 sensors in parallel.
The reason why i didn´t start from scratches is that i would do it exactly like this, as my knowledge and my abilities of programming are "super" limited 🙂 so i am not able to distiguish between an robust and a fragile program 😉
Could you tell my some keynotes which would lead me to a robust solution ? and maybe how you would solve the data acquisition and data write problem ?
The reason why I struggle so hard for this solution is that it runs quite reliable for a limited amount of switches ... so i hoped it would work with some further organisation?!;)
Thanks a lot by the way :=) !!!