0% found this document useful (0 votes)
20 views39 pages

Feh404-Built in Hi Speed Counter

Uploaded by

trung vothai
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
20 views39 pages

Feh404-Built in Hi Speed Counter

Uploaded by

trung vothai
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 39

series

FUJI PROGRAMMABLE CONTROLLER

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.

Title Type Manual No. Contents


User’s Manual – FEH400 Describes the instructions available with the SPB.
<Instruction>, MICREX-
SX Series SPB
User’s Manual – FEH401 Describes the MICREX-SX SPB Series hardware.
<Hardware>, MICREX-SX
Series SPB
User’s Manual <Handy NW0H-N FEH402 Describes how to use the handy program loader.
Program Loader>,
MICREX-SX Series SPB
User’s Manual <Personal NN4NWN-SS3E FEH403 Describes how to use the personal computer loader.
Computer Loader>,
MICREX-SX Series SPB

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”:

Warning : Incorrect handling of the device may result in death or injury.

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

* Manual No. is shown at lower right on the cover.

Printed on * Manual No. Revision contents

July 2001 FEH404 First edition


Contents

Preface
Safety Precautions
Revision
Contents
Page

Section 1 Overview .......................................................................................1-1


1-1 Overview .......................................................................................................................................... 1-1
1-2 Notes on use ................................................................................................................................... 1-1

Section 2 Specifications ...............................................................................2-1


2-1 High-speed counter input specifications .................................................................................... 2-1
2-2 Operation of the High-speed Counter .......................................................................................... 2-3
2-2-1 Single-phase mode ............................................................................................................................... 2-3
2-2-2 Two-phase mode ................................................................................................................................... 2-4
2-2-3 Auto reset function ................................................................................................................................ 2-6
2-2-4 Resetting the current value ................................................................................................................... 2-6
2-2-5 Presetting the current counter value ..................................................................................................... 2-6
2-2-6 Setting comparison value ...................................................................................................................... 2-7
2-2-7 Match interrupt ...................................................................................................................................... 2-7
2-3 Timing chart .................................................................................................................................... 2-9
2-3-1 Single-phase mode ............................................................................................................................... 2-9
2-3-2 Two-phase mode ................................................................................................................................. 2-10

Section 3 Internal Register Specifications ..................................................3-1


3-1 Address map ................................................................................................................................... 3-1
3-2 Status of internal registers at power failure or after stop/start ................................................. 3-1
3-3 Detail explanation of the registers ............................................................................................... 3-2
3-3-1 Parameter area ...................................................................................................................................... 3-2
3-3-2 Internal register area ............................................................................................................................. 3-4
3-4 Internal block diagram ................................................................................................................... 3-7

Section 4 External Connection Diagram .....................................................4-1


4-1 External connection diagram ........................................................................................................ 4-1

Section 5 Example of Program .....................................................................5-1


5-1 Example of single-phase counter ................................................................................................. 5-1
5-2 Example of two-phase counter ..................................................................................................... 5-3
Section 1 Overview

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

1-2 Notes on use ............................................................................................................... 1-1


Overview
Section 1 Overview
1-1 Overview

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-2 Notes on use


(1) The initial value (default) of the parameter is “Not use the high-speed counter”.
(2) When the parameter is set to “Not use the high-speed counter”, the setting of related internal registers does not take
effect.
(3) Since the input circuit of the high-speed counter is designed for fast response and is susceptible to external noise that
rides through the input cable, take particular care with wiring for inputs to the counter, for example, making the cable
length as short as possible or keeping the cable away from noise sources.

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-2 Operation of the High-speed Counter ....................................................................... 2-3


2-2-1 Single-phase mode ............................................................................................................... 2-3
(1) Single-phase, single multiplication (x1) counting .................................................................................... 2-3
(2) Single-phase double multiplication (x2) counting .................................................................................... 2-3
2-2-2 Two-phase mode ................................................................................................................... 2-4
(1) Pulse + direction signal ........................................................................................................................... 2-4
(2) Two-phase double multiplication (x2) counting ....................................................................................... 2-5
(3) Two-phase quadruple multiplication (x4) counting .................................................................................. 2-5
2-2-3 Auto reset function ................................................................................................................ 2-6
2-2-4 Resetting the current value ................................................................................................... 2-6
(1) Internal reset ........................................................................................................................................... 2-6
(2) External reset .......................................................................................................................................... 2-6
2-2-5 Presetting the current counter value ..................................................................................... 2-6
2-2-6 Setting comparison value ...................................................................................................... 2-7
2-2-7 Match interrupt ...................................................................................................................... 2-7

2-3 Timing chart ................................................................................................................. 2-9


2-3-1 Single-phase mode ............................................................................................................... 2-9
(1) Single-phase single multiplication (x1) .................................................................................................... 2-9
(2) Single-phase double multiplication (x2) .................................................................................................. 2-9
2-3-2 Two-phase mode ................................................................................................................. 2-10
(1) Two-phase (pulse + direction signal) ..................................................................................................... 2-10
(2) Two-phase double multiplication (x2) .................................................................................................... 2-10
(3) Two-phase quadruple multiplication (x4) ............................................................................................... 2-11
Input specification
Section 2 Specifications
2-1 High-speed counter input specifications

(1) Input specifications


Input terminals available for the built-in high-speed counter are X0 to X3.
Their input specifications are shown below:
Item Specification for the built-in high-speed counter
No. of input channels 2 channels in single-phase mode, 1 channel in two-phase mode
Max. input frequency 100 kHz in single-phase mode, 50 kHz in two-phase mode
Accuracy of input phase difference 90° ± 45°
(two-phase mode)
Input signal Rated voltage DC24V
conditions
Voltage (tolerance) DC24V ± 10%
Ripple factor tolerance 5%
Characteristics Input method Common source & sink (bi-directional)
of input circuit
Rated current Approx. 5 mA
Input impedance Approx. 4.7kΩ
Standard OFF → ON 15 – 26.4V
operating
range ON → OFF 0 – 5V

Input type DC type1


Input delay time Lead delay time: 10 µs
Software filtering time: The high-speed counter operates without filtering.
External connection M3 screw
Input signal indication LED lights (green) when ON for each point, logical side
Isolation method Photocoupler
Dielectric strength 1500 V AC , 1 minute between input terminals and frame ground
Insulation resistance 10 MΩ or more with 500 V DC megger (between input terminals and
frame ground)
Derating condition None

(2) Functions of input terminals


The input terminals of the high-speed counter have the following functions:
Input terminal Mode selection (by parameter setting)
Single-phase mode Two-phase mode
Single or double Double or quadruple
Pulse + direction signal
multiplication multiplication
X0 CH0 pulse input CH0 pulse input CH0 A-phase input
X1 CH1 pulse input CH0 direction signal input CH0 B-phase input
X2 CH0 reset signal input CH0 reset signal input CH0 reset signal input
X3 CH1 reset signal input –

2-1
2-1 High-speed counter input specifications Input specification

(3) Internal input circuit

+ PC

Photocoupler
+ COM

External input
(X0 to X3)

2-2
Phase mode 2-2 Operation of the High-speed Counter

The high-speed counter has the following operation modes:

2-2-1 Single-phase mode


In this mode, the high-speed counter counts the pulses that are input through the input terminal (X0 for CH0, X1 for CH1).
Unsigned 16-bit data is used in the counter. The data of CH0 is stored in D8040; that of CH1, in D8041.
D8040
D8041

FFFF (65,535)

FFFE (65,534)

0002 (2)

0001 (1)

0000 (0)

Hexadecimal Decimal
representation representation

The following types of counting are available:

(1) Single-phase, single multiplication (x1) counting


• This mode counts up only at the leading edge of input pulse.
• One is counted per cycle.
3
2
Current counter value 1
(D8040, D8041) 0

Input pulse
(X0, X1)

(2) Single-phase double multiplication (x2) counting


• This mode counts up at the leading and trailing edges of input pulse.
• Two is counted per cycle.
6
5
4
3
2
Current counter value 1
(D8040, D8041) 0

Input pulse
(X0, X1)

2-3
2-2 Operation of the High-speed Counter Phase mode

2-2-2 Two-phase mode


In this mode, the pulses that are input through the input terminal (X0, X1) are counted up or down.
In this mode, signed 32-bit data (expressed by two’s complement) is used in the high-speed counter, and high-order data
is stored in D8040 while low-order data in D8041.
D8041 D8040

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.

The following types of counting are available:

(1) Pulse + direction signal


• This mode counts at the trailing edge of the pulses that are input to the input terminal (X0).
• Counting is performed increasingly when direction signal (X1) is “L” while decreasingly when “H”.
• One is counted per cycle.
3
2 2
Current counter value 1 1
(D8040, D8041) 0 0

Input pulse
(X0)

Direction signal
(X1)

2-4
Phase mode 2-2 Operation of the High-speed Counter

(2) Two-phase double multiplication (x2) counting


• This mode counts at the leading and trailing edges of B-phase (X1 terminal) pulses.
• Two is counted per cycle.
• Timing of incremental or decremental counting
1) Timing of incremental counting
• At the leading edge of B-phase pulse while A-phase is “H”
• At the trailing edge of B-phase pulse while A-phase is “L”
2) Timing of decremental counting
• At the leading edge of B-phase pulse while A-phase is “L”
• At the trailing edge of B-phase pulse while A-phase is “H”
4
3 3
2 2
Current counter value 1 1
(D8040, D8041) 0 0

A-phase
(X0)

B-phase
(X1)

(3) Two-phase quadruple multiplication (x4) counting


• This mode counts at the leading and trailing edges of A-phase (X0 terminal) and B-phase (X1 terminal) pulses.
• Four is counted per cycle.
• Timing of incremental or decremental counting
1) Timing of incremental counting
• At the leading edge of B-phase pulse while A-phase is “H”
• At the trailing edge of B-phase pulse while A-phase is “L”
• At the trailing edge of A-phase pulse while B-phase is “H”
• At the leading edge of A-phase pulse while B-phase is “L”
2) Timing of decremental counting
• At the trailing edge of B-phase pulse while A-phase is “H”
• At the leading edge of B-phase pulse while A-phase is “L”
• At the leading edge of A-phase pulse while B-phase is “H”
• At the trailing edge of A-phase pulse while B-phase is “L”

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

2-2-3 Auto reset function


This function can be used only in single-phase mode.
This function is enabled by parameter setting.
When the Auto Reset function is disabled, counter upper limit is FFFF. When this function is enabled, you can arbitrarily
set the upper limit. When set, the content of comparison value registers (D8042, D8043) becomes the upper limit.
When the Auto Reset When the Auto Reset
function is disabled function is enabled
(comparison value = 0500)

FFFF 04FF

FFFE 04FE

0001 0001

0000 0000

2-2-4 Resetting the current value


The current counter value can be reset (cleared to zero) internally (by software) or externally (by hardware) (OR action).
Mode Channel Current value register Internal reset External reset

Single- CH0 D8040 M8181 X2 terminal


phase CH1 D8041 M8189 X3 terminal
Two- CH0 D8041 (high-order) M8181 X2 terminal
phase D8040 (low-order)

(1) Internal reset


The current counter value is reset when the status of the corresponding internal register is changed from 0 (zero) to 1
(one) (at the leading edge). To reset again, restore this internal register once to 0 (zero).
(2) External reset
The current counter value is reset when the status of the corresponding terminal is changed from “L” to “H” (at the leading
edge).
To reset again, restore this terminal once to “L”.

2-2-5 Presetting the current counter value


This function is used to forcibly change the current counter value to an arbitrary value.
Mode Channel Current value register Preset value register Preset flag
Single- CH0 D8040 D8044 M8187
phase
CH1 D8041 D8045 M818F
Two- CH0 D8041 (high-order) D8045 (high-order) M8187
phase D8040 (low-order) D8044 (low-order)

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

2-2-6 Setting comparison value


In this paragraph, counter comparison value is set.
The comparison value is used by the following functions:
• Auto Reset function
• Match interrupt
Mode Channel Comparison value register Comparison value set flag

Single- CH0 D8042 M8186


phase CH1 D8043 M818E
Two- CH0 D8043 (high-order) M8186
phase D8042 (low-order)

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).

2-2-7 Match interrupt


This function makes an interrupt take place when the current counter value coincides with the set comparison value.
Mode Channel Interrupt Interrupt Interrupt latch All interrupt Match Match clear
pointer permit clear batch clear occurrence

Single- CH0 I1000 M8182 M8184 M817F M8190 M8183


phase CH1 I1100 M818A M818C M8198 M818B
Two- CH0 I1000 M8182 M8184 M8190 M8183
phase

<Operation of match interrupt>

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

High priority Low priority


I0000>I0100>I0200>I0300>I1000>I1100>ICxx>IDxx>IExx>IFxx>

External interrupt High-speed Fixed cycle interrupt


counter
interrupt

<In the following cases, interrupt does not take place>


(1) Till currently executed instruction (MOV, AND, etc.) is finished
(2) Till currently executed interrupt program is finished
(3) During program scan end processing
No interrupt takes place because in this period I/O data refreshing or self diagnosis is performed. Interrupt takes place
when scan end processing is completed.
(4) When interrupt permit flag (M8182, M818A) is set to “1” (interrupt disable)
In this case, interrupt status is latched (held) internally, and match occurrence flag (M8190, M8198) is set to “1” (one).
Interrupt latch is possible only for once. When interrupt is permitted, latch is cleared, and interrupt takes place.
To clear a latched interrupt while interrupt is disabled, set interrupt latch clear flag (M8184, M818C) to “1”. The
interrupt can also be cleared by setting all interrupts batch clear flag (M817F) to “1”.

2-8
Phase mode 2-3 Timing chart

2-3-1 Single-phase mode


(1) Single-phase single multiplication (x1)
t3
t4

Current counter value

Input pulse
(X0, X1)
t1 t1

f t2
Reset signal
(X2, X3)

(2) Single-phase double multiplication (x2)


t3
t4

Current counter value

Input pulse
(X0, X1)
t1 t1

f t2
Reset signal
(X2, X3)

<Various timing values in single-phase mode>


Item Description Time
t1 Input pulse ON time/OFF time Min. 4 µs
f Input pulse frequency Max. 100 kHz
t2 Reset signal width Min. 7 µs
t3 Delay time from the leading edge of reset signal to counter value being reset Max. 7 µs
t4 Delay time from the leading edge of reset signal to next counting being started Min. 7 µs

2-9
2-3 Timing chart Phase mode

2-3-2 Two-phase mode


(1) Two-phase (pulse + direction signal)

t4

t3

Current counter value

Input pulse
(X0)

Direction signal
(X1)
t1 t1’ t1’

f t2

Reset signal
(X2)

(2) Two-phase double multiplication (x2)


t4

t3

Current counter value

A-phase
(X0)

B-phase
(X1)
t1 t1 t1 t1

f t2

Reset signal
(X2)

2-10
Phase mode 2-3 Timing chart

(3) Two-phase quadruple multiplication (x4)


t4

t3

Current counter value

A-phase
(X0)

B-phase
(X1)
t1 t1 t1 t1

f t2

Reset signal
(X2)

<Timing values for two-phase mode>


Item Description Time
t1 Pulse + direction signal: Overlap time between pulse and direction signals Min. 2.5 µs
Double multiplication, quadruple multiplication: Phase difference between A and B phases
t1’ Input pulse ON time/OFF time (only for “ pulse + direction signal” mode) Min. 5 µs
f Input pulse frequency Max. 50 kHz
t2 Reset signal width Min. 7 µs
t3 Delay time from the leading edge of reset signal till counter value being reset Max. 7 µs
t4 Delay time from the leading edge of reset signal to next counting being started Min. 7 µs

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

3-3 Detail explanation of the registers ............................................................................ 3-2


3-3-1 Parameter area ..................................................................................................................... 3-2
(1) Specification of whether or not to use the counter (0C) .......................................................................... 3-2
(2) Specification of counter operation (0D) ................................................................................................... 3-3
3-3-2 Internal register area ............................................................................................................. 3-4
(1) Interrupt latch batch reset flag (M817F) (leading edge) .......................................................................... 3-4
(2) Command register (WM818) ................................................................................................................... 3-4
(3) Status register (WM819) ......................................................................................................................... 3-6
(4) Current value register (D8040, D8041) ................................................................................................... 3-6
(5) Comparison value register (D8042, D8043) ........................................................................................... 3-6
(6) Preset value register (D8044, D8045) .................................................................................................... 3-6

3-4 Internal block diagram ................................................................................................ 3-7


Address map
Section 3 Internal Register Specifications
3-1 Address map

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

M817F: Interrupt latch batch reset (R/W)

WM818 Command register (R/W)


819 Status register (R)

(Single-phase mode) (Two-phase mode)

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-2 Status of internal registers at power failure or after stop/start


Address of internal register Power failure Run → Stop Stop → Run Timing to recognize
Parameter 0C, 0D Hold Hold Hold When started after stopped
M817F, WM818, WM819 Clear Hold Hold At scan end
D8040 to D8045 Hold Hold Hold At scan end

3-1
3-3 Detail explanation of the registers Parameter area

3-3-1 Parameter area


The initial value, for example, after parameter clear, is zero for all bits.
(1) Specification of whether or not to use the counter (0C)
This area is used to specify whether or not to use the counter.
<Bit assignment>
F E D C B A 9 8 7 6 5 4 3 2 1 0
Reserved Single- Whether or not to
(0) phase/ use the counter
two-pha-
se mode
selection

<Detail explanation of bits>


Bits 0 and 1: Whether or not to use the counter
These bits set whether or not to use the high-speed counter.
Bit 1 Bit 0 When single-phase mode is selected When two-phase mode is selected
0 0 High-speed counter is not used High-speed counter is not used
0 1 Two phases are used Two phases are used
1 0 Only single-phase CH1 is used High-speed counter is not used
1 1 Single-phase CH0 and CH1 are used Two phases are used

Bit 2: Single-phase/two-phase mode selection


This bit determines in which mode (single-phase mode or two-phase mode) to use the high-speed counter.
0: Single-phase mode is selected.
1: Two-phase mode is selected.
Bits 3 to F: Reserved
These bits must be set to 0 (zero).

3-2
Parameter area 3-3 Detail explanation of the registers

(2) Specification of counter operation (0D)


This area is used to specify operations of the high-speed counter.
<Bit assignment>

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

<Detail explanation of bits>


Bits 0 and 1: Sets multiplication for single-phase CH0 or two-phase mode
The setting of these bits takes effect when other setting is made to use shingle-phase CH0 or two-phase.
These bits set multiplication.
Bit 1 Bit 0 When single-phase mode is selected When two-phase mode is selected
0 0 Single-phase CH0 single multiplication Pulse + direction signal
0 1 Single-phase CH0 double multiplication Two-phase double multiplication
1 0 Single-phase CH0 single multiplication Two-phase quadruple multiplication
1 1 Single-phase CH0 double multiplication Two-phase quadruple multiplication

Bit 2: Single-phase CH0 auto reset


The setting of this bit takes effect when other setting is made to use single-phase CH0. This bit specifies whether or
not to enable the Auto Reset function for single-phase CH0.
0: Disable the Auto Reset function
1: Enable the Auto Reset function
Bit 3: Reserved
This bit must be set to 0 (zero).
Bit 4: Single-phase CH1 multiplication
The setting of this bit takes effect when other setting is made to use single-phase CH1.
This bit sets multiplication type for single-phase CH1.
0: Single-phase CH1 single multiplication
1: Single-phase CH1 double multiplication
Bit 5: Reserved
This bit must be set to 0 (zero).
Bit 6: Single-phase CH1 auto reset
The setting of this bit takes effect when other setting is made to use single-phase CH1. This bit specifies whether or
not to enable the Auto Reset function for single-phase CH1.
0: Disable the Auto Reset function
1: Enable the Auto Reset function
Bits 7 to F: Reserved
These bits must be set to 0 (zero).

3-3
3-3 Detail explanation of the registers Internal register area

3-3-2 Internal register area


(1) Interrupt latch batch reset flag (M817F) (leading edge)
0 to 1: Clear
“External interrupt” and “match interrupt of built-in high-speed counter” that occur while interrupt is disabled are latched
(held) internally.
When this flag is set to 1 (one), such latches are all cleared.
This function is used to cancel the interrupts that occurred while interrupt was disabled.
When latch clear processing is completed, this bit is automatically reset to 0 (zero).
(2) Command register (WM818)
This register is used to control the built-in high-speed counter.
<Bit assignment>
F• • • • • • • • • • • • • • • • • • 8 7• • • • • • • • • • • • • • • • • • 0
WM818

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

In two-phase mode, CH0 (bits 7 to 0) are used.


<Detail explanation of bits>
Bit 0 (8): Count stop (level)
0: Count (Input pulses are counted)
1: Count stop (No input pulse is counted)
This bit specifies whether or not to count external input pulses.
When this bit is set to 1 (one), counter input is ignored (not captured).
Bit 1 (9): Current value reset (leading edge)
0 to 1: Reset
1 to 0: None
When this bit is changed from 0 (zero) to 1 (one), the content of the current value register is cleared to zero.
The register is also reset at the leading edge (from 0 to 1) of external control signal (X2 for CH0, X3 for CH1).
Operation of this bit has no influence on other setting or flag register.
To reset again, restore this bit once to 0 (zero).
Bit 2 (A): Interrupt disable/enable (level)
0: Disable interrupt
1: Enable interrupt
This bit specifies enable/disable for the execution of match (current counter value = comparison value) interrupt
program
If a match interrupt occurs while interrupt is disabled, the interrupt only for once is latched to be executed when
interrupt is enabled.

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

(3) Status register (WM819)


This register is used to display the operating status of the built-in high-speed counter.
<Bit assignment>
F• • • • • • • • • • • • • • • • • • 8 7• • • • • • • • • • • • • • • • • • 0
WM819

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

In two-phase mode, CH0 (bits 7 to 0) are used.


<Detail explanation of bits>
Bit 0 (8): Match occurrence flag
0: No match occurred
1: Match occurred
When the content of current value register D8040 (D8041) coincides with that of comparison value register D8042
(D8043), this bit is set to 1 (one). Also when the matching had already occurred when the counter was started after
stopped, this bit is set to 1 (one). When bit 3 (B) of the command register is changed from 0 (zero) to 1 (one), this bit
is reset to 0 (zero).
The status of this bit is held till bit 3 (B) of the command register is operated.
(4) Current value register (D8040, D8041)
These registers are used to display the current counter value.
While counting is being performed internally, asynchronously with scan, the data of current value register is updated only
at scan end.
(5) Comparison value register (D8042, D8043)
These registers are used for comparison with the current counter value.
When the power is turned ON, this value is automatically transferred to the internal register of the built-on high-speed
counter and takes effect. To change comparison value after this, rewrite the value of this register and then change bit 6 (E)
(comparison value set flag) of command register WM818 from 0 (zero) to 1 (one). Then, the changed value will take effect
at scan end.
When the content of current value register coincides with that of comparison value register, the following operations take
place:
• Bit 0 (8) (match occurrence flag) of status register WM819 is set to 1 (one).
• When the Auto Reset function is enabled by parameter, the current counter value is cleared to zero. Counting is
continued.
• When bit 2 (A) (interrupt enable/disable) of command register WM818 is set to 1 (enable), interrupt program is
started.
(6) Preset value register (D8044, D8045)
These registers are used to change the current counter value.
To change the current counter value, write a desired value in this register and then change bit 7 (F) (current value preset
command flag) of command register WM818 from 0 (zero) to 1 (one). Then, the content of current value register is
updated at scan end.

3-6
High-speed Counter Internal Block Diagram

Comparison value set command

(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

(M8181) AND condition


External interrupt latch clear
(M8189) Negative logic

External reset OR condition

(X2) Match comparison

(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

• Be careful that counter input signal is susceptible to noise.


• Input signal cable shall be as short as possible, be separated from the cables of other devices, and not be wired
together with such cables.
• Be sure to use shielded cable and ground it independently on the PC or encoder side.
Example of wiring
(1) When connecting to two-phase open collector output encode

Power supply
+
DC24V 0V Input side COM

A- X0
phase

B- X1
phase

Encoder PC

(2) When connecting to two-phase output encoder (built-in resistor type)

Power supply
+
DC24V 0V Input side COM

A- X0
phase

B- X1
phase

Encoder PC

(3) When connecting to single-phase contact output

X0

+
DC24V

Input side COM

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

5-2 Example of two-phase counter .................................................................................. 5-3


(1) Operation pattern .................................................................................................................................... 5-3
(2) Address assignment ............................................................................................................................... 5-3
(3) Parameter setting .................................................................................................................................... 5-3
(4) Explanation of program operation ........................................................................................................... 5-4
(5) Ladder program ...................................................................................................................................... 5-5
(6) Mnemonic program ................................................................................................................................. 5-7
(7) Parameter setting (built-in high-speed counter) ...................................................................................... 5-7
Phase counter
Section 5 Example of Program
5-1 Example of single-phase counter

In this paragraph, an example of using as single-phase incremental counter is shown.


(1) Address assignment
X0: CH0 pulse input
X2: CH0 reset input
X4: CH0 internal reset command input (M8181 ON pulse)
X5: CH0 count start command input (M8180 OFF)
X6: CH0 count stop command input (M8180 ON)
X7: CH0 current counter value preset command input (D8044←100, M8187 ON)
D8040: CH0 current counter value
(2) Parameter setting
0C: H0001
0D: H0000
Single-phase mode, only CH0 is used, Auto Reset function disabled, single multiplication
(3) Explanation of program operation
1) When the power is turned ON and the program is started, H0001 (count stop setting) is written in WM818
(command register).
2) At the leading edge of external input X4, the current counter value is reset internally (M8181 is set to ON).
3) At the leading edge of external input X5, count stop bit (M8180) is set to OFF.
Counting is started. Pulses are input.
Current count data is stored in D8040.
4) At the leading edge of external input X6, count stop bit is set to ON (M8180 is set to ON).
Counting is stopped.
After this, pulse input is ignored.
The current count data is held.
5) At the leading edge of external input X7, 100 (H0064 by hexadecimal) is set as the current counter value (M8187
is set to ON).
6) To resume counting, set X5 to ON (M8180 is set to OFF).
7) To reset the counter, set X4 to ON (M8181 is set to ON).
Then, the counter value is reset to 0 (zero).
102
101
100

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

(4) Ladder program

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

(5) Mnemonic program


When coded by mnemonic, the ladder program becomes as follows:

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

First Second Third


(Current counter value) Operation ready
200,000 (current value clear)

190,000

150,000

Run command
(Y10) 3)
Start Start
Deceleration signal
output 1 (Y11) 4)

Deceleration signal
output 2 (Y12) 5)

Stop signal output


(Y13) 6) 7)
T0

(2) Address assignment


X0: CH0 A-phase input
X1: CH0 B-phase input
X2: CH0 reset input
X4: Operation ready switch
X5: Operation start switch
Y10: Run command
Y11: Deceleration output 1
Y12: Deceleration output 2
Y13: Stop delay timer
T0:
WM0: Interrupt occurrence counter
D8042, D8043: Comparison value register
(3) Parameter setting
0C: H0005
0D: H0001
Two-phase mode, double multiplication

5-3
5-2 Example of two-phase counter Phase counter

(4) Explanation of program operation


1) When the power is turned ON and the program is started, H001 (count stop setting) is written in WM818
(command register).
2) At the leading edge of operation ready switch (X4), various data are cleared, and comparison value data (for first
interrupt) is set to 150,000.
3) At the leading edge of operation start switch (X5), count and interrupt are enabled, and operation command
output (Y10) is set to ON.
Operation is started, and pulses are input from the encoder.
4) When the counter value reaches the comparison value (150,000), first interrupt takes place.
The interrupt program sets deceleration output 1 (Y11) to ON and the next comparison value (for second
interrupt) to 190,000.
The output waits for direct output (set) command so as to immediately turn ON.
5) When the counter value reaches the comparison value (190,000), second interrupt takes place.
The interrupt program sets deceleration output 2 (Y11) to ON and the next comparison value (for third interrupt)
to 200,000.
6) When the counter value reaches the comparison value (200,000), third interrupt takes place.
The interrupt program sets run command (Y10) to OFF and stop output (Y13) to ON.
Then, in order to hold the status of stop output for a given time, the timer (T0) is started.
7) When the time period of T0 elapsed, deceleration output 1, deceleration output 2 and stop output are all set to
OFF.
8) To resume counting, execute from step 2).

5-4
Phase counter 5-2 Example of two-phase counter

(5) Ladder program

Initial scan Command register


M8011 WM0818
] [ MOV H0001 → 0
Operation ready switch Count stop
X0004 M8180
]↑ [ (S)
Current value reset
M8181
( )
Match occurrence flag reset
M8183
( )
Match interrupt latch clear
M8184
(S)

Comparison value set


M8186
(S)
Comparison value register
D8042
DMOV 150000 → 0
Interrupt occurrence count
WM0000
Operation MOV 0→ 0
start switch Stop output Count stop
X0005 Y0013 M8180
]↑ [ ] [ (R)
Interrupt enable
M8182
(S)
Run command
Y0010
(S)

Stop output Stop delay timer


Y0013 T0000
] [ TMR 0 1000
Stop delay timer Deceleration output 1
T0000 Y0011
] [ (R)
Deceleration output 2
Y0012
(R)
Stop output
Y0013
(R)

FEND

INTR H1000
Always ON Interrupt occurrence count
M8010 WM0000
] [ +1 0

5-5
5-2 Example of two-phase counter Phase counter

Always ON Interrupt occurrence count Deceleration output 1


M8010 WM0000 Y0011
] [ = 0 1 ( SD )

Comparison value register


D8042
DMOV 190000 → 0
Comparison value set
M8186
(S)
Always ON Interrupt occurrence count Deceleration output 2
M8010 WM0000 Y0012
] [ = 0 2 ( SD )
Comparison value register
D8042
DMOV 200000 → 0
Comparison value set
M8186
(S)
Always ON Interrupt occurrence count Run command
M8010 WM0000 Y0010
] [ = 0 3 ( RD )
Stop output
Y0013
( SD )

IRET

End

5-6
Phase counter 5-2 Example of two-phase counter

(6) Mnemonic program


When coded by mnemonic, the ladder program becomes as follows:

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/

Information in this manual is subject to change without notice.

You might also like