Academic Company Events NI Developer Zone Support Solutions Products & Services Contact NI MyNI
2 ratings:
 2 out of 5     Rate this Document

Locking GPIB Interfaces with iblck, Even Across the Network

Hardware: GPIB

Problem: I have a GPIB ENET\100 on my network, but I only want one computer to access it at a time; is locking a GPIB session using iblck preserved across the network in this case?

Solution: The iblck function will allow a given GPIB session to lock a given GPIB interface board so that other attempted sessions or currently open sessions are locked from accessing the GPIB interface board. This behavior is preserved across the network for interfaces such as the GPIB ENET\100. The fundamental reason for this behavior being preserved across the network is that iblck is a board level command, affecting the interface board and all current and future attempted sessions open to it for the duration of the lock. For example, if computer A establishes a lock using iblck, then even if communication has already been established by computer B (over the network or otherwise), computer B will be locked out until the lock is released. The following is the iblck function prototype and a brief description of the function's behavior; see the NI-4882 Help for more information (with NI-488.2 installed: Start -> Programs -> National Instruments -> NI-488.2 -> NI-488.2 Help):

Prototype:
int iblck (int ud, int v, unsigned int LockWaitTime, void * Reserved)

Parameters:
ud: unit descriptor

v: lock parameter (1 or 0); if v is 1, the driver attempts to acquire an exclusive lock on the interface for the current process. The call fails with ELCK (that is, the call returns with ERR set in ibsta and iberr set to ELCK) if the lock could not be acquired within the timeout period specified by LockWaitTime. If v is 0, a lock previously acquired by the current process is released. Only the process that acquired an interface lock can release a lock. If v is zero, and no lock exists for the process, the call fails with ELCK. LockWaitTime is ignored when using iblck to release interface locks.

LockWaitTime: the period of time to wait, if necessary, to obtain the lock

Reserved: this parameter is reserved for future use; it must be NULL

Related Links: GPIB Support Page

Attachments:





Report Date: 04/29/2005
Last Updated: 05/02/2005
Document ID: 3KSEAU4B

Your Feedback! poor Poor  |  Excellent excellent   Yes No
 Document Quality? 
 Answered Your Question? 
  1 2 3 4 5
Please Contact NI for all product and support inquiries.submit