7-7
7.2.2 Initializing the MT8801C
<Example 1.1> Initializing the MT8801C
1) Project file: SMPL101.MAK
1 FORM1Ø1.FRM Specifies the form file.
2 INITØØ1.BAS Indicates the code file of the initialization
module.
3 VBIB.BAS Specifies the GPIB library file.
4 NIGLOBAL.BAS Specifies the GPIB library file.
5 ProjWinSize=87,394,243,136
6 ProjWinShow=2
Lines 1 and 2 indicate that the files described below are used. Lines 3 and 4
specify the GPIB control library to be used. If the directory containing these files
is not located where project file SMPL001.MAK is located, also specify the direc-
tory.
2) Form file: FORM101.FRM
Write the following additional procedures:
1 Sub Form_click () Executed when the form file is clicked.
2 Call initial_gpib' Calls the GPIB initialization routine.
3 End Sub
These procedures become main routines to call the initialization routine of the
GPIB interface. When the mouse button is clicked on the Form101 window,
initial_gpib is executed.
3) Code module file: INIT001.BAS
1 '----------------------------
2 ' MT88Ø1C GPIB Sample Program
3 ' Initialize
4 '----------------------------
5'
6
Global Const RCA% = 1'
Defines the MT8801C addrress in variable
RCS.
7 Global Ans%' Variable for GPIB board
8'
9
Sub initial_gpib ()'
GPIB initialization routine
1Ø Call ibdev(Ø, RCA%, Ø, Ø, 1, Ø, Ans%)'
Initializes the GPIB board in the controller.
11 Call ibsic(Ans%)' Initializes the interface function.
12 Call ibclr(Ans%)' Clears the MT8801C device.
13 Call ibwrt(Ans%, "TRM Ø")'
Sets the GPIB send terminator of the
MT8801C to LF.
14 Call ibwrt(Ans%, "INI")'
Initializes the MT8801C.
15 End Sub
7.2 Sample Program (Example of Program Using Visual Basic)