Omron SYSMAC C200H-ASC02 Operation Manual

Cat. No. W165-E1-04
SYSMAC
C200H-ASC02
ASCII Unit
C200H-ASC02 ASCII Unit
Operation Manual
iv
!
!
!
v
Notice:
OMRON products are manufactured for use according to proper procedures by a qualified operator and only for the purposes described in this manual.
The following conventions are used to indicate and classify precautions in this manual. Always heed the information provided with them. Failure to heed precautions can result in injury to people or dam­age to property.
DANGER Indicates an imminently hazardous situation which, if not avoided, will result in death or
serious injury.
WARNING Indicates a potentially hazardous situation which, if not avoided, could result in death or
serious injury.
Caution Indicates a potentially hazardous situation which, if not avoided, may result in minor or
moderate injury, or property damage.
OMRON Product References
All OMRON products are capitalized in this manual. The word “Unit” is also capitalized when it refers to an OMRON product, regardless of whether or not it appears in the proper name of the product.
The abbreviation “Ch,” which appears in some displays and on some OMRON products, often means “word” and is abbreviated “Wd” in documentation in this sense.
The abbreviation “PC” means Programmable Controller and is not used as an abbreviation for any­thing else.
Visual Aids
The following headings appear in the left column of the manual to help you locate different types of information.
Note Indicates informa t i o n o f particular interest for efficient and convenient operation
of the product.
1, 2, 3... 1. Indicates lists of one sort or another, such as procedures, checklists, etc.
OMRON, 1989
All rights reserved. No part of this publication may be reproduced, stored in a retrieval system, or transmitted, in any form, or by any means, mechanical, electronic, photocopying, recording, or otherwise, without the prior written permis­sion of OMRON.
No patent liability is assumed with respect to the use of the information contained herein. Moreover, because OMRON is constantly striving to improve its high-quality products, the information contained in this manual is subject to change without notice. Every precaution has been taken in the preparation of this manual. Nevertheless, OMRON assumes no responsibility for errors or omissions. Neither is any liability assumed for damages resulting from the use of the informa­tion contained in this publication.
vi
TABLE OF CONTENTS
vii
PRECAUTIONS xi. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
1 Intended Audience xii. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
2 General Precautions xii. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
3 Safety Precautions xii. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
4 Operating Environment Precautions xii. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
5 Application Precautions xiii. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
SECTION 1
Hardware 1. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
1-1 Front Panel 2. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
1-2 Back Panel 4. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
1-3 System Configuration 7. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
SECTION 2
Data Section 9. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
2-1 Bits and Bytes 10. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
2-2 Data Section 11. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
SECTION 3
Programming and Communication 15. . . . . . . . . . . . . . . . .
3-1 Programs 16. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
3-2 Program Transfer 17. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
3-3 Running the BASIC Program 18. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
3-4 Assembly Routines 18. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
SECTION 4
BASIC Language 19. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
4-1 Program Configuration 20. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
4-2 BASIC Language 25. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
SECTION 5
Assembly Programming 67. . . . . . . . . . . . . . . . . . . . . . . . . .
5-1 Assembly Language Programming 68. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
5-2 Terminology and Formatting 69. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
5-3 Monitor Mode Commands 69. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
SECTION 6
Program Examples 79. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
6-1 Example Programs 80. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
6-2 Execution Sequence 94. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
6-3 Assembly Language Example 102. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Appendices
A Standard Models 107. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
B Specifications 109. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
C PC Statements and Refresh Timing 117. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
D Formatting and Data Conversion 125. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
E ASCII Unit Memory Map 135. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
F Troubleshooting 141. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
G Reference Tables 145. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
H Programming with Windows 95 HyperTerminal 151. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
I Assembly Language Programming with a Terminal 155. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
TABLE OF CONTENTS
viii
Glossary 159. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Index 163. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Revision History 165. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
ix
About this Manual:
It has been assumed in the writing of this manual that the reader is already familiar with the hardware, programming, and terminology of OMRON PCs. If a review of this information is necessary, the read­er should refer to the appropriate OMRON PC manuals for assistance.
This manual is organized into six topic sections and six supplementary appendixes and was designed to be read from the beginning to the end in the presented sequence. It is important to fully study the current section before proceeding to the following section. However, because many of the concepts presented are interrelated, in some circumstances it will not be possible to fully understand a topic until the reader has read the whole manual. Therefore, it is recommended that the user read the man­ual through once for general understanding and then again to fill in the details. This manual also con­tains an index and a glossary of important terms. It is recommended that the reader become familiar with the terms in the glossary before attempting to read this manual.
Section 1 explains the details of the external hardware of the ASCII Unit and how it connects to a PC system.
Section 2 explains the format of the PC data section. The PC data section is an area in the PC memory where the ASCII Unit and the PC exchange data.
Section 3 explains how the ASCII Unit program and the PC Program communicate. It also explains how to write, load, save, and run an ASCII Unit BASIC program.
Section 4 presents the ASCII Unit BASIC programming language. Since many of the BASIC com­mands are nonstandard and particular to an ASCII Unit-PC system, it is recommended that even readers already proficient in BASIC pay careful attention to this section.
Section 5 explains the assembly language programming environment and how it relates to the ASCII Unit BASIC program. It also explains in detail how to write, edit, and run an assembly language pro­gram.
Section 6 presents programming examples that are meant to bring together all of the concepts pres­ented in this manual. most of the programs deal with data transfer and illustrate how the ASCII Unit and the PC work together in various applications. Also in this section are several examples used to illustrate the execution sequence of the hardware during execution of the ASCII Unit and PC pro­grams. Most of the detailed technical information not immediately necessary for the understanding of a particular section has been put into one of the six appendixes and should be used for reference when needed. For as list of the appendixes, refer to the table of contents.
Appendixes, a Glossary, and an Index are also included.
WARNING Failure to read and understand the information provided in this manual may result in
personal injury or death, damage to the product, or product failure. Please read each section in its entirety and be sure you understand the information provided in the section and related sections before attempting any of the procedures or operations given.
!
xi
PRECAUTIONS
This section provides general precautions for using the C200H Temperature Sensor Unit and related devices.
The information contained in this section is important for the safe and reliable application of the C200H T emperature Sensor Unit. You must read this section and understand the information contained before attempting to set up or oper­ate the C200H Temperature Sensor Unit.
1 Intended Audience xii. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
2 General Precautions xii. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
3 Safety Precautions xii. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
4 Operating Environment Precautions xii. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
5 Application Precautions xiii. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
!
!
!
!
!
4Operating Environment Precautions
xii
1 Intended Audience
This manual is intended for the following personnel, who must also have knowl­edge of electrical systems (an electrical engineer or the equivalent).
Personnel in charge of installing FA systems.
Personnel in charge of designing FA systems.
Personnel in charge of managing FA systems and facilities.
2 General Precautions
The user must operate the product according to the performance specifications described in the relevant manuals.
Before using the product under conditions which are not described in the manual or applying the product to nuclear control systems, railroad systems, aviation systems, vehicles, combustion systems, medical equipment, amusement ma­chines, safety equipment, and other systems, machines, and equipment that may have a serious influence on lives and property if used improperly, consult your OMRON representative.
Make sure that the ratings and performance characteristics of the product are sufficient for the systems, machines, and equipment, and be sure to provide the systems, machines, and equipment with double safety mechanisms.
This manual provides information for programming and operating the Unit. Be sure to read this manual before attempting to use the Unit and keep this manual close at hand for reference during operation.
WARNING It is extremely important that a PC and all PC Units be used for the specified
purpose and under the specified conditions, especially in applications that can directly or indirectly affect human life. You must consult with your OMRON representative before applying a PC system to the above-mentioned applications.
3 Safety Precautions
WARNING Do not attempt to take any Unit apart while the power is being supplied. Doing so
may result in electric shock.
WARNING Do not touch any of the terminals or terminal blocks while the power is being
supplied. Doing so may result in electric shock.
WARNING Do not attempt to disassemble, repair, or modify any Units. Any attempt to do so
may result in malfunction, fire, or electric shock.
4 Operating Environment Precautions
Caution Do not operate the control system in the following locations:
Locations subject to direct sunlight.
Locations subject to temperatures or humidity outside the range specified in
the specifications.
Locations subje c t t o c o n d e n s a t i o n a s t h e result of severe changes in tempera­ture.
!
!
!
!
5Application Precautions
xiii
Locations subject to corrosive or flammable gases.
Locations subject to dust (especially iron dust) or salts.
Locations subject to exposure to water, oil, or chemicals.
Locations subject to shock or vibration.
Caution Take appropriate and sufficient countermeasures when installing systems in the
following locations:
Locations subject to static electricity or other forms of noise.
Locations subject to strong electromagnetic fields.
Locations subject to possible exposure to radioactivity.
Locations close to power supplies.
Caution The operating environment of the PC system can have a large effect on the lon-
gevity and reliability of the system. Improper operating environments can lead to malfunction, failure, and other unforeseeable problems with the PC system. Be sure that th e operating environment is within the specified conditions at installa­tion and remains within the specified conditions during the life of the system.
5 Application Precautions
Observe the following precautions when using the PC system.
WARNING Always heed these precautions. Failure to abide by the following precautions
could lead to serious or possibly fatal injury.
Always ground the system to 100 or less when installing the Units. Not con­necting to a ground of 100 Ω or less may result in electric shock.
Always turn OFF the power supply to the PC before attempting any of the fol­lowing. Not turning OFF the power supply may result in malfunction or electric shock.
Mounting or dismounting I/O Units, CPU Units, Memory Units, or any other Units.
Assembling the Units.
Setting DIP switches or rotary switches.
Connecting cables or wiring the system.
Connecting or disconnecting the connectors.
Caution Failure to abide by the following precautions could lead to faulty operation of the
PC or the system, or could damage the PC or PC Units. Always heed these pre­cautions.
Fail-safe measures must be taken by the customer to ensure safety in the event of incorrect, missing, or abnormal signals caused by broken signal lines, momentary power interruptions, or other causes.
Always use the power supply voltages specified in this manual. An incorrect voltage may result in malfunction or burning.
Take appropriate measures to ensure that the specified power with the rated voltage and frequency is supplied. Be particularly careful in places where the power supply is unstable. An incorrect power supply may result in malfunction.
Install external breakers and take other safety measures against short-circuit­ing in external wiring. Insufficient safety measures against short-circuiting may result in burning.
5Application Precautions
xiv
Do not apply voltages to the Input Units in excess of the rated input voltage. Excess voltages may result in burning.
Do not apply voltages or connect loads to the Output Units in excess of the maximum switching capacity. Excess voltage or loads may result in burning.
Disconnect the functional ground terminal when performing withstand voltage tests. Not disconnecting the functional ground terminal may result in burning.
Be sure that all the mounting screws, terminal screws, and cable connector screws are tightened to the torque specified in this manual. Incorrect tighten­ing torque may result in malfunction.
Leave the label attached to the Unit when wiring. Removing the label may re­sult in malfunction if foreign matter enters the Unit.
Remove the label after the completion of wiring to ensure proper heat dissipa­tion. Leaving the label attached may result in malfunction.
Double-check all wiring and switch settings before turning ON the power sup­ply. Incorrect wiring may result in burning.
Wire correctly. Incorrect wiring may result in burning.
Mount Units only after checking terminal blocks and connectors completely.
Be sure that the terminal blocks, Memory Units, expansion cables, and other
items with locking devices are properly locked into place. Improper locking may result in malfunction.
Check the user program for proper execution before actually running it on the Unit. Not checking the program may result in an unexpected operation.
Confirm that no adverse effect will occur in the system before attempting any of the following. Not doing so may result in an unexpected operation.
Changing the operating mode of the PC.
Force-setting/force-resetting any bit in memory.
Changing the present value of any word or any set value in memory.
Resume operation only after transferring to the new CPU Unit the contents of
the DM Area, HR Area, and other data required for resuming operation. Not doing so may result in an unexpected operation.
Do not pull on the cables or bend the cables beyond their natural limit. Doing either of these may break the cables.
Do not place objects on top of the cables or other wiring lines. Doing so may break the cables.
Use crimp terminals for wiring. Do not connect bare stranded wires directly to terminals. Connection of bare stranded wires may result in burning.
When replacing parts, be sure to confirm that the rating of a new part is correct. Not doing so may result in malfunction or burning.
Before touching a Unit, be sure to first touch a grounded metallic object in order to discharge any static built-up. Not doing so may result in malfunction or dam­age.
1
SECTION 1
Hardware
The ASCII Unit is an intelligent PC peripheral device designed to make a PC-based control system more flexible and powerful. The ASCII Unit, programmed in BASIC, can be used for statistical quality control, system monitoring, data processing, report generation, and other tasks.
The ASCII Unit is a companion processor that relieves the PC of some of its housekeeping, monitoring, and decision making functions. Using BASIC, it is easy to program the ASCII Unit to process data collected by the PC and to imple­ment decisions based on the results.
The PC is constantly monitoring all of its input lines. Individual inputs might represent counts, time intervals, tempera­ture, position, data values, and many other parameters. Based on the values of these inputs, the PC must send the appro­priate signals to the various output devices to adjust or maintain the operation of the controlled system.
The PC makes decisions based on predefined values stored permanently in its memory. For example, the PC might be programmed to monitor the temperature of a mechanical system. It continuously compares the monitored temperature with a “danger” value stored in memory. If the system temperature exceeds this value, the PC could be programmed to shut the system down until the temperature falls below a “safe” level.
The above is a very basic example. In a more complicated system, it might be necessary to process large quantities of data from many different inputs, and based on the results of mathematical, relational, and logical computations, come to a decision that the PC must take a particular course of action. With an ASCII Unit, the PC can delegate these data process­ing and decision making tasks. Because the ASCII Unit is programmed in BASIC instead of Ladder Diagram Program­ming, it is better suited for data processing tasks.
The ASCII Unit also allows the user easy access to any desired information in any BASIC format via an attached printer or display terminal.
Using the ASCII Unit for intelligent support, the PC based control system becomes a more powerful, flexible, and effi­cient tool.
This section describes the external hardware of the ASCII Unit. The front and back panels of the ASCII Unit contain switches, buttons, connectors, and indicators which enable the user to set up, control, and monitor ASCII Unit operations.
1-1 Front Panel 2. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
1-2 Back Panel 4. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
1-3 System Configuration 7. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
2
1-1 Front Panel
The front panel contains two RS-232C communication ports, the program­mer’s START/STOP switch, a unit number selector, and several indicator LEDs. The back panel contains two sets of DIP switches for setting ASCII Unit parameters and the PC Backplane connector.
Ports The front panel of the ASCII Unit contains two RS-232C ports. These ports
are used for connecting peripheral I/O devices to the ASCII Unit. Both ports can be used for communication devices such as printers, terminals, and mo­dems. However, only port 1 can be used for uploading or downloading a BA­SIC program. The standard configuration is to connect a personal computer to port 1 and a printer or other I/O device to port 2.
Switches The START/STOP switch is a toggle switch that is used for initiating and halt-
ing execution of the ASCII Unit program. The Machine No. switch is used for identifying the particular ASCII Unit.
Since it is possible to have more then one ASCII Unit connected to a given PC, the Machine No. identifies each individual ASCII Unit. It is not permitted to have two ASCII Units with the same Machine No. The Machine No. can be set from 1 through 9. This should be done before power is applied to the Unit.
Indicators There are four indicator lights on the front panel. They are described in the
table following the diagram on the next page.
Front Panel Section 1-1
3
Front Panel
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
RUN BASIC
1
[
T / R ERR
]
2
T / R ERR
ASC 02
START / STOP
Machine No.
Port 1
Port 2
LED Display
Indicates the operating status of the ASCII Unit.
START/STOP switch
Starts/stops BASIC pro­gram execution.
RS-232C connector port 1
Connects peripheral devices. Is generally used to input the BA­SIC program but can be used for other peripheral devices as well.
RS-232C connector port 2
Connects peripheral devices. Cannot be used to input a BASIC program. Is generally used for a printer or other RS232-C devices.
Machine No. switch
Sets the ASCII Unit Machine Number
Indicator LEDs
Name Indication Function
Run
(green)
Lit when the ASCII Unit is operating normally. Unlit if an error occurs.
T/R for ports 1 and 2
(green)
Blinks during data transmission (port 1 and port 2).
ERR 1 (error for port 1) ERR 2 (error for port 2)
(red)
Lit if an error such as parity error occurs, or while the ASCII Unit is waiting for specific transmission conditions to be satisfied.
(red - 1 only)
Blinks when the battery voltage has fallen below the rated level or when the battery has not been inserted correctly.
BASIC
(green)
Lit while the BASIC program is running.
(green)
Blinks when the BASIC program stops, or when the ASCII Unit is waiting for input while the BASIC program is running.
(green)
Unlit when in monitor mode.
Indication: Lit Blinking Unlit
Front Panel Section 1-1
4
1-2 Back Panel
This section explains the operations of the back panel of the ASCII Unit. There are two 8-pin DIP switches on the Backplane side of the ASCII Unit. The desired configuration must be set before the ASCII Unit can be plugged into the Backplane.
Left-Side DIP Switch Definitions
Pin 1 is used to select the startup mode of the ASCII Unit. The BASIC pro-
gram can be automatically booted when power is applied or it can be acti­vated after power is applied by depressing the START/STOP switch.
Pin 2 allows automatic loading of a BASIC program from the EEPROM to the RAM when power is applied.
Pin 3 and Pin 4 are used to select which of the three BASIC programs will be used as the boot program.
Pin 5 is not used. Pins 6, 7, and 8 are used to select the screen size of the display terminal.
The DIP switches are described in more detail in the diagram on the follow­ing page.
Back Panel Section 1-2
5
6: The pin numbers for port 2 corrected in the diagram. Left-Side DIP Switch Settings
OFFON: 0
: 1
12345678
Start mode
Pin No. 1 Function
Setting
0
Manual start mode In this mode, the BASIC program is not
started upon power application. To start the program, either press the START/ STOP switch or issue a start command from the personal computer connected to port 1.
1
Automatic start mode In this mode, the BASIC program is
started automatically on power applica­tion.
Automatic program transfer from EEPROM to RAM
Pin No. Function
Set this pin to “0” if only the RAM is to be used.
2
Set this pin to “1” to automatically transfer the program from the EE­PROM to RAM on power applica­tion or reset.
0
1
Setting
Program No.
Pin No. Function34
00 10 01 11
No. 1
No. 2 No. 3
Setting
Screen size
Pin No. Screen Size
Setting
40 columns x 7 lines 40 columns x 8 lines 40 columns x 15 lines 40 columns x 16 lines
80 columns x 16 lines
80 columns x 15 lines
80 columns x 24 lines 80 columns x 25 lines
678 000 1
1 11
1 1
11
111
00
00
0 00 0
0
1
These pins select which program will be executed on power application or reset. The program number can be changed later with the PGEN command.
Not Used. Always set this pin to OFF.
Back Panel Section 1-2
6
Right-Side DIP Switch Definitions
Pins 1, 2, and 3 are used for setting the baud rate of port 1. Pin 4 is not used. Pins 5, 6, and 7 are used for setting the baud rate of port 2. Pin 8 is not used.
Right-Side DIP Switch Settings
Pin No.
Setting
567 000 1
1 11
1 1
11
111
00
00
0 00 0
0
1
Pin No.
Setting
123 000 1
1 11
1 1
11
111
00
00
0 00 0
0
1
300 BPS 600 BPS 1200 BPS 2400 BPS 4800 BPS
9600 BPS
300 BPS 600 BPS 1200 BPS 2400 BPS 4800 BPS 9600 BPS
19,200 BPS
Baud rate selection for port 1
Baud Rate
Not used (Always set these pins to OFF.)
Baud rate selection for port 2
Baud Rate
Not used (Always set these pins to OFF.)
OFFON: 0
: 1
12345678
Back Panel Section 1-2
7
1-3 System Configuration
If the ASCII Unit is plugged into either of the 2 CPU Backplane slots next to the CPU Unit, it will not be possible to mount a Host Link Unit or a Program­ming Device, such as a Programming Console. Before mounting the ASCII Unit, the DIP switches must be set. Make sure that the power supply to the PC is turned OFF during installation of the ASCII Unit. A personal computer used for entering the BASIC program should be connected to Port 1 and oth­er peripheral I/O devices such as a printer or a display terminal can be con­nected to Port 2 (refer to the following diagram). For more detailed informa­tion on peripheral interface connections and timing, refer to Appendix B Specifications.
C200H-ASC02
Port 1 (RS-232C) Port 1/Port 2 (RS-232C)
Bar-code reader
Output
Printer
Plasma Display
Personal Computer
Laptop Computer
Input
C200H PC
System Configuration Section 1-3
9
SECTION 2
Data Section
This section explains the data section of the PC, a special memory area used to communicate with the ASCII Unit. This section also defines several important terms which are used throughout this manual. The material in this section will be­come more clear later on when you begin working with an actual ASCII Unit program.
2-1 Bits and Bytes 10. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
2-2 Data Section 11. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
10
2-1 Bits and Bytes
The PC’s memory is divided up into many sections, each of which has its own name and purpose. The ASCII Unit can access any of these memory areas using the BASIC READ(@) and WRITE(@) statements (this is ex­plained in more detail in Section 4 BASIC Language). However, there is a special area in the PC’s IR data area that is assigned to each ASCII Unit. The MACHINE NO. switch on the front panel of the ASCII Unit (refer to Sec- tion 1-1 Front Panel) is used to select one of the nine possible positions.
The PC’s memory is organized into units called words. Information is usually stored in word or multiple word units. Each word has a unique address in the computer memory and can be accessed by specifying its address.
Each word contains 16 bits. A bit is the smallest piece of information that can be stored or accessed by a computer. A bit is always either one or zero. Cer­tain bits can be accessed individually and are used as flags. A flag is usually set (1) or cleared (0) by the hardware to indicate some state of the computer or to allow or disallow certain operations. Bits can also be set or cleared by the programmer to communicate certain parameters or conditions to the CPU.
For example: the ASCII Unit program requests data to be sent from the PC using the BASIC GET statement; however, the PC has not yet collected the data. The PC’s Write FLAG is cleared to zero (0), indicating that the ASCII Unit must wait. When the PC has collected the data, it sets the Write Flag to one (1), signaling the ASCII Unit that it may proceed to read the data.
Bits and Bytes Section 2-1
11
2-2 Data Section
Each ASCII Unit is assigned four memory words called the Data Section for communication with the PC. The words are assigned from addresses 100 to 199 of the PC IR memory area. How this information is used will be under­stood better after you read the BASIC Language and Programming Exam­ples sections of this manual.
See the following tables for detailed information on the location, breakdown, and purpose of each bit of the Data Section:
SYSMAC C200H, C200HS, C200HX/HG/HE
Transferred to each Unit every time the I/O data is refreshed.
ASCII Unit
Refresh timing
Words n to n+2 OUT refresh Word n+3 IN refresh
4 words are used (n: 100 + 10 + unit no.)
IR Area
Word 100 to 103 Unit 0 Word 110 to 113 Unit 1 Word 120 to 123 Unit 2 Word 130 to 133 Unit 3 word 140 to 143 Unit 4 Word 150 to 153 Unit 5 Word 160 to 163 Unit 6 Word 170 to 173 Unit 7 Word 180 to 183 Unit 8 Word 190 to 193 Unit 9
Data Section Section 2-2
12
Bit Definitions
I/O Word No. Bit Name Function
Output n 00 --- Not used (n = 100 +
10 x unit no.)
01 WRITE (PC to
ASCII)
This bit is used as a flag. When this flag is set (”1”) and the PC READ command is executed, a specified quantity of data will be transferred from the PC to the ASCII Unit, starting from a specified word. When this flag is cleared (”0”), execution of PC READ will be terminated. The interrupt numbers used by the ON PC GOSUB command become valid at the positive transition (i.e., from OFF to ON) of this flag.
02 READ (ASCII to
PC)
This bit is used as a flag. When this flag is set and the PC WRITE command is executed, a specified quantity of data will be transferred from the ASCII Unit to the PC. When this flag is cleared, execution of the PC WRITE command will be terminated.
03 Restart The ASCII Unit is initialized and restarted at the
negative transition of this flag (i.e., from ON to OFF). When this flag is set, the ASCII Unit is initialized.
04 to 07 Interrupt number These four bits constitute an interrupt number that is
used when the ON PC command is executed. These bits are read as a hexadecimal number; numbers 01 to 15 are treated as interrupt numbers while 00 is ignored.
08 to 15 Output data These bits constitute PC data. This data is written to
the ASCII Unit with MOV and read from the PC with the PC GET command in the BASIC program. Note: In addition to raw data, 8-bit address data can also be transferred to the ASCII Unit to facilitate branching within the BASIC program.
n + 1 00 to 11 Number of data
words to be transferred
These bits specify the number of words to be transferred by the PC READ or PC WRITE command. The number of words may not exceed 255.
12 to 15 --- Not used
Data Section Section 2-2
13
Bit Definitions Continued
I/O Word No. Bit Name Function
Output (n = 100 + 10 x unit no.)
n + 2 00 to 12 Transfer base word
No.
These bits specify the PC base word (the first word from which data is accessed) for data transfer.
13 to 15 PC memory
These bits specify the section of the PC memory from which data will be transferred between the PC and ASCII Unit with the PC READ or PC WRITE command.
Bit No.
Data Area
0 DM Area
IR Area HR Area AR Area LR Area TC Area
00
00 0 0
000
0
1 1 11
1 11
15 14 13
Input n + 3 00 ASCII busy This bit is used as a flag that is set during data
transfer.
(n = 100 + 10
01 to 03 --- Not used
x unit no.) 04 Port 1 error This bit is used as an error flag that is set if a
transmission error (such as parity error) has occurred in port 1.
05 Port 2 error This bit is used as an error flag; it is set if a
transmission error (such as parity error) has occurred in port 2.
06 Battery error This bit is used as a flag that is set when the supply
voltage of the built-in battery has dropped below the
rated level or the battery is not correctly connected. 07 BASIC RUN This flag is set while the BASIC program is running. 08 Input data These bits constitute data that is transferred from the
ASCII Unit to the PC. The data is written to the PC with
the ASCII Unit PC PUT command and is read by the
PC with the MOV.
Note: In addition to raw data, 8-bit control data can
also be transferred to the PC to facilitate branching
within the PC program.
Data Section Section 2-2
15
SECTION 3
Programming and Communication
Section 3-1 explains how the ASCII Unit and the PC exchange information. Section 3-2 explains how to transfer pro­grams from one device to another. The ASCII Unit BASIC program is written on a personal computer. To run the pro­gram, it must be transferred to the RAM of the ASCII Unit. The ASCII Unit program can be permanently stored in the ASCII Unit EEPROM and also loaded from the EEPROM. The program can also be transferred back to the personal computer or other storage device. Section 3-4 explains how to run a BASIC program once it has been transferred to the ASCII Unit.
3-1 Programs 16. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
3-2 Program Transfer 17. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
3-3 Running the BASIC Program 18. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
3-4 Assembly Routines 18. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
16
3-1 Programs
To use the ASCII Unit in conjunction with the PC, an ASCII Unit program writ­ten in BASIC is needed. A data exchange routine must also be incorporated into the PC program except when the READ(@...) and WRITE(@...) state­ments are used with specific memory area designators. The PC data ex­change routine must set the number of words to be transferred, the base address, and the specific memory area. This can be done using the PC MOV instruction.
There are two ways the ASCII Unit can communicate with the PC. In the first method, the PC controls the timing of the data transfer between the two de­vices. The ASCII Unit “requests” access to the PC data memory area using the PC READ, PC WRITE, PC GET, or PC PUT statements, and then waits for the PC to respond by setting either the read or write flag. The PC data exchange routine performs the designated operations. When the PC is ready, the appropriate flag is set and the ASCII Unit proceeds with the data transfer.
In the second method, no special PC data exchange code is necessary to facilitate communication between the two devices. If the memory area desig­nator parameter is specified with the PC READ or PC WRITE statement, the ASCII Unit can directly access the specified PC memory area.
The following two figures illustrate the relationship between the PC program and the ASCII Unit program.
PC program
General Program
General Program
Data exchange code
ASCII Unit program
Data exchange processing or I/ O program
write/read data exchange
PC program
I/O data ex­change
ASCII Unit program
Common memory
I/O memory
This diagram illustrates the relationship between the PC data exchange code and the ASCII Unit program.
PC READ command
PC WRITE command
PC PUT command
PC GET command
MOV Instruction
MOV instruction, OUT instruction, etc.
MOV Instruction
MOV instruction, OUT instruction, etc.
I/O memory
Programs Section 3-1
17
3-2 Program Transfer
Preparation For the personal computer to communicate with the ASCII Unit, set the com-
puter communication software as follows: Baud rate: same as ASCII Unit
Data length: 8 bits Parity: none No. stop bits: 2
Also: Full duplex, no echo, no XON/XOFF buffer busy control, no auto line feed.
Set the ASCII Unit DIP switches to the desired configuration. (Refer to Section 1 for DIP switch settings.)
Transfer The ASCII Unit BASIC program must be written on a personal computer
which is connected to port 1 of the ASCII Unit through an RS-232C interface. A program can be transferred to the ASCII Unit from the personal computer or any other storage device connected to one of the communication ports with the BASIC LOAD command (refer to Section 4-2-2 Commands). Pro­grams can also be transferred from the ASCII Unit’s EEPROM to the ASCII Unit’s RAM using the LOAD command.
Programs can be transferred from the ASCII Unit’s RAM to the EEPROM or to a personal computer or other storage device connected to one of the com­munication ports using the BASIC SAVE command (refer to Section 4-2-2 Commands).
The ASCII Unit can be booted on power application by a program stored in the EEPROM. To do this, set pin 2 of the left-side DIP switch on the back panel of the ASCII Unit to ON (refer to Section 1-2 Back Panel).
During data transfer, an overflow may occur if the buffering capacity of the baud rate settings of the computer and the ASCII Unit are not matched. If an overflow error does occur, set either a slower baud rate or specify XON with the OPEN command.
Note The EEPROM’s guaranteed lifetime is 5000 write operations.
Program Transfer Section 3-2
18
Direction of Data Transfer
Computer or other periph­eral device
Computer or other periph­eral device
SAVE #1, “COMU:” LOAD #1, “COMU:”
SAVE #2, “COMU:” LOAD #2, “COMU:”
(1)
(2)
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
RUN BASIC
1
[
T / R ERR
]
2
T / R ERR
ASC 02
START / STOP
Machine No.
Port 1
Port 2
Note Refer to the explanation of the OPEN command in Section 4-2-4 Device
Control Statements for details on COMU
.
3-3 Running the BASIC Program
The ASCII Unit can store and access three separate BASIC programs. Each program has an associated program number. The user can specify which program is to be used by setting a DIP switch on the back panel of the ASCII Unit. This must be done before the Unit is activated.
There are three ways to execute the specified BASIC program:
1, 2, 3... 1. Enter the RUN command from the keyboard of the personal computer.
(Keying in CTRL+X will abort the program.)
2. Pressing the START/STOP switch on the ASCII Unit will start the pro­gram. Pressing it again will stop the program.
3. If pin 1 of the left-side DIP switch is set to the ON position, the specified program will be executed automatically when the Unit is turned ON or when it is reset.
3-4 Assembly Routines
Assembly language routines can be written for the ASCII Unit and called from the BASIC program with the USR statement. An assembly program can be saved to the personal computer with the S command and loaded from the personal computer with the L command (refer to Section 5-3 Monitor Mode Commands). Assembly programs are stored in the S format.
Assembly Routines Section 3-4
19
SECTION 4
BASIC Language
This section contains an explanation of the terminology, components, structure, and use of the BASIC programming lan­guage on the ASCII Unit. Even those familiar with BASIC should study this section carefully, as many of the ASCII Unit BASIC commands, statements, and functions are non-standard, especially those that control I/O operations. Experienced BASIC users may wish to skip Section 4-1 and move directly to Section 4-2. All readers should pay special attention to the explanation of statements that are prefixed with “PC.” Also pay special attention to the OPEN statement.
4-1 Program Configuration 20. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
4-2 BASIC Language 25. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
4-2-1 BASIC Format 25. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
4-2-2 Commands 26. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
4-2-3 General Statements 32. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
4-2-4 Device Control Statements 51. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
4-2-5 Arithmetic Operation Functions 54. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
4-2-6 Character String Functions 57. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
4-2-7 Special Functions 60. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
20
4-1 Program Configuration
A BASIC program consists of commands, statements, and functions.
BASIC Language
Command
Function
Arithmetic operation function Character string function Special function
Statement
General statement
Device control statement
Basic Statements designate and control the flow of programs and are gen­erally used in program lines within a program.
Basic Commands are usually entered from the command line and control operations external to the program such as printing and listing.
Examples
: print, list, run
Functions are self-contained programs which accept one or more argu­ments, perform predefined calculations, and return a result/s. There are pre­defined BASIC functions for arithmetic and string operations as well as user­defined functions.
Examples
: INT(x), LOG(x), SQR(x)
Lines and Statements A program written in BASIC is a series of lines, each of which consists of one
or more statements. If several statement are written on the same line, they must be separated with colons(:). A line can be no longer than 255 charac­ters. Use single quotation marks (’) to separate comments.
Example
of four statements on a line:
10 FOR L=1 TO 100: J=L*I: PRINT J: NEXT L
Line Numbers Every BASIC program line begins with a line number. Line numbers indicate
the order in which the program lines are stored in memory and are also used as references for branching and editing. Line numbers must be in the range of 0 through 63999. A period may be used in AUTO, DELETE, EDIT, and LIST commands to refer to the current line.
Examples
:
LIST. EDIT. AUTO DEL 100-
Character Set The BASIC character set comprises alphabetical characters, numeric charac-
ters, and special characters. The alphabetic characters in BASIC are the upper case and lower case let-
ters of the alphabet. The numeric characters in BASIC are the digits 0 through 9.
The following special characters are recognized by BASIC: SP (space) ! ” # $ & ’ ( ) * + , - . / : ; < = > ? [ \ } ^ _
Constants The following can be used as constants:
Program Configuration Section 4-1
Loading...
+ 141 hidden pages