Author: sgeorge, Posted on: 12 July 2015 09:11
One of the things I wanted to do was make the reading smoother, basically even if your pondering what voltage to enter for 5 minutes, I wanted it to be able to continuously read data from the back end.
Threading is my answer!
Well no, it turned out to be a disaster, mostly because GPIB/SCPI commands are not multithreaded.
If say, you want to turn a channel on, you have to send two commands,
1 - Select Channel 1
2 - Channel On
The first command sets the active channel were going to send commands to operate on. The second command tells it to turn on.
Now, if we had a thread running in the background, I know it can take 1.6 seconds to do a full read across all 3 channels.. Imagine you want to turn a channel on or off, you may have to wait up to 2 seconds before that action took place because the read thread was right at the start of its code.
Nasty.
Threading is not my answer, not very easily.
But after some jiggery pokery threading magic, we got it working. Basically we put the Data Reading thread into a dont read mode while we mess with sending commands and such then re-enable it.
(dont include links in your comments.)
The Kråketær is © 2015 - Stu George. -- Static Generator v0.5a