Omron C40K 用户手册

下载
页码 222
68
5-1
Introduction
The K-type PCs have large programming instruction sets that allow for easy
programming of complicated control processes. This section explains each
instruction individually and provides the ladder diagram symbol, data areas,
and flags used with each. Basic application examples are also provided as
required in describing the instructions.
The many instructions provided by the K-type PCs are described in following
subsections by instruction group. These groups include Ladder Diagram In-
structions, Bit Control Instructions, Timer and Counter Instructions, Data
Shifting, Data Movement, Data Comparison, Data Conversion, BCD Calcula-
tions, Subroutines, Step Instructions, and Special Instructions.
Some instructions, such as timer and counter instructions, are used to control
execution of other instructions, e.g., a TIM completion flag might be used to
turn ON a bit when the time period set for the timer has expired. Although
these other instructions are often used to control output bits through the
OUTPUT instruction, they can be used to control execution of other instruc-
tions as well. The OUTPUT instructions used in examples in this manual can
therefore generally be replaced by other instructions to modify the program
for specific applications other than controlling output bits directly.
5-2
Notation
In the remainder of this manual, all instructions will be referred to by their
mnemonics. For example, the OUTPUT instruction will be called OUT; the
AND NOT instruction, AND NOT. If you’re not sure of what instruction a mne-
monic is used for, refer to 
Appendix B Programming Instructions and Execu-
tion Times.
If an instruction is assigned a function code, it will be given in parentheses
after the mnemonic. These function codes, which are 2-digit decimal num-
bers, are used to input most instructions into the CPU. A table of instructions
listed in order of function codes is also provided in 
Appendix B Programming
Instructions and Execution Times.
5-3
Instruction Format
Most instructions have at least one or more operands associated with them.
Operands indicate or provide the data on which an instruction is to be per-
formed. These are sometimes input as the actual numeric values (i.e., as
constants), but are usually the addresses of data area words or bits that con-
tain the data to be used. A bit whose address is designated as an operand is
called an operand bit; a word whose address is designated as an operand is
called an operand word. In some instructions, the word address designated
in an instruction indicates the first of multiple words containing the desired
data.
Each instruction requires one or more words in Program Memory. The first
word is the instruction word, which specifies the instruction and contains any
definers (described below) or operand bits required by the instruction. Other
operands required by the instruction are contained in following words, one
operand per word. Some instructions require up to four words.
A definer is an operand associated with an instruction and contained in the
same word as the instruction itself. These operands define the instruction
rather than telling what data it is to be used. Examples of definers are TC
numbers, which are used in timer and counter instructions to create timer
and counters, and jump numbers, which define which JUMP instruction is
Instruction Format
Section 5-3