Download Print this page

Mitsubishi Electric MELSEC-F FX3U User Manual page 3

Advertisement

5. Buffer Memories (BFM)
5.1 Buffer memory List
Note:
1) When writing to BFM #0 (CH1 counter mode), BFM #1 to #27 and #29 bit1 to
6 will be initialized. When writing to BFM #40 (CH2 counter mode), BFM #41
to #67 and #29 bit10 to 15 will be initialized.
When setting the counter mode, use a TOP (pulsed) instruction, or M8002
(initial pulse) to drive the TO instruction. (The continuous operation type
cannot be used.)
2) Read/Write of 16 bit data
When using a positive value between K32,768 and K65,535 with 16 bit
counters, read/writes of data, such as the current value, ring length, preset
data, YH1/YH2 compare value, maximum count value and the minimum
count value should use the 32-bit forms of FROM/TO instructions ((D)
FROM, (D) TO).
3) Read/write of 32 bit data
The usage of a 32-bit FROM/TO instruction is recommended.
In the event that a 16-bit FROM/TO instruction is used, the following cases
need to be considered.
 If the writing order is low word first and then high word, the 32 bit data will
be written normally. Data becomes valid after both low and high words are
written.
 In the event that data is not written in the order low word first and then high
word, the error bit b7 of BFM #29 turns ON.
BFM #
Description
Default
CH1
CH2
Counter mode
BFM #0
BFM #40
K0
(Setting range: K0 to K11)
DOWN/UP command
BFM #1
BFM #41
(1-phase 1-input mode [S/W UP/
K0
DOWN] only)
BFM #2
BFM #42
Lower
Ring length
K65536
BFM #3
BFM #43
Upper
BFM #4
BFM #44 Command
K0
B F M # 5
BFM #45
Not used
-
~ #9
~ #49
BFM #10 BFM #50
Lower
Preset data
K0
BFM #11 BFM #51
Upper
BFM #12 BFM #52
Lower
YH1 compare value
K32767
BFM #13 BFM #53
Upper
BFM #14 BFM #54
Lower
YH2 compare value
K32767
BFM #15 BFM #55
Upper
BFM #16
BFM #56
Not used
-
~ #19
~ #59
BFM #20 BFM #60
Lower
Counter current value
K0
BFM #21 BFM #61
Upper
BFM #22 BFM #62
Lower
Maximum count value
K0
BFM #23 BFM #63
Upper
BFM #24 BFM #64
Lower
Minimum count value
K0
BFM #25 BFM #65
Upper
BFM #26 BFM #66 Compare results
-
BFM #27 BFM #67 Terminal status
-
BFM #28
Not used
-
BFM #29
Error status
-
BFM #30
Model identification code: K4020
K4020
BFM #31 ~ 39
Not used
-
BFM #68 ~ 32767
Not used
-
5.2 Details of buffer memories
5.2.1
Counter mode
[BFM #0 (CH1), #40 (CH2)]
The counter mode is shown in the upper right table. (Default value: K0)
Note:
When writing to BFM #0 (CH1 counter mode), BFM #1 to #27 and #29 bit1 to 6 will
be initialized. When writing to BFM #40 (CH2 counter mode), BFM #41 to #67 and
#29 bit10 to 15 will be initialized. Please perform the setting of other BFM(s) after
the setting of the counter mode (BFM #0, #40).
When setting the counter mode, use a TOP (pulsed) instruction, or M8002 (initial
pulse) to drive the TO instruction. (The continuous operation type cannot be used.)
Count modes
32 bits
1 edge count
K0
2-phase input
(phase difference
2 edge count
K2
pulse)
4 edge count
K4
1-phase 2-input (add/subtract pulse)
K6
Hardware UP/DOWN
K8
1-phase
1-input
Software UP/DOWN
K10
1) 16/32-bit counter modes
a) 32-bit counter modes
Modes: K0, K2, K4, K6, K8, K10
A 32-bit binary counter which executes UP/
DOWN counting will change from the lower
limit value to the upper limit value or the
upper limit value to the lower limit value
when overflow occurs. Both the upper and
lower limit values are fixed values: the upper
limit value is +2,147,483,647, and the lower
limit value is -2,147,483,648.
b) 16-bit counter modes
Modes: K1, K3, K5, K7, K9, K11
A 16-bit binary counter handles only positive
BFM
values from 0 to 65,535. Changes to zero
Access
from the upper limit value or to the upper
limit value from zero when overflow occurs;
R/W
the upper limit value is determined by BFMs
#3 and #2 (CH1), #43 and #42 (CH2).
2) 2-phase counter [1 edge-count] (K0, K1)
R/W
Phase A
+1
+1
-1
R/W
Phase B
R/W
Phase B input OFF →
Phase B input ON →
R/W
ON while phase A input
OFF while phase A input
ON Count up by 1.
ON Count down by 1.
-
3) 2-phase counter [2 edge-count] (K2, K3)
R/W
Phase A
R/W
+1
+1
-1
-1
R/W
Phase B
R/W
Phase B input OFF →
Phase B input ON →
ON (ON → OFF) while
OFF (OFF → ON) while
R/W
phase A input ON (OFF)
phase A input ON (OFF)
R/W
Count up by 1.
Count down by 1.
4) 2-phase counter [4 edge-count] (K4, K5)
-
UP COUNT
DOWN COUNT
R/W
Phase A
R/W
+1
+1
+1
+1
-1
-1
R/W
Phase B
5) 1-phase 2-input counter (K6, K7)
R/W
R/W
ON
Phase A input-1
at OFF → ON
Phase A
R/W
OFF
ON
R
Phase B input+1
Phase B
at OFF → ON
OFF
1
2
3
4
3
2
1 0
R
6) 1-phase 1-input counter [Hardware UP/DOWN] (K8, K9)
-
R
Phase A
OFF
ON
R
ON
Phase B
-
UP/DOWN is
determined by input
OFF
-
phase A (ON/OFF).
UP
DOWN
Current
value
7) 1-phase 1-input counter [Software UP/DOWN] (K10, K11)
BFM #1, #41
K0
K1
ON
UP/DOWN is determined
Phase B
by the contents of
BFM #1, #41 (K0/K1).
OFF
UP
DOWN
Current
value
5.2.2
[BFM #1 (CH1), #41 (CH2)]
DOWN/UP command
16 bits
Reference
When using the 1-phase 1-input counter [Software UP/DOWN] (counter mode: K10,
K1
1), 2)
K11), set the count direction by the current value of BFM #1 or BFM #41. (Default
value: K0)
K3
1), 3)
For the operation, refer to the Subsection 5.2.1 7)
K5
1), 4)
Count Direction
Setting Value
K7
1), 5)
Up count
K0
K9
1), 6)
Down count
K1
K11
1), 7)
5.2.3
Ring length [BFM #3, #2 (CH1), #43, #42 (CH2)]
When setting the upper limit value of the 16 bit counters, the setting range is K2 to
K65536. (Default value: K65536)
+2,147,483,647
Please use the DTO instruction and write data as 32 bit data.
Upper limit value
When ring length K100 is specified, the current value of the counter is changed as
shown the following figure, and the upper limit value is set to 99.
0
UP
98
99
0
1
Lower limit value
5.2.4
Command [BFM #4 (CH1), #44 (CH2)]
-2,147,483,648
Bit No.
OFF (0)
0
b0
*1
Count prohibit
Ring length
b1
*2
YH1 compared output prohibit
CH1 : (BFM #3, #2) -1
CH2 : (BFM #43, #42) -1
*3
YH2 compared output prohibit
b2
*4
YH1/YH2 independent action
b3
*5
Preset prohibit
b4
No action if PLC is set from RUN
-1
*6
b5
to STOP
(FX
2N
-1HC compatibility mode)
b6, b7
*7
No action
b8
*8
No action
b9
*8
No action
b10
*8
No action
b11
*8
b12
No action
b13 ~ b15
*1 When b0 is set to ON and the DISABLE input terminal to OFF, the counter is
permitted to start counting input pulses.
*2 Unless b1 is set to ON, YH1 (compared output) does not turn ON.
*3 Unless b2 is set to ON, YH2 (compared output) does not turn ON.
*4 When b3=ON, YH2 output is reset if YH1 output is set, and YH1 output is reset if
-1
-1
YH2 output is set. When b3=OFF, YH1 and YH2 output act independently, and
do not reset each other.
The mutual reset action becomes valid only when both the YH1 comparison
output and the YH2 comparison output are permitted (b1, b2=ON).
*5 When b4=OFF, the preset function using the PRESET input terminal is disabled.
*6 When bit 5 is set to ON, the counter will be stopped and reset and the outputs
YH1 and YH2 will be switched OFF when the PLC is set from RUN to STOP.
*7 When bit 8 in BFM #4 is set to ON, the error flags bit 1 to 6 in BFM #29 will be
reset. The shared error flags (bit 7 and bit 8) will also be reset if no error on the
other counter channel requires them to remain ON. When bit 8 in BFM #44 is set
to ON, the error flags bit 10 to 15 in BFM #29 will be reset. The shared error flags
(bit 7 and bit 8) will also be reset if no error on the other counter channel requires
them to remain ON. After clearing BFM #29 error flags this flag will be reset
automatically.
*8 b9 to b12 can perform a forced set of the YH1 output or the YH2 output, and
reset.
The output is not changed when the forced set and reset are performed
simultaneously.
5.2.5
Preset data [BFM #11, #10 (CH1), #51, #50 (CH2)]
When BFM #4, #44 b4 is ON and the PRESET input is switched from OFF to ON,
preset data is stored in BFM #21, #20 (CH1) #61, #60 (CH2) (counter current value).
5.2.6
YH1 compare value [BFM #13, #12 (CH1), #53, #52 (CH2)],
YH2 compare value [BFM #15, #14 (CH1), #55, #54 (CH2)]
 The comparison set value for the output currently written here and the present value
of the counter are measured, and when the comparison result is equal, the YH1
output or the YH2 output is set to ON within 30 s.
 Output occurs when the current value becomes equal to the compare value but
only if b1 and b2 of BFM #4, #44 are ON. Once an output is set, it remains ON
until it is reset by b9 or b10 of BFM #4, #44.
Current value
YH1/YH2 output
If b3 of BFM #4, #44 is ON, however, one of the outputs is reset when the other is set.
(refer to the following figure)
Current value
DOWN
YH1 output
1
0
99
98
YH2 output
Setting Value
5.2.7
Counter current value [BFM #21, #20 (CH1), #61, #60 (CH2)]
ON (1)
The current value of the counter can be read by the PLC. It will not be an accurate
Count permit
value during high-speed operations because of the communication delay. The
current value of the counter can be forcibly changed by writing a 32-bit value into
YH1 compared output permit
the appropriate BFMs from the PLC.
YH2 compared output permit
5.2.8
Maximum count value [BFM #23, #22 (CH1), #63, #62 (CH2)],
Minimum count value [BFM #25, # 24 (CH1), #65, #64 (CH2)]
Mutual reset action
These BFM store the maximum and minimum value reached by the counter. If the
power is turned off, the stored data is cleared. Any value written to maximum and
Preset permit
minimum count value in 16 bit counter mode which is exceeding the valid range
(0 <= value < ring length) will be automatically adjusted. Values < 0 will be
Counter is stopped and reset if
adjusted to 0, values >= ring length will be adjusted to "ring length" - 1.
PLC is set from RUN to STOP
5.2.9
Compare results [BFM #26 (CH1), #66 (CH2)]
Not used
Target
Bit No.
output
Error flag reset
b0
YH1 output reset
b1
YH1
YH2 output reset
b2
YH1 output set
b3
YH2 output set
b4
YH2
b5
Not used
b6 ~ b15
5.2.10 Terminal status [BFM #27 (CH1), #67 (CH2)]
Bit N0.
b0
b1
b2
b3
b4 ~ b15
5.2.11
Error status
Bit N0.
b0
Set when any of b1 to b15 is ON.
Set when the value of the ring length is
b1
written incorrectly. (CH1)
Set when the preset value is written
b2
incorrectly. (CH1)
Set when the compare value is written
b3
incorrectly. (CH1)
Set when the current value is written
b4
incorrectly. (CH1)
Set when the counter overflows the
b5
upper limit. (CH1)
Set when the counter underflows the
b6
lower limit. (CH1)
b7
Set when the FROM/TO command is used incorrectly.
YH1/YH2
compare value
BFM #4,#44
BFM #4,#44
b9,b10:ON
b9,b10:ON
YH2 compare value
YH1 compare value
OFF (0)
ON (1)
Compare value  current value Compare value  current value
Compare value  current value Compare value  current value
Compare value  current value Compare value  current value
Compare value  current value Compare value  current value
Compare value  current value Compare value  current value
Compare value  current value Compare value  current value
Not used
Signal Name
OFF (0)
ON (1)
PRESET input
OFF
ON
DISABLE input
OFF
ON
YH1 output
OFF
ON
YH2 output
OFF
ON
Not used
[BFM #29]
Error Status
 Outside of K2 to K65,536
 Written while CH1 is in
32-bit counter mode
 Ring length changed
while counter running
Value is other than "K0 to ring
length-1" for 16-bit counters.
Value is other than "K0 to ring
length-1" for 16-bit counters.
When the upper or lower limit
i s e x c e e d e d o n a 3 2 - b i t
counter.
*1

Advertisement

loading

This manual is also suitable for:

Melsec-f fx3u-2hc