LAMBDA DG-4 & 5 PLUS/USB OPERATION MANUAL – REV.
51
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 should not be a significant problem in routine operation of a system, but it
can provide considerable frustration when developing and testing the control program. Test
the WAIT function with simple programs before you use it. Make sure that you will not lose
important data if you are forced to reboot.
Содержание Lambda DG-4Plus/USB
Страница 3: ......
Страница 4: ......
Страница 16: ...LAMBDA DG 4 5 PLUS USB OPERATION MANUAL REV 1 01B3 20190607 4...
Страница 24: ...LAMBDA DG 4 5 PLUS USB OPERATION MANUAL REV 1 01B3 20190607 12 Figure 2 7 Lambda DG 4 left side...
Страница 46: ......
Страница 69: ...LAMBDA DG 4 5 PLUS USB OPERATION MANUAL REV 1 01B3 20190607 57 This page intentionally left blank...
Страница 70: ......
Страница 76: ...LAMBDA DG 4 5 PLUS USB OPERATION MANUAL REV 1 01B3 20190607 64 This page intentionally blank...
Страница 78: ...LAMBDA DG 4 5 PLUS USB OPERATION MANUAL REV 1 01B3 20190607 66 This page intentionally blank...
Страница 94: ...LAMBDA DG 4 5 PLUS USB OPERATION MANUAL REV 1 01B3 20190607 82 NOTES...
Страница 98: ...LAMBDA DG 4 5 PLUS USB OPERATION MANUAL REV 1 01B3 20190607 86 NOTES...