Omron SYSMAC C200H-ASC02 Operation Manual page 92

Ascii unit
Hide thumbs Also See for SYSMAC C200H-ASC02:
Table of Contents

Advertisement

Example Programs
Example 4b
Example 5
PC Program
Execution
statement
PC words are used to store the data, which consists of four characters (two
characters per word).
When the execution statement flag is set, the data is stored in DM words
0020 and 0021.
The ASCII Unit OPENs port 2 as the keyboard, and stores the entered char-
acters as a character string, A$. The character string is terminated with a car-
riage return.
Purpose:
To use the PC WRITE statement to specify and write data to the
PC DM area
• This example does not require a PC data transfer routine.
ASCII Unit Program:
10
OPEN #2,"KYBD:"
20
INPUT #2,A$
30
PC WRITE "@D,20,2,2A3";A$
Remarks:
When the PC WRITE "@..." statement is executed, the first four characters of
character string A$ are converted into ASCII code and stored in DM words
0020 and 0021.
During PC WRITE "@..." execution, the busy flag (word n+3 bit 00) is set.
Purpose:
To control the ASCII Unit from the PC using the ON PC state-
ment
MOV
#0030
100
10001
Remarks:
In this example, the PC controls execution of the ASCII Unit by means of an
interrupt.
When the ASCII Unit ON PC GOSUB statement is executed (the PC ON
statement must be executed to enable the interrupts ) the PC can then inter-
rupt the ASCII Unit. Each interrupt generated by the PC has a unique inter-
rupt number associated with it. This number is written to the ASCII Unit Pro-
gram and causes branching to a corresponding interrupt service routine. In
the above example, the unique interrupt number is 3, causing a branch to
line 200 of the BASIC program.
ASCII Unit Program
50
60
70
200
300
WRITE flag
Section 6-1
ON PC 3 GOSUB 200
ON PC 4 GOSUB 300
PC ON
A = 1234:RETURN
A = 2345:RETURN
83

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents