External device initialization, Interrupt handling – Measurement Computing Personal488 rev.3.0 For DOS & Windows 3.Xi User Manual
Page 185

9G. Pascal
II. SOFTWARE GUIDES - 9. Driver488/SUB
II-170
Personal488 User’s Manual, Rev. 3.0
External Device Initialization
Refer to the device manufacturer’s documentation on specific requirements for initializing your
IEEE 488 instrument. In the case of the ADC488, appropriate initialization involves sending it a
Clear
command and placing it into
Remote
mode:
rv: = ioClear (adc);
rv: = ioRemote (adc);
For our hypothetical application, we also wish to have the ADC488 generate a service request should it
detect a command error. This involves sending a command string consisting of textual data to the
ADC488:
lrv: = ioOutput (adc,‘M8X’);
We may also wish to perform other initialization and configuration. In this case, we set up the
ADC488 (
adc
) in the following configuration:
Differential inputs (A0)
Scan group channel 1 (C1)
Compensated ASCII floating-point output format (G0)
Channel 1 range to +/-10V (R3)
One-shot trigger on talk (T6)
The command to perform this configuration combines the above strings and adds the
Output
command for the ADC488:
lrv: = ioOutput (adc,’A0C1G0R3T6X’)
Interrupt Handling
In case we send out an invalid command, either due to a programming error or an unanticipated
condition in the equipment, Driver488/SUB will automatically notify the interrupt handling function as
established above:
lrv: = ioOutput (adc,’V13X’)
The interrupt handler as established above might consist of a function similar to the following:
procedure isr (var param);far;
var
sp, stadc,
{ Driver488/SUB and ADC488 spoll response }
errnum : Integer;
{ ADC488 error number }
errtext : string;
{ ADC error response }
begin
{ Check if the interrupt was due to a Service Request }
sp: = ioSPoll (ieee);
if sp = 0 then begin
Writeln (‘No SRQ detected’);
halt;
end;
{ Check that the Service Request was from the ADC488 }
stadc: = ioSPoll (adc);
if stadc = 64 then begin
Writeln (‘Not an ADC488 SRQ. SPOLL = ‘,stadc);
halt;
end;
{ Interpret the Serial Poll response }
if bitSet(stadc,1) then
Writeln(‘Triggered’);
if bitSet(stadc,2) then
Writeln(‘Trigger overrun’);
if bitSet(stadc,4) then