09-17-2014 02:02 PM
Turns out that I was programming the supplies with a current limit of 0. Doh! Though, I learned something from all the suggestions on structure and good practices. Thanks to all that posted suggestions. I would still like to incorporate the 3rd while loop into the queue structure. Aputman, I need to study your layout I'm trying to figure out how the first loop continuously runs. I'm still a novice when it comes to queuing structures. Thanks.
09-17-2014 02:17 PM
How does a current limit of 0 stop your UI from responding?
09-17-2014 02:20 PM
Technically, I was still able to press buttons and update the voltage setting, so I wasn't totally locked out. It is just that the current and voltage readings were always zero no matter what change that I made. With a zero current limit, the voltage reading will also stay at zero. Thanks.
09-17-2014 02:29 PM
Gotcha.
In regards to your comment about the third loop, with your code as posted, there is no reason to use a queue because you are only displaying the data. If you want to store the data or act on it in any way, then you might want to use a queue to move the data to your consumer loop to handle those actions and keep the display updating without those delays.
09-17-2014 02:33 PM
I do plan to have a file log of the voltage and current readings taken at a regular frequency...once every 10 seconds or so. In this case, you think putting it into a consumer loop would be beneficial?
09-17-2014 02:54 PM
@jschichl wrote:
I do plan to have a file log of the voltage and current readings taken at a regular frequency...once every 10 seconds or so. In this case, you think putting it into a consumer loop would be beneficial?
The problem you could run into is with the communications. If you have one loop requesting data and before the data is sent back the other loop sends data, you could potentially get an error from your instrument. It is best to have all of your communication in a single location to avoid those kinds of race conditions.