LAMBDA DG-4 PLUS & DG-5 PLUS OPERATION MANUAL – REV. 3.05B (20131009)
44
With the Lambda DG-4 BUSY line connected to PIN 11 of the computer’s parallel printer
port the input port can be read to obtain the status of the Lambda DG-4. Using Microsoft
QuickBasic, this would be done as follows:
Listing 4-1. A routine for obtaining the status of the DG-4.
BUSY:
OUT B2, 16 ‘ required on some computers
‘
before
data
can
be
read
FOR U = 0 TO 5
‘Delay to allow Lambda DG-4
NEXT U
‘to set busy flag
LOOK:
STATUS = INP(INPORT)
‘Read in from printer port
STATUS = STATUS AND 128 ‘Mask to read only bit 7
IF STATUS <> 128 THEN GOTO LOOK
‘Still Busy so loop
RETURN
‘Not
Busy
so
return
The example given will loop until the BUSY signal is low. When developing a program it is
advisable to insert an escape device in this loop such as:
IF INKEY$<>”” THEN RETURN
If you are stuck in a tight, endless loop without an escape device, you will have to reset the
computer. This statement may be removed once the program is operating correctly.
An alternative command to use in Microsoft QuickBasic is WAIT. This statement has the
form:
WAIT
port
, AND
data
, XOR
data
Where the port is the address of the input port, and data is an integer in the range 0 to 255.
When the WAIT statement executes, program execution halts until the input port indicated
by port reads as the indicated by data expressions. The AND
data
expression is evaluated as
an AND operation. Thus, we may test to see if the BUSY line is set as follows:
WAIT 889, 128
The program will suspend operation until the value read for the most significant bit is 1.
Since the printer adapter inverts this bit, this condition will be met only when the BUSY line
is low. An XOR operation can be used as well, as noted in the Microsoft QuickBasic Language
Reference. The WAIT statement will XOR the read data before the AND operation if a value
for XOR
data
is provided. Consider the statement:
WAIT 889, 128, 128
The XOR of the read value of the port with 128 will invert the most significant bit. The
program execution would thus be suspended until the BUSY signal went high, indicating that
the unit was busy. Using the 2 statements in series would insure that the control unit had
time to assert the BUSY line in response to a command before the program began to test to
see if the BUSY line had come back down:
WAIT 889, 128, 128
WAIT 889, 128,
THERE IS AN IMPORTANT CONSIDERATION WHEN USING THE WAIT STATEMENT!
The WAIT statement seems to be ideal because it provides a fast and easy way of directly
testing input port bits. However, if the input port does not have the correct value, and you
are unable to force the port to the correct value, you will need to reboot the computer. This
Содержание Lambda DG-4PLUS
Страница 3: ......
Страница 4: ......
Страница 16: ...LAMBDA DG 4 PLUS DG 5 PLUS OPERATION MANUAL REV 3 05B 20131009 4 This page intentionally blank...
Страница 24: ...LAMBDA DG 4 PLUS DG 5 PLUS OPERATION MANUAL REV 3 05B 20131009 12 This page intentionally blank...
Страница 46: ...LAMBDA DG 4 PLUS DG 5 PLUS OPERATION MANUAL REV 3 05B 20131009 34 This page intentionally blank...
Страница 66: ...LAMBDA DG 4 PLUS DG 5 PLUS OPERATION MANUAL REV 3 05B 20131009 54 This page intentionally blank...
Страница 68: ...LAMBDA DG 4 PLUS DG 5 PLUS OPERATION MANUAL REV 3 05B 20131009 56 This page intentionally blank...
Страница 78: ...LAMBDA DG 4 PLUS DG 5 PLUS OPERATION MANUAL REV 3 05B 20131009 66 This page intentionally blank...
Страница 82: ...LAMBDA DG 4 PLUS DG 5 PLUS OPERATION MANUAL REV 3 05B 20131009 70 NOTES...