Language Interface: 16-bit Borland Turbo Pascal
Downloads
Filename: example900232.zip
Requirements: View
How to Use the 16-bit Borland Turbo Pascal Language Interface:
I. Overview
The 16-bit GPIB language interface contains the following files:
TPDECL.TPU: Pascal unit
TPIB.OBJ: Pascal language interface module
II. Items to Include in Your GPIB Application
You must include the following line at the beginning of your application:
Uses TPDECL;
III. Compiling, Linking, and Running from the DOS Command Line
From the DOS command line, type in the following to compile and link an application, called yourprog, with the Turbo Pascal language interface, TPIB.OBJ:
tpc yourprog
To run the newly created executable, type in the name of your application on the DOS command line, like so:
yourprog
IV. Note to Borland Pascal 7.0 Users
Use the predefined type PChar in your application program according to the following guidelines:
1. Board/Device Names and Buffers to Send Data
You must declare the variable to be of type PChar. You cannot pass literal strings as parameters. The variable name must be referenced in the subroutine call statement by using the pointer symbol (^) after the variable name.
Examples:
ibfind:
var bdname : PChar;
ud : integer;
bdname := "GPIB0";
bd := ibfind(bdname^);
ibwrt:
var wrtbuf : PChar;
wrtbuf := "VAL1?";
ibwrt (bd, wrtbuf^, 5);
SendCmds:
var cmdbuf : PChar;
cmdbuf := "*IDN?";
SendCmds (0, cmdbuf^, 5);
2. Buffers to Receive Data
You must define variables that receive data as zero-based arrays. Define the array buffer large enough to receive the expected data. For variables declared as zero-based arrays, do not use the pointer symbol (^) after the variable name.
Examples:
ibrd:
var rdbuf : [0..20] of char;
ibrd (bd, rdbuf, 10);
Receive:
var data : array[0..100] of char;
Receive(0, 8, data, 100, STOPend);
In the NI-488 and NI-488.2 Subroutines for Pascal, there are Turbo Pascal for Windows examples using zero-based arrays or the type PChar for each NI-488 and NI-488.2 subroutine. You can follow these examples when creating your application programs; however, ibfind and ibbna must follow the guidelines above for board/device names.
Requirements
Filename: example900232.zip
Software Requirements
Language(s): Pascal
Hardware Requirements
Hardware Group: GPIB
Driver: NI-488.2
Reader Comments | Submit a comment »
Legal
This example program (this "program") was developed by a National Instruments ("NI") Applications Engineer. Although technical support of this program may be made available by National Instruments, this program may not be completely tested and verified, and NI does not guarantee its quality in any way or that NI will continue to support this program with each new revision of related products and drivers. THIS EXAMPLE PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND AND SUBJECT TO CERTAIN RESTRICTIONS AS MORE SPECIFICALLY SET FORTH IN NI.COM'S TERMS OF USE (http://ni.com/legal/termsofuse/unitedstates/us/).
