Reference Manual
CONTEC Data Collector
for Counter

CONTENTS
Overview ........................................................................ 3

Software ......................................................................... 9
Appendix...................................................................... 18
Customer Support and Inquiry............................ 26

Table of Contents
Overview ............................................................................3
1. Product Overview ...................................................................................................................................................4
1. About Edgecross ..............................................................................................................................................4
2. About “CONTEC Data Collector for Counter" .......................................................................................5
2. Data Collector Specifications .............................................................................................................................6
1. Common Specifications .................................................................................................................................6
2. Device Support Function ...............................................................................................................................6
3. Digital filter coefficient...................................................................................................................................7
4. External Signal Source ....................................................................................................................................7
3. Function ......................................................................................................................................................................8
1. Collection Function .........................................................................................................................................8
2. Read Function ....................................................................................................................................................8
3. Write Function ...................................................................................................................................................8

Software.............................................................................9
1. About Device Driver ........................................................................................................................................... 10
1. Installation for Device Driver .................................................................................................................... 10
2. Installation for Data Collector .................................................................................................................. 10
3. Uninstall ............................................................................................................................................................ 10
2. About Data Collector ......................................................................................................................................... 11
1. Parameter Setting ......................................................................................................................................... 11
2. Error Handling ................................................................................................................................................ 13
3. Details of Error Code [Data Collector] .................................................................................................. 14
4. Details of Error Code [Driver] ................................................................................................................... 15

Appendix ........................................................................ 18
1. Glossary ................................................................................................................................................................... 19
2. Inquiries ................................................................................................................................................................... 23
3. Open Source Software ....................................................................................................................................... 24
1. RapidJSON ....................................................................................................................................................... 24
2. msinttypes ........................................................................................................................................................ 25

Customer Support and Inquiry ..................................... 26
1. Services .................................................................................................................................................................... 27— 2 —Overview

This manual provides the information and specifications of
the product. Make sure you read this before actual use.

— 3 —

— —
Overview

CONTEC Data Collector for Counter Reference Manual

1.Product Overview
1. About EdgecrossEdgecross is a standard open edge computing software platform going beyond the bounds ofcompanies and industries that promote the use of IoT at manufacturing sites. It connects the edge

computing area between FA and IT systems and realizes seamless data coordination, which is
independent from hardware.

Since 2017, which is when “Edgecross Consortium” was establishment, operation monitoring,

preventive maintenance and data analysis software, or supporting industrial computers have beenreleased, and the applications for those have expanded in the field of edge applications. On the other

hand, while data were collected from industrial networks such as OPC UA in the area of FA field, it
was difficult to collect the data from sensors or switch circuits that were incompatible with industrial
networks due to the lack of supporting devices or software.

With the “CONTEC Data Collector” software, you can utilize our extensive measuring controllers

and remote I/O devices on the Edgecross platform, and collect data from sensors or switch circuitsthat are incompatible with industrial networks. This software enhances the application range of the
Edgecross platform, and contributes to the development for various industries as well as the
manufacturing industry.

— 4 —

— —
Overview

CONTEC Data Collector for Counter Reference Manual

2. About “CONTEC Data Collector for Counter"[CONTEC Data Collector for Counter] is software that implements cooperation between the

Edgecross basic software platform and the data of our counter measurement control and remote I/O
devices.

By using this Data Collector, the collection function, read function, and write function can be used
for compatible counter devices.

— 5 —

— —
Overview

CONTEC Data Collector for Counter Reference Manual

2.Data Collector Specifications
1. Common Specifications
Item

Specification

Support Language
Collection Function

EnglishCollection Interval

100 msec to 900 msec
1 sec to 3600 sec

Data TypeUDINT

Read Function

Data TypeUDINT

Write Function

Data TypeUDINT

Support Device

CPS-BXC200+
Support I/O Module

CPS-CNT-3202I

CPSN-MCB271-S1-041,
CPSN-MCB271-1-041+
Support I/O Module

CPSN-CNT-3201I

2. Device Support Function
DeviceCollection Function

Read Function

Write Function

CPS-CNT-3202I

Yes

Yes

Yes

CPSN-CNT-3201I

Yes

Yes

Yes

— 6 —

— —
Overview

CONTEC Data Collector for Counter Reference Manual

3. Digital filter coefficient

The digital filter coefficient that can be set for each device is as follows.
Coefficient

Filter Time0h

0.1 μsec

1h

6.5 μsec

2h25.7 μsec

3h32.1 μsec

4h204.9 μsec5h211.3 μsec6h230.5 μsec7h236.9 μsec

8h819.3 μsec

9h825.7 μsec

Ah844.9 μsec

Bh851.3 μsec

Ch1024.1 μsec

Dh1030.5 μsec

Eh1049.7 μsecFh1056.1 μsec

4. External Signal Source
The external signal sources that can be set for each device is as follows.
DeviceExternal Signal Source

CPS-CNT-3202I

Photocoupler

CPSN-CNT-3201I

Photocoupler

— 7 —

— —
Overview

CONTEC Data Collector for Counter Reference Manual

3.Function

1. Collection Function
Input the count value from the specified channel of the device at the set time interval.
Counter operation mode, Z-phase settings and digital filter can be selected.
Counting will start automatically when collection starts.

2. Read Function
Input the count value from the specified channel of the device at the timing requested by the
Edgecross basic software.

Counter operation mode, Z-phase settings and digital filter can be selected.

3. Write Function
Start or stop counting
Start or stop counting on the specified channel of the device at the timing requested by the
Edgecross Basic Software.
Value

Function

0Count stop

1

Count start*This is the same as the location parameter used in the read function.

Count value preset
Preset the count value to the specified channel of the device at the timing requested by the Edgecrossbasic software.

— 8 —SoftwareThis section provides the information on the device driverand the data collector software.

— 9 —

— —
Software

CONTEC Data Collector for Counter Reference Manual

1.About Device Driver

1. Installation for Device Driver
It is necessary to install device driver for counter devices before using [CONTEC Data Collector for
Counter]. If device driver has been already installed and enabled, please proceed to the next item.

 Download Device Driver
Please download device driver from following URL.

1 Access to https://www.contec.com/download/list/driver-software/apipac/.

Please download [Run-Time Environment (Run-Time only)] of API-CNT(WDM).

2 Expand the downloaded file to a suitable place.

3 For details on how to install device driver, please refer to the reference manual for each device.
2. Installation for Data Collector
1 Expand the downloaded Data Collector package to a suitable place.
2 Execute the following expanded file.
¥Installer¥CNT¥setup.exe

3 Follow the instructions to install.

When the installation is complete, [CONTEC Data Collector] will be added to the start menu
and this Reference Manual will be stored in the folder.

3. Uninstall
Select [CONTEC Data Collector for Counter] from [Programs and Features] in [Control Panel] anduninstall it.

— 10 —

— —Software

CONTEC Data Collector for Counter Reference Manual

2.About Data Collector
The data collector settings are described here.

1. Parameter Setting Communication Parameters
Select and set the device which is to be used with this Data Collector.

Setting Item
Device Name

Description
Select the device you want to use from the list of device names set in the driver.

 Collection Parameters
Set the data collection interval.

— 11 —

— —Software

CONTEC Data Collector for Counter Reference Manual Location Parameters

Set the actual I/O target for the selected device.

Setting Item

Description

I/O Direction

To input the count value and start/stop counting, select [Input / Operation].
To preset the count value, select [Output].
If only one of them can be used depending on the function you are using, the setting
value is fixed.

ChannelSelect the target channel.

Digital Filter

Select the digital filter value by coefficient.

Signal SelectSelect the external signal source. [TTL / Photocoupler / Differential]

Count Phase

Select the number of phases. [1-phase(Mono-phase) / 2-phase / Gate control]

Count Mul

Select the multiplier. [x1(1X) / x2(2X) / x4(4X)]

Count Sync Clear

Select Synchronous clear/Asynchronous clear.
[Asynchronous clear / Synchronous clear]

Count Direction

Select the count direction. [Up count / Down count]

Z ModeSelect the Z-phase mode. [Not Used / Next One Time / Every Time]Z Logic

Select the Z-phase logic. [Positive Logic / Negative Logic]*1 The choices you can make depend on the functions installed in your device— 12 —*1

— —Software

CONTEC Data Collector for Counter Reference Manual

2. Error Handling Supplement on Error CodeIf an error occurs in the device driver, as detailed information,[Driver API name] and [Driver API error] items are displayed, and the API name, error code, and error
code description of the device driver in which the error occurred are displayed.

When you make an inquiry, please provide this information together to make it easier to understandthe details of the phenomenon.

Display contents example

1 Overview

Connection Processing error

2 Event code
2200

3 Detailed information[Process Flow information]
Source function :Data Collection Process Flow type :Data logging flow Data logging/diagnosis
flow No. :1 Process No. :1 Target device setting No. :1[Driver API name]
CntInit()[Driver API error]
10000: The devicename which wasn't registered by a device manager or a setup-tool was
specified

4 CauseAn error occurred in the driver.

— 13 —

— —Software

CONTEC Data Collector for Counter Reference Manual

3. Details of Error Code [Data Collector]
Error code [Hex]1001

Description (Overview / Cause)
Driver initialization error
Read data No. is incorrect.

1002

Collection data No. error
Collection data No. is incorrect.

1003

Read data No. error
Read data No. is incorrect.

1004

Write data No. error
Write data No. is incorrect.

1005

Collection parameter error
Collection parameter is incorrect.

1006

Connection status notification error
Connection status notification failed.

1007

Event notification function registration error
Error occurred in communication driver.

1008

Communication parameter acquisition failure
Failed to get the communication parameter.

1009

Data parameter acquisition failure
Failed to get the data parameter.

1300

Collection processing error
Parameter is incorrect.

1400

Read processing error
Parameter is incorrect.

1500

Write processing error
Parameter is incorrect.

2200

Connection processing error
An error occurred in the driver.

2300

Disconnection processing error
An error occurred in the driver.

2400

Collection processing error
An error occurred in the driver.

2500

Read processing error
An error occurred in the driver.

2600

Write processing error
An error occurred in the driver.

— 14 —

— —Software

CONTEC Data Collector for Counter Reference Manual

4. Details of Error Code [Driver]
Value [Dec]Description0

Normality completion

1

Failed in the acquisition of the resource.
The used Device was not registered in the device manager normally, please makesure about that.

2

Failed in the registration of the interruption routine.
The IRQ duplicates with another device, please make sure about that.

3

Failed in the allocation of the memory.
Please extend the memory.

4

Failed in the access of registry.
Please make sure if the property pages can be set.
When this error occurred, please reinstall the device.

7

Execute the function CntResetDevice to return from the standby mode.

8

Because the ccnt.sys file is not found, it is not possible to initialize it.

9

Because the version information on the ccnt.dll file cannot be retrieved, it is notpossible to initialize it.

10

Because the version information on the ccnt.sys file cannot be retrieved, it is notpossible to initialize it.

11

Because the version information of ccnt.dll is not corresponding to the version
information of ccnt.sys, it is not possible to initialize it.

10000

The device name which wasn't registered by a device manager was specified.
Please make sure about the settings of property pages.

10001

Invalid ID was specified.
Please make sure if the initialization function could complete normally.
And make sure about the scope of variable containing ID.

10002

CNT driver can't be called (Failed in the device I/O control).
Please make sure if the initialization function could complete normally.
And make sure about the scope of variable containing ID.

10003

Failed in the creation of the file (Failed in CreateFile).
Please use the device manager to make sure if the device driver could activate
normally.
When the device driver cannot activate normally, please delete the device andreinstall it.

10004

Failed in the closing of the file (Failed in CloseFile).
It is possible that you have executed the exit processing of the device which
wasn't initialized.
Even if the error is ignored, you needn't to mind it.

10005

Failed in the creation of the thread (Failed in CreateThread).
This error would hardly occur. If this error occurred, please make sure about the
number of threads activated by the application.

10050

The specified device name is not found. Please check spelling.
Please make sure of the device name used in the application and the device nameset in the device manager.

10051

No more device.
Please make sure that the device was registered in the device manager.

10052

Information type is invalid.
Error occurred in the information acquisition functions. Please make sure about
the parameters.
— 15 —

— —Software

CONTEC Data Collector for Counter Reference Manual

Value [Dec]Description

10100

Invalid mode setting.
Please set mode to the defined value.

10101

Invalid data buffer address.
The buffer address is NULL(0). Please make sure of the application's source code.

10200

Window handle is invalid.
Error occurred in the message notice function. It is possible that the window
handle is not valid when the function is executing. adjust the timing for function
calling.

20000

It failed in memory allocation for the object preparation. This error would hardly
occur. If this error occurred, please extend the memory.

20001

This function can't be used by this device.

20002

Cannot use while by another device works.
When the device is accessing in background and a foreground processing is
executed, the error occurs.

20003

Cannot use because another process is using the device.
Please make sure of the restrictions when using multiple processes.
For the USB device, when executing count match function, only one process
could be executed.
When the same device is accessed from the multiple processes, the countmatch function couldn't be used.

20020

The final data packet received from the endpoint have CRC error.

20021

The final data packet received from the endpoint have infract of bit stuff error.

20022

The final data packet received from the endpoint mismatch with the expected
data toggle packet.

20023

The STALL packet id returned from the endpoint.

20024

The device is marked with unresponsive token (IN). Or it cannot support
handshake.

20025

The device is marked with unresponsive token (IN). Or it cannot support
handshake.

20026

Received packet id is invalid or undefined.

20027

The size of the data returned from the endpoint is over the permitted maximum
length of data packet or buffer remain.

20028

The size of the data returned from the endpoint is not up to the expectation.

20029

When doing IN transfer, the specified buffer is too small to store all the data
received from the device.

20030

When doing OUT transfer, the specified buffer cannot store all the datatransferred to the device.

20031

The status of the endpoint is STALL, transfer failed.

20032

The device information is not found.

20033

The access to hardware was refused.

20034

The specified handle is invalid.

20100

Invalid mode setting. The selected mode on the specified device is can't beused. Please refer to the device's manual.

20201

Channel number is out of range.
Please make sure about the channel number.

20202

Number of channels is out of range.
Please make sure about the number of channels.
— 16 —

— —Software

CONTEC Data Collector for Counter Reference Manual

Value [Dec]Description

20203

Counter value is out of range.

20204

Compare register number is out of range.

20300

Timer value is out of range.

20301

The output logic of the control output signal is out of range.

20302

The kind of hardware event is out of range.

20303

The coefficient of one-shot pulse width is out of range.

20304

The input logic of control input signal is out of range.

20305

The output data is out of range.

22000

Access error.

22001

Access right violation.

22002

Area error.

22003

Access size error.

22004

Parameter error.

22005

Length error.

22006

Resource insufficient.

22016

Communication timeout occurred.

22017

Handle error.

22018

Close error.

OthersSpare error code not currently in use.

— 17 —

Appendix

This section describes words and terms used in thismanual, software details, and inquiries.

— 18 —

— —Appendix

CONTEC Data Collector for Counter Reference Manual

1.Glossary A-phase/B-phase/Z-phase
A-phase, B-phase and Z-phase refer respectively to counter board input signals.
A-phase and B-phase are the names of signals counted on the counter board.
The counter board counts these signals in terms of rising and falling, and the mode setting
determines which change in the signal is counted.

Z-phase is the signal that clears the count value to zero.

 Digital Filter
The digital filter is a function that does not count the counter input signal when it changes in a little
time.

It works to prevent the counter from malfunctioning due to noise etc.
For more information about this function, please refer to the manual of your device.

 Mono-phase/2-phase/Gate Control
Mono-phase/2-phase/Gate control indicates the usage of the signals of A-phase and B-phase.
It's necessary to set the software by the usage of the following input signals.

Mono-phase
A-phase is UP pulse, B-phase is DOWN pulse. It's the using mode that the system counts UP andcounts DOWN at the rising edge of the two signals.
During mono-phase input, only 1X is valid.

If UP pulse and DOWN pulse occur at the same time, or if the both pulses change to LOW, it can't be
count normally.

The settings of count direction determine whether A-phase is UP or B-phase is UP.
The figure illustrates the case of DIR=1 (CW direction).

— 19 —

— —Appendix

CONTEC Data Collector for Counter Reference Manual

2-phaseIt's the using mode of two pulses input, A-phase (fast signal) and B-phase (slow signal), which differ
in phase by 90º. During 2-phase input, 1X/2X/4X is valid.

The settings of count direction determine to UP count or DOWN count at the rising edge of A-phase.
The figure illustrates the case of DIR=1 (CW direction).

Gate Control
Mono-phase input with gate control.
Counts with A-phase, B-phase is regarded as gate signal. When B-phase is being LOW, the risingedge of A-phase is not counted.

During mono-phase input with gate control, 1X/2X is valid.

The settings of count direction determine to UP count or DOWN count at the rising edge of A-phase.
The figure illustrates the case of DIR=1 (CW direction).

— 20 —

— —Appendix

CONTEC Data Collector for Counter Reference Manual Multiplier

By setting the count input multiplier to 2X or 4X, more detailed control can be effected.

Mono-phase input
There is only 1X.

2-phase input
The O signal in the following figure are counted.

Mono-phase input with gate control
The O signal in the following figure are counted.

— 21 —

— —Appendix

CONTEC Data Collector for Counter Reference Manual Synchronous Clear/Asynchronous Clear
Synchronous clear/ Asynchronous clear is the usage of Z-phase.
The difference is whether to consider the state of A-phase and B-phase or to perform only bychanging the Z-phase as the timing to clear the counter to zero.
Synchronous clear exists only when the mode is 2-phase.

Asynchronous clear is the clear method when the mode is 2-phase, mono-phase or gate control.

Synchronous clear
Synchronous clear is, which the counter is zero-cleared when A-phase rises with B-phase being LOW
and Z-phase being valid.

When the logic of Z-phase is set to Positive Logic, it is cleared with Z-phase being HIGH. When the
logic of Z-phase is set to Negative Logic, it is cleared with Z-phase being Low.

Asynchronous clear
Asynchronous is, which the counter is zero-cleared when Z-phase becomes valid, irrespective of thestate of A-phase or B-phase.

When the logic of Z-phase is set to Positive Logic, it is cleared at the rising edge of the Z-phase.

When the logic of Z-phase is set to Negative Logic, it is cleared at the falling edge of the Z-phase.

 Preset
The operation of setting an arbitrary value to the counter is called preset or load preset value.

— 22 —

— —Appendix

CONTEC Data Collector for Counter Reference Manual

2.Inquiries

Contact your retailer about the matter which is not described by this reference manual or unusual
operation.

Moreover, because the contents of question are hard to grasp as being oral, please inquire it in Email or Web form. We will contact you back.

When it is thought that operation is unusual, please write down the version of driver, Edgecross basic
software, Data Collector and the hardware environment of PC or other using devices in detail.

Please note that we cannot answer general questions such as how to use the Edgecross basic
software.

Before inquiry
The retailer first checks whether the hardware is not working properly or the software is not working,and responds according to each situation.

If you suspect an abnormal operation, please let us know in detail as much as possible after
confirming the reproduction procedure and the location where the problem occurred.

Inquiry Contact toPlease refer to the contact information and templates for making inquiries on our website.
https://www.contec.com/support/
FAQ library is also available.

— 23 —

— —Appendix

CONTEC Data Collector for Counter Reference Manual

3.Open Source SoftwareThis software consists of multiple software components. Each of them is copyrighted by this company
and/or third parties.

This software contains the following open source software.
Software copyrighted by third parties and distributed as free software
In addition, source codes are not distributed for the software that this company and/or third parties
have copyrights to.

Please refrain from inquiring about the source codes of this open source.

1. RapidJSONThis product uses RapidJSON licensed under the MIT License.
The copyright and permission notices of RapidJSON are described below.
Tencent is pleased to support the open source community by making RapidJSON available.
Copyright (C) 2015 THL A29 Limited, a Tencent company, and Milo Yip. All rights reserved.
If you have downloaded a copy of the RapidJSON binary from Tencent, please note that the
RapidJSON binary is licensed under the MIT License.

If you have downloaded a copy of the RapidJSON source code from Tencent, please note that

RapidJSON source code is licensed under the MIT License, except for the third-party components

listed below which are subject to different license terms.

Your integration of RapidJSON into yourown projects may require compliance with the MIT License, as well as the other licenses applicableto the third-party components included within RapidJSON.

To avoid the problematic JSON license

in your own projects, it's sufficient to exclude the bin/jsonchecker/ directory, as it's the only code
under the JSON license.

A copy of the MIT License is included in this file.
Permission is hereby granted, free of charge, to any person obtaining a copy of this software andassociated documentation files (the "Software"), to deal in the Software without restriction,

including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,

and/or sell copies of the Software, and to permit persons to whom the Software is furnished to doso, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial
portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A— 24 —

— —Appendix

CONTEC Data Collector for Counter Reference Manual

PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR

COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN

AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

2. msinttypes
This product uses msinttypes licensed under the BSD License.
The copyright and permission notices of msinttypes are described below.
The msinttypes r29
Copyright (c) 2006-2013 Alexander Chemeris
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted
provided that the following conditions are met:

* Redistributions of source code must retain the above copyright notice, this list of conditions andthe following disclaimer.

* Redistributions in binary form must reproduce the above copyright notice, this list of conditions
and the following disclaimer in the documentation and/or other materials provided with the
distribution.

* Neither the name of copyright holder nor the names of its contributors may be used to endorse or
promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESSOR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.

IN NO EVENTSHALL THE REGENTS AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,

SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,

PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN

CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANYWAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

— 25 —Customer Support andInquiry

CONTEC provides the following support services for you to
use CONTEC products more efficiently and comfortably.

— 26 —

—

Customer Support and Inquiry—

CONTEC Data Collector for Counter Reference Manual

1.Services

CONTEC offers the useful information including product manuals that can be downloaded throughthe CONTEC website.

Download
https://www.contec.com/download/
You can download updated driver software, firmware, and differential
manuals in several languages. Membership registration (myCONTEC)
is required to use the services.

— 27 —

—

Revision History—

CONTEC Data Collector for Counter Reference Manual

Revision History
MONTH YEAR
January 2021

Summary of Changes
The First Edition— 28 —

CONTEC CO., LTD.

3-9-31, Himesato, Nishiyodogawa-ku, Osaka 555-0025, Japan

https://www.contec.com/
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 Data Collector for Counter Reference Manual

NA07923 (LYZC771)[01152021]

January 2021 Edition