Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

gpib multithreaded access/ thread safety/ how to prevent collisions from accessing from many threads to single GPIB controller in parallel

Hi members,

 

  1.        I am working over solution how to handle multiple requests from many threads to single GPIB controller

(For example if I have 10 different instruments on single  GPIB bus, e.g. GPIB0)

 

  1.        I use NationalInstruments.VisaN.dll and create object from MessageBasedSession
  2.        I know only how safely to handle in a serial mode,.e.g. Lock/Unlock Recourse, but I need to handle it in parallel – that

                Is what I do not know

  1.        I implement my algorithm in C#

Questions:

How to configure/implement NationalInstruments.VisaN.dll  object to prevent collisions via multiple/multithreaded access to many devices that sit on single GPIB controllel?

 

Thank you a lot, Yuri

Thank you & Best Regards

*I use LabVIEW 2018 & TestStand 2021 versions
0 Kudos
Message 1 of 6
(6,639 Views)

Hi Yuri_IL,

 

The following document explains how to develop multi-threaded GPIB applications and it includes sample code as well. 

 

Developing Multithreaded GPIB Applications using NI-488.2
http://www.ni.com/white-paper/3275/en/

 

Warm Regards,

 

William Fernandez

Applications Engineering

National Instruments

0 Kudos
Message 2 of 6
(6,621 Views)

Thank you, BUT i did not understand from this example how to cope with it because of:

 

The "strange" API calls like: ibwrt/ibdev/ThreadIbsta/ibonl ...

i do  not know where and how to call this API's methods or whatever

I suppose it is relevant only for C/C++ coders and not for C#

 

Regards, Yuri

Thank you & Best Regards

*I use LabVIEW 2018 & TestStand 2021 versions
0 Kudos
Message 3 of 6
(6,612 Views)

Yuri_IL

 

You need to download the 488.2 driver. Make sure that you include the support for .NET framework. You specify this during the installation.  

 

NI-488.2 3.1.1
http://www.ni.com/download/ni-488.2-3.1.1/3786/en/

 

In the following readme file you can find .NET framework compatibility, GPIB interface compatibility and other details that might be of your interest. You can also find where the .NET examples are going to be located.

 

NI-488.2 for Windows, Version 3.1.1 Readme
http://ftp.ni.com/support/softlib/gpib/Windows/3.1.1/ReadMe.html

 

The following manual explains all of the functions that are included in the driver API

 

www.ni.com/pdf/manuals/370428f.pdf
http://www.ni.com/pdf/manuals/370428f.pdf

 

Warm Regards,

 

William Fernandez

Applications Engineering

National Instruments

0 Kudos
Message 4 of 6
(6,599 Views)
I'm not sure why you would be advised to abandon VISA for the less portable low level GPIB functions or to download a driver you obviously have.

I don't use .NET but I believe the VISA LOCK and UNLOCK exist in the .NET api. The low level gpib functions ibwrt/ibrd in the example given is the same as viwrite/viread.
0 Kudos
Message 5 of 6
(6,575 Views)