Feh404-Built in Hi Speed Counter
Feh404-Built in Hi Speed Counter
USER’S MANUAL
BUILT-IN
HIGH-SPEED
COUNTER
FEH404
Preface
Thank you very much for purchasing the Fuji MICREX-SX SPB Series Programmable Controller. To ensure correct
operation, please carefully read and fully understand this manual before using the product.
This manual explains the built-in high-speed counter of the MICREX-SX SPB series programmable controller.
In addition to this manual, the following manuals on programming tool are available. Please ask a nearest dealer for the
appropriate manuals and read them as required.
Notes
1. This manual may not be reproduced in whole or part in any form without prior written approval by the manufacturer.
2. The contents of this manual (including specifications) are subject to change without prior notice.
3. If you find any ambiguous or incorrect descriptions in this manual, please write them down (along with the manual
No. shown on the cover) and contact FUJI.
Safety Precautions
Before mounting, wiring, operation, maintenance and inspection of the device, be sure to read the operating instructions
carefully to ensure operation.
Here, the safety precaution items are classified into “Warning” and “Caution”:
Caution : Incorrect handling of the device may result in minor injury or physical damage.
Even some items indicated by “Caution” may also result in a serious accident.
The general safety precautions are described below. Individual precautions are given where necessary, with the above
symbols.
Caution
◊ Never touch any part of charged circuits as terminals and exposed metal portion while the power is turned ON.
It may result in an electric shock to the operator.
◊ Turn OFF the power before mounting, dismounting, wiring, maintaining or checking, otherwise, electric shock, erratic
operation or troubles might occur.
◊ Place the emergency stop circuit, interlock circuit or the like for safety outside the PC. A failure of PC might break or
cause problems to the machine.
◊ Do not connect in reverse polarity, charge (except rechargeable ones), disassemble, heat, throw in fire or short-circuit
the batteries, otherwise, they might burst or take fire.
◊ If batteries have any deformation, spilled fluids, or other abnormality, do not use them. The use of such batteries might
cause explosion or firing.
Safety Precautions
Caution
◊ Do not use one found damaged or deformed when unpacked, otherwise, failure or erratic operation might be caused.
◊ Do not shock the product by dropping or tipping it over, otherwise, it might be damaged or troubled.
◊ Follow the directions of the operating instructions when mounting the product. If mounting is improper, the product might
drop or develop problems or erratic operations.
◊ Use the rated voltage and current mentioned in the operating instructions and manual. Use beyond the rated values
might cause fire, erratic operation or failure.
◊ Operate (keep) in the environment specified in the operating instructions and manual. High temperature, high humidity,
condensation, dust, corrosive gases, oil, organic solvents, excessive vibration or shock might cause electric shock, fire,
erratic operation or failure.
◊ Select a wire size to suit the applied voltage and carrying current. Tighten the wire terminals to the specified torque.
Inappropriate wiring or tightening might cause fire, malfunction, failure, or might cause the product to drop from its
mounting.
◊ Contaminants, wiring chips, iron powder or other foreign matter must not enter the device when installing it, otherwise,
erratic operation or failure might occur.
◊ Remove the dust-cover seals of units after wiring, otherwise, fire, accidents, failure or fault might occur.
◊ Connect the ground terminal to the ground, otherwise, an erratic operation might occur.
◊ Periodically make sure the terminal screws and mounting screws are securely tightened.
Operation at a loosened status might cause fire or erratic operation.
◊ Put the furnished connector covers on unused connectors, otherwise, failure or erratic operation might occur.
◊ Sufficiently make sure of safety before program change, forced output, starting, stopping or anything else during a run.
The wrong operation might break or cause machine problems.
◊ Engage the loader connector in a correct orientation, otherwise, an erratic operation might occur.
◊ Before touching the PC, discharge any static electricity that may have been collected on your body. To discharge it,
touch a grounded metallic object. Static electricity might cause erratic operation or failure of the module.
◊ Be sure to install the electrical wiring correctly and securely, observing the operating instructions and manual. Wrong or
loose wiring might cause fire, accidents, or failure.
◊ Do not attempt to change system configurations (such as installing or removing expansion block) while the power is ON,
otherwise, failure or erratic operation might occur.
◊ Do not attempt to repair the module by yourself -- contact your Fuji Electric agent. When replacing the batteries, correctly
and securely connect the battery connectors, otherwise, fire, accidents or failure might occur.
◊ To clean the module, turn power off and wipe the module with a cloth moistened with warm water. Do not use thinner or
other organic solvents, as the module surface might become deformed or discolored.
◊ Do not remodel or disassemble the product, otherwise, a failure might occur.
◊ Follow the regulations of industrial wastes when the device is to be discarded.
◊ The modules covered in these operating instructions have not been designed or manufactured for use in equipment or
systems which, in the event of failure, can lead to loss of human life.
◊ If you intend to use the modules covered in these operating instructions for special applications, such as for nuclear
energy control, aerospace, medical, or transportation, please consult your Fuji Electric agent.
◊ Be sure to provide protective measures when using the module covered in these operating instructions in equipment
which, in the event of failure, may lead to loss of human life or other grave results.
◊ External power supply (such as 24V DC power supply) which is connected to DC I/O should be strongly isolated from
AC Power supply.
Revision
Preface
Safety Precautions
Revision
Contents
Page
Page
1-1 Overview ...................................................................................................................... 1-1
(1) Number of counters that can be incorporated ........................................................................................ 1-1
(2) Counting speed ....................................................................................................................................... 1-1
(3) Count range ............................................................................................................................................ 1-1
(4) Resetting ................................................................................................................................................. 1-1
(5) Presetting ................................................................................................................................................ 1-1
(6) Automatic resetting ................................................................................................................................. 1-1
(7) Interrupt .................................................................................................................................................. 1-1
(8) Multiplication ........................................................................................................................................... 1-1
The basic unit of the Fuji MICREX-SX Programmable Controller SPB Series is equipped with a built-in high-speed counter
as a standard feature. The SPB Series programmable controller boasts the following functions and performance
characteristics:
(1) Number of counters that can be incorporated
The counter can have two channels for single-phase pulse inputs or one channel for two-phase pulse inputs. In which
mode to use the counter is set by parameter.
(2) Counting speed
Counting speed is maximum 100 kHz in single-phase mode; maximum 50 kHz in two-phase mode.
The counter always operates without filtering (at highest speed), ignoring the input filtering time that is set by parameter.
(3) Count range
Single-phase mode: Unsigned 16-bit binary incremental counter (H0000 to HFFFF)
Two-phase mode: Signed 32-bit binary incremental/decremental counter (H80000000 to H7FFFFFFF)
Counter value is updated at program scan end.
(4) Resetting
The current counter value can be cleared to zero by external signal or by internal register.
(5) Presetting
The current counter value can be preset by user program before counting is started.
(6) Automatic resetting
This function is enabled only in single-phase mode.
This function is used to set an arbitrary upper limit on counter value.
(7) Interrupt
For each channel, one interrupt program can be started when the current counter value becomes equal to the comparison
register value. This enables high-speed response.
(8) Multiplication
This function determines how many times to count during a single pulse cycle.
Single-phase mode: x1, x2
Two-phase mode: x2, x4
1-1
Section 2 Specifications
Page
2-1 High-speed counter input specifications ................................................................. 2-1
(1) Input specifications ................................................................................................................................. 2-1
(2) Functions of input terminals .................................................................................................................... 2-1
(3) Internal input circuit ................................................................................................................................. 2-2
2-1
2-1 High-speed counter input specifications Input specification
+ PC
Photocoupler
+ COM
External input
(X0 to X3)
2-2
Phase mode 2-2 Operation of the High-speed Counter
FFFF (65,535)
FFFE (65,534)
0002 (2)
0001 (1)
0000 (0)
Hexadecimal Decimal
representation representation
Input pulse
(X0, X1)
Input pulse
(X0, X1)
2-3
2-2 Operation of the High-speed Counter Phase mode
7FFFFFFF (2,147,483,647)
7FFFFFFE (2,147,483,646)
00000001 (1)
00000000 (0)
FFFFFFFF (–1)
FFFFFFFE (–2)
80000001 (–2,147,483,647)
80000000 (–2,147,483,648)
Hexadecimal Decimal
representation representation
• To express a negative numeric value by two’s complement, individual bit of the numeric part is reversed and then 1
(one) is added.
Input pulse
(X0)
Direction signal
(X1)
2-4
Phase mode 2-2 Operation of the High-speed Counter
A-phase
(X0)
B-phase
(X1)
8
7 7
6 6
5 5
4 4
3 3
2 2
Current counter value 1 1
(D8040, D8041) 0 0
A-phase
(X0)
B-phase
(X1)
2-5
2-2 Operation of the High-speed Counter Phase mode
FFFF 04FF
FFFE 04FE
0001 0001
0000 0000
Presetting Procedure
1) Write a data in the preset value register.
2) Set the preset flag to “1” (one).
When presetting is completed, this flag is automatically reset to 0 (zero).
2-6
Phase mode 2-2 Operation of the High-speed Counter
Comparison value is recognized when the comparison value set flag is set to “1” (one) or the PC power switch is turned
once OFF and then ON again after it is written in this register.
When the setting of comparison value is completed, this flag is automatically reset to 0 (zero).
Main program
Occurrence
of match
Interrupt program
I1000
FEND
IRET
2-7
2-2 Operation of the High-speed Counter Phase mode
<Priority of interrupt>
When multiple interrupts occur at a time, an interrupt program to which the highest priority is given is executed first, and
then other interrupt programs are executed in order of their priority levels.
When an interrupt of higher priority occurs while an interrupt program is being executed, the former must wait till the latter
is completed.
Priority of interrupt
2-8
Phase mode 2-3 Timing chart
Input pulse
(X0, X1)
t1 t1
f t2
Reset signal
(X2, X3)
Input pulse
(X0, X1)
t1 t1
f t2
Reset signal
(X2, X3)
2-9
2-3 Timing chart Phase mode
t4
t3
Input pulse
(X0)
Direction signal
(X1)
t1 t1’ t1’
f t2
Reset signal
(X2)
t3
A-phase
(X0)
B-phase
(X1)
t1 t1 t1 t1
f t2
Reset signal
(X2)
2-10
Phase mode 2-3 Timing chart
t3
A-phase
(X0)
B-phase
(X1)
t1 t1 t1 t1
f t2
Reset signal
(X2)
2-11
Section 3 Internal Register Specifications
Page
3-1 Address map ............................................................................................................... 3-1
(1) Parameter area ....................................................................................................................................... 3-1
(2) Internal register area ............................................................................................................................... 3-1
3-2 Status of internal registers at power failure or after stop/start .............................. 3-1
The internal registers that are related to the built-on high-speed counter are explained below:
(1) Parameter area
Specification of whether
0C or not to use the counter
0D Specification of
counter operation
The parameter setting takes effect when the CPU is turned once OFF and then ON again.
(2) Internal register area
D8040 CH0 current value (R) CH0 current value, low-order (R)
or
8041 CH1 current value (R) CH0 current value, high-order (R)
D8042 CH0 comparison value (R/W) CH0 comparison value, low-order (R/W)
8043 CH1 comparison value (R/W) CH0 comparison value, high-order (R/W)
D8044 CH0 preset value (R/W) CH0 preset value, low-order (R/W)
8045 CH1 preset value (R/W) CH0 preset value, high-order (R/W)
R: Read-only
W: Write-only
3-1
3-3 Detail explanation of the registers Parameter area
3-2
Parameter area 3-3 Detail explanation of the registers
F E D C B A 9 8 7 6 5 4 3 2 1 0
Reserved Single- Reserved Single- Reserved Single- Single-
(0) phase (0) phase (0) phase phase CH0,
CH1 CH1 CH0 two-phase
Auto reset Multiplicat- Auto reset Multiplicati-
ion on
3-3
3-3 Detail explanation of the registers Internal register area
F E D C B A 9 8
CH1 Current Comparison Reserved Match Match Interrupt Current Stop counting
value preset value preset (0) interrupt occurrence enable/ value reset
latch clear flag clear disable
7 6 5 4 3 2 1 0
CH0 Current Comparison Reserved Match Match Interrupt Current Stop counting
value preset value preset (0) interrupt occurrence enable/ value reset
latch clear flag clear disable
3-4
Internal register area 3-3 Detail explanation of the registers
When executed, match interrupt latch is automatically cleared. It is unnecessary to operate bit 4 (C) for clearing.
Set this bit to 1 (one) when you use interrupt.
Set this bit to 0 (zero) when you do not use interrupt.
Bit 3 (B): Match flag reset (leading edge)
0 to 1: Reset
1 to 0: None
This bit specifies whether or not to reset the match occurrence flag of the status register (WM819).
When match occurrence flag reset processing is completed, this bit is automatically reset to 0 (zero).
Bit 4 (C): Match interrupt latch clear (leading edge)
0 to 1: Clear
This bit is used to forcibly clear the match interrupt latch that occurred while interrupt was disabled and thus to cancel
the interrupt.
When match interrupt latch clear processing is completed, this bit is automatically reset to 0 (zero).
If this bit is set to 1 (one), latch clear processing is performed internally and the bit is automatically reset to 0 (zero)
even when no match interrupt is latched in reality.
Bit 5 (D): Reserved
This bit must be set to 0 (zero).
Bit 6 (E): Comparison value preset flag (leading edge)
0 to 1: Set
When this bit is set to 1 (one), the data written in comparison value register D8042 (D8043) takes effect. Unless this
bit is set to 1 (one), even when a numeric value is set in the comparison value register, it cannot be recognized by the
built-in high-speed counter.
When the built-in high-speed counter recognizes the content of comparison value register, this bit is automatically
reset to 0 (zero).
Bit 7 (F): Current value preset flag (leading edge)
0 to 1: Preset
When this bit is set to 1 (one), the content of preset value register D8044 (D8045) is written in the current value
register D8040 (D8041).
When the writing operation is completed, this bit is automatically reset to 0 (zero).
3-5
3-3 Detail explanation of the registers Internal register area
F E D C B A 9 8
CH1 Match
Reserved occurrence
flag
7 6 5 4 3 2 1 0
CH0 Match
Reserved occurrence
flag
3-6
High-speed Counter Internal Block Diagram
(M8186)
(M818E)
Stop→Start
Comparison value Match occurrence flag
D8042 comparison
CH0 value (M8190)
Count stop
Internal block diagram
D8043 comparison
CH1 value (M8198)
(M8180)
(M8188)
Match clear command
External pulse input (M8183)
Current value
(X0) (M818B)
D8040
(X1) Interrupt program
D8041
CH0 interrupt latch I1000
CH1 interrupt latch I1100
Preset value
3-7
Interrupt latch clear command
D8044
(M8184)
D8045
(M818C)
Interrupt enable
(M8182)
Current value preset command
(M818A)
(M8187)
(M818F)
Batch reset command
(Symbols)
(M817F)
Current value reset command Positive logic
(X3)
A B A is output to B when
condition C is met.
C
3-4 Internal block diagram
Section 4 External Connection Diagram
Page
4-1 External connection diagram ..................................................................................... 4-1
(1) When connecting to two-phase open collector output encode ............................................................... 4-1
(2) When connecting to two-phase output encoder (built-in resistor type) ................................................... 4-1
(3) When connecting to single-phase contact output ................................................................................... 4-1
Connection diagram
Section 4 External Connection Diagram
4-1 External connection diagram
Power supply
+
DC24V 0V Input side COM
A- X0
phase
B- X1
phase
Encoder PC
Power supply
+
DC24V 0V Input side COM
A- X0
phase
B- X1
phase
Encoder PC
X0
+
DC24V
PC
4-1
Section 5 Example of Program
Page
5-1 Example of single-phase counter .............................................................................. 5-1
(1) Address assignment ............................................................................................................................... 5-1
(2) Parameter setting .................................................................................................................................... 5-1
(3) Explanation of program operation ........................................................................................................... 5-1
(4) Ladder program ...................................................................................................................................... 5-2
(5) Mnemonic program ................................................................................................................................. 5-2
(6) Parameter setting (built-in high-speed counter) ...................................................................................... 5-2
3
2
D8040 1
(Current value) 0 0
X0
(Pulse input)
M8180
(Count stop) 1) 3) 4) 6)
M8181
(Reset) 2) 7)
M8187
(Preset) 5)
5-1
5-1 Example of single-phase counter Phase counter
Initial scan
M8011 WM0818
] [ MOV H0001 → 0
Current value reset CH0 current value reset
X0004 M8181
]↑ [ ( )
CH0 count stop
Count start
M8180
X0005
]↑ [ (R)
CH0 count stop
Count stop
M8180
X0006
]↑ [ (S)
CH0 preset value
Current value preset
M8180
X0007
]↑ [ MOV 100 → 0
CH0 current value preset
M8187
(S)
End
00000 LD M8011
00001 MOV H0001 WM0818
00004 LD+ X0004
00006 OUT M8181
00008 LD+ X0005
00010 RST M8180
00012 LD+ X0006
00014 SET M8180
00016 LD+ X0007
00018 MOV 100 D8044
00021 SET M8187
00023 END
(6) Parameter setting (built-in high-speed counter)
Mode: Single-phase
Channel 0/two-phase
Counter: Used
Multiplication: x1
Auto reset: Disable
Channel 1
Counter: Not used
Multiplication: x1
Auto reset: Disable
5-2
Phase counter 5-2 Example of two-phase counter
In this paragraph, an example of using two-phase counter and interrupt function for simplified position control is shown.
(1) Operation pattern
Interrupt
occurred
190,000
150,000
Run command
(Y10) 3)
Start Start
Deceleration signal
output 1 (Y11) 4)
Deceleration signal
output 2 (Y12) 5)
5-3
5-2 Example of two-phase counter Phase counter
5-4
Phase counter 5-2 Example of two-phase counter
FEND
INTR H1000
Always ON Interrupt occurrence count
M8010 WM0000
] [ +1 0
5-5
5-2 Example of two-phase counter Phase counter
IRET
End
5-6
Phase counter 5-2 Example of two-phase counter
00000 LD M8011
00001 MOV H0001 WM0818
00004 LD+ X0004
00006 SET M8180
00008 OUT M8181
00010 OUT M8183
00012 SET M8184
00014 SET M8186
00016 DMOV 150000 D8042
00020 MOV 0 WM0000
00023 LD+ X0005
00025 ANI Y0013
00026 RST M8180
00028 SET M8182
00030 SET Y0010
00031 LD Y0013
00032 OUTT T0000 1000
00034 LD T0000
00035 RST Y0011
00036 RST Y0012
00037 RST Y0013
00038 FEND
00039 I1000
00041 LD M8010
00042 INC WM0000
00044 LD M8010
00045 AND= WM0000 1
00048 SETD Y0011
00050 DMOV 190000 D8042
00054 SET M8186
00056 LD M8010
00057 AND= WM0000 2
00060 SETD Y0012
00062 DMOV 200000 D8042
00066 SET M8186
00068 LD M8010
00069 AND= WM0000 3
00072 RSTD Y0010
00074 SETD Y0013
00076 IRET
00077 END
(7) Parameter setting (built-in high-speed counter)
Mode: Two-phase
Channel 0/two-phase
Counter: Used
Multiplication: x2
Auto reset: Disable
Channel 1
Counter: Nor used
Multiplication: x1
Auto reset: Disable
5-7
ED & C · Drive Systems Company
Gate City Ohsaki, East Tower, 11-2, Osaki 1-chome, Shinagawa-ku, Tokyo, 141-0032, Japan
Phone: +81-3-5435-7135 ~ 8
Fax: +81-3-5435-7456 ~ 9
URL http://www.fujielectric.co.jp/kiki/