Manuals >Reference >icedil Functions
Print version of this Book (PDF file)
prev next

Other Functions

The following functions are translated either to system calls or to a set of low level functions to make GPIB programming easier. The controller address on a GPIB is kept in a static array hidden in icedil.o so that users of this library do not need to remember it. However users can read this address at any time using ice_hpib_get_address().

ice_hpib_bus_init
This function takes an eid (entity id) and initializes the raw GPIB associated with this eid as follows:
   EOI Enable
   EOL No EOL character
   Timeout 2 sec
   Remote Line Asserted

ice_hpib_open
This function takes a device file name (full path name) and a flag (usually O_RDWR) to be passed to open() system call. It opens this device file and initializes it by calling ice_hpib_bus_init(). This function must be used prior to using a raw GPIB device file.
ice_hpib_read
This takes an eid, a pointer to a character buffer, the maximum number of bytes to read, and an addrs. It sets myself a listener and the addressed device a talker, then receives the response from that device.
ice_hpib_write
This function takes an eid, a pointer to a character buffer, the number of bytes to send, and addrs. It sets myself a talker and the addressed device a listener, then sends the specified characters to that device.
ice_hpib_close
This function takes an eid and closes the device file associated with this eid. This function is used to terminate communication with this device file.
ice_hpib_clear
This function takes an eid and a GPIB address. It sends a Selected Device Clear to the GPIB device specified by the addrs.
ice_hpib_get_address
This function takes an eid and returns my GPIB address on the device file associated with the eid. Usually this is 21. Note that currently no function is provided to change this controller address.
ice_hpib_listen
This function takes an eid and a GPIB address. It prepares the GPIB so that the device specified by addrs is a talker and myself is a listener. This function is called from ice_hpib_read().
ice_hpib_talk
This function takes an eid and a GPIB address. It prepares the GPIB so that the device specified by addrs is a listener and myself is a talker. This function is called from ice_hpib_write().
ice_hpib_wait
This takes one float and waits for the float second. This is implemented as a busy wait with the gettimeofday() system call.
ice_hpib_strpos
This takes two strings (string1, string2) and returns the position of the string2 in string1. This is similar to POS() function in HP BASIC.
ice_hpib_raw_read
This takes an eid, a pointer to a character buffer, and a length. This reads up to the length number of bytes from the device file specified by eid until it sees either an EOI or a terminal character. This function does not set up a talker/listener pair on the bus.
ice_hpib_raw_write
This takes an eid, a pointer to a character buffer, and a length. This writes out the length number of bytes from the buffer without setting up a talker/listener pair on the bus.
ice_hpib_check_eid
This is a "static" function visible only inside of icedil.c file. This function returns 0 if the given eid is out of the valid range and non-zero for a valid eid.


prev next