![background image](http://html1.mh-extra.com/html/omron/sysmac-c200h-asc02/sysmac-c200h-asc02_operation-manual_742429101.webp)
92
Example 17
Purpose:
To direct processing using different interrupts
10
OPEN #1,“TERM:(42)”
20
OPEN #2,“COMU:(42)”
30
ON KEY 1 GOTO 100
40
ON KEY 2 GOTO 200
50
ON PC GOSUB 300
60
ON COM2 GOSUB 400
70
KEY ON:COM2 STOP
80
GOTO 80
100
’KEY 1 PROCESSING
110
COM2 ON:PC ON
120
GOTO 120
200
’KEY 2 PROCESSING
210
COM2 ON
220
IF A = 1 THEN GOSUB 300
230
GOTO 220
300
’PC INTERRUPT PROCESSING
310
B$ = MID$(STR$(LEN(A$)),2)
320
PC WRITE“@D,0,”+B$+“,”+B$+“A3”;A$
330
A = 0
340
RETURN
400
’COM INTERRUPT PROCESSING
410
IF EOF(2) THEN RETURN
420
A$ = INPUT$ (LOC(2),#2)
430
A = 1
440
RETURN
MOV
#0010
100
10001
PC Program
ASCII Unit Program
Start
ASCII busy
WRITE flag
Remarks:
In this example, a terminal is connected to port 1 and an RS-232C communi-
cation device is connected to port 2. Initially, all the interrupts are disabled.
The program 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 inter-
rupts in a unique way.
1, 2, 3... 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 communi-
cation device and assigned to the variable A$. When the PC subse-
quently interrupts 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
interrupts the ASCII Unit, the data is read and written directly to the PC.
Example Programs
Section 6-1
Содержание SYSMAC C200H-ASC02
Страница 1: ...Cat No W165 E1 04 ASCII Unit SYSMAC C200H ASC02 ...
Страница 2: ...C200H ASC02 ASCII Unit Operation Manual Revised September 2002 ...
Страница 3: ...iv ...
Страница 5: ...vi ...
Страница 7: ...TABLE OF CONTENTS viii Glossary 159 Index 163 Revision History 165 ...
Страница 122: ...Appendix B Specifications 115 130 35 100 5 ...
Страница 167: ...Cat No W165 E1 04 Note Specifications subject to change without notice Printed in Japan Authorized Distributor ...
Страница 168: ...Cat No W165 E1 04 C200H ASC02 ASCII Unit OPERATION MANUAL ...