Section 7 Sample Programs
7-4
(2) Common module
This paragraph describes the program module used commonly when writing the
sample programs:
1) Response message read module
To simplify the program, create the following routines based on the functions
provided by the BASIC library for the GPIB board to read response messages.
Code module file: RESP01.BAS
1 Function ReceiveResp() As String '
Response message processing routine
2 Dim read_data$, read_term$
3 Dim i%
4'
5 read_data$ = Space$(257)'
Clears receiving buffer.
6 read_term$ = Chr$(1Ø)'
Reads the terminator as LF.
7'
8Do
9 Call ibrd(Ans%, read_data$)'
Receives a response message.
1Ø If ibsta% < Ø Then '
Displays an error if it occurs in reception
process.
11 ReceiveResp$ = ""
12 MsgBox "Data Read Address = " & Str$(RCA%),
MB_IconStop, "Data Error !"
13 End
14 Else
15 i% = InStr(read_data$, read_term$)
16 ReceiveResp$ = Mid$(read_data$, 1, i% - 1)'
Accepts the terminator for the response
message.
17 Exit Do
18 End If
19 Loop
2Ø End Function