关键词不能为空

当前您在: 主页 > 英语 >

gpib函数

作者:高考题库网
来源:https://www.bjmy2z.cn/gaokao
2021-02-27 15:43
tags:

-

2021年2月27日发(作者:jungle是什么意思)


5. GPIB protocol




5.1. GPIB command bytes




The meaning and values of the possible GPIB command bytes are as follows:



Table 12. GPIB command bytes



byte


(hexadecimal)


0x1


0x4


0x5


value


name


GTL


SDC


PPConfig (also 'PPC' on


non- powerpc


architectures)


GET


TCT


LLO


DCL


PPU


SPE


SPD


MLA0 to MLA30


description


Go to local


Selected device clear


Parallel poll configure


0x8


0x9


0x11


0x14


0x15


0x18


0x19


0x20 to 0x3e


0x3f


0x40 to 0x5e


0x5f


0x60 to 0x6f


Group execute trigger


Take control


Local lockout


Device clear


Parallel poll unconfigure


Serial poll enable


Serial poll disable


My


(primary)


listen


address 0 to 30


UNL


Unlisten


MTA0 to MTA30


My


(primary)


talk


address 0 to 30


UNT


Untalk


MSA0


to


MSA15,


also


When following a talk or


PPE


listen


address,


this


is


'my


secondary


address'


0


to


15. When


following


a


parallel


poll


configure,


this


is


'parallel


poll


enable'.


For parallel poll


enable,


the


least


significant


3


bits


of


the


command


byte


specify


which


DIO


line


the


device


should


use


to


send


its


parallel


poll


response.


The


fourth


least significant bit (0x8)


0x70 to 0x7d


0x7e




5.2. GPIB bus lines




indicates


the


'sense'


or


polarity


the


device


should


use


when


responding.



MSA16


to


MSA29,


also


When following a talk or


PPD


listen


address,


this


is


'my


secondary


address'


16 to 29. When following


a


parallel


poll


configure,


this


is


'parallel


poll


disable'.


MSA30


My


secondary


address


30


Physically, the GPIB bus consists of 8 data lines, 3 handshaking lines, and 5


control


lines


(and


8


ground


lines).


Brief


descriptions


of


how


they


are


used


follow:


Table 13. GPIB bus lines



bus line


DIO1 through DIO8


description


Data


input/output


bits.


These


8


lines are used to read and write


the 8 bits of a data or command


byte


that


is being


sent


over the


bus.


End-or-identify.


This


line


is


asserted


with


the


last


byte


of


data


during


a


write,


to


indicate


the


end


of


the


message.


It


can


also be asserted along


with the


ATN


line


to


conduct


a


parallel


poll.


Data


valid.


This


is


a


handshaking line, used to signal


that


the


value


being


sent


with


DIO1-DIO8


is


valid.


During


transfers


the


DIO1-DIO8


lines


are


set,


then


the


DAV


line


is


asserted after a delay called the


'T1 delay'. The T1 delay lets the


pin number


DIO1


to


DIO4


use


pins 1 to 4, DIO5 to


DIO8


use


pins


13


to 16


5


EOI


DAV


6


NRFD


NDAC


IFC


SRQ


ATN


REN


data lines settle to stable values


before they are read.


Not


ready


for


data.


NRFD


is


a


handshaking


line


asserted


by


listeners to indicate they are not


ready


to


receive


a


new


data


byte.


Not


data


accepted.


NDAC


is


a


handshaking


line


asserted


by


listeners


to


indicate


they


have


not


yet


read


the


byte


contained


on the DIO lines.


Interface


clear.


The


system


controller can assert this line (it


should


be


asserted


for


at


least


100


microseconds)


to


reset


the


bus


and


make


itself


controller-in-charge.


Service request. Devices on the


bus


can


assert


this


line


to


request


service


from


the


controller-in-charge.


The


controller


can


then


poll


the


devices


until


it


finds


the


device


requesting service, and perform


whatever action is necessary.


Attention.


ATN


is


asserted


to


indicate


that


the


DIO


lines


contain


a


command


byte


(as


opposed to a data byte). Also, it


is


asserted


with


EOI


when


conducting parallel polls.


Remote enable. Asserted by the


system


controller,


it


enables


devices


to


enter


remote


mode.


When REN is asserted, a device


will


enter


remote


mode


when


it


is


addressed


by


the


controller.


When


REN


is


false,


all


devices


will


immediately


return


to


local


mode.



7


8


9


10


11


17








ibwrt




Name


ibwrt -- write data bytes (board or device)


Synopsis





class=FUNCSYNOPSISINFO


#include



int ibwrt(int ud, const void *data, long num_bytes);



Description





ibwrt() is used to write data bytes to a device or board. The argument ud can


be either a device or board descriptor. num_bytes specifies how many bytes


are written from the user-supplied array data. EOI may be asserted with the


last


byte


sent


or


when


the


end-of-string


character


is


sent


(see


ibeos()


and


ibeot()). The write operation may be interrupted by a timeout (see ibtmo()), the


board receiving a device clear command, or receiving an interface clear.



If ud is a device descriptor, then the library automatically handles addressing


the


device


as


listener


and


the


interface


board


as


talker,


before


sending


the


data bytes onto the bus.



If ud is a board descriptor, the board simply writes the data onto the bus. The


controller-in- charge must address the board as talker.



After the ibwrt() call, ibcnt and ibcntl are set to the number of bytes written.



Return value





The value of ibsta is returned.








ibdev




Name


ibdev -- open a device (device)


Synopsis





class=FUNCSYNOPSISINFO#include


ib/ib.h>



int ibdev(int board_index, int pad, int sad, int timeout, int send_eoi, int eos);



Description





ibdev() is used to obtain a device descriptor, which can then be used by other


functions


in


the


library.


The


argument


board_index


specifies


which


GPIB


interface board the device is connected to. The pad and sad arguments specify


the GPIB address of the device to be opened (see


ibpad() and ibsad()). The


timeout for io operations is specified by timeout (see


ibtmo()). If send_eoi is


nonzero, then the EOI line will be asserted with the last byte sent during writes


(see


ibeot()).


Finally,


the


eos


argument


specifies


the


end-of-string


character


and whether or not its reception should terminate reads (see ibeos()).



Return value





If


sucessful,


returns


a


(non-negative)


device


descriptor.


On


failure,


-1


is


returned.





ibcnt and ibcntl




Name


ibcnt and ibcntl -- hold number of bytes transferred, or errno


Synopsis


class=PROGRAMLISTING


#include





volatile int ibcnt;



volatile long ibcntl;


Description





ibcnt and ibcntl are set after IO operations to the the the number of bytes sent


or received. They are also set to the value of errno after EDVR or EFSO errors.



If you wish to avoid using a global variable, you may instead use ThreadIbcnt()


or ThreadIbcntl() which return thread-specific values.





iberr




Name


iberr -- holds error code


Synopsis


class=PROGRAMLISTING


#include





volatile int iberr;


Description





iberr is set whenever a function from the 'traditional' or 'multidevice' API fails


with an error. The meaning of each possible value of iberr is summarized in the


following table:



Table 1. iberr error codes



constant


value


EDVR


0


ECIC


ENOL


EADR


EARG


ESAC


EABO


1


2


3


4


5


6


meaning


A


system


call


has


failed.


ibcnt/ibcntl


will


be


set


to


the


value of errno.


Your


interface


board


needs


to


be


controller-in-charge,


but is not.


You have attempted to write data or command bytes, but


there are no listeners currently addressed.


The interface board has failed to address itself properly


before starting an io operation.


One or more arguments to the function call were invalid.


The interface board needs to be system controller, but is


not.



A read or write of data bytes has been aborted, possibly


ENEB


EDMA


EOIP


ECAP


7


8


10


11


EFSO


EBUS


ESTB


12


14


15


ESRQ


16


ETAB




20


due


to


a


timeout


or


reception


of


a


device


clear


command.


The GPIB interface board does not exist, its driver is not


loaded, or it is not configured properly.


Not


used


(DMA


error),


included


for


compatibility


purposes.


Function call can not proceed due to an asynchronous


IO operation (ibrda(), ibwrta(), or ibcmda()) in progress.


Incapable of executing function call, due the GPIB board


lacking the capability, or the capability being disabled in


software.


File system error. ibcnt/ibcntl will be set to the value of


errno.


An attempt to write command bytes to the bus has timed


out.


One or more serial poll status bytes have been lost. This


can


occur


due


to


too


many


status


bytes


accumulating


(through automatic serial polling) without being read.


The serial poll request service line is stuck on. This can


occur if a physical device on the bus requests service,


but its GPIB address has not been opened (via ibdev()


for example) by any process. Thus the automatic serial


polling


routines


are


unaware


of


the


device's


existence


and will never serial poll it.



This


error


can


be


returned


by


ibevent(),


FindLstn(),


or


FindRQS(). See their descriptions for more information.


If you wish to avoid using a global variable, you may instead use ThreadIberr()


which returns a thread-specific value.




ibsta




Name


ibsta -- holds status


Synopsis


class=PROGRAMLISTING


#include





volatile int ibsta;


Description





ibsta


is


set


whenever


a


function


from


the


'traditional'


or


'multidevice'


API


is


called.


Each


of


the


bits


in


ibsta


has


a


different


meaning,


summarized


in


the


following table:



Table 1. ibsta Bits



bit


DCAS


value


(hexadecimal)


0x1


meaning


used


for


board/device


DCAS


is


set


when


a


board


board


receives


the


device


clear


command


(that


is,


the


SDC


or DCL command byte). It is


cleared


on


the


next


'traditional'


or


'multidevice'


function


call


following


ibwait()


(with


DCAS


set


in


the


wait


mask),


or following


a


read


or


write


(ibrd(),


ibwrt(), Receive(), etc.). The


DCAS


and


DTAS


bits


will


only


be


set


if


the


event


queue


is


disabled.


The


event


queue


may


be


disabled with ibconfig().


DTAS


is


set


when


a


board


board


has


received


a


device


trigger


command


(that


is,


the


GET


command


byte).


It


is


cleared


on


the


next


'traditional'


or


'multidevice'


function


call


following


ibwait()


(with


DTAS


in


the


wait


mask). The


DCAS


and


DTAS bits will only be set if


the event queue is disabled.


The


event


queue


may


be


disabled with ibconfig().


Board


is


currently


board


addressed as a listener.


Board


is


currently


board


addressed as talker.


The ATN line is asserted.


board


Board


is


board


DTAS


0x2


LACS


TACS


ATN


CIC


0x4


0x8


0x10


0x20


REM


LOK


CMPL


0x40


0x80


0x100


EVENT


0x200


SPOLL


0x400


RQS


0x800


SRQI


0x1000


controller-in-charge,


so


it


is


able to set the ATN line.


Board is in 'remote' state.


Board is in 'lockout' state.


I/O


operation


is


complete.


Useful for determining when


an


asynchronous


io


operation


(ibrda(),


ibwrta(),


etc) has completed.


One


or


more


clear,


trigger,


or


interface


clear


events


have


been


received,


and


are


available


in


the


event


queue


(see


ibevent()).


The


EVENT bit will only be set if


the event queue is enabled.


The


event


queue


may


be


enabled with ibconfig().


If


this


bit


is


enabled


(see


ibconfig()), it is set when the


board


is


serial


polled.


The


SPOLL


bit


is


cleared


when


the


board


requests


service


(see


ibrsv())


or


you


call


ibwait()


on


the


board


with


SPOLL in the wait mask.



RQS


indicates


that


the


device


has


requested


service,


and


one


or


more


status


bytes


are


available


for


reading


with


ibrsp().


RQS


will


only


be


set


if


you


have automatic serial polling


enabled (see ibconfig()).


SRQI indicates that a device


connected


to


the


board


is


asserting the SRQ line. It is


only


set


if


the


board


is


the


controller-in-charge.


If


automatic


serial


polling


is


enabled


(see


ibconfig()),


SRQI


will


generally


be


cleared,


since


when


a


device


requests


service


it


board


board


board or device


board


board


device


board


END


0x2000


TIMO


0x4000


will


be


automatically


polled


and then unassert SRQ.


END


is


set


if


the


last


io


board or device


operation


ended


with


the


EOI


line


asserted,


and


may


be


set


on


reception


of


the


end-of- string


character.


The


IbcEndBitIsNormal option of


ibconfig()


can


be


used


to


configure


whether


or


not


END


should


be


set


on


reception


of


the


eos


character.



TIMO indicates that the last


board or device


io operation or ibwait() timed


out.


指示上次输入输出操作或者


ibwait()


函数超时



ERR


0x8000


ERR


is


set


if


the


last


board or device


'traditional'


or


'multidevice'


function


call


failed.


The


global


variable


iberr


will


be


set indicate the cause of the


error.




If you wish to avoid using a global variable, you may instead use ThreadIbsta()


which returns a thread-specific value.



ibask




Name


ibask -- query configuration (board or device)



//


质问


,


询问


,


怀疑


,


疑问



Synopsis





class=FUNCSYNOPSISINFO#include



int ibask(int ud, int option, int *result);



Description





Queries


various


configuration


settings


associated


with


the


board


or


device


descriptor ud. The option argument specifies the particular setting you wish to


query. The result of the query is written to the location specified by result. To


change the descriptor's configuration, see ibconfig().



Table 1. ibask options



option


IbaPAD


IbaSAD


value


(hexadecimal)


0x1


0x2


result of query


used


for


board/device


primary


board or device


board or device


IbaTMO


0x3


IbaEOT


0x4


IbaPPC


0x5


IbaREADDR


0x6


IbaAUTOPOLL


0x7


IbaCICPROT


0x8


IbaSC


0xa


GPIB


address


GPIB


secondary


address


(0


for


none,


0x60


to


0x7e


for


secondary


addresses


0


to


30)


Timeout


setting


for


io


operations


(a number from 0


to


17).


See


ibmto().



Nonzero


if


EOI


is


asserted


with


last


byte


on


writes.


See ibeot().



Parallel


poll


configuration.


See ibppc().



Useless,


included


for


compatibility


only.


Nonzero


if


automatic


serial


polling is enabled.


Useless,


included


for


compatibility


only.


Nonzero


if


board


is


system


board or device




board


device


board


board


board


IbaSRE


0xb


IbaEOSrd


0xc


IbaEOSwrt


0xd


IbaEOScmp


0xe


IbaEOSchar


IbaPP2


0xf


0x10


controller.


See


ibrsc().



Nonzero


if


board


autmatically


asserts


REN


line


when


it


becomes


the


system


controller.


See


ibsre().



Nonzero


if


termination


of


reads


on


reception


of


the


end-of-string


character


is


enabled.


See


ibeos(),


in


particular


the


REOS bit.



Nonzero


if


EOI


is


asserted


whenever


end-of-string


character


is


sent.


See


ibeos(),


in


particular


the


XEOS bit.


Nonzero


if


all


8


bits


are


used


to


match


end-of- string


character.


Zero


if


only


least


significant


7


bits


are


used.


See


ibeos(),


in


particular


the


BIN


bit.


The


end-of-string


byte.


Nonzero if in local


parallel


poll


configure


mode.


Zero


if


in


remote


board


board or device


board or device


board or device


board or device


board


IbaTIMING


0x11


IbaReadAdjust


0x13


IbaWriteAdjust


0x14


IbaEventQueue


IbaSPollBit


0x15


0x16


IbaSendLLO


0x17


parallel


poll


configure mode.


Number


indicating


T1


delay.


1


for


2


microseconds,


2


for


500


nanoseconds,


3


for


350


nanoseconds.


The


values


are


declared


in


the


header


files


as


the


constants


T1_DELAY_2000


ns,


T1_DELAY_500n


s,


and


T1_DELAY_350n


s.



Nonzero


if


byte


pairs


are


automatically


swapped


during


reads.


Nonzero


if


byte


pairs


are


automatically


swapped


during


writes.


Nonzero


if


event


queue is enabled.


Nonzero


if


the


use of the SPOLL


bit


in


ibsta


is


enabled.


Nonzero


if


devices


connected


to


this


board


are


automatically


put


into


local


lockout


mode


when


brought


online


board


board or device


board or device


board


board


board


IbaSPollTime


0x18


IbaPPollTime


0x18


IbaEndBitIsNorm


al


0x1a


IbaUnAddr


0x1b


IbaHSCableLengt


0x1f


h


IbaIst


IbaRsv


0x20


0x21


IbaBNA


0x200


with


ibfind()


or


ibdev().


Timeout


for


serial


polls.


The


value


of


the


result


is


between


0


and


17,


and


has


the


same meaning as


in ibtmo().



Timeout


for


parallel polls. The


value of the result


is


between


0


and


17,


and


has


the


same meaning as


in ibtmo().



Nonzero


if


END


bit


of


ibsta


is


set


on


reception


of


end-of-string


character


or


EOI.


Zero if END bit is


only set on EOI.


Nonzero


if


UNT


(untalk)


and


UNL


(unlisten)


commands


are


automatically


sent


after


a


completed


io


operation


using


this descriptor.


Useless,


included


only


for


compatibility.


Individual


status


bit, a.k.a. 'ist'.


The


current


status


byte


this


board


will


use


to


respond


to


serial


polls.


Board


index


(minor number) of


device


board


board or device


device


board


board


board


device


Iba7BitEOS


0x1000


interface


board


which


is


the


controller-in- char


ge of this device's


GPIB bus.


Nonzero


if


board


board


supports


7


bit


EOS


comparisons. See


ibeos(),


in


particular


the


BIN


bit.


This


is


a


Linux-GPIB


extension.




Return value





The value of ibsta is returned.






ibbna




Name


ibbna -- change access board (device)


Synopsis





class=FUNCSYNOPSISINFO#include



int ibbna(int ud, const char *name);



Description





ibbna() changes the GPIB interface board used to access the device specified


by ud. Subsequent device level calls using the descriptor ud will assume the


device is connected to


the interface board specified by name. If you wish to


specify a device's new access board by board index instead of name, you can


use the IbcBNA option of ibconfig().



The name of a board can be specified in the configuration file .



On success, iberr is set to the board index of the device's old access board.



Return value





The value of ibsta is returned.





ibcac




Name


ibcac -- assert ATN (board)


Synopsis





class=FUNCSYNOPSISINFO#include



int ibcac(int ud, int synchronous);



Description





ibcac() causes the board specified by the board descriptor ud to become active


controller by asserting the ATN line. The board must be controller-in-change in


order to assert ATN. If synchronous is nonzero, then the board will wait for a


data


byte


on


the


bus


to


complete


its


transfer


before


asserting


ATN.


If


the


synchronous


attempt


times


out,


or


synchronous


is


zero,


then


ATN


will


be


asserted immediately.



It is generally not necessary to call ibcac(). It is provided for advanced users


who want direct, low-level access to the GPIB bus.



Return value





The value of ibsta is returned.





ibclr




Name


ibclr -- clear device (device)


Synopsis





class=FUNCSYNOPSISINFO#include



int ibclr(int ud);



Description





ibclr() sends the clear command to the device specified by ud.



Return value





The value of ibsta is returned.




ibcmd




Name


ibcmd -- write command bytes (board)


Synopsis





class=FUNCSYNOPSISINFO#include



int ibcmd(int ud, const void *commands, long num_bytes);



Description





ibcmd()


writes


the


command


bytes


contained


in


the


array


commands


to


the


bus.


The


number


of


bytes


written


from


the


array


is


specified


by


num_bytes.


The


ud


argument


is


a


board


descriptor,


and


the


board


must


be


controller-in-charge.


Most


of


the


possible


command


bytes


are


declared


as


constants in the header files. In particular, the constants GTL, SDC, PPConfig,


GET,


TCT,


LLO,


DCL,


PPU,


SPE,


SPD,


UNL,


UNT,and


PPD


are


available.


Additionally,


the


inline


functions


MTA(),


MLA(),


MSA(),


and


PPE_byte()


are


available for producing


'my


talk address',


'my


listen


address',


'my


secondary


address', and 'parallel poll enable' command bytes respectively.



It is generally not necessary to call ibcmd(). It is provided for advanced users


who want direct, low-level access to the GPIB bus.



Return value





The value of ibsta is returned.





ibcmda




Name


ibcmda -- write command bytes asynchronously (board)


Synopsis





class=FUNCSYNOPSISINFO#include



int ibcmda(int ud, const void *commands, long num_bytes);



Description





ibcmda()


is


similar


to


ibcmd()


except


it


operates


asynchronously.


ibcmda()


does not wait for the sending of the command bytes to complete, but rather


returns immediately.



While an asynchronous operation is in progress, most library functions will fail


with


an


EOIP


error.


In


order


to


sucessfully


complete


an


asynchronous


operation, you must call ibwait() until the CMPL bit is set ibsta. Asynchronous


operations may also be aborted with an ibstop() or ibonl() call.



Return value





The value of ibsta is returned.

















ibconfig




Name


ibconfig -- change configuration (board or device)


Synopsis





class=FUNCSYNOPSISINFO#include



int ibconfig(int ud, int option, int setting);



Description





Changes


various


configuration


settings


associated


with


the


board


or


device


descriptor ud. The option argument specifies the particular setting you wish to


modify.


The


setting


argument


specifies


the


option's


new


configuration.


To


query the descriptor's configuration, see ibask().



Table 1. ibconfig options



option


IbcPAD


value


(hexadecimal)


0x1


effect


used


for


board/device


Sets


GPIB


board or device


primary


address.


Same as ibpad()



Sets


GPIB


board or device


secondary


address.


Same


as ibsad()



Sets timeout for io


board or device


operations.


Same


as ibmto().



If


setting


is




nonzero,


EOI


is


asserted


with


last


byte


on


writes.


IbcSAD


0x2


IbcTMO


0x3


IbcEOT


0x4


IbcPPC


0x5


IbcREADDR


0x6


IbcAUTOPOLL


0x7


IbcCICPROT


0x8


IbcSC


0xa


IbcSRE


0xb


IbcEOSrd


0xc


IbcEOSwrt


0xd


Same as ibeot().



Sets


parallel


poll


configuration.


Same as ibppc().



Useless,


included


for


compatibility


only.


If


setting


is


nonzero


then


automatic


serial


polling is enabled.


Useless,


included


for


compatibility


only.


If


setting


is


nonzero,


board


becomes


system


controller.


Same


as ibrsc().



If


setting


is


nonzero


then


board


asserts


REN


line.


Otherwise REN is


unasserted.


Same as ibsre().



If


setting


is


nonzero


then


reads


are


terminated


on


reception


of


the


end-of-string


character.


See


ibeos(),


in


particular


the


REOS bit.



If


setting


is


nonzero then EOI


is


asserted


whenever


the


end-of-string


character


is


sent.


See


ibeos(),


in


particular


the


board


device


board


board


board


board


board or device


board or device


IbcEOScmp


0xe


IbcEOSchar


0xf


IbcPP2


0x10


IbcTIMING


0x11


XEOS bit.


If


setting


is


board or device


nonzero then all 8


bits


are


used


to


match


the


end-of-string


character.


Otherwise


only


the


least


significant


7


bits


are


used.


See


ibeos(),


in


particular


the


BIN


bit.


Sets


the


board or device


end-of-string


byte. See ibeos().



If


setting


is


board


nonzero


then


the


board


is


put


into


local


parallel


poll


configure


mode,


and


will


not


change


its


parallel


poll


configuration


in


response


to


receiving


'parallel


poll


enable'


command


bytes


from


the


controller-in-char


ge. Otherwise the


board


is


put


in


remote


parallel


poll


configure


mode.


Some


older


hardware


does


not


support


local


parallel


poll


configure mode.



Sets the T1 delay.


board


Use


setting


of


1


for


2


IbcReadAdjust


0x13


IbcWriteAdjust


0x14


IbcEventQueue


0x15


microseconds,


2


for


500


nanoseconds,


or


3


for


350


nanoseconds.


These


values


are


declared


in


the


header


files


as


the


constants


T1_DELAY_2000


ns,


T1_DELAY_500n


s,


and


T1_DELAY_350n


s.


A


2


microsecond


T1


delay


is


safest,


but


will


limit


maximum transfer


speeds


to


a


few


hundred


kilobytes


per second.



If


setting


is


board or device


nonzero then byte


pairs


are


automatically


swapped


during


reads.


Presently,


this


feature


is


unimplemented.



If


setting


is


board or device


nonzero then byte


pairs


are


automatically


swapped


during


writes.


Presently,


this


feature


is


unimplemented.



If


setting


is


board


nonzero


then


the


event


queue


is


enabled.


The


event


queue


is


disabled


by


IbcSPollBit


0x16


IbcSendLLO


0x17


IbcSPollTime


0x18


IbcPPollTime


0x18


IbcEndBitIsNorm


al


0x1a


default.


If


the


setting


is


nonzero


then


the


use of the SPOLL


bit


in


ibsta


is


enabled.



If


the


setting


is


nonzero


then


devices


connected


to


this


board


are


automatically


put


into


local


lockout


mode


when


brought


online


with


ibfind()


or


ibdev().


Sets


timeout


for


serial


polls.


The


setting


must


be


between


0


and


17,


which


correspond to the


same


time


periods


as


in


ibtmo().



Sets


timeout


for


parallel polls. The


setting


must


be


between


0


and


17,


which


correspond to the


same


time


periods


as


in


ibtmo().



If


setting


is


nonzero


then


the


END bit of ibsta is


set


on


reception


of


the


end-of- string


character


or


EOI


(default).


Otherwise


END


board


board


device


board


board or device


IbcUnAddr


0x1b


IbcHSCableLengt


h


IbcIst


0x1f


0x20


IbcRsv


0x21


IbcBNA


0x200


bit


is


only


set


on


EOI.


If


setting


is


nonzero


then


UNT


(untalk)


and


UNL


(unlisten)


commands


are


automatically


sent


after


a


completed


io


operation


using


this


descriptor.


This


option


is


off


by default.


Useless,


included


only


for


compatibility.


Sets


the


individual


status


bit,


a.k.a.


'ist'.


Same as ibist().



Sets


the


current


status


byte


this


board


will


use


to


respond


to


serial


polls.


Same


as


ibrsv().



Changes


the


GPIB


interface


board


used


to


access


a


device.


The


setting


specifies


the


board index of the


new


access


board.


This


configuration


option is similar to


ibbna() except the


new


board


is


specified


by


its


board


index


instead


of


a


name.



device


board


board


board


device




Return value





The value of ibsta is returned.






ibeos




Name


ibeos -- set end-of-string mode (board or device)


Synopsis





class=FUNCSYNOPSISINFO


#include



int ibeos(int ud, int eosmode);



Description





ibeos()


is


used


to


set


the


end-of- string


character


and


mode.


The


least


significant


8


bits


of


eosmode


specify


the


eos


character.


You


may


also


bitwise- or one or more of the following bits to set the eos mode:



Table 1. End-of- String Mode Bits



constant


REOS


value (hexadecimal)


0x400


meaning


Enable


termination


of


reads


when


eos


character is received.


Assert


the


EOI


line


whenever


the


eos


character


is


sent


during


writes.


Match


eos


character


using


all


8


bits


(instead


of


only


looking


at


the


7


least significant bits).


XEOS


0x800


BIN


0x1000




Return value





The value of ibsta is returned.





ibeot




Name


ibeot -- assert EOI with last data byte (board or device)


Synopsis





class=FUNCSYNOPSISINFO#include



int ibeot(int ud, int send_eoi);



Description





If send_eoi is non-zero, then the EOI line will be asserted with the last byte


sent by calls to ibwrt() and related functions.



Return value





The value of ibsta is returned.





ibevent




Name


ibevent -- get events from event queue (board)


Synopsis





class=FUNCSYNOPSISINFO#include



int ibevent(int ud, short *event);



Description





ibevent() is used to obtain the oldest event stored in the event queue of the


board specified by the board descriptor ud. The EVENT bit of ibsta indicates


that


the


event


queue


contains


1


or


more


events.


An


event


may


be


a


clear


command, a trigger command, or reception of an interface clear. The type of


event is stored in the location specified by event and may be set to any of the


following values:



Table 1. events



constant


EventNone


EventDevTrg


value


0


1


description


The


board's


event


queue is empty


The


board


has


received


a trigger command from


the controller-in-charge.


The


board


has


received


a


clear


command


from


the controller-in-charge.


The


board


has


received


an


interface


clear


from


the


system


controller.


Note,


some


models


of


GPIB


interface


board


lack


the


ability


to


report


interface clear events.


EventDevClr


2


EventIFC


3




The


event


queue


is


disabled


by


default.


It


may


be


enabled


by


a


call


to


ibconfig().


Each


interface


board


has


a


single


event


queue


which


is


shared


across all processes and threads. So, only one process can retrieve any given


event from the queue. Also, the queue is of finite size so events may be lost


(ibevent() will return an error) if it is neglected too long.



Return value





The value of ibsta is returned.





ibfind




Name


ibfind -- open a board or device (board or device)


Synopsis





class=FUNCSYNOPSISINFO#include



int ibfind(const char *name);



Description





ibfind() returns a board or device descriptor based on the information found in


the


configuration


file.


It


is


not


required


to


use


this


function,


since


device


descriptors can be obtained with ibdev() and the 'board index' (minor number


in the configuration file) can be used directly as a board descriptor.



Return value





If sucessful, returns a (non-negative) board or device descriptor. On failure, -1


is returned.



ibist




Name


ibist -- set individual status bit (board)


Synopsis





class=FUNCSYNOPSISINFO#include



int ibist(int ud, int ist);



Description





If


ist


is


nonzero,


then


the


individual


status


bit


of


the


board


specified


by


the


board descriptor ud is set. If ist is zero then the individual status bit is cleared.


The individual status bit is sent by the board in response to parallel polls.



On success, iberr is set to the previous ist value.



Return value





The value of ibsta is returned.



ibln




Name


ibln -- check if listener is present (board or device)


Synopsis





class=FUNCSYNOPSISINFO#include



int ibln(int ud, int pad, int sad, short *found_listener);



Description





ibln()


checks


for


the


presence


of


a


device,


by


attempting


to


address


it


as


a


listener. ud specifies the GPIB interface board which should check for listeners.


If ud is a device descriptor, then the device's access board is used.



The GPIB address to check is specified by the pad and sad arguments. pad


specifies


the


primary


address,


0


through


30


are


valid


values.


sad


gives


the


secondary address, and may be a value from 0x60 through 0x7e (96 through


126), or one of the constants NO_SAD or ALL_SAD. NO_SAD indicates that


no


secondary


addressing


is


to


be


used,


and


ALL_SAD


indicates


that


all


secondary addresses should be checked.



If the board finds a listener at the specified GPIB address(es), then the variable


specified by the pointer found_listener is set to a nonzero value. If no listener is


found, the variable is set to zero.



The board must be controller-in-charge to perform this function. Also, it must


have the capability to monitor the NDAC bus line (see iblines()).



Return value





The value of ibsta is returned.



iblines




Name


iblines -- monitor bus lines (board)


Synopsis





class=FUNCSYNOPSISINFO#include



int iblines(int ud, short *line_status);



Description





iblines() is used to obtain the status of the control and handshaking bus lines of


the bus. The board used to monitor the bus is specified by the ud argument,


and the status of the various bus lines are written to the location specified by


line_status.



Some older chips are not capable of reporting the status of the bus lines, so


each


line


has


two


corresponding


bits


in


line_status.


One


bit


indicates


if


the


board


can


monitor


the


line,


and


the


other


bit


indicates


the


line's


state.


The


meaning of the line_status bits are as follows:



Table 1. line status bits



constant


ValidDAV


ValidNDAC


ValidNRFD


ValidIFC


ValidREN


ValidSRQ


ValidATN


ValidEOI


BusDAV


value


0x1


0x2


0x4


0x8


0x10


0x20


0x40


0x80


0x100


description


The BusDAV bit is valid.


The


BusNDAC


bit


is


valid.


The


BusNRFD


bit


is


valid.


The BusIFC bit is valid.


The BusREN bit is valid.


The BusSRQ bit is valid.


The BusATN bit is valid.


The BusEOI bit is valid.


Set/cleared


if


the


DAV


line


is


asserted/unasserted.


Set/cleared if the NDAC


line


is


asserted/unasserted.


Set/cleared


if


the


NRFD


line


is


asserted/unasserted.


Set/cleared


if


the


IFC


line


is


asserted/unasserted.


BusNDAC


0x200


BusNRFD


0x400


BusIFC


0x800

-


-


-


-


-


-


-


-



本文更新与2021-02-27 15:43,由作者提供,不代表本网站立场,转载请注明出处:https://www.bjmy2z.cn/gaokao/674632.html

gpib函数的相关文章

  • 爱心与尊严的高中作文题库

    1.关于爱心和尊严的作文八百字 我们不必怀疑富翁的捐助,毕竟普施爱心,善莫大焉,它是一 种美;我们也不必指责苛求受捐者的冷漠的拒绝,因为人总是有尊 严的,这也是一种美。

    小学作文
  • 爱心与尊严高中作文题库

    1.关于爱心和尊严的作文八百字 我们不必怀疑富翁的捐助,毕竟普施爱心,善莫大焉,它是一 种美;我们也不必指责苛求受捐者的冷漠的拒绝,因为人总是有尊 严的,这也是一种美。

    小学作文
  • 爱心与尊重的作文题库

    1.作文关爱与尊重议论文 如果说没有爱就没有教育的话,那么离开了尊重同样也谈不上教育。 因为每一位孩子都渴望得到他人的尊重,尤其是教师的尊重。可是在现实生活中,不时会有

    小学作文
  • 爱心责任100字作文题库

    1.有关爱心,坚持,责任的作文题库各三个 一则150字左右 (要事例) “胜不骄,败不馁”这句话我常听外婆说起。 这句名言的意思是说胜利了抄不骄傲,失败了不气馁。我真正体会到它

    小学作文
  • 爱心责任心的作文题库

    1.有关爱心,坚持,责任的作文题库各三个 一则150字左右 (要事例) “胜不骄,败不馁”这句话我常听外婆说起。 这句名言的意思是说胜利了抄不骄傲,失败了不气馁。我真正体会到它

    小学作文
  • 爱心责任作文题库

    1.有关爱心,坚持,责任的作文题库各三个 一则150字左右 (要事例) “胜不骄,败不馁”这句话我常听外婆说起。 这句名言的意思是说胜利了抄不骄傲,失败了不气馁。我真正体会到它

    小学作文