10-26-2016 06:38 AM
Hi,
an application is running in background communicate with the Maschine, sends and recieves his own Data. My Application should send also his commands to contol the Maschine. It comes somethimes to crash. As an application waits to recieve Data from the Machine and the other application send Data to the Machine. I uses ThreadIbasta to check the current state before i send a command. But with the one and same 'Ibsta' value (and no error) once i get error once not.
If i stop the backrground application everything works properly with my application, but the background application mus run too.In one sentense, how can i findout the right time to send a command to a GPIB device while other application is communicate with the same device?
Thanks
10-26-2016 06:58 AM
In general, a single resource should never be used by multiple applications. If possible, I would see if you can send a message via TCP or some other way to the "background appliction" to have it send the commands you want and pass back the data.
Another option is to simply rewrite what the background application is doing in your application and then have a single loop that can recieve messages and send them for you. That single loop is the only location you should be doing the communications with the instrument.
10-26-2016 07:00 AM
The easiest one, if you are running in the development environment, is to add a vi that handles commands.
So not longer directly communicate with the machine, but send the question to a subvi and wait until you receive the answer. So all communication is handled by the subvi.
If taking data is slow you need three things: a command, a status and a reply.
The command only replies with, I understand the command.
The status answers data available or not.
The reply gives you the data in the correct format.
Inside the subvi you can queue commands from several clients and answer each appropriate while handling just one sequence with the machine.