Contec CNT16-8GY, CNT16-8LGY, CNT16-8FITGY, CNT16-8LFITGY User Manual

Page 1
F&eIT Series
16Bits Isolated Up-Counter Module
12 - 24VDC type
CNT16-8(FIT)GY
5VDC type
CNT16-8L(FIT)GY
CONTEC CO.,LTD.
Page 2

Check Your Package

Thank you for purchasing the CONTEC product. The product consists of the items listed below. Check, with the following list, t hat your packa ge is complete. If yo u discover dam aged or missi ng items,
contact your retailer.
Product Configuration List
- Module (One of the following) ...1 [CNT16-8(FIT)GY, or CNT16-8 L(FIT)GY]
- First Step Guide …1
- CD-ROM [F&eIT Series Setup Disk] *1 …1
- Interface connector plug ...1
*1 The CD-ROM contains various software and User’s Manual (this manual)
0123
4567
6
7
5
040
Device
4
1
ID
3
2
COM 0
NC
0 1 2 3
COM 1
NC
4 5 6 7
CNT16-8L
Module
Interface connector plug
First step guide
CD-ROM
[F&eIT Series Setup Disk]
CNT16-8(FIT)GY, CNT16-8L(FIT)GY
i
Page 3

Copyright

Copyright 2004 CONTEC CO., LTD. ALL RIGHTS RESERVED. No part of this document may be copied or reproduced in any form by any means without prior written
consent of CONTEC CO., LTD.
CONTEC CO., LTD. makes no commitment to update or keep c urre nt t he i n formation contained in this document. The information in this document is subject to change without notice.
All relevant issues hav e be en consid e red in th e prep ar atio n of th is do cu men t. Sh ould yo u no tic e an omission or any questionable item in this document, please feel free to notify CONTEC CO., LTD.
Regardless of the foregoing statement, CONTEC assumes no responsibility for any errors that may appear in this document or for results obtained by the user as a result of using this product.

Trademarks

F&eIT is a registered trademark or trademark of CONTEC CO., LTD. Other company and product names that are referred to in this manual are generally trademarks or registered trade trademark.
CNT16-8(FIT)GY, CNT16-8L(FIT)GY
ii
Page 4

Table of Contents

Check Your Packag e............................................................................................................................ i
Copyright ............................................................................................................................................ ii
Trademarks .........................................................................................................................................ii
Table of Con tents...............................................................................................................................iii
1. Before Using the Product 1
About the Mo d ule............................................................................................................................... 1
Features........................................................................................................................................ 1
Functions and co n tro l meth o d by co nt ro ll e r co nn e c ted .............................................................. 2
Customer Supp o rt ............................................................................................................................... 4
Web Site....................................................................................................................................... 4
Limited One- Ye ar Wa rr a nt y............................................................................................................... 4
How to Obtain Serv i ce ....................................................................................................................... 4
Liability............................................................................................................................................... 4
Safety Precau t io ns .............................................................................................................................. 5
Safety Infor mat i o n ....................................................................................................................... 5
Handling Pre ca u tio ns................................................................................................................... 5
Environment................................................................................................................................. 7
Inspection..................................................................................................................................... 7
Storage ......................................................................................................................................... 7
Disposal ....................................................................................................................................... 7
2. Module Nomenclature and Settings 9
Nomenclature of Module Components.............................................................................................. 9
Setting a Dev ic e ID............................................................................................................................. 9
Setup Method............................................................................................................................... 9
LED Indicato r ................................................................................................................................... 1 0
3. Connecting to an External Device 11
Interface Con n ec to r .......................................................................................................................... 11
How to Connect an Interface Connector ................................................................................... 11
Signal Layout on the Interface Co nnector................................................................................. 12
External I/O C i r cu it s......................................................................................................................... 13
CNT16-8(FIT)GY, CNT16-8L(FIT)GY
iii
Page 5
4. Using the I/O Address Map 15
Starting I/O Ad d r es s ......................................................................................................................... 15
List of I/O Add re s s Ma p s .................................................................................................................16
Specificatio ns Co mmo n to F &e IT P ro du c ts..................................................................................... 20
Product Info r mat i on...................................................................................................................20
Bit Assignmen ts f or I/ O Po rts .......................................................................................................... 22
Flow of Count V a lu es .......................................................................................................................22
Operation Co mma n ds .......................................................................................................................23
Description of I np u t Co m man d s....................................................................................................... 24
Reading a Coun t (c o m man d 00 h - 0 7 h ) ..................................................................................... 24
Interrupt mask (co mman d 11h) ................................................................................................. 24
Status (comma nd 1 2h ) ...............................................................................................................25
Count control (C o mma n d 14 h ) ..................................................................................................25
Digital Filter (command 15h).................................................................................................... 25
Description of O u tpu t Co m man d s ....................................................................................................2 6
Initial Count V alu e (c o m man d 00 h - 0 7h ) ................................................................................ 26
Count Data Lat ch i ng (c o m man d 10 h ) .......................................................................................26
Interrupt Ma sk (c o mma n d 1 1h ) ................................................................................................. 26
Status Reset (command 12h) ..................................................................................................... 27
Counter initia li z at ion ( co m ma n d 13h )....................................................................................... 27
Counter contr ol ( command 14h)................................................................................................ 27
Digital Filter (command 15h).................................................................................................... 28
Examples........................................................................................................................................... 30
Pulse Count (no i nt e rru pt s )........................................................................................................ 30
Pulse Count (wi th in t e rru p ts)..................................................................................................... 33
5. Using the Memory Addre ss Ma p 39
Module Infor ma ti o n Are a .......................................................................................................... 40
Module Infor ma ti o n Are a .......................................................................................................... 47
Basic I/O Data Ar ea...................................................................................................................50
Examples........................................................................................................................................... 51
6. System Reference 57
Block Diagra m ..................................................................................................................................57
Specificatio n s.................................................................................................................................... 58
Physical Di men si ons......................................................................................................................... 60
CNT16-8(FIT)GY, CNT16-8L(FIT)GY
iv
Page 6
1. Before Using the Product

1. Before Using the Product

This chapter provides information you should know before using the product.

About the Module

This product is an expansio n module (device m odule) that up- counts pulse s ignals inpu t from an exter nal device. The product is used i n combinati on with the I/ O controller module < CPU- CAxx(FIT)GY > ( *1) or microcontroller unit < CPU-SBxx(FIT)GY > (*1) in the F&eIT Series.
Each < CNT16-8(FIT)GY > module can count a maximum of eight pulse signals. The pulse signals are input via opto-couplers. The external power supply can be in the range 12 - 24 VDC. The < CNT16-8L(FIT)GY > has the same coun t funct ion as t he < CNT16- 8(FIT )GY > but op erate s on a 5 VDC external power supply.
Please read this manual carefully to create application programs and configure the system, such as setting the switches and connecting it to external devices.
*1 The "x" in a model code represents a single digit (or no digit) indicating different products. (The
same convention applies below).

Features

- Performs a 16-bit up-count for eight channels.
- Isolated from each other by an opto-coupler, offering good noise immunity.
- A digital filter is included to prevent miscounting due to chattering on the input pulses.
- A rotary switch allows you to set device IDs to help you keep track of device numbers.
- Like other F&eIT series products, the module has a 35mm DIN rail mounting mechanism as standard. A connection to a controller module can be effected on a lateral, stack basis in a unique configuration, which perm its a s imple, smar t system con figur ati on wi thout t he nee d for a back plane board.
CNT16-8(FIT)GY, CNT16-8L(FIT)GY
1
Page 7
1. Before Using the Product

Functions and control method by controller connected

The CNT16-8(FIT)GY and CNT16-8L(FIT)GY can be connected to a variety of controllers.
Supported controllers Microcontroller Unit : CPU-SBxx(FIT)GY I/O Controller Module : CPU-CAxx(FIT)GY Monitoring & Control Server Unit : SVR-MMF2(FIT) Monitoring & Control Server Unit : SVR-MMF(FIT)GY
Check each controller to which the module can be connected as well as the method of controlling the module when conn ec ted to th at co nt ro ll er .
Connections to controllers
Y
Y
G
G
)
)
T
T
I
I
F
F
(
(
x
x
x
B
O: Permitted ×: Not permitted
CNT16-8(FIT)GY ΟΟΟΟ
CNT16-8L(FIT)GY ΟΟΟΟ
Device ID setting range 0 - 7 0 - 7 0 - 7 0 - 7
S
-
U
P
P
C
C
F
x
M
A
C
M
-
-
U
R
V
S
Y
)
G
)
T
I
T
I
F
F
2(
(
F
M
M
-
R
V
S
CNT16-8(FIT)GY, CNT16-8L(FIT)GY
2
Page 8
1. Before Using the Product
Control method by co n tro lle r co n nec te d
Y
Y
G
G
)
)
T
T
I
I
F
F
(
(
x
x
x
B
S
-
U
P
P
C
Control using the I/O address map Ο
Control using the memory address map Ο
FIT Protocol Ο
Control via the Windows driver *
Control over the web (as set from within the browser)
* The API-SBP(W32) is included in the development kit [DTK-SBxx(FIT)GY]; the other drivers are bundled with each
controller.
API-CAP(W32) Ο
API-SBP(W32) Ο
C
x
A
C
-
U
R
V
S
ΟΟ
F
M
M
-
Y
)
G
)
T
I
T
I
F
F
2(
(
F
M
M
-
R
V
S
Control using the I/O address map
When connected to the CPU- SBxx (F IT) GY , th e modul e can receive I/O instructions directly from the controller module. For details, see Chapter 4 “Using the I/O Address Map”.
Control using the memory address map
When connected to the CPU- CAxx ( FI T)G Y, th e mod ule can be accessed from the host computer over the network. The module is assigned with its device ID in the memory managed by the controller module. The application running on the host computer controls the module by reading/writing the memory managed by the controller module. For details, see Chapter 5 “Using the Memory Address Map”.
Control via the Windows driver
For the functions and settings available when using the Windows driver, refer to the reference manual and online help for each module.
Control over the web
You can monitor collected data and manage the log over t he w eb. You can use your familiar browser to easily make various settings. For details, refer to the reference manual for the SVR-MMF2(FIT), SVR-MMF(FIT)GY.
CNT16-8(FIT)GY, CNT16-8L(FIT)GY
3
Page 9
1. Before Using the Product

Customer Support

CONTEC provides the following s upport services fo r you to use CONTEC products more efficiently and comfortably.

Web Site

Japanese http://www.contec.co.jp/ English http://www.contec.com/ Chinese http://www.contec.com.cn/
Latest product information CONTEC provides up-to-date information on products.
CONTEC also provides product manuals and various technical documents in the PDF.
Free download You can download updated driver software a nd diff erenti al files as we ll as sample pr ograms available i n
several languages.
Note! For product information Contact your retailer if you have any technical question about a CONTEC product or need its price,
delivery time, or estimate information.

Limited One-Year Warranty

CONTEC products are warranted by CONTEC CO., LTD. to be free from defects in material and workmanship for up to one year from the date of purchase by the original purchaser. Repair will be free of char ge only w hen thi s device is ret urned fr eight pr epaid with a c opy of t he origi nal invoice and a Return Merchandise Authorization to the distributor or the CONTEC group office, from which it was purchased. This warranty is not applicable for scratches or normal wear, but only for the electronic circuitry and original products. The warranty is not applicable if the device has been tampered with or damaged through abuse, mistreatment, neglect, or unreasonable use, or if the original invoice is not included, in which case repairs will be considered beyond the warranty policy.

How to Obtain Service

For replacement or repair, return the device freight prepaid, with a copy of the original invoice. Please obtain a Return Merchandise Authorization number (RMA) from the CONTEC group office where you purchased before returning any product.
* No product will be accepted by the CONTEC group without the RMA number.

Liability

The obligation of the warrantor is solely to repair or replace the product. In no event will the warrantor be liable for any incidental or consequential damages due to s uch defec t or consequence s that arise from inexperienced usage, misuse, or malfunction of this device.
CNT16-8(FIT)GY, CNT16-8L(FIT)GY
4
Page 10
1. Before Using the Product

Safety Precautions

Understand the following definitions and precautions to use the product safely.

Safety Information

This document provides safety information u sing the foll owing sym bols to prevent a ccidents res ulting in injury or death and the destruc tion of equi pment and res ources. Under stand the mean ings of these la bels to operate the equipment safely.
DANGER
WAR NI NG
CAUTION
DANGER indicates an imminently hazardous situation which, if not avoided, will result in death or serious injury.
WARNING indicates a potentially hazardous situation which, if not avoided, could result in death or serious injury.
CAUTION indicates a potentially hazardous situation which, if not avoided, may result in minor or moderate injury or in property damage.

Handling Precautions

CAUTION
- Do not modify the module. CONTEC will bear no responsibility for any problems, etc., resulting from modifying this module.
- Do not use or store the equipment in a hot or cold place, or in a place that is subject to severe temperature changes. (Operating temperature range: 0 - 50°C)
- Do not use or store the equipment in a place subject to direct sunlight or near a heating device, such as a stove.
- Do not use or store the equipment in a dusty or humid place. (Operating humidity range: 10 - 90%RH, No cond ens ation )
- As this product contains precision electronic components, do not use or store in environments subject to shock or vibration.
- Do not use or store the product near equipment genera ting a strong m agnetic field or radio waves.
- If you notice any strange odor or overheating, please unplug the power cord immediately.
- In the event of an abnormal condition or malfunction, please consult the dealer from whom the equipment was purchased.
- To avoid electric shock, please do not touch the system with a wet hand.
- Do not open the module casing. CONTEC will disclaim any responsibility for equipment whose casing has been opened.
- To prevent damage, please do not subject the module to impact or bend it.
- To prevent contact malfunction, please do not touch the metallic pins on the external module connector.
CNT16-8(FIT)GY, CNT16-8L(FIT)GY
5
Page 11
1. Before Using the Product
- The module contains switches that need to be properly set. Before using the module, please check its switch settings.
- To avoid malfunction, please do not change the module switch settings in an unauthorized manner.
- Do not operate the device module when the power for the Controller Module is on. To avoid malfunction, please be sure to turn off the power for the Controller Module.
FCC PART 15 Class A Notice
NOTE
This equipment has been tested and found to comply with the limits for a Class A digital device, pursuant to part 15 of the FCC Rules. These limits are designed to provide reasonable protection against harmful interference when the equipment is operated in commercial environment. This equipment generates, uses, and can radiate radio frequency energy and, if not installed and used in accordance with the instruction manual, may cause harmful interference to radio communications. Operation of this equipment in a residential area is likely to cause harmful interference at his own expense.
WAR N ING T O USE R
Change or modifications not expressly approved the manufacturer can void the user's authority to operate this equipment.
CNT16-8(FIT)GY, CNT16-8L(FIT)GY
6
Page 12
1. Before Using the Product

Environment

Use this product in the following environm ent. If used in an u nauthorize d environm ent, the module m ay overheat, malfunction, or cause a failure.
Operating temperature
0 - 50°C
Operating humidity
10 - 90%RH (No condensation)
Corrosive gases
None
Floating dust particles
Not to be excessive

Inspection

Inspect the product periodically as follows to use it safely.
- Check that the ventilation slit has no obstruction and has no dust or foreign matter adh ering.
0123
4567
6
7
5
040
Device
4
1
ID
3
2
COM 0
NC
0 1 2 3
COM 1
NC
4 5 6 7
CNT16-8L

Storage

When storing this product, keep it in its original pa ck ing form. (1) Put the module in the storage bag. (2) Wrap it in the packing material, then put it in the box. (3) Store the package at room temperature at a place free from direct sunlight, moisture, shock,
vibration, magnetism, and static electricity.

Disposal

When disposing of the product, follow the disposal procedures stipulated under the relevant laws and municipal ordinances.
CNT16-8(FIT)GY, CNT16-8L(FIT)GY
7
Page 13
1. Before Using the Product
CNT16-8(FIT)GY, CNT16-8L(FIT)GY
8
Page 14

2. Module Nomenclature and Settings

2. Module Nomenclature and Settings Nomenclature of Module Components
Figure 2.1 shows the names of module components. In the figure, the indicated switch settings represent factory settings.
CNT16-8(FIT)GY CNT16-8L(FIT)GY
LED indicator
Input
Device
COM 0
COM 1
NC
NC
0123
4567
6
5
4
ID
3
2
0 1 2 3
4 5 6 7
CNT16-8
7
040
1
Device ID
Input
LED indicator
0123
4567
Device
ID
COM 0
NC
0 1 2
3
COM 1
NC
4 5 6 7
CNT16-8L
6
7
5
040
4
1
3
2
Device ID
Figure 2.1. Names of Module Components

Setting a Device ID

The controller module distinguishes and keeps track of the modules that are c onnecte d to it by ass igning device IDs to them. Each module, therefore, should be assigned a unique ID.
A Device ID can be assigned in a 0 - 7 range, so t hat a m a ximum of eight modules can be distinguis hed. The factory setting for the Device ID is [0].

Setup Method

A Device ID can be set by turning the rotary switch that is located on the module face. A Device ID can be assigned by turning the switch.
6
7
5
4
3
040
1
Factory setting:
2
(Device ID = 0)
Device
ID
Figure 2.2. Setting a Device ID
CNT16-8(FIT)GY, CNT16-8L(FIT)GY
9
Page 15
2. Module Nomenclature and Settings

LED Indicator

Table 2.1. LED Indicator
Name Function LED indicator
ON: Indicates current flowing in the input pin (Counting pulse signal)
OFF: Indicates no current flowing in the input pin (Not counting pulse signal)
Status LED
Input indicator (0 - 7): GREEN
CNT16-8(FIT)GY, CNT16-8L(FIT)GY
10
Page 16
3. Connecting to an External Device
3. Connecting to an External Device Interface Connector

How to Connect an Interface Connector

When connecting the Module to an external device, you can use the supplied connector plug. To wire the Module, strip the sheath ab out 9 - 10mm from an end of the wire an d insert the e xposed wire into an opening. Tighten th e sc rew to fas ten th e in se rted wi re. App lic ab le wires a re A WG2 8 - 16.
0123
4567
Device
ID
COM 0
NC
0 1 2 3
COM 1
NC
4
5 6 7
CNT16-8L
Turn the screw to fasten the wire.
6
7
5
040
4
1
3
2
- Connector used:
- Applicable plug (bundled):
9 - 10mm
3.81mm pitch, 12-pin type, 8.0A rated current MC1,5/12-GF-3,81 [made by Phoenix Contact Corp.]
Front screw type with connector stopper flange FRONT-MC 1,5/12-STF-3,81 [made by Phoenix Contact Corp.] Applicable wire: AWG28 - 16
Figure 3.1. Connecting an Interface Connector and Connectors That Can Be Used
CAUTION
Removing the connector plug by grasping the cable can break the wire.
CNT16-8(FIT)GY, CNT16-8L(FIT)GY
11
Page 17
3. Connecting to an External Device

Signal Layout on the Interface Connector

The Module can be connected to an external device using a 12-pin connector that is provided on the Module face.
COM 0--- +/-COM N.C. 0 --- IN 0 1 --- IN 1
2 --- IN 2 3 --- IN 3 COM 1--- +/-COM
N.C. 4 --- IN 4 5 --- IN 5
6 --- IN 6 7 --- IN 7
Common plus/minus for input port
Pulse input: 4points
Common plus/minus for input port
Pulse input: 4points
Figure 3.2. Signal Layout on the Interface Connector
CNT16-8(FIT)GY, CNT16-8L(FIT)GY
12
Page 18
3. Connecting to an External Device

External I/O Circuits

Input section Figure 3.3 or 3.4 shows the input equivalent circuit for the interface section.
The signal input section consists o f an opto-i solate d inpu t (com patible wi th both c urre nt sink ou tput a nd current source output). An external power s upp ly is th erefore requ ired to driv e the inpu t section of this module. The power requirement for the < CNT16-8(FIT)GY > is about 8 mA per input channel at 24 VDC (about 4 mA at 12 VDC) and for t he < CNT16- 8L(FIT)GY > i s about 4 m A per i nput cha nnel at 5 VDC.
External circuitModule
Vcc
3kΩ
Optocoupler
Optocoupler
3kΩ
+/-
common
Input
pin
Input
pin
Input contact
point
Input contact
point
External
power supply
12V - 24VDC
Figure 3.3. Input Circuit < CNT16-8(FIT)GY >
External circuitModule
Vcc
1.2kΩ
+/-
common
Input
Optocoupler
1.2kΩ
Optocoupler
pin
Input
pin
Input contact
point
Input contact
point
Figure 3.4. Input Circuit < CNT16-8L(FIT)GY >
CNT16-8(FIT)GY, CNT16-8L(FIT)GY
External
power supply
5VDC
13
Page 19
3. Connecting to an External Device
External circuitModule
Vcc
3kΩ
Optocoupler
Plus
common
Input
pin
Current sink
output
External
power supply
12V - 24VDC
Figure 3.5. Example of a Connection to Current Sink Output < CNT16-8(FIT)GY >
External circuitModule
Vcc
1.2kΩ
Optocoupler
Plus
common
Input
pin
Current sink
output
External
power supply
5VDC
Figure 3.6. Example of a Connection to Current Sink Output < CNT16-8L(FIT)GY >
External circuitModule
Vcc
3kΩ
Optocoupler
Minus
common
Input
pin
Current
source output
External
power supply
12V - 24VDC
Figure 3.7. Example of a Connection to Current Source Output < CNT16-8(FIT)GY >
External circuitModule
Vcc
1.2kΩ
Optocoupler
Minus
common
Input
pin
Current
source output
External
power supply
5VDC
Figure 3.8. Example of a Connection to Current Source Output < CNT16-8L(FIT)GY >
CNT16-8(FIT)GY, CNT16-8L(FIT)GY
14
Page 20

4. Using the I/O Address Map

4. Using the I/O Address Map Starting I/O Address
When connected to a CPU-SBxx(FIT)GY, the Module can directly receive I/O commands from the controller module. Depending on how the Device ID is set, the I/O addresses indicated below will be used exclusively by the Module.
Because the address bus on which I/O address space is allocated is not fully decoded in 16 bits, four starting I/O addresses exist for each Device ID.
If the Device ID is set to 0h, one of the four addresses (0800h, 0840h, 0880h , or 08C0h ) will be us ed as a starting I/O address.
Table 4.1. List of Starting I/O Addresses
< CNT16-8(FIT)GY, CNT16-8L(FIT)GY >
ID No. Occupied I/O address
0 0800h - 081Fh(recommended) 0840h - 085Fh 0880h - 089Fh 08C0h - 08DFh
1 1800h - 181Fh(recommended) 1840h - 185Fh 1880h - 189Fh 18C0h - 18DFh
2 2800h - 281Fh(recommended) 2840h - 285Fh 2880h - 289Fh 28C0h - 28DFh
3 3800h - 381Fh(recommended) 3840h - 385Fh 3880h - 389Fh 38C0h - 38DFh
4 4800h - 481Fh(recommended) 4840h - 485Fh 4880h - 489Fh 48C0h - 48DFh
5 5800h - 581Fh(recommended) 5840h - 585Fh 5880h - 589Fh 58C0h - 58DFh
6 6800h - 681Fh(recommended) 6840h - 685Fh 6880h - 689Fh 68C0h - 68DFh
7 7800h - 781Fh(recommended) 7840h - 785Fh 7880h - 789Fh 78C0h - 78DFh
For detailed specifications on the I/O space that is managed by the controller module, see the controller module manua l.
CNT16-8(FIT)GY, CNT16-8L(FIT)GY
15
Page 21
4. Using the I/O Address Map

List of I/O Address Maps

CNT16-8(FIT)GY
Starting
I/O
address D7 D6 D5 D4 D3 D2 D1 D0
Input
+0
(00h)
Products ID Number
+1
(01h)
Interrupt Status
+2
(02h)
(03h)
+16
(10h)
+17
(11h)
+18
(12h)
+31
(1Fh)
Enable
(0)
+3
Data 07 Data 06 Data 05 Data 04
Figure 4.1. Input Port < CNT16-8(FIT)GY >
Products Category Rivision Data
0 0 1 1
0 0 0 0 0 0 0 1
Status
(0)
Rivision
Data 3
Reserved
Data / Status
Data 03 Data 02 Data 01 Data 00
Reserved
Rivision
Data 2
IRQ 9
(0)
Rivision
Data 1
IRQ 7
(0)
Rivision
Data 0
IRQ 5
(0)
CNT16-8(FIT)GY, CNT16-8L(FIT)GY
16
Page 22
4. Using the I/O Address Map
Starting
I/O
address D7 D6 D5 D4 D3 D2 D1 D0
Output
+0
(00h)
+1
(01h)
+2
(02h)
+3
(04h)
+15
(0Fh)
+16
(10h)
+17
(11h)
+18
(12h)
+31
(1Fh)
Enable
(0)
Command
Data 07
Setting
Data 07
Command
Data 06
Setting
Data 06
Command
Data 05
Setting Data 05
N/A
Interrupt Status
N/A
Command
Command
Data 04
Setting Data
Setting Data 04
N/A
Command
Data 03
Setting
Data 03
IRQ 9
(0)
Command
Data 02
Setting
Data 02
IRQ 7
(0)
Command
Data 01
Setting
Data 01
IRQ 5
(0)
Command
Data 00
Setting
Data 00
Figure 4.2. Output Port < CNT16-8(FIT)GY >
CNT16-8(FIT)GY, CNT16-8L(FIT)GY
17
Page 23
4. Using the I/O Address Map
CNT16-8L(FIT)GY
Starting
I/O
address D7 D6 D5 D4 D3 D2 D1 D0
Input
+0
(00h)
Products ID Number
+1
(01h)
Interrupt Status
+2
(02h)
+3
(03h)
+16
(10h)
+17
(11h)
+18
(12h)
+31
(1Fh)
Products Category Rivision Data
0 0 1 1
0 0 0 0 0 0 1 0
Enable
(0)
Data 07 Data 06 Data 05 Data 04
Status
(0)
Rivision
Data 3
N/A
Input Data
Data 03 Data 02 Data 01 Data 00
Reserved
Rivision
Data 2
IRQ 9
(0)
Rivision
Data 1
IRQ 7
(0)
Rivision
Data 0
IRQ 5
(0)
Figure 4.3. Input Port < CNT16-8L(FIT)GY >
CNT16-8(FIT)GY, CNT16-8L(FIT)GY
18
Page 24
4. Using the I/O Address Map
Starting
I/O
address D7 D6 D5 D4 D3 D2 D1 D0
Output
+0
(00h)
+1
(01h)
+2
(02h)
+3
(04h)
+15
(0Fh)
+16
(10h)
+17
(11h)
+18
(12h)
+31
(1Fh)
Enable
(0)
Command
Data 07
Setting
Data 07
Command
Data 06
Setting
Data 06
Command
Data 05
Setting Data 05
N/A
Interrupt Status
N/A
Command
Command
Data 04
Setting Data
Setting Data 04
N/A
Command
Data 03
Setting
Data 03
IRQ 9
(0)
Command
Data 02
Setting
Data 02
IRQ 7
(0)
Command
Data 01
Setting
Data 01
IRQ 5
(0)
Command
Data 00
Setting
Data 00
Figure 4.4. Output Port < CNT16-8L(FIT)GY >
CNT16-8(FIT)GY, CNT16-8L(FIT)GY
19
Page 25
4. Using the I/O Address Map

Specifications Common to F&eIT Products

The starting I/O addresses from +0h - +Fh are common to all modules in the F&eIT series.

Product Information

Starting
I/O
address D7 D6 D5 D4 D3 D2 D1 D0
Input
+0
(00h)
Product ID Number
+1
(01h)
+2
(02h)
0 0 1 1
0 0 0 0 0 0 0 1
Enable(0) Status(0) 0 0 0
Figure 4.5. Product Information < CNT16-8(FIT)GY >
- Revision Data [D3 - D0]: This is product update information, su bjec t t o cha nge wi th out notice, t hat is m ana ge d by CONTE C.
- Product Category [D7 - D4]: This is a module function classification code. For the CNT16-8(FIT)GY and CNT16-8L(FIT)GY,
the code is "1h".
Table 4.2. Product Category
Code Function
0 Bus expansion
1 Digital input-output
2 Analog input-output
3 Counter
4 Serial communications
5 GPIB
6-F Reserved
- Products ID Number [D7 - D0]: This is the product ID within the same product category.
CNT16-8(FIT)GY : 1h CNT16-8L(FIT)GY : 2h
Following are examples of initialization coded in high-level languages: Microsoft C
Microsoft QBASIC
ProductID = inp( ADR+1 ); ProductID = INP( ADR+1 )
* ADR is the starting I/O address for the CNT16-8(FIT)GY and CNT16-8L(FIT)GY.
Product Category Rivision Data
Revision
Data3
Interruput Status
Revision
Data2
IRQ 9
(0)
Revision
Data1
IRQ 7
(0)
Revision
Data0
IRQ 5
(0)
CNT16-8(FIT)GY, CNT16-8L(FIT)GY
20
Page 26
4. Using the I/O Address Map
Interrupt status This is a common port on which the interrupt status requested by the Module can be verified.
Information on interrupt sources varies from module to module.
Starting
I/O
address D7 D6 D5 D4 D3 D2 D1 D0
Input
+2
(02h)
Enable
(0)
Status
(0)
0 0 0
Interruput Status
IRQ 9
(0)
IRQ 7
(0)
IRQ 5
(0)
Figure 4.6. Interrupt Status
- Enable [D7]: This bit verifies the interrupt source enabled/disabled status.
The value "1" indicates that a hardware interrupt on the controller module is enabled.
- Status [D6]: This bit indicates an interrupt request status in the module. When a n interrupt event ha s occurred i n
the module and IRQ5, IRQ7, or IRQ9 is "1", this bit will also be "1".
- IRQ* [D2 - D0]: These bits allow you to verify the interrupt level that is currently set. The current interrupt level is
indicated as "1".
Setting an interrupt level
Starting
I/O
address D7 D6 D5 D4 D3 D2 D1 D0
Output
+2
(02h)
Enable
(0)
Status
(0)
0 0 0
Interruput Status
IRQ 9
(0)
IRQ 7
(0)
IRQ 5
(0)
Figure 4.7. Setting an interrupt level
- Enable [D7]: This bit enables an interrupt source. Setting the bit to “1” enables hardware interrupts to the
controller module.
- IRQ* [D2 - D0]: The interrupt level used by the module is set in these bits. Setting any of t he IRQs t o “1” make s the
signal on that IRQ active upon reception of an interrupt request.
CNT16-8(FIT)GY, CNT16-8L(FIT)GY
21
Page 27
4. Using the I/O Address Map

Bit Assignments for I/O Ports

The I/O ports for the counting function have command-section and data-section registers. A register can be set as follows: First, a command is issued (OUT) to a port located at starting I/O
address + 16 to make the register available for setting. For output, data is assigned (OUT) to the register at port +17; for input, the +17 port is read. In other words, for both input and output, a command is issued (OUT) to the output port +16 to make registers available for setting, and either data is issued (OUT) to the port +17 to set the register or the register is read at the +17 port.
When setting a register even when using the same command, the command should be output to the output port +16 each time.
Figures 4.8. and 4.9. show I/O port bit assignments.
Starting
I/O
address D7 D6 D5 D4 D3 D2 D1 D0
+16
(10h)
+17
(11h)
Setting Data 07
Setting
Data 06
Setting
Data 05
Figure 4.8. Input Port
Starting
I/O
address D7 D6 D5 D4 D3 D2 D1 D0
+16
(10h)
+17
(11h)
Command
Data 07
Setting Data 07
Command
Data 06
Setting
Data 06
Command
Data 05
Setting
Data 05
Figure 4.9. Output Port
Undetermined
Setting Data
Setting
Data 04
Command
Command
Data 04
Setting Data
Setting
Data 04
Setting
Data 03
Command
Data 03
Setting
Data 03
Setting
Data 02
Command
Data 02
Setting
Data 02
Setting
Data 01
Command
Data 01
Setting
Data 01
Setting
Data 00
Command
Data 00
Setting
Data 00

Flow of Count Values

Initial count setting
[Command 00h - 07h]
16-bit UP/DOWN counter
Count control
[Command 14h]
Count up
[FFFFh → 0000h]
Count-vaule latch
[Command 10h]
Carry
Interrupt ma sk [Comand 11h]
Status data [Command 12h]
Figure 4.10. Flow of Count Values
CNT16-8(FIT)GY, CNT16-8L(FIT)GY
22
READ register
Reading count vaule
[Command 00h - 07h]
Page 28
4. Using the I/O Address Map

Operation Commands

Table 4.3. Output Commands
Command D7 D6 D5 D4 D3 D2 D1 D0 Function
00h CH0 initial count vaule CH0 initial count vaule 16-bit
01h CH1 initial count vaule CH1 initial count vaule 16-bit
02h CH2 initial count vaule CH2 initial count vaule 16-bit
03h CH3 initial count vaule CH3 initial count vaule 16-bit
04h CH4 initial count vaule CH4 initial count vaule 16-bit
05h CH5 initial count vaule CH5 initial count vaule 16-bit
06h CH6 initial count vaule CH6 initial count vaule 16-bit
07h CH7 initial count vaule CH7 initial count vaule 16-bit
10h CH7 CH6 CH5 CH4 CH3 CH2 CH1 CH0 Count data latching 8-bit
11h CH7 CH6 CH5 CH4 CH3 CH2 CH1 CH0 Interrupt mask 8-bit
12h CH7 CH6 CH5 CH4 CH3 CH2 CH1 CH0 Status reset 8-bit
13h CH7 CH6 CH5 CH4 CH3 CH2 CH1 CH0 Counter initialization 8-bit
14h CH7 CH6 CH5 CH4 CH3 CH2 CH1 CH0 Counter control 8-bit
15h Not allowed ST4 ST3 ST2 ST1 ST0 Digital filter 5-bit
Table 4.4. Input Commands
Command D7 D6 D5 D4 D3 D2 D1 D0 Function
00h CH0 count vaule CH0 count vaule 16-bit
01h CH1 count vaule CH1 count vaule 16-bit
02h CH2 count vaule CH2 count vaule 16-bit
03h CH3 count vaule CH3 count vaule 16-bit
04h CH4 count vaule CH4 count vaule 16-bit
05h CH5 count vaule CH5 count vaule 16-bit
06h CH6 count vaule CH6 count vaule 16-bit
07h CH7 count vaule CH7 count vaule 16-bit
11h CH7 CH6 CH5 CH4 CH3 CH2 CH1 CH0 Interrupt mask 8-bit
12h CH7 CH6 CH5 CH4 CH3 CH2 CH1 CH0 Status 8-bit
14h CH7 CH6 CH5 CH4 CH3 CH2 CH1 CH0 Counter control 8-bit
15h Not allowed ST4 ST3 ST2 ST1 ST0 Digital filter 5-bit
Data
Size
Data
Size
CNT16-8(FIT)GY, CNT16-8L(FIT)GY
23
Page 29
4. Using the I/O Address Map

Description of Input Commands

Reading a Count (command 00h - 07h)

By reading the contents of the R EA D regi ste r fo r a co rres pon ding c hann e l, th is co mman d reads a co unt value. By issuing the command to the output port +16 and reading the input port +17 two times, you ca n read low, middle, and high count values.
In the initial state, the contents of the READ register are undefined. Following are programs that read a count value from CH0: Microsoft C
outp( ADR+16, 0x0 ); OUT ADR+16, &H0 LowerData = inp( ADR+17 ); LowerData = INP( ADR+17 ) UpperData = inp( ADR+17 ); UpperData = INP( ADR+17 )
In this case, the count value latch for CH0 must be pre-set to [1].

Interrupt mask (command 11h)

Command D7 D6 D5 D4 D3 D2 D1 D0 Function Data length
This command allows you to monitor the status of the current interrupt mas k tha t wa s se t us ing the interrupt mask command. CH7 - CH0 are associated with channels. When these bits are [1], the interrupt is masked, and no interrupt signals are output.
You can monitor the masking status by issuing the value 15h to the output port +16 and by reading the input port +17.
Initial state: FFH
Microsoft QBASIC
11h CH7 CH6 CH5 CH4 CH3 CH2 CH1 CH0 Interrupt masuk 8-bit
0: Not masked 1: Masked
CAUTION
CNT16-8(FIT)GY, CNT16-8L(FIT)GY
24
Page 30
4. Using the I/O Address Map

Status (command 12h)

Command D7 D6 D5 D4 D3 D2 D1 D0 Function Data length
12h CH7 CH6 CH5 CH4 CH3 CH2 CH1 CH0 Status 8-bit
Indicates a carry-up occurred for the count on each channel. By issuing 12H to the output po rt +16 and re ading th e inp ut po rt +17 , you can monito r the status . Th e
corresponding bit is set to "1" when a carry-up occurs on a channel (CH7 - CH0).
0 : No carry 1 : Carry
CAUTION
- Initial state: 00h
- If an interrupt is generated with the interrupt option set, and if one of the bits in CH7 - CH0 is set to [1], before another interrupt can be generated, the affected sense bit must be reset. For a description of how to reset a sense bit, see "Sense Reset" on output ports.

Count control (Command 14h)

Command D7 D6 D5 D4 D3 D2 D1 D0 Function Data length
14h CH7 CH6 CH5 CH4 CH3 CH2 CH1 CH0 Count control 8-bit
Count operating status of each channel is displayed. You can monitor the operaing status by issuing the value 14h to the output port +16 and by reading the
input port +17.
0 : Stopping 1 : Operating
CAUTION
Initial state: 00h

Digital Filter (command 15h)

Command D7 D6 D5 D4 D3 D2 D1 D0 Function Data length
15h 0 0 0 ST4 ST3 ST2 ST1 ST0 Digital Filter 5-bit
This can be used to check the settings for the digital filter. Output 15H to output port +16 and read input port +17.
CNT16-8(FIT)GY, CNT16-8L(FIT)GY
25
Page 31
4. Using the I/O Address Map

Description of Output Commands

Initial Count Value (command 00h - 07h)

The command is issued to the output port +16, and an initial count value is set on the output port +17. Because count data consists o f 16 bits, count values ar e outp ut tw o tim es in l ow, m iddle, and high order , 8 bits each time. When the third (high 8 bits) count value is output, data consisting of 16 bits is loaded simultaneously by the counting process.
Following are program examples that set a count value 100(64h) on CH0: Microsoft C
outp( ADR+16, 0x0 ); OUT ADR+16, &H0 outp( ADR+17, 0x64 ); OUT ADR+17, &H64 outp( ADR+17, 0x0 ); OUT ADR+17, &H0

Count Data Latching (command 10h)

Command D7 D6 D5 D4 D3 D2 D1 D0 Function Data length
10h CH7 CH6 CH5 CH4 CH3 CH2 CH1 CH0 Count data
This command latches a count value on a corresponding channel to the READ register. The command issues the value "10h" to the output port +16, and set s a dat a latch on th e outp ut port + 17. These bits are associated with the respective channels. The command latches the count value by setting the
applicable bit to "1". All channels can be latched simultaneously by setting all applicable bits to "1".
The initial condition is no-latch (00h).
Microsoft QBASIC
CAUTION
latching
8-bit

Interrupt Mask (command 11h)

Command D7 D6 D5 D4 D3 D2 D1 D0 Function Data length
11h CH7 CH6 CH5 CH4 CH3 CH2 CH1 CH0 Interrupt Mask 8-bit
This command issues the value "11 h" to the output p ort +16, and set s a mask on the ou tput port +17. The generation of interrupt signals is disabled when an applicable bit is set to "1".
These bits are associated with the respective channels. Setti ng the val ue "1" to any of these bits disable s a carry-up interrupt on the associated channel. Setting the value "0" resets the disabled condition.
CAUTION
- In the initial condition, all channels are timer-masked (FFh).
- Even in the masked state, on all channels the carry-up conditions change.
CNT16-8(FIT)GY, CNT16-8L(FIT)GY
26
Page 32
4. Using the I/O Address Map

Status Reset (command 12h)

Command D7 D6 D5 D4 D3 D2 D1 D0 Function Data length
12h CH7 CH6 CH5 CH4 CH3 CH2 CH1 CH0 Status Reset 8-bit
The interrupt sense sets an applicable bit to "1" when carry-up condition is detected on a given channel. When the applicable bit is "1", an interrupt signal is not generated when another carry-up condition
arises. Issuing the value "+12h" to the output port +16 and the value "1" to the applicable bit on the output port +17 clears the sense bit, and enables the generation of another interrupt signal.

Counter initialization (command 13h)

Command D7 D6 D5 D4 D3 D2 D1 D0 Function Data length
13h CH7 CH6 CH5 CH4 CH3 CH2 CH1 CH0 Counter
initialization
8-bit
This command resets the counter data of each channel to 0000h. The command issues the value "13h" to the output port +16, and resets on the output port +17 and sets
the applicable bit to "1".

Counter control (command 14h)

Command D7 D6 D5 D4 D3 D2 D1 D0 Function Data length
14h CH7 CH6 CH5 CH4 CH3 CH2 CH1 CH0 Counter control 8-bit
This command controls the corresponding count operation of channel. The command issues the value "14h" to the output port +1 6, and sets a c ount c ontr ol on t he o utput por t +17. T he c ommand c ontr ols t he count operation by setting the applicable bit to "1".
These bits are associated with the respective channels. Setti ng the value "1" to any of these bits starts counting. Setting the value "0" to any of these bits stops counting.
CAUTION
- The initial state is all channels stopped(00h).
- The count data remains unchanged while the count is stopped.
CNT16-8(FIT)GY, CNT16-8L(FIT)GY
27
Page 33
4. Using the I/O Address Map

Digital Filter (command 15h)

Using this function digitally filters the signals at all input pins by means of hardware. Use it to prevent input signal noise and chattering from being detected by mistake.
The level is checked at each clock sampling time. If the signal le vel remains the same for longer tha n the time set for the digital filter, the signal is treated as a vali d input and the level of the P C signal is changed.
Accordingly, if leve l changes occur at a higher frequency than the filter time, the level changes will not be detected.
Input Signal
Bounce time m < Filter Setting Time a
Input Signal
Filter Output Signal
Delay time 2a (Max.)
Digital Filter
Filter Output Signal
Val id
Figure 4.11. Digital Filter Operation Principle
Set Digital Filter Time
Command D7 D6 D5 D4 D3 D2 D1 D0 Function Data length
15h Not used ST4 ST3 ST2 ST1 ST0 Digital Filter 5-bit
CNT16-8(FIT)GY, CNT16-8L(FIT)GY
28
Page 34
4. Using the I/O Address Map
Set Digital Filter Time Output setting data "ST4 - ST0" to the "time setting" output port to set the digital filter time.
The table below lists the relationships between digital filter time and setting data. Digital Filter Time [sec] = 2
n
/ (8 x 106)
n: Setting Data (0 - 20)
Table 4.5. Digital Filter Time and Setting Data
Setting Data
(n)
0 (00h) *1 Not used 7 (07h) 16μSec 14 (0Eh) 2.048mSec
1 (01h) 0.25μSec 8 (08h) 32μSec 15 (0Fh) 4.096mSec
2 (02h) 0.5μSec 9 (09h) 64μSec 16 (10h) 8.192mSec
3 (03h) 1μSec 10 (0Ah) 128μSec 17 (11h) 16.384mSec
4 (04h) 2μSec 11 (0Bh) 256μSec 18 (12h) 32.768mSec
5 (05h) 4μSec 12 (0Ch) 512μSec 19 (13h) 65.536mSec
6 (06h) 8μSec 13 (0Dh) 1024μSec 20 (14h) 131.072mSec
*1: Factory setting
CAUTION
Digital
Filter Time
Setting Data
(n)
Digital
Filter Time
Setting Data
(n)
Digital
Filter Time
- The default value for digital filter setting time is "Not used". The default setting i s used when the power is turned on.
- The digital filter applies to all input channels; it cannot apply to specific input pins only.
- Do not set the setting data to an y v alue oth er th an th e abov e. Doing so ma y resu lt in a malfunction.
CNT16-8(FIT)GY, CNT16-8L(FIT)GY
29
Page 35
4. Using the I/O Address Map

Examples

Pulse Count (no interrupts)

Flowchart
Start
Set digital filter
Status reset
Set initial counter
value
Data latch
command
Enter data
Initialization
Data input
Keyboard input
End
No
Yes
Figure 4.12. Pulse Count (No Interrupts)
CNT16-8(FIT)GY, CNT16-8L(FIT)GY
30
Page 36
4. Using the I/O Address Map
Sample Program
/* =========================================================================== Sample program 1
DEVICE ID: 0 Initial Data: 0000H Channel: 0ch Digital Filter 1024 usec Interrupt: N/A =========================================================================== */ #include <stdio.h> #include <conio.h>
/* ----- Constant --------------------------------------------------------- */ #define ADR 0x0800 /* I/O address */ #define CH 8 /* channel */
/* ----- Declarations ------------------------------------------------------ */ struct REGS08 { /* 8-bit */ unsigned char lower; /* lower */ unsigned char upper; /* upper*/ };
struct REGS16 { /* 16-bit */ unsigned short count; };
union ACCESS { struct REGS08 Byte[CH]; /* 8-bit */ struct REGS16 Whole[CH]; /* 16-bit */ };
union ACCESS CountData;
/* ----- Prototype --------------------------------------------------------- */ void main( void ); void Initialize( unsigned char ); /* initialize */ void ReadData( unsigned char, unsigned short *, unsigned char * ); /* read data */
/* ----- Initialize -------------------------------------------------------- */ void Initialize( unsigned char ch ) { outp( ADR+0x10, 0x15 ); /* digital filter set */ outp( ADR+0x11, 0x0d ); /* 1024us */ outp( ADR+0x10, 0x12 ); /* sense reset */ outp( ADR+0x11, 0xff ); outp( ADR+0x10, ch); /* initial data set */ outp( ADR+0x11, CountData.Byte[ch].lower ); /* lower */ outp( ADR+0x11, CountData.Byte[ch].upper ); /* upper */ }
CNT16-8(FIT)GY, CNT16-8L(FIT)GY
31
Page 37
4. Using the I/O Address Map
/* ----- Read Data ---------------------------------------------------------­*/ void ReadData( unsigned char ch, unsigned short *data, unsigned char *sts ) { outp( ADR+0x10, 0x10 ); /* data latch */ outp( ADR+0x11, 0xff ); outp( ADR+0x10, ch ); /* read data */ CountData.Byte[ch].lower = inp( ADR+0x11 ); /* lower */ CountData.Byte[ch].upper = inp( ADR+0x11 ); /* upper */ *data = CountData.Whole[ch].count; outp( ADR+0x10, 0x12 ); /* status*/ *sts = (unsigned char)inp(ADR+0x11); }
/* ------ main ------------------------------------------------------------- */ void main( void ) { unsigned char ch, sts; unsigned short data;
ch = 0; /* channel 0 */ CountData.Whole[ch].count = 0x0000; /* count data */
Initialize( ch ); outp( ADR+0x10, 0x14 ); /* count start */ outp( ADR+0x11, (0x01 << ch)); while( !kbhit() ) { ReadData( ch, &data, &sts ); printf("%01dch %08d Status %02x \n", ch, data, sts );/* display */ } outp( ADR+0x10, 0x14 ); /* count stop */ outp( ADR+0x11, 0x00 ); }
/* -------------------------------------------------------- End of file --- */
CNT16-8(FIT)GY, CNT16-8L(FIT)GY
32
Page 38
4. Using the I/O Address Map

Pulse Count (with interrupts)

Flowchart
Start
Interrupt vectors
processing
Initialize
Set an interrupt
level
Reset the
interrupt mask
Start couner
Count value
acquiring
Show data
End of interrupt?
Yes
Keyboard input
Yes
Clear the
interrupt mask
Reset the
interrupt level
Interrupt processing
Count the number
of interrupts
Status acqu iring
Status reset
EOI
Return
No
No
Restore
interrupt vector
Stop couner
End
Figure 4.13. Pulse Count (with Interrupts)
CNT16-8(FIT)GY, CNT16-8L(FIT)GY
33
Page 39
4. Using the I/O Address Map
Sample Program
/* =========================================================================== Sample program 2
DEVICE ID: 0 Initial Data: 0000H Channel: 0 to 3ch Digital Filter 1024 usec Interrupt: IRQ5 10 times
=========================================================================== */ #include <stdio.h> #include <conio.h> #include <dos.h>
/* ----- Constant ---------------------------------------------------------- */ #define ADR 0x0800 /* I/O address */ #define CH 4 /* channel */ #define IRQ5 0 /* IRQ5 */ #define IRQ7 1 /* IRQ7 */ #define IRQ9 2 /* IRQ9 */
/* ----- Declarations ------------------------------------------------------ */ struct REGS08 { /* 8-bit */ unsigned char lower; /* lower */ unsigned char upper; /* upper*/ };
struct REGS16 { /* 16-bit */ unsigned short count; };
union ACCESS { struct REGS08 Byte[CH]; /* 8-bit */ struct REGS16 Whole[CH]; /* 16-bit */ };
union ACCESS CountData; volatile int intcnt = 0; /* interrupt counter */ volatile unsigned char intstatus = 0; /* interrupt status */ volatile int IrqLevel = IRQ5; /* interrupt level */ int OrgMasterImr, OrgSlaveImr; /* original IMR */ unsigned char IntVector[3] = { 0x0d, 0x0f, 0x71 }; /* interruput vector */ unsigned char PicMask[3] = { 0xdf, 0x7f, 0xfd }; /* mask bit */ unsigned char IsrClear[3] = { 0x65, 0x67, 0x61 }; /* ISR clear */ unsigned char IntEnable[3] = { 0x81, 0x82, 0x84 }; /* interrupt enable */
/* ----- Prototype ---------------------------------------------------------­*/ void main( void ); void Initialize( unsigned char ); /* initialize */ void ChgVect( void ); /* change vector */
CNT16-8(FIT)GY, CNT16-8L(FIT)GY
34
Page 40
4. Using the I/O Address Map
void ReadData( void ); /* read data */ void Display( void ); /* display */ void ResVect( void ); /* restore vector */ void _interrupt _far inthandler( void ); /* interrupt handler */ void ( _interrupt _far *OrgVect)(); /* original interrupt vector */
/* ----- Initialize --------------------------------------------------------­*/ void Initialize( unsigned char ch ) { outp( ADR+0x10, 0x15 ); /* digital filter set */ outp( ADR+0x11, 0x0d ); /* 1024us */ outp( ADR+0x10, 0x12 ); /* sense reset */ outp( ADR+0x11, 0xff ); outp( ADR+0x10, ch ); /* initial data set */ outp( ADR+0x11, CountData.Byte[ch].lower ); /* lower */ outp( ADR+0x11, CountData.Byte[ch].upper ); /* upper */ }
/* ----- change vector ------------------------------------------------------­*/ void ChgVect( void ) { OrgVect = _dos_getvect( IntVector[IrqLevel] ); _disable(); _dos_setvect( IntVector[IrqLevel], inthandler ); if ( IrqLevel > IRQ7 ) { /* IMR and mask clear */ outp( 0x21, ( OrgMasterImr = inp( 0x21 ) ) & 0xfb ); outp( 0xa1, ( OrgSlaveImr = inp( 0xa1 ) ) & PicMask[IrqLevel] ); outp( 0x20, 0x62 ); /* ISR clear (master) */ outp( 0xa0, IsrClear[IrqLevel] ); /* ISR clear (slave) */ } else { /* IMR and mask clear */ outp( 0x21, ( OrgMasterImr = inp( 0x21 ) ) & PicMask[IrqLevel] ); outp( 0x20, IsrClear[IrqLevel] ); /* ISR clear */ } _enable(); /* enable */ }
/* ----- Read Data ---------------------------------------------------------­*/ void ReadData( void )
{ unsigned char ch; outp( ADR+0x10, 0x10 ); /* data latch */ outp( ADR+0x11, 0xff );
for (ch=0; ch<CH; ch++) { outp( ADR+0x10, ch ); /* read data */ CountData.Byte[ch].lower = inp( ADR+0x11 ); /* lower */ CountData.Byte[ch].upper = inp( ADR+0x11 ); /* upper */ } }
/* ----- display ------------------------------------------------------------­*/ void Display( void ) {
CNT16-8(FIT)GY, CNT16-8L(FIT)GY
35
Page 41
4. Using the I/O Address Map
int i; for (i = 0; i < CH; i++) {
printf("%dch %04XH, ", i, CountData.Whole[i].count ); } printf("interrupt count = %03d, status = %02X\n", intcnt, (int)intstatus); }
/* ------ restore vector ----------------------------------------------------­*/ void ResVect( void ) { _disable(); /* disable */ if ( IrqLevel > IRQ7 ) { /* restore IMR */ outp( 0x21, OrgMasterImr ); outp( 0xa1, OrgSlaveImr ); } else outp( 0x21, OrgMasterImr ); _dos_setvect( IntVector[IrqLevel], OrgVect ); /* restore orgvect */ _enable(); /* enable */ }
/* ----- interrupt handler --------------------------------------------------­*/ void _interrupt _far inthandler( void ) { _enable(); /* enable */
intcnt++; /* count interrupt */ outp( ADR+0x10, 0x12 ); /* status sence */ intstatus = (unsigned char)inp(ADR+0x11); outp( ADR+0x10, 0x12 ); /* sense reset */ outp( ADR+0x11, 0xff ); _disable(); /* disable */
if ( IrqLevel > IRQ7 ) { /* EOI */ outp( 0xa0, 0x20 ); outp( 0xa0, 0x0b ); if ( !inp( 0xa0 ) ) { outp( 0x20, 0x20 ); } } else { outp( 0x20, 0x20 ); } }
/* ------ main -------------------------------------------------------------­*/ void main( void ) { unsigned char i;
ChgVect(); /* change vector */ for (i = 0; i < CH; i++) {
CountData.Whole[i].count = 0x0000; /* count data */ Initialize(i); /* initialize */ }
outp( ADR+0x2, IntEnable[IrqLevel] ); /* interrupt level */
CNT16-8(FIT)GY, CNT16-8L(FIT)GY
36
Page 42
4. Using the I/O Address Map
outp( ADR+0x10, 0x11 ); /* interrupt mask open */ outp( ADR+0x11, 0x00 );
outp( ADR+0x10, 0x14 ); /* count start */ outp( ADR+0x11, 0xff );
while( intcnt < 10 && kbhit() == 0) { ReadData(); /* read data */ Display(); /* display */ }
Display(); /* display */ outp( ADR+0x10, 0x11 ); /* interrupt mask close */ outp( ADR+0x11, 0xff ); outp( ADR+0x2, 0x0 ); /* interrupt level */ ResVect(); /* restore vector */ outp( ADR+0x10, 0x14 ); /* count stop */ outp( ADR+0x11, 0x00 );
} /* --------------------------------------------------------- End of file --- */
CNT16-8(FIT)GY, CNT16-8L(FIT)GY
37
Page 43
4. Using the I/O Address Map
CNT16-8(FIT)GY, CNT16-8L(FIT)GY
38
Page 44
5. Using the Memory Address Map

5. Using the Memory Address Map

When connected to a CPU-CAxx(FIT)GY, the CNT16-8(FIT)GY, CNT16-8L(FIT)GY can be accessed by a host computer through a network. In addition, the Module can be allocated to the memory controlled by the Controller Module according to a given Device ID. Applications running on the host computer control the I/O modules by reading/writing the memory that is controlled by the Controller Module.
For detailed specifications on the memory controlled by the Controller Module, see the Controller Module manual.
Following is an explanation of the memory areas necessary for the use of this I/O module: the "module area", the "module information area", and the "basic data area".
Module Information area This area controls the settings and how the module is started. The module becomes available when the necessary settings are written into this area and the module
activation option is set in the [module startup register].
Module information area The current module settings are stored in this area. When the Module is star ted , th e cont en ts of th e Module Information Area are copied to the Module
Information Area. By reading this area, you can verify the current module settings.
Basic I/O data area Basic I/O data is accessed in this area.
CNT16-8(FIT)GY, CNT16-8L(FIT)GY
39
Page 45
5. Using the Memory Address Map

Module Information Area

A module information area, which is a 128-byte (80h) area beginning with address 301000h an d corresponding to a given Device ID, is where the settings for the given device are read and written.
The starting address can be determined according to the following expression: Starting address = 301000h + 80h x (Device ID)
Table 5.1. Module Information Area < 1 / 3 >
Address(h) Area Item Size
Starting address+00
Starting address+01
Starting address+02
Starting address+03
Starting address+04
Starting address+05
Starting address+06
Starting address+07
Starting address+08
Starting address+09
Starting address+0A
Starting address+0B
Starting address+0C
- Starting address+0F Starting address+10
Starting address+11
Starting address+12 Counter resolution 1 R 10 16bits Starting address+13 Digital filter setting 1 R/W 00 Not used Starting address+14
- Starting address+1F
*1 "02" on the CNT16-8L(FIT)GY.
Module-
specific
information
Common to
modules
Module type (category)
Module type (serial No.)
System-reserved (revision No.)
Supported functions
Number of basic input channels
Basic input data size
Number of basic output channels
Basic output data size
Input channel settings address
Input channel settings data size
Output channel settings address
Output channel settings data size
Reserved
Module startup register
Error status
Reserved 12 R None
Access
type
1 R 03
1 R 01 *1
1 R None
1 R 01 Basic input
1 R 08 8channels
1 R 02 2bytes
1 R 00
1 R 00
1 R 20 20h
1 R 08 8bytes
1 R 00
1 R 00
4 R None
1 R/W 00
1 R 00
Initial
value(h)
Initial
settings
CNT16-8(FIT)GY
CNT16-8(FIT)GY, CNT16-8L(FIT)GY
40
Page 46
5. Using the Memory Address Map
Table 5.1. Module Information Area < 2 / 3 >
Address(h) Area Item Size
Starting address+20 Startup register 1 R/W 00 Starting address+21 Status reset 1 R/W 00 Starting address+22 Counter initialization 1 R/W 00 Starting address+23
- Starting address+24 Starting address+25
- Starting address+27 Starting address+28 Startup register 1 R/W 00 Starting address+29 Status reset 1 R/W 00 Starting address+2A Counter initialization 1 R/W 00 Starting address+2B
- Starting address+2C Starting address+2D
- Starting address+2F Starting address+30 Startup register 1 R/W 00 Starting address+31 Status reset 1 R/W 00 Starting address+32 Counter initialization 1 R/W 00 Starting address+33
- Starting address+34 Starting address+35
- Starting address+37 Starting address+38 Startup register 1 R/W 00 Starting address+39 Status reset 1 R/W 00 Starting address+3A Counter initialization 1 R/W 00 Starting address+3B
- Starting address+3C Starting address+3D
- Starting address+3F Starting address+40 Startup register 1 R/W 00 Starting address+41 Status reset 1 R/W 00 Starting address+42 Counter initialization 1 R/W 00 Starting address+43
- Starting address+44 Starting address+45
- Starting address+47 Starting address+48 Startup register 1 R/W 00 Starting address+49 Status reset 1 R/W 00 Starting address+4A Counter initialization 1 R/W 00 Starting address+4B
- Starting address+4C Starting address+4D
- Starting address+4F Starting address+50 Startup register 1 R/W 00 Starting address+51 Status reset 1 R/W 00 Starting address+52 Counter initialization 1 R/W 00 Starting address+53
- Starting address+54 Starting address+55
- Starting address+57
Channel
settings
CH0
Preset counter value 2 R/W 0000
Reserved 3 R None
CH1
Preset counter value 2 R/W 0000
Reserved 3 R None
CH2
Preset counter value 2 R/W 0000
Reserved 3 R None
CH3
Preset counter value 2 R/W 0000
Reserved 3 R None
CH4
Preset counter value 2 R/W 0000
Reserved 3 R None
CH5
Preset counter value 2 R/W 0000
Reserved 3 R None
CH6
Preset counter value 2 R/W 0000
Reserved 3 R None
Access
type
Initial
value(h)
Initial
settings
CNT16-8(FIT)GY, CNT16-8L(FIT)GY
41
Page 47
5. Using the Memory Address Map
Table 5.1. Module Information Area < 3 / 3 >
Address(h) Area Item Size
Starting address+58 Startup register 1 R/W 00 Starting address+59 Status reset 1 R/W 00 Starting address+5A Counter initialization 1 R/W 00 Starting address+5B
- Starting address+5C Starting address+5D
- Starting address+5F Starting address+60 Startup register mask 1 R/W 00 Starting address+61 Status reset mask 1 R/W 00 Starting address+62 Counter initialization mask 1 R/W 00 Starting address+63 Preset counter value mask 1 R/W 00 Starting address+64
- Starting address+7F
CH7
Preset counter value 2 R/W 0000
Reserved 3 R None
Reserved 28 R None
Access
type
Initial
value(h)
Initial
settings
CNT16-8(FIT)GY, CNT16-8L(FIT)GY
42
Page 48
5. Using the Memory Address Map
Module-specific information
- Module type (category) The CNT16-8x(FIT)GY belongs to the counter module (03h) category.
- Module type (serial No.) The CNT16-8(FIT)GY is a counter module with a serial No. 1 (01h). The CNT16-8L(FIT)GY is a counter module with a serial No. 2 (02h).
- Supported functions The CNT16-8x(FIT)GY supports the basic input function (01h). Basic input data takes count values. No basic output data.
- Number of basic input channels The number of basic input channels for the CNT16-8x(FIT)GY is 8 (08h). Eight counter channels are provided.
- Basic input data size The basic input data size for the CNT16-8x(FIT)GY is 2 (02h) byte. The count value consists of two b ytes .
- Number of basic output channels The number of basic output channels for the CNT16-8x(FIT)GY is 0 (00h). No output channel.
- Basic output data size The basic output data size for the CNT16-8x(FIT)GY is 0 (00h) byte.
- Input channel settings address The addresses of the settings for each input channel are represented as offset addresses within the
module setting area.
On the CNT16-8x(FIT)GY, the locations of the input channel settings start from "20h".
- Input channel settings data size Indicates the size of the data area for each input channel setting.
The data size for the CNT16-8x(FIT)GY input channel settings is 8 bytes (08h).
- Output channel settin gs ad d res s The CNT16-8x(FIT)GY does not have channel-specific settings. This field is provided for
compatibility with other device modules.
- Output channel settin gs da ta siz e The CNT16-8x(FIT)GY does not have channel-specific settings. This field is provided for
compatibility with other device modules.
CNT16-8(FIT)GY, CNT16-8L(FIT)GY
43
Page 49
5. Using the Memory Address Map
Items common to mo d u les
- Module startup register Setting the module startup option (01h) causes the device module to be started. Setting the module startup op tion w hen the mod ule is be ing sta rted c aus es th e modu le to be
restarted.
The CNT16-8x(FIT)GY does not contain a module shutdown function.
00h : No operation
01h : Module startup
- Error status The error status bits, which are not reflected in the module information area, always remain [00h]. The error status on a module is stored in the module information area.
- Counter resolution
The counter resolution of the CNT16-8x(FIT)GY is 16 (10h) bit.
- Digital filter setting
Sets the digital filter.
Table 5.2. Digital Filter Time and Setting Data
Setting Data
(n)
0 (00h) *1 Not used 7 (07h) 16μSec 14 (0Eh) 2.048mSec
1 (01h) 0.25μSec 8 (08h) 32μSec 15 (0Fh) 4.096mSec
2 (02h) 0.5μSec 9 (09h) 64μSec 16 (10h) 8.192mSec
3 (03h) 1μSec 10 (0Ah) 128μSec 17 (11h) 16.384mSec
4 (04h) 2μSec 11 (0Bh) 256μSec 18 (12h) 32.768mSec
5 (05h) 4μSec 12 (0Ch) 512μSec 19 (13h) 65.536mSec
6 (06h) 8μSec 13 (0Dh) 1024μSec 20 (14h) 131.072mSec
*1: Factory setting
CAUTION
Digital
Filter Time
Setting Data
(n)
Digital
Filter Time
Setting Data
(n)
Digital
Filter Time
- The default value for digital filter setting time is "Not used".
- Writing a setting data other than a "0" will apply this filter function to all input channels. This function cannot be applied to particular pins only but is applied to all input channels.
- Do not set the setting data to an y v alue oth er th an th e abov e. Doing so ma y resu lt in a malfunction.
CNT16-8(FIT)GY, CNT16-8L(FIT)GY
44
Page 50
5. Using the Memory Address Map
Channel settings
- Startup register This command controls the corresponding count operation of the channel. The command controls
the count operation by setting the data of corresponding ch annel to 01h . Setting "01h" to the setting for each channel starts counting on that channel. Setting "00h" stops
counting. 00h : Stop
01h : Start Setting the module start setting (01h) to the module startup register sets the startup registers for all
channels to "01h".
CAUTION
The count data does not change while the count is stopped.
- Status reset When a carry-up occurs on a channel count, the data for the corresponding channel in "module data
area", "channel data", and "status" goes to "01h". The next carry-up does not occur if the "status" for a channel is "01h". Using status reset to output
"01" to the corresponding channel clears the sense and permits the next count carry-up to occur. 00h : No operation
01h : Sense reset Changes to "00h" when sense reset processing completes.
- Counter initialization Resets the counter data of each channel to 0000h. 00h : No operation
01h : Counter initialization
Changes to "00h" when counter initialization completes.
- Preset counter value By setting values, you can set a preset value to the count for each channel.
The preset counter value is stored as a little endian value.
Table 5.3. Preset counter value
D7 D6 D5 D4 D3 D2 D1 D0
+00h A7 A6 A5 A4 A3 A2 A1 A0
+01h A15 A14 A13 A12 A11 A10 A9 A8
Changes to "0000h" when preset processing completes.
CNT16-8(FIT)GY, CNT16-8L(FIT)GY
45
Page 51
5. Using the Memory Address Map
- Startup register mask Use this function when you want to start or stop channels simultaneously. Write the settings and
mask for CH0 - CH7 in a single write operation.
Table 5.4. Startup register mask
D7 D6 D5 D4 D3 D2 D1 D0
+60h CH7 CH6 CH5 CH4 CH3 CH2 CH1 CH0
Update the "startup register" values for the channels corresponding to bits set to "1". 0 : Ignore 1 : Update "startup register" value.
- Status reset mask Use this function when you want to perform a status reset for multiple channels simultaneously.
Write the settings and mask for CH0 - CH7 in a single write operation.
Table 5.5. Status reset mask
D7 D6 D5 D4 D3 D2 D1 D0
+61h CH7 CH6 CH5 CH4 CH3 CH2 CH1 CH0
Update the "Status reset" v alue s for th e ch ann els co rrespon ding to b its set to "1 ". 0 : Ignore 1 : Update "Status reset" value.
- Counter initialization mask Use this function when you want to initialize channels simultaneously. Write the settings and mask
for CH0 - CH7 in a single write operation.
Table 5.6. Counter initialization mask
D7 D6 D5 D4 D3 D2 D1 D0
+62h CH7 CH6 CH5 CH4 CH3 CH2 CH1 CH0
Update the "Counter initialization" values for the channels corresponding to bits set to "1". 0 : Ignore 1 : Update "Counter initialization" value.
- Preset counter mask Use this function when y ou want to prese t chan nels sim ultaneou sly. W rite the settin gs and m ask for
CH0 - CH7 in a single write operation.
Table 5.7. Preset counter mask
D7 D6 D5 D4 D3 D2 D1 D0
+63h CH7 CH6 CH5 CH4 CH3 CH2 CH1 CH0
Update the "Preset counter" values for the channels corresponding to bits set to "1".
0 : Ignore 1 : Update "Preset counter" value.
CNT16-8(FIT)GY, CNT16-8L(FIT)GY
46
Page 52
5. Using the Memory Address Map

Module Information Area

The module information area, which is a 128-byte (80h) area beginning with address 300000h and corresponding to a given Device ID, is the area into which settings are read.
The starting address can be determined according to the following expression: Starting address = 300000h + 80h x (Device ID)
Table 5.8. Module Information Area < 1 / 2 >
Address(h) Area Item Size
Starting address+00
Starting address+01
Starting address+02
Starting address+03
Starting address+04
Starting address+05
Starting address+06
Starting address+07
Starting address+08
Starting address+09
Starting address+0A
Starting address+0B
Starting address+0C
- Starting address+0F Starting address+10
Starting address+11
Starting address+12 Counter resolution 1 R 10 Starting address+13 Digital filter 1 R 00 Starting address+14
- Starting address+1F
*1 "02" on the CNT16-8L(FIT)GY.
Module-
specific
information
Common to
modules
Module type (category)
Module type (serial No.)
System-reserved (revision No.)
Supported functions
Number of basic input channels
Basic input data size
Number of basic output channels
Basic output data size
Input channel settings address
Input channel settings data size
Output channel settings address
Output channel settings data size
Reserved
Module startup register
Error status
Reserved 12 R None
Access
type
1 R 03
1 R 01 *1
1R None
1 R 01
1 R 08
1 R 02
1 R 00
1 R 00
1 R 20
1 R 08
1 R 00
1 R 00
4R None
1 R 00
1 R 00
Initial
value (h)
CNT16-8(FIT)GY, CNT16-8L(FIT)GY
47
Page 53
5. Using the Memory Address Map
Table 5.8. Module Information Area < 2 / 2 >
Address(h) Area Item Size
Starting address+20 Startup register 1 R 00 Starting address+21 Status 1 R 00 Starting address+22
- Starting address+27
Starting address+28 Startup register 1 R 00 Starting address+29 Status 1 R 00 Starting address+2A
- Starting address+2F
Starting address+30 Startup register 1 R 00 Starting address+31 Status 1 R 00 Starting address+32
- Starting address+37
Starting address+38 Startup register 1 R 00 Starting address+39 Status 1 R 00 Starting address+3A
- Starting address+3F
Starting address+40 Startup register 1 R 00 Starting address+41 Status 1 R 00 Starting address+42
- Starting address+47
Starting address+48 Startup register 1 R 00 Starting address+49 Status 1 R 00 Starting address+4A
- Starting address+4F
Starting address+50 Startup register 1 R 00 Starting address+51 Status 1 R 00 Starting address+52
- Starting address+57
Starting address+58 Startup register 1 R 00 Starting address+59 Status 1 R 00 Starting address+5A
- Starting address+5F
Starting address+60
- Starting address+7F
Channel settings
CH0
Reserved 6 R None
CH1
Reserved 6 R None
CH2
Reserved 6 R None
CH3
Reserved 6 R None
CH4
Reserved 6 R None
CH5
Reserved 6 R None
CH6
Reserved 6 R None
CH7
Reserved 6 R None
Reserved 32 R None
Access
type
Initial
value (h)
When the module is started, the contents of the module information area are stored in the module information area.
Items common to mo d u les
- Module startup register This register stores the module operating status.
00h : No operation
01h : Module startup
- Error status This register stores the error status of the module.
The error status register is reset when the module is restarted.
00h : Normal status
CNT16-8(FIT)GY, CNT16-8L(FIT)GY
48
Page 54
5. Using the Memory Address Map
- Counter resolution This can be used to check the counter resolution for the CNT16-8x(FIT)GY.
- Digital filter setting This can be used to check the digital filter setting.
Channel settings
- Startup register This register displays the count operating status of each channel. 00h : Stopping 01h : Operating
- Status Indicates a carry-up occurred for the count on each channel. The data corresponding to each channel
is set to "01h" when a ca rry -up oc cu rs on a ch an nel . 00h : No carry 01h : Carry Once a carry-up has occurred for a channel, the next carry-up cannot be detected until the sense is
reset for that channel. See “Status reset” in the “ module in formation area” for detai ls of sense reset.
CNT16-8(FIT)GY, CNT16-8L(FIT)GY
49
Page 55
5. Using the Memory Address Map

Basic I/O Data Area

The basic Input data area, which is a 128-byte (80h) area beginning with address 304000h and corresponding to a given Device ID
The starting address can be determined according to the following expression: Starting address = 304000h + 80h x (Device ID)
Table 5.9. Basic Input Data area
Address(h) Area Item Size
Starting address+00 CH0 Counter value 2 R
Starting address+02 CH1 Counter value 2 R
Starting address+04 CH2 Counter value 2 R
Starting address+06 CH3 Counter value 2 R
Starting address+08 CH4 Counter value 2 R
Starting address+0A CH5 Counter value 2 R
Starting address+0C CH6 Counter value 2 R
Starting address+0E CH7 Counter value 2 R
Starting address+10
- Starting address+7F
Reserved 112 R
Digital input value The preset counter value is stored as a little endian value.
Access
type
Table 5.10. Digital Input Values
D7 D6 D5 D4 D3 D2 D1 D0
+00h A7 A6 A5 A4 A3 A2 A1 A0
+01h A15 A14 A13 A12 A11 A10 A9 A8
CNT16-8(FIT)GY, CNT16-8L(FIT)GY
50
Page 56
5. Using the Memory Address Map

Examples

Flowchart The following flowchart illustrates an example where the CNT16-8x(FIT)GY i s installed at device ID: 0.
Start
Open processing
Opened
successfully?
Counter
module type?
Digital filter setting
Counter initialization
Status reset
Preset counter
Set Module Startup
in modul e startu p register
No
Yes
No
Yes
No
Yes
No
Yes
No
Any error in
error status bit?
Get a count value
Get a status
Carry-up?
Status reset
End?
Yes
Closing processing
End
CNT16-8(FIT)GY, CNT16-8L(FIT)GY
51
Page 57
5. Using the Memory Address Map
Sample Program
/*=========================================================================== F&eIT I/F Sample Program
DEVICE ID: 0 Channel: 0ch ========================================================================== */ #include <windows.h> #include <stdio.h> #include <stdlib.h> #include <conio.h> #include "Fit.h"
/* Address(common) */ #define FIT_IO (0x00300000) #define FIT_IO_DEVICE_INFOR (0x0000) #define FIT_IO_DEVICE_CONFIG (0x1000) #define FIT_IO_INPUT (0x4000) #define FIT_IO_OUTPUT (0x5000)
#define FIT_IO_DEVICE_SIZE (0x0080) #define FIT_PRODUCT_CATEGORY (0x00) #define FIT_MODULE_START (0x10)
#define FIT_ERROR_STATUS (0x11) /* Information(Common) */
#define FIT_PRODUCT_DIGITAL (0x01) #define FIT_PRODUCT_ANALOG (0x02) #define FIT_PRODUCT_COUNTER (0x03)
#define FIT_MODULE_START_OFF (0x00) #define FIT_MODULE_START_ON (0x01)
/* Address(CNT) */ #define FIT_CNT_BIT (0x12) #define FIT_CNT_D_FILTER (0x13)
#define FIT_CNT_CH_START (0x00) #define FIT_CNT_CH_ST_RESET (0x01) #define FIT_CNT_CH_INITIAL (0x02) #define FIT_CNT_CH_PRESET (0x03)
/* Sample */ #define FIT_SAMPLE_IP_ADDRESS "172.17.8.151" #define FIT_SAMPLE_PORT (0x5007) #define FIT_SAMPLE_DEVICE_ID (0) #define FIT_SAMPLE_CH (0)
int main(int argc, char* argv[]) { DWORD dwIpAddress; DWORD dwVaBase; DWORD dwVaBase_Data; DWORD dwVaOffset; DWORD dwVaChOffset; DWORD dwVaChOffset_Data; DWORD dwChCarryCnt; WORD hHandle; WORD wStatus; BYTE byCategory;
CNT16-8(FIT)GY, CNT16-8L(FIT)GY
52
Page 58
5. Using the Memory Address Map
BYTE byModuleStart; BYTE byData[0x80]; BYTE byErrorStatus; BYTE byChStatus;
/* Open */ dwIpAddress = FIT_IpChenge((BYTE *)FIT_SAMPLE_IP_ADDRESS); hHandle = FIT_Open((BYTE *)&dwIpAddress, FIT_SAMPLE_PORT, NULL); if (hHandle == 0) { printf("Error! FIT_Open = %04X(H)\n", hHandle); return 1; }
/* Offset Address */ dwVaOffset = FIT_IO_DEVICE_SIZE * FIT_SAMPLE_DEVICE_ID;
/* Read 'Category' */ dwVaBase = FIT_IO + FIT_IO_DEVICE_CONFIG;
wStatus = FIT_Read(hHandle, dwVaBase + dwVaOffset + FIT_PRODUCT_CATEGORY, 0x01, &byCategory);
if (wStatus != 0) { printf("Error! FIT_Read = %04X(H)\n", wStatus); FIT_Close(hHandle); return 1; } if (byCategory != FIT_PRODUCT_COUNTER) { printf("Error! Category = %02X(H)\n", byCategory); FIT_Close(hHandle); return 1; }
/* Digital Filter Set */ byData[0x00] = 0x0D; /* 1.024msec */
/* Write 'Digital Filter Settings' */
wStatus = FIT_Write(hHandle, dwVaBase + dwVaOffset + FIT_CNT_D_FILTER, 0x01, &byData[0]);
if (wStatus != 0) { printf("Error! FIT_Write = %04X(H)\n", wStatus); }
/* Channel Offset */ dwVaChOffset = 0x20 + 0x08 * FIT_SAMPLE_CH;
/* Read 'Channel Configuration' */
wStatus = FIT_Read(hHandle, dwVaBase + dwVaOffset + dwVaChOffset, 0x08, &byData[0]);
if (wStatus != 0) { printf("Error! FIT_Read = %04X(H)\n", wStatus); }
/* Configuration Data Set */ byData[FIT_CNT_CH_START] = 0x00; /* Ch Start */ byData[FIT_CNT_CH_ST_RESET] = 0x01; /* Ch Status Reset */ byData[FIT_CNT_CH_INITIAL] = 0x01; /* Ch Initial */ byData[FIT_CNT_CH_PRESET] = 0x00; /* Ch Preset Value (0)*/ byData[FIT_CNT_CH_PRESET + 1] = 0x00;
/* Write 'Channel Configuration' */
wStatus = FIT_Write(hHandle, dwVaBase + dwVaOffset + dwVaChOffset, 0x08, &byData[0]);
if (wStatus != 0) { printf("Error! FIT_Write = %04X(H)\n", wStatus);
CNT16-8(FIT)GY, CNT16-8L(FIT)GY
53
Page 59
5. Using the Memory Address Map
} /* Write 'Module Start' */
dwVaBase = FIT_IO + FIT_IO_DEVICE_CONFIG; byModuleStart = FIT_MODULE_START_ON;
wStatus = FIT_Write(hHandle, dwVaBase + dwVaOffset + FIT_MODULE_START,
1, &byModuleStart); if (wStatus != 0) { printf("Error! FIT_Write = %04X(H)\n", wStatus); }
/* Read 'Error Status' */ dwVaBase = FIT_IO + FIT_IO_DEVICE_INFOR;
wStatus = FIT_Read(hHandle, dwVaBase + dwVaOffset + FIT_ERROR_STATUS,
1, &byErrorStatus); if (wStatus != 0) { printf("Error! FIT_Read = %04X(H)\n", wStatus); FIT_Close(hHandle); return 1; } if (byErrorStatus != 0x00) { printf("Error! Error Status = %02X(H)\n", byErrorStatus); FIT_Close(hHandle); return 1; }
/* Read 'Counter Data' */ dwVaBase = FIT_IO + FIT_IO_DEVICE_INFOR; dwVaOffset = FIT_IO_DEVICE_SIZE * FIT_SAMPLE_DEVICE_ID; dwVaChOffset = 0x08 * FIT_SAMPLE_CH;
dwVaBase_Data = FIT_IO + FIT_IO_INPUT; dwVaChOffset_Data = 0x02 * FIT_SAMPLE_CH;
dwChCarryCnt = 0; printf("- Hit Any Key:Stop -\n");
while (!kbhit()) { /* Read 'Counter Data' */
if (wStatus != 0) { printf("Error! FIT_Read = %04X(H)\n", wStatus); }
/* Read 'Status Data' (Carry Up)*/ dwVaBase = FIT_IO + FIT_IO_DEVICE_INFOR;
if (wStatus != 0) { printf("Error! FIT_Read = %04X(H)\n", wStatus); }
if( byChStatus == 0x01 ){ /* Write 'Status Reset' (Carry Up Clear)*/ dwChCarryCnt ++; dwVaBase = FIT_IO + FIT_IO_DEVICE_CONFIG;
if (wStatus != 0) { printf("Error! FIT_Write = %04X(H)\n", wStatus); }
wStatus = FIT_Read(hHandle, dwVaBase_Data + dwVaOffset + dwVaChOffset_Data, 2, &byData[0]);
wStatus = FIT_Read(hHandle, dwVaBase + dwVaOffset + dwVaChOffset + FIT_CNT_CH_ST_RESET + 0x20, 1, &byChStatus);
wStatus = FIT_Write(hHandle, dwVaBase + dwVaOffset + dwVaChOffset + FIT_CNT_CH_ST_RESET + 0x20, 1, &byChStatus);
CNT16-8(FIT)GY, CNT16-8L(FIT)GY
54
Page 60
5. Using the Memory Address Map
} printf("Counter CH%d Data:%02X%02X CarryUpCount: %d\r", FIT_SAMPLE_CH, byData[1], byData[0], dwChCarryCnt);
} /* Close */
FIT_Close(hHandle); return 0;
}
CNT16-8(FIT)GY, CNT16-8L(FIT)GY
55
Page 61
5. Using the Memory Address Map
CNT16-8(FIT)GY, CNT16-8L(FIT)GY
56
Page 62

6. System Reference

6. System Reference Block Diagram
Interface Connector IN00 - IN07
Opto-Coupler
&
Transistor
Output
Data Latch
Device ID
Control Circuit
Stack Connector
Figure 6.1. Circuit Block Diagram
CNT16-8(FIT)GY, CNT16-8L(FIT)GY
57
Page 63
6. System Reference

Specifications

CNT16-8(FIT)GY
Table 6.1. Specifications
Item Specification
Counter input section
Channel count 8 (8 points/common) Counting system Up/down counting Max. count FFFFH (binary data) Response frequency 5kHz (Max.)
Input format Opto-isolated input (Compatible with both current sinking output and courrent
Input resistance 3kΩ Input ON /OFF current 3.4 mA(Min.) / 0.16 mA (Max.) External circuit power supply 12 - 24 VDC (±15%)
Digital filter 0.25μsec - 131.072μsec Interrupt The interrupts for all eight channels are combined as a single interrupt output
Common section
Interrupt level Using CPU-SBxx(FIT)GY: IRQ 5, 7, or 9 Internal power consumption 5 VDC(±5%) 150 mA (Max.) *1 Allowable distance of signal extension Physical dimensions (mm) 25.2 (W) x 64.7 (D) x 94.0 (H) (exclusive of protrusions) Weight of the module itself 100g Module connection method Stack connection by the connector that is provided with the side of module Module installation method One-touch connection to 35mm DIN rails
Applicable wire AWG 28 - 16 Applicable plug FRONT-MC 1,5/12-STF-3,81 (made by Phoenix Contact Corp.)
*1 The stack connector accepts currents of up to 3.0A (Max.).
Table 6.2. Installation Environment Requirements
Parameter Requirement description
Operating temperature 0 - 50°C Storage temperature -10 - 60°C Operating humidity 10 - 90%RH (No condensation) Floating dust particles Not to be excessive Corrosive gases None
CAUTION
When connecting the Module to a control le r modu le, the inte rnal po wer con su mpt ion sho uld be
taken into account. If the total current exceeds the capacity of the power supply unit, the integrity of
the operation cannot be guaranteed. For further details, please see the Controller Module manual.
Duty 50% (Max.)
source output)
(4 mA/12 V - 8 mA/24 V per channel)
signal. An interrupt is generated when a count carry-up occurs.
Approx. 50m (depending on wiring environment)
(standard connection mechanism provided in the system)
CNT16-8(FIT)GY, CNT16-8L(FIT)GY
58
Page 64
6. System Reference
CNT16-8L(FIT)GY
Table 6.3. Specifications
Item Specification
Counter input section
Channel count 8 (8 points/common) Counting system Up/down counting Max. count FFFFH (binary data) Response frequency 10kHz (Max.)
Input format Opto-isolated input (Compatible with both current sinking output and courrent
Input resistance 1.2kΩ Input ON /OFF current 3.8 mA(Min.) / 0.16 mA (Max.) External circuit power 5 VDC (±10%)
Digital filter 0.25μsec - 131.072μsec Interrupt The interrupts for all eight channels are combined as a single interrupt output
Common section
Interrupt level Using CPU-SBxx(FIT)GY: IRQ 5, 7, or 9 Internal power consumption 5 VDC(±5%) 150 mA (Max.) *1 Allowable distance of signal extension Physical dimensions (mm) 25.2 (W) x 64.7 (D) x 94.0 (H) (exclusive of protrusions) Weight of the module itself 100g Module connection method Stack connection by the connector that is provided with the side of module Module installation method One-touch connection to 35mm DIN rails
Applicable wire AWG 28 - 16 Applicable plug FRONT-MC 1,5/12-STF-3,81 (made by Phoenix Contact Corp.)
*1 The stack connector accepts currents of up to 3.0A (Max.).
Duty 50% (Max.)
source output)
(4 mA per channel)
signal. An interrupt is generated when a count carry-up occurs.
Approx. 50m (depending on wiring environment)
(standard connection mechanism provided in the system)
Table 6.4. Installation Environment Requirements
Parameter Requirement description
Operating temperature 0 - 50°C Storage temperature -10 - 60°C Operating humidity 10 - 90%RH (No condensation) Floating dust particles Not to be excessive Corrosive gases None
CAUTION
When connecting the Module to a control le r modu le, the inte rnal po wer con su mpt ion sho uld be
taken into account. If the total current exceeds the capacity of the power supply unit, the integrity of the operation cannot be guaranteed. For further details, please see the Controller Module manual.
CNT16-8(FIT)GY, CNT16-8L(FIT)GY
59
Page 65
6. System Reference

Physical Dimensions

(1.2) (1.2)
31.5
14.0
Figure 6.2. Physical Dimensions
0123
4567
6
7
5
040
Device
4
1
ID
3
2
COM 0
NC
0
94
1 2 3
COM 1
NC
4 5 6 7
CNT16-8L
25.23.5 64.7 4
14.0
35.0
45.0
[mm]
CNT16-8(FIT)GY, CNT16-8L(FIT)GY
60
Page 66
CNT16-8(FIT)GY
CNT16-8L(FIT)GY
User’s Manual
CONTEC CO., LTD. August 2008 Edition
3-9-31, Himesato, Nishiyodogawa-ku, Osaka 555-0025, Japan Japanese http://www.contec.co.jp/ English http://www.contec.com/ Chinese http://www.contec.com.cn/
No part of this document may be copied or reproduced in any form by any means without prior written consent of CONTEC CO., LTD. [08222008]
[07262004] Management No. A-40-668 [08222008_rev4] Parts No. LYDQ283
Loading...