Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

Multithreading GPIB in .NET

I am working a a tester that has several test stations that use GPIB devices for testing and measurement,.
I have been using Version 1.7 with .NET for quite a while now. I re-wrote the vbib-32.bas file to work with .NET. While this works fine for GPIB access, I am now working on getting the test station to all work at the same time.

I am running Windows 2k with a dual processor computer. My question concerns accessing the GPIB dll through multiple threads.

I currently have classes written for the access to the sourcemeters, and power supplies. I also have seperate test subs for each test station. I would like these to run in seperate threads.

What do I need to look out for in order to access the GPIB DLL from 4 seperate threads
? Any help or examples would be appreciated. I already have 1 station running on its own thread, but it just uses RS232 for communication to a ink jet machine for serialization.

Thanks

Brian DeJong
0 Kudos
Message 1 of 4
(3,669 Views)
Hi Brian,

The GPIB driver should handle the multithreading without any hitches. In the end all you need is the handle returned by ibdev. All the rest should be handled internally by the driver.

Hope This helps out!

Best Regards,
Aaron K.
0 Kudos
Message 2 of 4
(3,669 Views)
I am thinking that there has to be some way of ensuring that one thread does not try to initiate a command while the other thread is in the process of sending/receiving a command.

For example if one thread is in the middle of sending the read command, and another thread needs/wants to read the results of another device.

I imagine that I am missing a status bit or some other flag that can be used to prevent this from happening.

Any ideas/suggestions?

Thanks
Brian DeJong
0 Kudos
Message 3 of 4
(3,669 Views)
Hi Brian,

Ahh I see what you are asking for now. There is a really good document on multithreaded GPIB applications. It is not written for .NET, but the application and 488.2 commands and ideas are presented there in a concise format. The link is located at http://zone.ni.com/devzone/conceptd.nsf/2d17d611efb58b22862567a9006ffe76/6b896f37c2d2cc5686256804006875dc?OpenDocument.

Hope this helps out Brian! Let me know if there is anythign else I can do for you!

Best Regards,
Aaron K.
Application Engineer
National Instruments
0 Kudos
Message 4 of 4
(3,669 Views)