Compare Instructions; The Cmp Instruction - Mitsubishi Electric FX2N Beginners Manual

Hide thumbs Also See for FX2N:
Table of Contents

Advertisement

Compare Instructions

How to use the TO instruction
The TO instruction transfers data from the controller base unit to the buffer of a special function
module. Note that this is a copy operation, it does not change the data in the source location.
Ladder Diagram
0
³ Special function module address (0 to 7)
· Starting address in buffer (FX
FX
3UC
» Data source in the controller base unit
¿ Number of data units to be transferred
In the example above the contents of data register D0 is copied to the buffer address 1 of spe-
cial function module number 0.
5.3
Compare Instructions
Checking the status of bit devices like inputs and relays can be achieved with basic logic
instructions because these devices can only have two states, "0" and "1". However, you will
also often want to check the contents of word devices before doing something – for example
switching on a cooling fan when a specified setpoint temperature is exceeded. The controllers
of the MELSEC FX family provide a number of different ways to compare data.
5.3.1

The CMP instruction

CMP compares two numerical values, which can be constants or the contents of data regis-
ters. You can also compare the current values of timers and counters. Depending on the result
of the comparison (greater than, less than or equal) one of three bit devices is set.
Ladder Diagram
0
³ Input condition
· First value to be compared
» Second value to be compared
¿ First of three consecutive relays or outputs, which are set (signal status "1") depending on
the result of the comparison:
1. Device 1: ON if Value 1 > Value 2
2. Device 2: ON if Value 1 = Value 2
3. Device 3: ON if Value 1 < Value 2
5 – 16
TO K0 K1 D0 K1
: 0 to 32,766). You can use a constant or a data register containing the value.
CMP D0 K100 M0
Instruction List
0 TO
: 0 to 31, FX
, FX
1N
2N
2NC
Instruction List
0 LD
1 CMP
More Advanced Programming
K0
K1
D0
, FX
, FX
, FX
, FX
3G
3GC
3GE
....
D0
K100
MITSUBISHI ELECTRIC
K1
and
3U
M0

Advertisement

Table of Contents
loading

Table of Contents