09-26-2007 10:39 PM
09-26-2007 11:02 PM
09-27-2007 10:05 AM
09-28-2007 10:08 AM
Hi,
If I am understanding it correctly, you are reading the temperature on a time cycle, and the status on a separate 'random' pattern. It sounds like every once in a while you call the vi session at virtually the same time, thus overwriting the data. How often does this occur? Is it completely necessary for the status measurements to run on a different cycle than the temperature measurements?
Also, what type of communication are you using and how are you handling the data?
The easiest solution would be to time the calls so that they are never simultaneous. Of course, it sounds like you want the status calls to be random, so this may not be optimal. Instead of locking the session itself, it may be possible to create a queue so that the vi session cannot be called while the other one is running.
Lauren L.
09-28-2007 10:23 AM
09-28-2007 01:51 PM
Hello Micho,
You should probably create your own method of thread synchronization for this problem. Since viLock only locks a device to a particular session, you should use a mutex to lock a session to only be used by one thread at a time. Each thread should check the mutex before doing any type of session communication (reads or writes).
Check if Mutex is available (wait if its not available) and
Acquire Mutex.
Perform VISA operations
Release Mutex.
Since you will be using a mutex, make sure that dead-lock will not occur in your application.
Steven T.
09-29-2007 12:03 AM