![background image](http://html1.mh-extra.com/html/omron/c500-asc04/c500-asc04_operation-manual_743033094.webp)
84
Example 9
Purpose:
To use PC interrupts to direct execution of the ASCII Unit
PC Program
ASCII Unit Program
MOV(21/030)
#0001
DM 000
Start 1 Start 2 Start 3
Start 2 Start 1 Start 3
Start 3 Start 1 Start 2
10 OPEN #2, “LPRT: (47)”
20 ON PC 1 GOSUB 100
30 ON PC 2 GOSUB 200
40 ON PC 3 GOSUB 300
50 PC ON
60 GOTO 60
100 PC READ “2I4” ; X1, X2
110 PRINT #2, “DM1 = ”; X2
120 RETURN
200 PC READ “3I4” ; X1, X2, X3
210 PRINT #2, “DM11 = ” ; X2
220 PRINT #2, “DM12 = ” ; X3
230 RETURN
300 PC READ “4I4” ; X1, X2, X3, X4
310 PRINT #2, “DM101 = ” ; X2
320 PRINT #2, “DM102 = ” ; X3
330 PRINT #2, “DM103 = ” ; X4
340 RETURN
WRIT(87/191)
#0002
DM000
00
WRIT(87/191)
#0003
DM010
00
WRIT(87/191)
#0004
DM100
00
MOV(21/030)
#0002
DM 010
MOV(21/030)
#0003
DM 100
Always ON
Remarks:
Three ON PC GOSUB statements are used to direct program execution to three
different interrupt service routines. After the branch destinations are defined by
the ON PC GOSUB statements, the ON PC statement is executed enabling the
interrupts. The statement “GOTO 60” at line 60 causes the program to “sit and
wait” for a PC interrupt to initiate further action.
If PC interrupt 1 interrupts the ASCII Unit, the contents of DM 000 will be printed.
If PC interrupt 2 interrupts the ASCII Unit, the contents of DM 010 and 011 will be
printed. If PC interrupt 3 interrupts the ASCII Unit, the contents of DM 100, 101,
and 102 will be printed.
Connect the printer to port 2 and set the baud rate to 4,800 bps.
The lot sizes are stored in DM words as follows:
Programs in Two-word Mode
Summary of Contents for C500-ASC04
Page 1: ...C500 ASC04 ASCII Unit Operation Manual Revised February 2001 ...
Page 5: ...iv ...
Page 7: ...vi ...