Using HP Instrument BASIC
Creating ASP-like IBASIC Programs
Programming Tips
This section describes features and tips of IBASIC programs in relation to
ASP programs. Some examples use an example measurement setup le
named \VTH.MES". Before executing these examples, you need to save setup
data to a le named \VTH.MES" on the diskette.For an example setup, see
\Example Application Setup for Vth Measurement" in Chapter 3.
File Name Variables.
You can specify a string variable for the le name in
NNNNNNNNNNNNNNNNNNNNNNNNNN
SAVEDATA
as follows:
Filename$="DATA1.DAT"
EXECUTE ("SAVEDATA Filename$")
This feature allows you to create a more simple program as follows
.
Example ASP Program
Following ASP program gets a setup le, makes measurements, and saves
results to following les:
VTH1
,
VTH2
, ...
VTH10
. Program is 21 lines.
1 GET P VTH
2 SINGLE
3 SAVE D VTH1
4 SINGLE
5 SAVE D VTH2
6 SINGLE
7 SAVE D VTH3
.
.
.
21 SAVE D VTH10
Corresponding IBASIC
Program.
The following HP Instrument BASIC (IBASIC) program does the same
operation as the above ASP program. The program is simplied by using a
lename variable
Filename$
and the
FOR NEXT
keyword.
10 EXECUTE ("GETSETUP 'VTH.PRO'")
20 FOR I=1 TO 10
30 EXECUTE ("SINGLE")
40 Filename$="VTH"&VAL$(I)&".DAT"
50 EXECUTE ("SAVEDATA Filename$")
60 NEXT I
In line 40, the
Filename$
is dened. For example,
Filename$
=
"VTH1.DAT"
when
I
=1. So, the 21-line ASP program can be converted to a 6-line IBASIC
program.
1-45