93
Remarks:
In this example, a terminal is connected to port 1 and an RS-232C communica-
tion device is connected to port 2. Initially, all the interrupts are disabled. The pro-
gram will wait for one of two inputs from the keyboard –– KEY 1 or KEY 2, each of
which will direct the program to process subsequent interrupts in a unique way.
1. If key 1 is pressed, the COM2 and PC interrupts will be enabled. When
COM2 interrupts the ASCII Unit, a character is read from the communication
device and assigned to the variable A$. When the PC subsequently inter-
rupts the ASCII Unit, the character will be written to the PC.
2. If key 2 is pressed, only the COM 2 interrupt is enabled. When COM 2 inter-
rupts the ASCII Unit, the data is read and written directly to the PC.
6-3
Programs in Four-word Mode
This section presents example programs with the ASCII Unit set in four-word
mode. There are also several ASCII programs that do not require a PC program
in order to run.
For all of the following examples:
•
printer is connected to port 2
•
8 bits/ no parity/ 2 stop bits
Example 1
Purpose: To print data at fixed time intervals using the LPRINT state-
ment
This example does not require a PC data transfer routine.
ASCII Unit Program:
100
TH$ = MID$(TIME$,1,2)
110
IF TH$ = TH0$ GOTO 200
120
TH0$ = TH$
130 LPRINT
TIME$,A
Remarks:
This program example prints a value (A) and the present time (TIME$), on a
printer, every hour, on the hour. The PRINT statement is executed when the
“hours” change on the internal clock (for example, when the time changes from
9:59 to 10:00). The clock (24-hour) must be set prior to program execution.
Example 2
Purpose: To direct execution of the ASCII Unit from the PC using the
PC GET statement
Another way to externally control program execution is through poling. Poling is
the process of continuously checking the value of a specified bit or word. If the
value of the bit or word matches a condition set in the program, a corresponding
branch instruction is executed.
In the following program, the ASCII Unit PC GET statement is used to pole a spe-
cific word of the PC.
Programs in Four-word Mode
Section 6-3
Содержание C500-ASC04
Страница 1: ...C500 ASC04 ASCII Unit Operation Manual Revised February 2001 ...
Страница 5: ...iv ...
Страница 7: ...vi ...