Ch06_Basic_Function.pdf

(1351 KB) Pobierz
Microsoft Word - 6-1_f.doc
Chapter 6 Basic Function Instruction
T …………………………………6-2
C …………………………………6-5
SET …………………………………6-8
RST …………………………………6-10
0 MC …………………………………6-12
1 MCE …………………………………6-14
2 SKP …………………………………6-15
3 SKPE …………………………………6-17
4 DIFU …………………………………6-18
5 DIFD …………………………………6-19
6 BSHF …………………………………6-20
7 UDCTR…………………………………6-21
8 MOV …………………………………6-23
9 MOV …………………………………6-24
10 TOGG …………………………………6-25
11 ( ) …………………………………6-26
12 ( ) …………………………………6-27
13 ( ) …………………………………6-28
14 ( ) …………………………………6-30
15 ( 1) …………………………………6-32
16 ( 1) …………………………………6-33
17 CMP …………………………………6-34
18 AND …………………………………6-35
19 OR …………………………………6-36
20 →BCD…………………………………6-37
21 →BN …………………………………6-38
6 - 1
Basic Function Instruction
T
TIMER
T
Symbol
Operand
Tn: Timer Number.
PV: Preset value of the timer.
TB: Time Base (0.01S, 0.1S, 1S)
Range
WX WY WM
WS TMR CTR HR
IR
OR
SR ROR DR
K
0
32767
Tn
PV ○ ○ ○ ○ ○ ○ ○
WX0
WX240
WY0
WY240
WM0
WM1896
WS0
WS984
T0
T255
C0
C255
R0
R3839
R3840
R3903
R3904
R3967
R3968
R4167
R5000
R8071
D0
D4095
The total number of timers is 256 (T0 T255) with three different time bases, 0.01S, 0.1S and 1S.The
default number and allocation of timers is shown as below (Can be adjusted according to user’s actual
requirements by the “Configuration” function):
T0 T49 0.01S timer default as 0.00 327.67S )。
T50 T199 0.1S timer default as 0.0 3276.7S )。
T200 T255 1S timer default as 0 32767S )。
FBs-PLC programming tool will lookup the timer’s time base automatically according to the “Memory
Configuration” after the timer number is keyed in. Timer’s time = Time base x Preset value. In the example
1 below, the time base T0 = 0.01S and the PV value = 1000, therefore the T0 timer’s time = 0.01S x 1000 =
10.00S.
If PV is a register, then Timer’s time = Time base x register content. Therefore, you only need to change
the register content to change the timer’s time. Please refer to Example 2.
The maximum error of a timer is a time base plus a scan time. In order to reduce the timing error in the
application, please use the timer with a smaller time base.
Description
When the time control “EN” is 1, the timer will start timing (the current value will accumulate from 0) until
“Time Up” (i.e. CV PV), then the Tn contact and TUP (FO0) will change to 1. As long as the timer control
“EN” input is kept as 1, even the CV of Tn has reached or exceeded the PV, the CV of the timer will
continue accumulating (with M1957 = 0) until it reaches the maximum limit (32767). The Tn contact status
and flag will remain as 1 when CV PV, unless the “EN” input is 0. When “EN” input is 0, the CV of Tn will
be reset to 0 immediately and the Tn contact and “Time Up” flag TUP will also change to 0 (please refer to
the diagram c below).
If the FB S -PLC OS version is higher than V3.0 (inclusive), the M1957 can be set to 1 so the CV will not
accumulate further after “Time Up” and stops at the PV value. The default value of the M1957 is 0,
therefore the status of M1957 can be set before executing any timer instruction in the program to
individually set the timer CV to continue accumulating or stop at the PV after “Time Up” (please refer to the
diagram d below).
6-2
Ope-
rand
689134589.034.png 689134589.035.png 689134589.036.png 689134589.037.png 689134589.001.png 689134589.002.png 689134589.003.png 689134589.004.png 689134589.005.png 689134589.006.png 689134589.007.png 689134589.008.png 689134589.009.png 689134589.010.png 689134589.011.png
Basic Function Instruction
T
TIMER
T
Example 1 Constant preset value
Ladder diagram
Key operations
Mnemonic code
X1
.01S
Y0
ORG
ORG X 1
EN
T0
1000
TUP
T0 PV: 1000
P
SET M1957
X1
.01S
FO 0
OUT Y 0
ORG SHORT
SET M 1957
ORG X 1
T1 PV: 1000
EN
T1
1000
TUP
OUT
ORG
An example of taking
“Time-Up” signal directly
from FO0.
ORG
X1
327.67S
32767
10.0S
T0
(CV)
1000
c
M1957=0
(Defaulted)
0
Y0
or
T0
1000
CV
T1
(CV)
0
d
M1957=1
T1
Time Start
Time-Up
Example 2 Variable PV
The preset value (PV) shown in example 1 is a constant which is equal to 1000. This value is fixed and can not
be changed once programmed. In many circumstances, the preset time of the timers needs to be varied while
PLC running. In order to change the preset time of a timer, can first use a register as the PV operand (R or WX,
WY...) and then the preset time can be varied by changing the register content. As shown in this example, if set
R0 to100, then T becomes a 10S Timer, and hence if set R0 to 200, then T becomes a 20S Timer.
6-3
689134589.012.png 689134589.013.png 689134589.014.png
Basic Function Instruction
T
TIMER
T
Ladder diagram
Key operations
Mnemonic code
X1
.1S
ORG X 1
EN
T50
R 0
TUP
T 50 PV: R 0
T50
Y0
ORG T 50
An example of applying
the “time-up” status by
using the T50 contact.
OUT Y 0
X1
200
100
T50
0
(current value)
c
When R0=100
Y0
10.0S
d
When R0=200
Y0
20.0S
Time Start
c
Time-Up
d
Time-Up
Remark: If the preset value of the timer is equal to 0, then the timer's contact status and FO0 (TUP) become 1
("EN" input must be at 1) immediately after the PLC finishes its first scan because "Time-Up" has
occurred. (TUP) stays at 1 until "EN" input changes to 0.
6-4
689134589.015.png 689134589.016.png
Basic Function Instruction
C
COUNTER
16-Bit: C0 C199 32-Bit: C200 C255
C
Symbol
Operand
Cn: The Counter number
PV: Preset value
Range
WX WY
WM
WS TMR CTR HR
IR
OR
SR ROR DR
K
Ope-
rand
0
2147483647
Cn
PV ○ ○ ○ ○ ○ ○ ○ ○
WX0
WX240
WY0
WY240
WM0
WM1896
WS0
WS984
T0
T255
C0
C255
R0
R3839
R3840
R3903
R3904
R3967
R3968
R4167
R5000
R8071
D0
D4095
There are total 200 16-Bit counters (C0~C199). The range of preset value is between 0~32767. C0~C139
are Retentive Counters and the CV value will be retained when the PLC turns on or RUN again after a
power failure or a PLC STOP. For Non Retentive Counters, if a power failure or PLC STOP occurs, the CV
value will be reset to 0 when the PLC turns on or RUN again.
There are total 56 32-Bit counters (C200~C255). The range of the preset value is between 0~2147483647.
C200~C239 are Retentive Counters and C240~C255 are Non Retentive Counters.
The default number and assignment of the counters are shown below, if necessary can use the
"CONFIGURATION" function to change the settings.
To insure the proper counting, the sustain time of input status of CLK should greater than 1 scan time.
The max. counting frequency with this instruction can only up to 20Hz, for higher frequency please use the
high-speed soft/hardware counter.
Description
When "CLR" is at 1, all of the contact Cn, FO0 (CUP), and CV value of the counter CV are cleared to 0 and
the counter stops counting.
When "CLR" is at 0, the counter is allowed to count up. The Counter counts up every time the clock "CK "
changes from 0 to 1 (adds 1 to the CV) until the cumulative current value is equal to or greater than the
preset value (CV>=PV), the counter "Count-Up" and the contact status of the counter Cn and FO0 (CUP)
changes to 1. If the input status of clock continues to change, even the cumulative current value is equal
and greater than the preset value, the CV value will still accumulate until it reaches the up limit at 32767 or
2147483647. The contact Cn and FO0 (CUP) stay at 1 as long as CV>=PV unless the "CLR" input is set to
1. please refer the diagram c below )。
If the FB S -PLC OS version is higher than V3.0 (inclusive), the M1973 can set to 1 so the CV will not
accumulate further after “Count Up” and stops at the PV. M1973 default value is 0, therefore the status of
M1973 can be set before executing any counter instruction in the program to individually set the counter
CV to continue accumulating or stops at the PV after “Count Up” (please refer to the diagram d below).
6-5
689134589.017.png 689134589.018.png 689134589.019.png 689134589.020.png 689134589.021.png 689134589.022.png 689134589.023.png 689134589.024.png 689134589.025.png 689134589.026.png 689134589.027.png 689134589.028.png 689134589.029.png 689134589.030.png 689134589.031.png 689134589.032.png 689134589.033.png
Zgłoś jeśli naruszono regulamin