home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 18 REXX
/
18-REXX.zip
/
rxgpib.zip
/
RXGPIB.INF
(
.txt
)
< prev
next >
Wrap
OS/2 Help File
|
1999-04-21
|
11KB
|
316 lines
ΓòÉΓòÉΓòÉ 1. Introduction ΓòÉΓòÉΓòÉ
rxGPIB is a REXX DLL that allows access to the National Instruments AT-GPIB
boards. This particular board has OS/2 drivers available, but up until now, the
functions were only available through C programs. rxGPIB now enables REXX to
access them as well.
Please note that rxGPIB was written for prototyping purposes. It will not set
any speed records for data acquisitions, but for many lab instrument
applications it is more than adequate.
Currently, only a subset of the IEEE488 functions are included in rxGPIB. They
are the only functions I currently need. Depending on demand, I may add more
functions in the future. You are free to use rxGPIB, and if you do, let me know
if you would like to see additional functions added.
To run rxGPIB, you need the National Instruments AT-GPIB card and OS/2 drivers.
You can find National Instuments at:
http://www.natinst.com
The drivers, library and sample C code can be found at:
ftp://ftp.natinst.com/support/gpib/os2/at-gpib/atos2v22.zip
Also necessary are the NI-488.2M Software Reference Manual for OS/2, part
number 320610B-01 and NI-488.2M Function Reference Manual for OS/2, part number
320611-01. Both of the manuals can be downloaded from the National Instruments
web site at:
http://www.natinst.com/support/techdocs.htm
For a description on how to use rxGPIB see rxGPIB Function Description
For individual function description see each section below.
IBCLR | IBFIND | IBLOC | IBRD | IBRDF | IBWRT | IBWRTF
ΓòÉΓòÉΓòÉ 2. rxGPIB Function Description ΓòÉΓòÉΓòÉ
rxGPIB is essentially a wrapper DLL to allow REXX to access the IEEE488
functions. rxGPIB closely follows the programming rules as outlined in the
National Instruments documents for the NI-488 function calls.
Some differences are:
Each IEEE488 function inside rxGPIB is preceded with an rx, so IBFIND will
become rxIBFIND.
Each function inside rxGPIB will return the decimal values of ibsta and iberr
along with any additional data on one single line, i.e. reading a parameter
from an oscilloscope may return the following data:
8448 0 TA:PAVA MAX,0E-3 V,OK
The value 8448 (2100hex) is ibsta indicating END or EOS detected and I/O
completed. The next value is iberr and it is set to zero since ibsta did not
indicate any errors. The remaining string is the data returned from the
instrument.
The value of iberr as returned by rxGPIB will always be zero, unless bit 15 of
ibsta is set.
The buffer sizes for reading and writing operations are set to 512 bytes each.
The length of the device name for rxIBFIND is limited to 20 characters or less.
To find out the version level of rxGPIB, simply add the line rc =
RXDLLVersion() to your program. The return value will be in the form rxGPIB
vX.YY.
Consult the NI-488.2M Software Reference Manual for OS/2, part number
320610B-01 for explanation of ibsta and iberr.
See the included REXX CMD file for examples on how to use these IEEE488
functions.
GPLoadFuncs
GPDropFuncs
rxIBCLR
rxIBFIND
rxIBLOC
rxIBRD
rxIBRDF
rxIBWRT
rxIBWRTF
ΓòÉΓòÉΓòÉ 2.1. GPLoadFuncs ΓòÉΓòÉΓòÉ
This function loads rxGPIB.DLL to be used within your REXX program. A REXX
program using rxGPIB must contain the following two lines to access other
functions inside rxGPIB:
CALL RXFuncAdd 'GPLoadFuncs', 'RXGPIB', 'GPLoadFuncs'
CALL GPLoadFuncs
Standard REXX errors are returned for this function, for example: Error 43 -
Routine not found if rxGPIB.DLL can't be found. rxGPIB.DLL must be in the
current directory or in a directory where the LIBPATH statement points to.
ΓòÉΓòÉΓòÉ 2.2. GPDropFuncs ΓòÉΓòÉΓòÉ
This function unloads rxGPIB.DLL from memory. A REXX program using rxGPIB must
contain the following line to unload rxGPIB:
CALL GPDropFuncs
ΓòÉΓòÉΓòÉ 2.3. rxIBCLR ΓòÉΓòÉΓòÉ
Clears a specific device.
The command is used as follows:
rc = rxIBCLR(deviceunit)
The deviceunit is the integer value returned by the function rxIBFIND.
The return value rc consists of two integer values separated by a space:
ibsta iberr
ibsta is the status word value.
iberr indicates the possible error code if bit 15 of ibsta is set.
ΓòÉΓòÉΓòÉ 2.4. rxIBFIND ΓòÉΓòÉΓòÉ
Open and initialize a GPIB board or a user-defined device.
The command is used as follows:
rc = rxIBFIND(device)
The device is the GPIB device address. If an instrument is setup at address 4,
device would be the string DEV4
The return value rc consists of three integer values separated by spaces:
ibsta iberr deviceunit
ibsta is the status word value.
iberr indicates the possible error code if bit 15 of ibsta is set.
deviceunit is an integer value specific to the instument and must be used in
all other functions when addressing that specific instument.
ΓòÉΓòÉΓòÉ 2.5. rxIBLOC ΓòÉΓòÉΓòÉ
Go to Local.
The command is used as follows:
rc = rxIBLOC(deviceunit)
The deviceunit is the integer value returned by the function rxIBFIND.
The return value rc consists of two integer values separated by a space:
ibsta iberr
ibsta is the status word value.
iberr indicates the possible error code if bit 15 of ibsta is set.
ΓòÉΓòÉΓòÉ 2.6. rxIBRD ΓòÉΓòÉΓòÉ
Read data from a device into a user buffer.
The command is used as follows:
rc = rxIBRD(deviceunit, count)
The deviceunit is the integer value returned by the function rxIBFIND.
The count is the number of characters to read. If it's unknown, then make the
value large enough to fit the data. Reading will be terminated whenever an END
or EOS is detected.
The return value rc consists of two integer values and the data string read
separated by spaces:
ibsta iberr datastring
ibsta is the status word value.
iberr indicates the possible error code if bit 15 of ibsta is set.
datastring contains the data as reported by the instrument. No carriage return
follows the datastring.
ΓòÉΓòÉΓòÉ 2.7. rxIBRDF ΓòÉΓòÉΓòÉ
Read data from a device into a file.
The command is used as follows:
rc = rxIBRDF(deviceunit, filename)
The deviceunit is the integer value returned by the function rxIBFIND.
The filename is the name of the disk file to store the data i.e.
C:\DATA\DATA.TXT
The return value rc consists of three integer values separated by spaces:
ibsta iberr count
ibsta is the status word value.
iberr indicates the possible error code if bit 15 of ibsta is set.
count is the number of characters that were stored in the file.
ΓòÉΓòÉΓòÉ 2.8. rxIBWRT ΓòÉΓòÉΓòÉ
Write data to a device from a user buffer.
The command is used as follows:
rc = rxIBWRT(deviceunit, datastring, length)
The deviceunit is the integer value returned by the function rxIBFIND.
The datastring is the IEEE command string as required to control the
instrument.
The length is the length of the datastring variable.
The return value rc consists of two integer values separated by a space:
ibsta iberr
ibsta is the status word value.
iberr indicates the possible error code if bit 15 of ibsta is set.
ΓòÉΓòÉΓòÉ 2.9. rxIBWRTF ΓòÉΓòÉΓòÉ
Write data to a device from a file.
The command is used as follows:
rc = rxIBWRTF(deviceunit, filename)
The deviceunit is the integer value returned by the function rxIBFIND.
The filename is the name of the disk file to write to the instrument i.e.
C:\DATA\DATA.SET
The return value rc consists of two integer values separated by a space:
ibsta iberr
ibsta is the status word value.
iberr indicates the possible error code if bit 15 of ibsta is set.
ΓòÉΓòÉΓòÉ 3. The Legal Stuff ΓòÉΓòÉΓòÉ
rxGPIB is freeware but the source code is copyrighted by A. Schwarz.
This program may be distributed electronically as long as all files are kept
together.
DISCLAIMER
The author of rxGPIB is in no way responsible for any damage this program may
cause to computer equipment or instruments. No warranty is implied or given for
rxGPIB. Use rxGPIB at your own risk.
Any trademarks mentioned in this document belong to their respective owners and
the author of rxGPIB is not connected in any way to these products nor does he
endorse any of the products mentioned.
ΓòÉΓòÉΓòÉ 4. Contact ΓòÉΓòÉΓòÉ
For rxGPIB support, you can contact me directly via e-mail.
My e-mail address:
ASchw@worldnet.att.net
Visit my home page, "The Warped Code Cellar" at
http://home.att.net/~ASchw
for other information and applications for OS/2 like rxPortIO, a REXX-DLL to
access port I/O, UPS Monitor for APC brand uninterruptible power supplies and
HOUSE/2, a home automation program for X-10 devices.
This program is also available at the following internet site:
http://hobbes.nmsu.edu