Contec CNT24-4 User Manual

Page 1
CNT24-4(PCI)
24Bit Up/Down Counter Board for PCI
User’s Guide
Page 2
Copyright
Copyright 1997 CONTEC Co., LTD. ALL RIGHTS RESERVED No part of this document may be copied or reproduced in any form
CONTEC Co., LTD. makes no commitment to update or keep current the information contained in this document. The information in this document is subject to change without notice.
All relevant issues have been considered in the preparation of this document. Should you notice 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 nor for results obtained by the user as a result of using this product.
Trademarks
MS, Microsoft, MS-DOS and Windows are trademarks of Microsoft Corporation. Other brand and product names are trademarks of their respective holder.
CNT24-4(PCI)
i
Page 3
Product Configuration
- CNT24-4(PCI) Board…1
- CNT24-4(PCI) Setup Disk (3.5inch/1.44MB)…1
- User's Guide (this Booklet)…1
Unpacking:
This card is specially packed in an anti-static bag to prevent damage in shipping.
Check the contents to make sure that you have everything listed above. If you do not have all the items, contact your distributor or CONTEC group office where you purchased.
Note!
Do not remove the board from its protective packaging until the computer case is open and ready for installation. Electrical static can cause damage to electrical components.
ii
CNT24-4(PCI)
Page 4
Table of Contents
Copyright........................................................................... i
Trademarks........................................................................ i
Product Configuration......................................................ii
1. Introduction............................................................. 1
Features.........................................................................1
Limited Three-Year Warranty......................................2
How to Obtain Service..................................................2
Liability .........................................................................2
About the Manual .........................................................3
2. Setup....................................................................... 5
Component Locations....................................................... 5
Setting the Board ID........................................................ 6
Setting procedure..........................................................6
Setting the Interrupt Use................................................ 7
Setting up the Board
(For Use under MS-DOS or Windows 3.1)...................... 8
Procedure.......................................................................8
Checking resources.......................................................8
Obtaining resource information...................................9
Sample programs for MS-DOS.....................................9
Sample's Specification ................................................10
Setting up the Board (for Use under Windows 95)....... 14
Checking the OS version ............................................14
Procedure for use under Windows 95
version 4.00.950 or 4.00.950a.....................................15
Procedure for use under Windows 95
version 4.00.950B........................................................15
Method of installing two or more CNT24-4(PCI)
boards (for use under Windows 95 version 4.00.950
or 4.00.950a)................................................................16
Method of installing two or more CNT24-4(PCI)
boards
(for use under Windows 95 version 4.00.950B) .........18
Checking resources.....................................................19
CNT24-4(PCI)
iii
Page 5
Support software.........................................................20
Setting up the Board (for Use under Windows NT) ..... 21
Procedure.....................................................................21
Checking resources.....................................................22
Support software.........................................................22
3. External Connection ................................................ 23
Connecting the Interface Connector..........................23
Connector........................................................................ 24
Optional Cable DT/B2.................................................26
External Connection ...................................................... 27
Output Circuit and Connecting Example..................29
Connecting Rotary Encoder........................................... 30
Measures Against Voltages............................................ 31
4. I/O Ports and Registers............................................ 33
I/O Port Bit Assignment................................................. 33
Data Setting ................................................................33
Count Value Flow........................................................34
Operation Command...................................................35
Output Command........................................................... 37
Count initial value
(Commands; CH0:00h, CH1:05h, CH2:0Ah, CH3:0Fh)
......................................................................................37
Operation Mode
(Command CH0:01h, CH1:06h, CH2:0Bh, CH3:10h)
......................................................................................37
Counter Operation Mode ............................................... 40
2-phase input...............................................................40
Single-phase input......................................................40
Single-phase input with gate control.........................41
Synchronization clear.................................................42
Asynchronization clear...............................................42
Count input multiplication.........................................43
Z-phase/CLR input
(Command CH0:02h, CH1:07h, CH2:0Ch, CH3:11h)
......................................................................................44
iv
CNT24-4(PCI)
Page 6
Comparison register
(Command CH0:03h, CH1:08h, CH2:0Dh, CH3:12h)
......................................................................................45
Digital filter
(Command CH0:04h, CH1:09h, CH2:0Eh, CH3:13h)
......................................................................................46
Latch Count value (Command 14h)...........................48
Interrupt mask (Command 15h)................................48
Sense Reset (Command 16h)......................................49
Programmable time
(Command timer data:17h, Timer start:18h)............50
Timer interrupt frequency..........................................51
One-shot pulse (Command 19h).................................52
Input Command ............................................................. 53
Read count value
(Command CH0:00h, CH1:05h, CH2:0Ah, CH3:0Fh)
......................................................................................53
Status data
(Command CH0:01h, CH1:06h, CH2:0Bh, CH3:10h)
......................................................................................54
Interrupt mask (Command 15h)................................56
Sense port (Command 16h) ........................................56
Default Setting............................................................57
5. System Reference .................................................... 59
Specifications.................................................................. 59
Block Diagram................................................................ 60
6. Troubleshooting....................................................... 61
QUESTIONS: ................................................................. 61
Is the pilot light on?....................................................61
Did the system boot up?..............................................61
Does your program work?...........................................61
Does the sample program work?................................61
Is the input data accurate? .........................................62
Still have a problem? ..................................................62
7. Index......................................................................65
CNT24-4(PCI)
v
Page 7
List of Figures
Figure 2.1. Component Locations ...............................................5
Figure 2.2. Board ID Settings (SW1) ..........................................6
Figure 2.3. Setting the Interrupt Use ...........................................7
Figure 2.4. Sample Programs on FD............................................ 9
Figure 2.5. CRT Display (CNTPCI01.C)...................................11
Figure 2.6. Flowchart (CNTPCI01.C) .......................................11
Figure 2.7. CRT Display (CNTPCI02.C)...................................12
Figure 2.8. CRT Display (CNTPCI03.C)...................................12
Figure 2.9. Flowcharts (CNTPCI03.C)...................................... 13
Figure 3.1. Connecting the Interface Connector........................23
Figure 3.2. CN1 Connector as Viewed from Back of Computer
................................................................................ 24
Figure 3.3. CN1 Pin Assignments.............................................24
Figure 3.4. CN2 Frontal View...................................................25
Figure 3.5. CN2 Pin Assignments.............................................25
Figure 3.6. Optional Cable DT/B2 ............................................26
Figure 3.7. 37-Pin D-Type Connector Pin Assignments............26
Figure 3.8. Digital Input............................................................ 27
Figure 3.9. Connecting to Open-collector Output Device..........27
Figure 3.10. TTL-Level Input Circuitry...................................... 28
Figure 3.11. Output Circuit and Connecting Example .................29
Figure 3.12. Photocoupler Input..................................................30
Figure 3.13. TTL Input ...............................................................30
Figure 3.14. Samples of Surge Voltage Protection.......................31
Figure 4.1. Output port ..............................................................33
vi
CNT24-4(PCI)
Page 8
Figure 4.2. Input port................................................................ 33
Figure 4.3. Count Value Flow....................................................34
Figure 4.4. Counting Example with 2-phase Input .................... 40
Figure 4.5. Single-phase Counting Example..............................40
Figure 4.6. Example of Single-phase Input with Gate Control... 41
Figure 4.7. Example of Synchronization Clear..........................42
Figure 4.8. Example of Asynchronization Clear ........................42
Figure 4.9. Counting Example for Multiplied Count Inputs.......43
Figure 4.10. Number of Z-phase Inputs Available ZSE=0
(Positive Logic).......................................................44
Figure 4.11. Digital Filter ............................................................47
Figure 5.1. Block Diagram........................................................60
CNT24-4(PCI)
vii
Page 9
List of Tables
Table 2.1. Sample's Specification ...............................................10
Table 4.1. Output Command ...................................................... 35
Table 4.2. Input Command.........................................................36
Table 4.3. Counter Operation Mode ...........................................38
Table 4.4. Switching Counting Direction.................................... 39
Table 4.5. Z-phase Input Mode...................................................44
Table 4.6. Digital Filter Clock Data............................................ 47
Table 4.7. Relationship between programmable timer interrupt
................................................................................ 51
Table 4.8. Relationship Between One-shot Pulse Width Data
and Pulse Width......................................................52
Table 4.9. Default Setting...........................................................57
Table 5.1. Specifications ............................................................59
viii
CNT24-4(PCI)
Page 10
1. Introduction
Thank you for purchasing the CNT24-4(PCI). The CNT24-4(PCI) is the PCI bus compatible. This board is plugged into a PCI bus expansion slot on the motherboard in the personal computer or into a PCI bus unit. You should read this manual carefully to construct your system with the board by creating its application programs and connecting the required external devices to the board.
Features
- One board enables 24 bit up/down counts for four channels.
- Counts two phase signals from devices like a rotary encoder or a linear gauge.
- Photocoupler insulated input or TTL level input for each channel.
- Generates interrupts or outputs signals by matching the count value of each channel with the value set by the user.
- Periodically generates an interrupt using an internal programmable timer.
- Each channel has a general input signal (including photocoupler and TTL input).
Introduction
CNT24-4(PCI)
1
Page 11
Introduction
Limited Three-Year Warranty
CONTEC Interface boards are warranted by CONTEC Co., LTD. to be free from defects in material and workmanship for up to three years from the date of purchase by the original purchaser.
Repair will be free of charge only when this device is returned freight prepaid with a copy of the original 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 boards. 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.
2
* No product will be accepted by 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 such defect or consequences that arise from inexperienced usage, misuse, or malfunction of this device.
CNT24-4(PCI)
Page 12
About the Manual
This manual consists of the following chapters: Chapter 1 Introduction Chapter 2 Setup
This chapter describes the procedures for setting up the CNT24-4(PCI) board and setting its switches.
Chapter 3 Connecting the External Devices
This chapter explains how to connect external devices to the board and gives notes on connecting them.
Chapter 4 I/O Ports and Registers
This chapter provides the assignment and definitions of each I/O port bit used the board.
Chapter 5 Specifications
This chapter summarizes the hardware specifications of the board and provides circuit block diagrams.
Chapter 6 Index
Introduction
CNT24-4(PCI)
3
Page 13
Introduction
4
CNT24-4(PCI)
Page 14
2. Setup
Component Locations
Figure 2.1. shows the names of major parts on the CNT24-4(PCI) board. Note that the switch setting shown below is the factory default.
• Interface connector for TTL level input (CN2)
• Jumper for interrupt signal resource settings
JP1 INT
USE
1 2 3
NOT USE
Setup
CNT24-4(PCI)
• Interface connector for photocoupler resistance input (CN1)
• BOARD ID Setting Switch
Figure 2.1. Component Locations
8
9
7
A
B
6
5
C
4
D
3
E
2
F
1
0
SW1
BOARD ID
JP1
BOARD ID
SW1
CNT24-4(PCI)
5
Page 15
Setup
Setting the Board ID
If you install two or more CNT24-4(PCI) boards on one personal computer, set their respective board IDs to distinguish them. Assign a different value to each of the boards.
The board IDs from 0 to F can be set to identify up to sixteen boards.
If only one board is used, the original factory setting (Board ID = 0) should be used.
Setting procedure
To set the board ID, use the rotary switch on the board. Turn the SW1 knob to set the board ID as shown below.
8
9
7
A
6
B
5
C
4
D
3
E
2
F
1
0
SW1
BOARD ID
( Same for match output :
BOARD ID = 0 )
Figure 2.2. Board ID Settings (SW1)
6
CNT24-4(PCI)
Page 16
Setting the Interrupt Use
If you don't use the Interrupt function, to save the Interrupt resources of PC, you can let recognize to the PC the CNT24-4(PCI) as no-Interrupt function boards.
In case of interrupt use, this board is assigned the interrupt level from PC.
Setup
Setup when interrupt is used
JP1 INT
USE
(Factory setting)
NOT USE
Setup when interrupt is not used
JP1 INT
USE
NOT USE
1 2 31 2 3
Figure 2.3. Setting the Interrupt Use
CNT24-4(PCI)
7
Page 17
Setup
Setting up the Board
(For Use under MS-DOS or Windows 3.1)
The board setup method for the CNT24-4(PCI) is different depending on each OS. Set up the board using the appropriate method depending on the OS used. This section describes the procedure and notes for using the board under MS-DOS or Windows 3.1.
Procedure
(1) Set the board ID. (2) Be sure to check that the personal computer is off, then plug
the board into a PCI bus slot in the personal computer. (3) Turn the personal computer on to start up MS-DOS. (4) Setting up the board is completed when MS-DOS gets and
running. When setting up the board has been completed,
be sure to check the assigned resources.
Checking resources
Before operating the CNT24-4(PCI) board, be sure to check the personal computer resources (I/O addresses and interrupt level) assigned to the board. For PCI compatible (Plug and Play compliant) boards, free resources among the personal computer resources are assigned automatically upon activation of the personal computer. Follow the steps below to check the assigned resources.
(1) Run the resource check program "CNTPCI.EXE" stored in the
DOS directory on the supplied floppy disk (FD). (2) Check the I/O addresses and interrupt level (IRQ) displayed on
the screen. Once the CNT24-4(PCI) has been set up correctly, it can be used
under MS-DOS and Windows 3.1.
8
CNT24-4(PCI)
Page 18
Obtaining resource information
You can get information on the personal computer resources assigned to the CNT24-4(PCI) by accessing the PCI BIOS. For the precise method, refer to the sample program stored in the DOS directory on the supplied FD.
Sample programs for MS-DOS
The sample programs for using the CNT24-4(PCI) under MS-DOS are written in Microsoft C.
Setup
DOS --- Samples --
DOS --- Samples --- 98 or PC ---
(1) CNTPCI.C Resource check program
CNTPCI.EXE
(2) CNTPCI01.C Count value of any Channel
CNTPCI01.EXE
(3) CNTPCI02.C 4 channel count value at the same time
CNTPCI02.EXE
(4) CNTPCI03.C Count value for every time period by timer interrupt
CNTPCI03.EXE
Figure 2.4. Sample Programs on FD
For details on I/O addresses, see Chapter 4 "I/O Ports and Registers."
CNT24-4(PCI)
9
Page 19
Setup
Sample's Specification
Table 2.1. Sample's Specification
Using channel 0ch 0ch - 3ch 0ch - 3ch Operating mode *1 *1 *1 Input Z-phase/clear once in valid in valid Digital filter 6.5µsec 100nsec *2 100nsec *2 Initial count value 0 0 0 Comparison count value 100 (64h) 100 (64h) 100 (64h) One-shot pulse width Timer value --- --- 1 second Using connector CN1 CN1 CN1
*1 Set an operation mode Set an operation mode for input spcification. Operation mode data example 8Ch : Photocoupler insulation, 2-phase input 9Bh : Photocoupler insulation, Single-phase input 8Bh : Photocoupler insulation, Gate control input CCh : TTL level, 2-phase input DBh : TTL level, Single-phase input CBh : TTL level, Gate Control input Other settings (Common) : Asynchronization clear, UP counting direction, Z-phase positive logic, Single input multiplication. The Sample program uses the 8C setting. *2 In the CNTPCI02, CNTPCI03, the digital filter is not set and the default is 100nsec. *3 To Output the signal to an external peripheral, CN1 must be connected.
Item Specification
CNTPCI01.C CNTPCI02.C CNTPCI03.C
104.4msec *3 --- ---
10
Note!
Connect a signal appropriate for the input specification of an external peripheral. To connect a rotary encoder, see Chapter 3. "Connecting Rotary Encoder".
CNT24-4(PCI)
Page 20
Setup
(1) Display count value of any channel (CNTPCI01.C) This program displays the count value of the specified channel.
If the program is executed, the count value of the signal connected to channel 0 is displayed.
The count comparison data is set at 100; matching with the count value outputs the one-shot pulse to an external peripheral.
Pressing the ESC key terminates the program
CHANNEL DATA STATUS
CH0 0 7F
Figure 2.5. CRT Display (CNTPCI01.C)
START
Set I/O address
*********
Set channel
Initial setting
• Set operation mode
• Set Z-phase
• Set digital filter
• Reset sense bit
Set count data
(Lower)
(Middle)
(Upper)
Set count match data
(Lower)
(Middle)
(Upper)
1
1
Set one-shot
pulse width
Latch count value
Read count value
(Lower) (Middle) (Upper)
Calculate count value
Display count value
Figure 2.6. Flowchart (CNTPCI01.C)
CNT24-4(PCI)
11
Page 21
Setup
(2) Display 4 channel count values at the same time
(CNTPCI02.C) This program displays the 4 channel count values at the same time.
When this program is executed, the signal count values (Decimal and HEX) that are connected to channels 0 - 3 and their input status.
Pressing the ESC key terminates the program.
CHANNEL DATA STATUS
CH0 0 7F CH1 0 7F000000 CH2 0 7F000000 CH3 0 7F000000
DATA(HEX)
000000
Figure 2.7. CRT Display (CNTPCI02.C)
(3) Display count value for every time period by timer interrupt
(CNTPCI03.C) This program generates an interrupt every second using the timer
and displays the count value. If this program is executed, the count values (HEX and decimal) of the signal that is connected to channels 0 -3 are displayed. The interrupt level is IRQ5.
Pressing the ESC key terminates the program.
CHANNEL DATA
CH0 0 CH1 0000000 CH2 0000000 CH3 0000000
INTERRUPT COUNT 0TIME
DATA(HEX)
000000
12
Figure 2.8. CRT Display (CNTPCI03.C)
Note!
To terminate the program, press the ESC key. If the program is terminated by another key, the interrupt routine is aborted and the process stops.
CNT24-4(PCI)
Page 22
Setup
START
Set segment
*********
base address
Set address
Initial setting
• Set operation mode
• Set Z-phase
• Reset sense bit
Set count data (Lower) (Middle) (Upper)
Set count data (Lower) (Middle) (Upper)
Interrupt process
Set IRQ5
1
1
Clear mask
Set timer data (Lowest) (Lower) (Upper) (Highest)
Start timer
Check sense port
Latch count value
Read count value
Calculate count value
Display count value
Reset sense bit
N
END
Y
Set IMR
Stop timer
END
IRQ5
Save registar
*********
Input number of timer count ups
Interrupt EQI process
Restore register
IRET
Figure 2.9. Flowcharts (CNTPCI03.C)
CNT24-4(PCI)
13
Page 23
Setup
Setting up the Board
(for Use under Windows 95)
The board setup method for the CNT24-4(PCI) is different depending on each OS. Set up the board using the appropriate method depending on the OS used. This section describes the procedure and notes for using the board under Windows 95.
Before the CNT24-4(PCI) can be used under Windows 95, have the OS recognize the I/O addresses and interrupt level (IRQ) to be used for the CNT24-4(PCI). Assigning the resources such as I/O addresses and IRQ for a piece of hardware in Windows 95 is called "installing the hardware." Use the appropriate procedure to install the CNT24-4(PCI).
Checking the OS version
Note that the procedure for installing the CNT24-4(PCI) is different depending on each version of Windows 95.
Check the version of Windows 95 on your system as follows before installing the CNT24-4(PCI).
14
(1) Open [Control Panel] from [My Computer]. (2) Double-click on the [System] option to open the [System
Properties] property sheet. (3) Check the "System:" number displayed on the [General] page.
System:
Microsoft Windows 95
4.00.950
The version numbers of Windows 95 include 4.00.950, 4.00,950a, and 4.00.950B. The CNT24-4(PCI) setup method is different depending on the version number of Windows 95.
CNT24-4(PCI)
Page 24
Procedure for use under Windows 95 version 4.00.950 or
4.00.950a
(1) Set the board ID. (2) Be sure to check that the personal computer is off, then plug
the board into a PCI bus slot in the personal computer. (3) Turn the personal computer on to start up Windows 95. (4) Windows 95 will come up with the [New Hardware] detection
dialog box. Select [Multimedia Device: Select which driver
you want to install for your new hardware.] and then [Driver
from disk provided by hardware manufacturer]. (5) In the [Install From Disk] dialog box, insert the supplied FD in
a drive, enter the drive name and directory name in the [Copy
Distributed File From] field, then click on [OK]. (6) Follow the instructions on the screen to complete installation
of the CNT24-4(PCI). After finishing installing the board, be
sure to check the assigned resources.
Procedure for use under Windows 95 version 4.00.950B
Setup
(1) Set the board ID. (2) Be sure to check that the personal computer is off, then plug
the board into a PCI bus slot in the personal computer. (3) Turn the personal computer on to start up Windows 95. (4) Windows 95 will come up with the [New Hardware] detection
dialog box. In the [Device Driver Wizard] that appears next,
check that "CONTEC Co., Ltd. - Multimedia Device" has been
listed, then select [Next>]. (5) In the next dialog box, select [Specify Location...].
Insert the supplied FD in a drive, enter the drive name and
directory name (WIN95) in the [Location] field, then click on
[OK]. (6) In the next dialog box, check the "Updated driver found for
this device" message, then select [End]. This completes
installation of the CNT24-4(PCI). After finishing installing
the board, be sure to check the assigned resources.
CNT24-4(PCI)
15
Page 25
Setup
Method of installing two or more CNT24-4(PCI) boards
(for use under Windows 95 version 4.00.950 or
4.00.950a)
Follow the procedure below to install two CNT24-4(PCI) boards for use under Windows 95 version 4.00.950 or 4.00.950a.
(1) Check the board ID of the fi rst CNT24-4(PCI) board, plug it
into a PCI bus slot, then start up Windows 95 to install the first
board correctly. (2) Check that the first CNT24-4(PCI) board has been set up
correctly, as described in "Checking resources." Be sure to
complete installation of the first board before trying to install
the second one. (3) Exit Windows 95 and turn the personal computer off. (4) Check the board ID of the second CNT24-4(PCI) board, then
plug it into a PCI bus slot. To the second board, assign a
board ID different from that assigned to the first board. (5) Turn the personal computer on again to start up Windows 95. (6) Windows 95 will come up with the [New Hardware] detection
dialog box. In [Multimedia Device: Select which driver you
want to install for your new hardware.], select [Select from
List].
16
(7) The [Select Hardware Type] dialog box will then appear.
In [Select Hardware Type to Install], select [Other Devices]. (8) In the [Select Device] dialog box that appears, select
[CONTEC] from [Manufacturers] and select [CONTEC Co.,
Ltd. - CNT24-4(PCI)] from [Models]. (9) The [Change System Settings] dialog box appears. Follow
the messages to restart the computer. (10) When Windows 95 is restarted, installation of the second
CNT24-4(PCI) board is completed. Check the assigned
resources again.
CNT24-4(PCI)
Page 26
Notes!
Setup
For installing the third board and later, follow the same steps as those for installing the second one. Before you can install the third board or later, all of the already installed CNT24-4(PCI) boards must be in the PCI bus slots.
- The second CNT24-4(PCI) board cannot be installed normally
unless the resources (I/O addresses and interrupt level) to be used for the board cannot be allocated. Before trying to install the second board, check free resources on the personal computer.
- The resources used for each CNT24-4(PCI) board do not depend
on the location of the PCI bus slot or the board itself. If you remove two or more CNT24-4(PCI) boards which have already been installed and then re-mount one of them on the computer, therefore, it is unknown which one of the sets of resources previously assigned to the two boards is assigned to the re­mounted board. In this case, check the resource settings again.
CNT24-4(PCI)
17
Page 27
Setup
Method of installing two or more CNT24-4(PCI) boards (for use under Windows 95 version 4.00.950B)
Follow the procedure below to install two CNT24-4(PCI) boards for use under Windows 95 version 4.00.950B.
(1) Check the board ID of the first CNT24-4(PCI) board, plug it
into a PCI bus slot, then start up Windows 95 to install the first
board correctly. (2) Check that the first CNT24-4(PCI) board has been set up
correctly, as described in "Checking resources." Be sure to
complete installation of the first board before trying to install
the second one. (3) Exit Windows 95 and turn the personal computer off. (4) Check the board ID of the second CNT24-4(PCI) board, then
plug it into a PCI bus slot. To the second board, assign a
board ID different from that assigned to the first board. (5) Turn the personal computer on again to start up Windows 95. (6) The OS will then automatically install the second board.
When the installation has been completed, check the assigned
resources again.
18
For installing the third board and later, follow the same steps as those for installing the second one. Before you can install the third board or later, all of the already installed CNT24-4(PCI) boards must be in the PCI bus slots.
CNT24-4(PCI)
Page 28
Notes!
- The second CNT24-4(PCI) board cannot be installed normally
unless the resources (I/O addresses and interrupt level) to be used for the board cannot be allocated. Before trying to install the second board, check free resources on the personal computer.
- The resources used for each CNT24-4(PCI) board do not depend
on the location of the PCI bus slot or the board itself. If you remove two or more CNT24-4(PCI) boards which have already been installed and then re-mount one of them on the computer, therefore, it is unknown which one of the sets of resources previously assigned to the two boards is assigned to the re­mounted board. In this case, check the resource settings again.
Checking resources
Before operating the CNT24-4(PCI) board, be sure to check the PC resources (I/O addresses and interrupt level) assigned to the board. For PCI compatible (Plug and Play compliant) boards, free resources among the PC resources are assigned automatically upon activation of the personal computer. Follow the steps below to check the assigned resources managed by the OS.
(1) Double-click on the [System] option in [Control Panel] to open
the [System Properties] property sheet. Select the [Device
Manager] tab.
Setup
(2) Click on the [Multi function adapter] folder. (3) Click on the [CONTEC Co., Ltd. - CNT24-4(PCI)] folder to
display its properties. (4) Select the [Resources] tab to check the device type, resource
settings, and the conflicting device list. (5) If you want to change a resource setting, uncheck the [Use
automatic settings] option in advance. To change the I/O
address range (Input/Output Range), change the configuration
name in the [Setting based on:] field. Since the interrupt
level (Interrupt Request) cannot be changed, use the assigned
IRQ. Once the CNT24-4(PCI) has been installed correctly, it can be used
under Windows 95.
CNT24-4(PCI)
19
Page 29
Setup
Support software
CONTEC provides the following driver software for Windows 95:
API-CNT(98/PC)W95 Ver. 2.3 or later
These pieces of driver software support up to four CNT24-4(PCI) boards.
Note that, when API-CNT(98/PC)W95 is used, development languages that can be used are only 32-bit versions. Neither driver can be supported by any language dedicated to 16-bit applications.
20
CNT24-4(PCI)
Page 30
Setting up the Board
(for Use under Windows NT)
The board setup method for the CNT24-4(PCI) is different depending on each OS. Set up the board using the appropriate method depending on the OS used. This section describes the procedure and notes for using the board under Windows NT.
Before the CNT24-4(PCI) can be used under Windows NT, have the OS recognize the I/O addresses and interrupt level (IRQ) to be used for the CNT24-4(PCI). Assigning the resources such as I/O addresses and IRQ for a piece of hardware in Windows NT is called "installing the hardware."
Installing the CNT24-4(PCI) board requires separately priced CONTEC driver software "API-CNT(98/PC)NT." Follow the procedure below to install the board.
Procedure
(1) Set the board ID. (2) Be sure to check that the personal computer is off, then plug
the board into a PCI bus slot in the personal computer.
Setup
(3) Turn the personal computer on to start up Windows NT . (4) When Windows NT has been started, run SETUP.EXE for
API-CNT(98/PC)NT. For details on SETUP.EXE, refer to the
API-CNT(98/PC)NT manual. (5) When SETUP.EXE has been terminated, run CONFIG.EXE
for API-CNT(98/PC)NT. For details on CONFIG.EXE, refer
to the API-CNT(98/PC)NT manual. You have now finished installing the CNT24-4(PCI) board. When
setting up the board has been completed, be sure to check the assigned resources.
CNT24-4(PCI)
21
Page 31
Setup
Checking resources
Before operating the CNT24-4(PCI) board, be sure to check the personal computer resources (I/O addresses and interrupt level) assigned to the board. For PCI compatible (Plug and Play compliant) boards, free resources among the personal computer resources are assigned automatically upon activation of the personal computer. Follow the steps below to check the assigned resources managed by the OS.
(1) Open [Windows NT Diagnostic Program] from [Management
(2) Select [Resources] (IRQ/port settings). Check the type and
Once the CNT24-4(PCI) has been installed correctly, it can be used under Windows NT.
Support software
CONTEC provides the following driver software for Windows NT:
Tools].
settings of resources assigned to the API-CNT(98/PC)NT and
the conflicting device list.
22
API-CNT(98/PC)NT Ver. 2.3 or later
This driver software supports up to four CNT24-4(PCI) boards.
CNT24-4(PCI)
Page 32
3. External Connection
Connecting the Interface Connector
To input external pulse signals, use the interface connector on the board. Use CN1 for the photocoupler insulated input. For TTL level input, connect CN2 to an external device by connecting the optional cable to CN2.
Matched pulse output is output from CN1. (Photocoupler insulated open collector output)
External Connection
Note!
Figure 3.1. Connecting the Interface Connector
See Chapter 3 "Option cable DT/B2" for further information.
CNT24-4(PCI)
23
Page 33
External Connection
Connector
Connecting the CNT24-4(PCI) board to external devices is via one 37-pin female D-Type connector (CN1) and one 30-pin male connector (CN2).
37 36
21 20
Figure 3.2. CN1 Connector as Viewed from Back of
Count-equal Plus Output
19 18
17 3
2 1
Computer
Plus Common General-purpose Input OUT Z/CLR
CH3
OUT B/DOWN OUT A/UP Not Connected General-purpose Input OUT Z/CLR
CH2
OUT B/DOWN OUT A/UP Plus Common 2 Not Connected Minus Common CH3 Output CH2 Output CH1 Output CH0 Output Plus Common
• Installed connector 37-pin D-Type connector (female)
• Suitable cable 17JE-23370-02(D8C) (male) (DDK) FDCD-37P (male) (HIROSE) DC-37P-N (male) (Japan Aviation Electronics)
19
37
P3P P3U P3Z P3B P3A N.C. P2U P2Z P2B P2A P2P N.C. OUTN OUT3 OUT2 OUT1 OUT0 OUTP
18
36
17
35
16
34
15
33
14
32
13
31
12
30
11
29
10
28
9
27
8
26
7
25
6
24
5
23
4
22
3
21
2
20
1
N.C.
Not Connected
P1P
Plus Common 1
P1U
General-purpose Input
P1Z
OUT Z/CLR
P1B
OUT B/DOWN
P1A
OUT A/UP
N.C.
Not Connected
P0U
General-purpose Input
P0Z
OUT Z/CLR
P0B
OUT B/DOWN
P0A
OUT A/UP
P0P
Plus Common 0 N.C. N.C. N.C.
Not Connected
N.C. N.C. N.C. N.C.
CH1
CH0
24
Note!
Each channel has an independent Plus Common.
Figure 3.3. CN1 Pin Assignments
CNT24-4(PCI)
Page 34
External Connection
Note!
A15
B15 B14
A13
A14
B13
• Installed connector PS-30PE-D4T1PN1(JAE)
• Suitable cable
PS-30SEN-D4P1-1C(JAE)
(Japan Aviation Electronics)
A3
B3
A2 A1
B1B2
Figure 3.4. CN2 Frontal View
Not Connected General-purpose Input OUT Z/CLR
CH1
OUT B/DOWN OUT A/UP Ground General-purpose Input OUT Z/CLR
CH0
OUT B/DOWN Not Connected General-purpose Input OUT Z/CLR
CH3
OUT B/DOWN OUT A/UP
CH2
+5V
N.C. T1U T1Z T1B T1A GND T0U T0Z T0B N.C. T3U T3Z T3B T2A Vcc
A1 A2 A3 A4 A5 A6 A7 A8 A9 A10 A11 A12 A13 A14 A15
B1 B2 B3 B4 B5 B6 B7 B8 B9 B10 B11 B12 B13 B14 B15
T0A
OUT A/UP
N.C.
Not Connected
GND
Ground
GND
Ground
GND
Ground
GND
Ground
GND
Ground
GND
Ground
GND
Ground
T3A
OUT A/UP
GND
Ground
T2U
General-purpose Input
T2Z
OUT Z/CLR
T2B
OUT B/DOWN
Vcc
+5V
The VCC and GND signals are used for all four channels.
CH0
CH3
CH2
Figure 3.5. CN2 Pin Assignments
CNT24-4(PCI)
25
Page 35
External Connection
Optional Cable DT/B2
Note!
1 2 3
17 18 19
30-pin header connector (Connector to CN2)
37-pin D-Type connector (Connector to external equipment)
Figure 3.6. Optional Cable DT/B2
Not connected OUT A/UP OUT B/DOWN
CH0
OUT Z/CLR General-purpose Input Ground OUT A/UP OUT B/DOWN
CH1
OUT Z/CLR General-purpose Input Not connected Not connected
Ground
GND GND GND GND GND GND GND
GND
N.C.
T0A T0B T0Z
T0U T1A
T1B
T1Z
T1U N.C. N.C.
1
20
2
21
3
22
4
23
5
24
6
25
7
26
8
27
9
28
10
29
11
30
12
31
13
32
14
33
15
34
16
35
17
36
18
37
19
+5V
Vcc
+5V
Vcc N.C. N.C. N.C. N.C. N.C. N.C.
OUT A/UP
T2A
OUT B/DOWN
T2B
OUT Z/CLR
T2Z
General-purpose Input
T2U
Ground
GND
OUT A/UP
T3A
OUT B/DOWN
T3B
OUT Z/CLR
T3Z
General-purpose Input
T3U
Not connected
N.C.
Each channel has an independent Plus Common.
20 21
36 37
Not connected
CH2
CH3
26
Figure 3.7. 37-Pin D-Type Connector Pin Assignments
CNT24-4(PCI)
Page 36
External Connection
You are now ready to connect the I/O cables to the board if you have not already done so. Connecting the CNT24-4(PCI) to external devices is via the 37-pin D-SUB I/O connector on the board. Figure 3.8. shows Digital input circuits. Figure 3.9. shows an example of connecting this board to open-collector output device.
2.2k
Photocoupler
220
BOARD
Digital output
Plus common
+5V
External Connection
Input Terminal
External Signal Output
Figure 3.8. Digital Input
400
R
Plus common +12V
External Signal Output
2.2k
Photocoupler
220
Input Terminal
Figure 3.9. Connecting to Open-collector Output Device
CNT24-4(PCI)
27
Page 37
External Connection
Notes!
- The general input signal uses the same circuit structure. (the photocoupler uses TLP 521.)
- To use external power (other than 5V), insert a current limiting resistor at the R position.
<Calculating R (current limiting resistor)> Assume external power is PV, then
P - 5 P - 5
20
If P=12, use a 350 < R < 470 ohm resistor.
LS244
< Rk <
Vcc
+5V
15
Diode
Diode
BOARD
Input Terminal
GND
Digital output
External Signal Output
28
Figure 3.10. TTL-Level Input Circuitry
Notes!
- The general input signal uses the same circuit structure.
- The cable should be 1.5m or less.
- To prevent malfunction caused by noise, separate the circuit as much as possible from other signal cables and noise sources.
CNT24-4(PCI)
Page 38
External Connection
Output Circuit and Connecting Example
When the count value of each channel and the user set value match, the circuit outputs a matched signal for one shot (1 pulse). The signal output part uses the open collector method by photocoupler insulation. As a result, an external power source is needed to run the board output.
Note!
Vcc
1k
1k
Photocoupler
Photocoupler
18k
Plus common
Load
Output pin
Minus common
Load
External Power Supply DC5V~12V
Figure 3.11. Output Circuit and Connecting Example
The board's output transistor does not have a surge voltage protection circuit. As a result, to run inductive loads (for example, relays and lamps), install surge voltage protection at the loading side. See "Appendix C: Surge Voltage" for further information.
CNT24-4(PCI)
29
Page 39
External Connection
Connecting Rotary Encoder
Note!
Encoder
Shield
Power source
A-phase
B-phase
Z-phase
0V
(Connector pin number) CH0 : 8 CH2 : 27 CH1 : 18 CH3 : 37
CH0 : 9 CH2 : 28
R
CH1 : 14 CH3 : 33 CH0 : 10 CH2 : 29
R
CH1 : 15 CH3 : 34 CH0 : 11 CH2 : 30
R
CH1 : 16 CH3 : 35
A-phase
B-phase
Z-phase
Plus Common
CN1
CNT24-4(PCI)
To use the photocoupler with 12V, 400 resistors are needed at R. For 5V, no resistor is needed.
Figure 3.12. Photocoupler Input
Power source
(Connector pin number) CH0 : 9 CH2 : 28
CN2
Encoder
A-phase
B-phase
Z-phase
0V
CH1 : 14 CH3 : 33
CH0 : 10 CH2 : 29 CH1 : 15 CH3 : 34
CH0 : 11 CH2 : 30 CH1 : 16 CH3 : 35
1-7, 13, 32
A-phase
B-phase
Z-phase
GND
CN2
CNT24-4(PCI)
30
Note!
Shield
Option Cable
Convert the connector to a 37 pin connector using the optional cable. The following shows the pin numbers of the 37 pin connector.
Figure 3.13. TTL Input
CNT24-4(PCI)
Page 40
Measures Against Voltages
When connecting a load which may generate a surge voltage or current, for example an inductive load (relay coil) or incandescent lamp, to one-shot output lines, suitable protection measures are required to prevent damage to the output stage or a malfunction due to noise. Instantaneously interrupting current flowing through a coil including a relay causes the sudden generation of a high­voltage pulse. If its voltage exceeds the withstand voltage of the transistor, the performance of the transistor may be degraded or it may be damaged. To prevent this, be sure to connect a surge absorption element when driving an inductive load including a relay coil. Examples of measures against surge voltages are as shown in the Figure 3.14. below.
External Connection
Note!
Figure 3.14. Samples of Surge Voltage Protection
The protection circuit will not be effective unless it is installed less than 50cm from the load and contact.
CNT24-4(PCI)
31
Page 41
External Connection
32
CNT24-4(PCI)
Page 42
4. I/O Ports and Registers
I/O Port Bit Assignment
This board occupies consecutive I/O addresses for two ports. Each I/O port has a register; the register is assigned by a command. To set the register, execute an OUT command for the port (+0) to be set, and enable the register. Then, execute an OUT command to load data into the register for output, or to read the +1 port for input. That is, for either input or output, first execute an OUT command to enable the register, then output data to the register, or read the register on the +1 port.
To set a register, execute an OUT command every time for the output port (+0).
The following Figure 4.1. and Figure 4.2. show the I/O port bit allocation.
D6 D5 D4 D3 D2 D1 D0
Base Address
D7
+0 +1 +2 +3
Command output (select register)
Setting data output
Not use Not use
I/O Ports and Registers
Figure 4.1. Output port
D6 D5 D4 D3 D2 D1 D0
Base Address
D7
+0 +1 +2 +3
Impossible
Data / status read
Not use Not use
Figure 4.2. Input port
Data Setting
To set 8 bit data, execute an OUT command for the +0 port and output data to the +1 port. To set 24 bit data, execute an OUT command for the 0 port and output data three times to the + port. In this case, the data is set from the lower bite, the middle byte and the upper byte. Data of 24 bits is read from the lower byte, the middle byte and the upper byte.
Similarly, to set 32 bit data, output data four times to the +1 port.
CNT24-4(PCI)
33
Page 43
I/O Ports and Registers
Count Value Flow
Set count initial value
Command CH0 : 00h CH1 : 05h CH2 : 0Ah CH3 : 0Fh
Set comparison register
Command CH0 : 03h CH1 : 08h CH2 : 0Dh CH3 : 12h
24bit up / down counter
24bit comparator
Comparison Register
Latch count value (Command 14h)
Count value coincidence
Figure 4.3. Count Value Flow
Read Regisster
Coincidence signal
Sense port (Command 16h)
Interrupt mask (Command 15h)
Status data
Command CH0 : 01h CH1 : 06h CH2 : 0Bh CH3 : 10h
Output one-shot pulse (Command 19h)
Read Counter value
Command CH0 : 00h CH1 : 05h CH2 : 0Ah CH3 : 0Fh
34
CNT24-4(PCI)
Page 44
I/O Ports and Registers
Operation Command
Table 4.1. Output Command
Command [h] D7 D6 D5 D4 D3 D2 D1 D0 Function (bit)
00 CH0 Count initial value CH0 Count initial value (24) 01 RESET SEL ZSEL UD/AB DIR SEL2 SEL1 SEL0 CH0 Operation mode (8) 02 No used ZE1 ZE0 0 CH0 Z-phase/CLR input (3) 03 CH0 count compare value CH0 Comparison register (24) 04 No used Clock data for digital filter CH0 Digital filter (4) 05 CH1 Count initial value CH1 Count initial value 06 RESET SEL ZSEL UD/AB DIR SEL2 SEL1 SEL0 CH1 Operation mode 07 No used ZE1 ZE0 0 CH1 Z-phase/CLR input 08 CH1 count compare value CH1 Comparison register 09 No used Clock data for digital filter CH1 Digital filter 0A CH2 Count initial value CH2 Count initial value 0B RESET SEL ZSEL UD/AB DIR SEL2 SEL1 SEL0 CH2 Operation mode
0C No used ZE1 ZE0 0 CH2 Z-phase/CLR input 0D CH2 count compare value CH2 Comparison register 0E No used Clock data for digital filter CH2 Digital filter 0F CH3 Count initial value CH3 Count initial value
10 RESET SEL ZSEL UD/AB DIR SEL2 SEL1 SEL0 CH3 Operation mode
11 No used ZE1 ZE0 0 CH3 Z-phase/CLR input
12 CH3 count compare value CH3 Comparison register
13 No used Clock data for digital filter CH3 Digital filter
14 No used CH3 LT CH2 LT CH1 LT CH0 LT Latch count value (4)
15 No used TIME CH3 CH2 CH1 CH0 nterrupt latch (5)
16 No used TIME CH3 CH2 CH1 CH0 Sense set (5)
17 Programmable timer setting data Timer data (32)
18 No used START Timer start (1)
19 One-shot pulse width data One-shot pulse (8)
CNT24-4(PCI)
35
Page 45
I/O Ports and Registers
Table 4.2. Input Command
Command [h] D7 D6 D5 D4 D3 D2 D1 D0 Function (bit)
00 CH0 read count value CH0 Read count value (24) 01 AI Z A B 1 U/D EQ U CH0 Status data (8) 05 CH1 read count value CH1 Read count value (24) 06 AI Z A B 1 U/D EQ U CH1 Status data (8) 0A CH2 read count value CH2 Read count value (24) 0B AI Z A B 1 U/D EQ U CH2 Status data (8) 0F CH3 read count value CH2 Read count value (24) 10 AI Z A B 1 U/D EQ U CH2 Status data (8) 15 0 0 0 TIME CH3 CH2 CH1 CH0 Interrupt mask (5) 16 0 0 0 TIME CH3 CH2 CH1 CH0 Sense port (5)
36
CNT24-4(PCI)
Page 46
I/O Ports and Registers
Output Command
Count initial value (Commands; CH0:00h, CH1:05h, CH2:0Ah, CH3:0Fh)
To set a count initial value, execute an OUT command for the output port (+0) and set output port +1. The count data is 24 bit data. Output the data eight times, eight bits at time. After the last eight bits have been output, all data (24 bits) is loaded as the count initial value.
The following sample program shows how to set the count initial value 100 (64h) in CH0.
OUT Address+0h, 00h (CH0: Select count data) OUT Address+1h, 64h (Lower bits) OUT Address+1h, 00h (Middle bits) OUT Address+1h, 00h (Upper bits)
Operation Mode (Command CH0:01h, CH1:06h, CH2:0Bh, CH3:10h)
D6 D5
D7
01h/06h/0Bh/10h UD/ABSEL SEL2
D4
D3 D2 D1
SEL1
D0 SEL0DIRRESET ZSEL
Execute an OUT command for output port +0, then set an operation mode on output port +1.
RESET Clears the 24 bit up-down counter to "00000h." During RESET=0, counting is disabled.
0 : Clear counter 1 : Count
CNT24-4(PCI)
37
Page 47
I/O Ports and Registers
The counter is zero-cleared when one Z-phase input is enabled; this bit changes to 0 (RESET=0) and one Z-phase input is again enabled.
SEL : Switches the pulse input for the counter.
ZSEL : Selects logic for Z-phase input
UD/AB, SEL2-SEL0 :
Table 4.3. Counter Operation Mode
UD/AB DIR SEL2 SEL1 SEL0 Operation mode
0
0
0
0
0
0
1
0
0
0 : Photocoupler insulation input 1 : TTL level input
0 : Positive logic (HIGH active) 1 : Negative logic (LOW active)
Set the counter operation mode
0
0
0
0
0
1
1
0
See 2-phase input, Asynchronization clear,
Table4.4. Double multiplication mode
1
0
1
1
0
1
0
1
1
1
2-phase input, Synchronization clear,
0
Single multiplication mode 2-phase input, Synchronization clear,
1
Double multiplication mode 2-phase input, Synchronization clear,
0
Quadruple multiplication mode 2-phase input, Asynchronization clear,
0
Single multiplication mode
1
2-phase input, Asynchronization clear,
0
Single multiplication mode Single-phase input, Asynchronization clear,
1
Quadruple multiplication mode Single-phase input with gate control,
1
Asynchronization clear, Double multiplication mode Single-phase input with gate control,
1
Asynchronization clear, Double multiplication mode
38
CNT24-4(PCI)
Page 48
DIR : Switches
The rotary encoder counting direction.
Table 4.4. Switching Counting Direction
I/O Ports and Registers
Note!
DIR
0 DOWN UP 1 UP DOWN
Rotary encoder rotation
Clockwise Counterclockwise
In the default setting, all of channels are set 00h.
CNT24-4(PCI)
39
Page 49
I/O Ports and Registers
Counter Operation Mode
2-phase input
The 2-phase input inputs two different pulses when there is 90 degree difference between the A-phase (forward signal) and the B-phase (following signal).
Inputting a Z-phase pulse clears the counter if there is a Z-phase (base position signal).
A-phase (A-phase/UP)
B-phase (B-phase/DOWN)
Z-phase (Z-phase/CLR)
Counting
Figure 4.4. Counting Example with 2-phase Input
Single-phase input
For a single-phase input, the counter counts up with an UP pulse and counts down with a DOWN pulse. If UP and DOWN pulses occur at the same time or both pulses are LOW, the counter will not count properly.
UP pulse (A-phase/UP)
DOWN pulse (B-phase/DOWN)
Counting
Figure 4.5. Single-phase Counting Example
Note!
This is a counting operation when DIR=1. If DIR=0, the counter counts down with the rising edge of an UP pulse and counts up with the rising edge of a DOWN pulse.
40
0 1 2
5
6
7
8
7
6
CNT24-4(PCI)
Page 50
I/O Ports and Registers
Single-phase input with gate control
Inputting a gate control signal starts/stops the counter and a single­phase pulse. A clear signal clears the counter to zero.
Single pulse (A-phase/UP)
Gate control signal (B-phase/DOWN)
no count
Note!
Couting
7
6 9
8
Figure 4.6. Example of Single-phase Input with Gate
Control
This is a counting operation when DIR=1. If DIR=0 and the gate control signal (B-phase/DOWN) is HIGH, the counter counts down with the rising edge of a single-phase pulse (A-phase/UP). If DIR=0 and the gate control signal is LOW, the counter stops.
CNT24-4(PCI)
41
Page 51
I/O Ports and Registers
Synchronization clear
If DIR=1, ZSEL=1, the B-phase input is LOW and the Z-phase input is HIGH, the counter is cleared with the rising edge of an A-phase input, and the counter starts counting with the rising edge of an A-phase input after the Z-phase input changes to LOW.
A-phase (A-phase/UP)
B-phase (B-phase/DOWN)
Z-phase (Z-phase/CLR)
Counting
2 0 11
Figure 4.7. Example of Synchronization Clear
DIR=0 and a B-phase is LOW, the counter starts counting down with a rising edge of an A-phase input. If ZSEL=0, the Z-phase input is available only when it is LOW.
Asynchronization clear
If DIR=1, ZSEL=1, regardless of the input state of the A-phase and B-phase inputs, the counter is zero-cleared when a Z-phase input changes to HIGH, and regardless of the Z-phase input state, the counter starts counting with the next rising edge of the A-phase input.
A-phase (A-phase/UP)
B-phase (B-phase/DOWN)
Z-phase (Z-phase/CLR)
Counting
Figure 4.8. Example of Asynchronization Clear
2
3
11
0
42
If DIR=0 and the B-phase is LOW, the counter starts counting down with the falling edge of the A-phase input. If ZSEL=0, the Z-phase input is available only when it is LOW.
CNT24-4(PCI)
Page 52
I/O Ports and Registers
Count input multiplication
To set the count input multiplication as double or quadruple, more precise counting is available.
- Double-phase input
- Single-phase input
For single-phase input, only the single multiplication mode is available. (There is no double or quadruple multiplication.)
- Single-phase input with gate control
Figure 4.9. Counting Example for Multiplied Count Inputs
CNT24-4(PCI)
43
Page 53
I/O Ports and Registers
Z-phase/CLR input
(Command CH0:02h, CH1:07h, CH2:0Ch, CH3:11h)
02h/07h/0Ch/11h
D7
D6 D5
D4
D3 D2 D1
D0
ZE0 0ZE1Not used
Output a command to output port +0 and set the number of Z-phase inputs on output port +1.
ZE1, ZE0 : Select Z-phase input mode.
Table 4.5. Z-phase Input Mode
ZE1 ZE0 State
0 1 Disable Z-phase input if there is no Z-phase input.
* 1 0 Only the next Z-phase input is available.
1 1 Every Z-phase input is available.
* mark is the default setting.
- Disabled Z-phase input
- Only next Z-phase input is available
44
- Every Z-phase input is available
Figure 4.10. Number of Z-phase Inputs Available ZSE=0
(Positive Logic)
CNT24-4(PCI)
Page 54
I/O Ports and Registers
Notes!
- The default is "only the next Z-phase input is available." (04h)
- If ZSEL=1 (negative logic), a LOW Z-phase input is available.
- If the Z-phase/CLR input is not used, set ZE1=0 and ZE0=1 (Disable Z-phase input).
- If "only the next Z-phase input is available" is set and the counter is zero-cleared with the Z-phase input, and if the counter is cleared with RESET=0, "only the next Z-phase input is available" will be set with the RESET=0.
Comparison register
(Command CH0:03h, CH1:08h, CH2:0Dh, CH3:12h)
The counter value of the corresponding channel and the data in the comparison register are compared. If they match, the status bit "EQ" is set to 0. (As long as they match, the bit remains 0.) This register is cleared when the bus is reset.
Output the command on the output port +0 and set the comparison data on the output port +1. The comparison data is 24 bit data. Output the data three times, eight bits at a time, from the lower bits, the middle bits and the upper bits.
The following sample program shows how to set the counting comparison value 1000 (3E8h) to CH1.
OUT Address+0h, 03h (CH1 : Select comparison register) OUT Address+1h, E8h (Lower bits) OUT Address+1h, 03h (Middle bits) OUT Address+1h, 00h (Upper bits)
In addition, a particular setting can output a one-shot pulse. (For more details, see "One-shot Pulse" description.)
CNT24-4(PCI)
45
Page 55
I/O Ports and Registers
D
4
D
0
Digital filter
(Command CH0:04h, CH1:09h, CH2:0Eh, CH3:13h)
Note!
04h/09h/0Eh/13h
D7
D6 D5
D3 D2 D1
Digital filter clock dataNot used
The digital filter filters noise on the counter pulse input (A, B or Z­phase signals ). The digital filter clock data determines the sampling clock frequency of the filter. The filter samples with the sampling clock; if it detects HIGH (or LOW) signals for four consecutive clocks, it outputs a HIGH (or LOW) signal and sends the signal to the counter circuit.
Output a command to output port +0 and set the sampling frequency on the output port +1. The range is 100nsec -1056.1 usec.
Since external input signals (except the general input signal) are read into the internal counter through the digital filter, these signals are read after a four clock delay of the sampling frequency. With the default setting, external input signal is read with 400nsec delay.
46
CNT24-4(PCI)
Page 56
I/O Ports and Registers
External input signal
External input signal
PC input signal
Digital Filter
4 clock of the sampling frequency
in valid
valid
PC input signal
Figure 4.11. Digital Filter
Table 4.6. Digital Filter Clock Data
D3 D2 D1 D0 Clock frequency Input frequency numbers
0 0 0 0 0 0 0 1 6.5µsec 15 0 0 1 0 0 0 1 1 32.1µsec 3 0 1 0 0 0 1 0 1 211.3µsec 470Hz 0 1 1 0 0 1 1 1 236.9µsec 420 1 0 0 0 1 0 0 1 825.7µsec 121 1 0 1 0 1 0 1 1 851.3µsec 117 1 1 0 0 1 1 0 1 1030.5µsec 96 1 1 1 0 1 1 1 1 1056.1µsec 94
* The accuracy is 0.01% of the setting frequency.
0.1µsec
25.7µsec
204.9µsec
230.5µsec
819.3µsec
844.9µsec
1024.1µsec
1049.7µsec
about under 1MHz
3.5
480Hz
430
122
118
97
95
Notes!
- The default is 100nsec setting.
- Some noise causes more than a four clock delay of the set frequency.
- If the level changes faster than the sampling clock frequency that has been set, the level change is invalid and there is no count. Latch count.
CNT24-4(PCI)
47
Page 57
I/O Ports and Registers
Latch Count value (Command 14h)
D4
D3 D2 D1
CH3 LTNot used CH2 LTCH1 LT CH0 LT
14h
D7
D6 D5
The counter value of the corresponding channel is latched in the read-out register.
Output 14h to the output port +0 and set the data latch on output port +1. Data is latched by setting an appropriate bit to "1." By setting all bits, all channels can be latched at the same time.
Note!
The default is not latched (00h).
Interrupt mask (Command 15h)
D6 D5
D7
15h TIMENot used CH2
Output 15h to output port +0 and set the mask on output port +1. By setting an appropriate bit to "1," the interrupt is disabled.
TIME : Setting this bit to "1" disables the interrupt that
CH3-CH0 : These bits correspond to the channels. Setting these
D4
D3 D2 D1
signals that the programmable timer has elapsed for the predetermined time. Setting this bit to "0", enables the interrupt.
bit to "1," enables the interrupt that notifies the count match. Setting these bits "0," enables the interrupt.
CH1
D0
D0 CH0CH3
48
Notes!
- In the default setting, all of the four channels and the timer are disabled (1Fh).
- However, to mask a channel or the timer will not effect the function of setting/resetting the related status.
CNT24-4(PCI)
Page 58
Sense Reset (Command 16h)
I/O Ports and Registers
D6 D5
D7
Not used
16h TIME
D4
D3 D2 D1
CH2
CH3
CH1
D0
CH0
When the counts of the channels match or the timer count is up, the corresponding bit changes "1" If this bit is "1", the interrupt does not occur with the next count match or the timer count is up. Outputting 16h to output port +0 and outputting "1" to the corresponding bit of output port +1 clear the sense bit. The next interrupt signal can be generated.
TIME : Resets the sense bit when the progr ammable timer
count is up.
CH3-CH0 : Resets the sense bit for count match of the channels.
CNT24-4(PCI)
49
Page 59
I/O Ports and Registers
Programmable time
(Command timer data:17h, Timer start:18h)
D7
17h
D6 D5
D4
Programable timer data
D3 D2 D1
D0
18h
D7
D6 D5
D4
D3 D2 D1
Not used START
D0
The programmable timer generates an interrupt with a frequency that has been set in the 32 bit data. To generate an interrupt by the timer, set the 32 bit data, then set the START bit to "1".
To set the programmable timer, output 17h to output port +0 and set the timer data on output port +1. Since the timer data is 32 bit data, output the data four times, eight bits at a time, from the lower bits to the upper bits. The range is 1msec - 200sec.
To start the timer, output the timer start command (18h) and set the corresponding bit on output port +1. Setting the bit to "0" stops the timer.
Table 4.8. shows the relationship between the programmable timer data and the timer interrupt frequency.
Example : The following program sample show how to set the programmable timer to 1 second.
OUT Address+0h, 17h (Select timer setting) OUT Address+1h, FFh (Lowest bits) OUT Address+1h, 2Ch (Lower bits) OUT Address+1h, 31h (Upper bits) OUT Address+1h, 01h (Highest bits) OUT Address+0h, 18h (Select timer start) OUT Address+1h, 1h (Timer start)
50
Note!
In the default setting, the timer is disabled.
CNT24-4(PCI)
Page 60
Timer interrupt frequency
The timer interrupt frequency is obtained from following equation :
I/O Ports and Registers
( Timer Data x 50 + 50) x 10 = Timer interrupt frequency (msec)
32 bits (converted to decimal)
-6
Table 4.7. Relationship between programmable timer
interrupt
Programmable timer data (Hex) Timer interrupt
High byte Low byte frequency
0 0 0 0 4 E 1 F 1msec 0 0 0 3 0 D 3 F 10msec 0 0 1 E 8 4 7 F 100msec 0 1 3 1 2 C F F 1sec 0 2 6 2 5 9 F F 2sec 0 3 9 3 8 6 F F 3sec 0 4 C 4 B 3 F F 4sec 0 5 F 5 E 0 F F 5sec 0 7 2 7 0 D F F 6sec 0 8 5 8 3 A F F 7sec 0 9 8 9 6 7 F F 8sec 0 A B A 9 4 F F 9sec 0 B E B C 1 F F 10sec 1 1 E 1 A 2 F F 15sec 1 7 D 7 8 3 F F 20sec 2 3 C 3 4 5 F F 30sec 2 F A F 0 7 F F 40sec 3 B 9 A C 9 F F 50sec 7 7 3 5 9 3 F F 100sec B 2 D 0 5 D F F 150sec E E 6 B 2 7 F F 200sec
* The accuracy is 0.01% of the setting frequency.
CNT24-4(PCI)
51
Page 61
I/O Ports and Registers
One-shot pulse (Command 19h)
D6 D5
D7
19h One-shot pulse width data
D4
D3 D2 D1
D0
When the counter values on the channels and the value in the comparison register match, a one-shot pulse is output to each channel. The pulse width is common to all channels and determined by the data that is set. The range is 0msec -
104.45msec.
To set the pulse width, output the command (19h) to output port +0 and set the pulse width on output port +1. The one-shot width is obtained from the following equation:
Pulse width data x 409.6 = Pulse width (used)
8 bits (converted to decimal)
Table 4.8. Relationship Between One-shot Pulse Width
Data and Pulse Width
One-shot pulse width data
D7 D0 [h] Pulse width
0 0 0 0 0 0 0 0 00h 0 0 0 0 0 0 0 0 1 01h 0 0 0 0 0 0 1 0 02h About 819.2µsec 0 0 0 0 0 0 1 1 03h About 1.23msec 0 0 0 0 1 1 0 0 0Ch About 4.92msec 0 0 0 1 1 0 0 1 19h About 10.24msec 0 0 1 1 0 0 0 1 31h About 20.07msec 0 1 0 0 1 0 0 1 49h About 29.9msec 0 1 1 0 0 0 1 0 62h About 40.14msec 0 1 1 1 1 0 1 0 7Ah About 49.97msec 1 0 0 1 0 0 1 1 93h About 60.2msec 1 0 1 0 1 0 1 1 ABh About 70.04msec 1 1 0 0 0 1 0 0 C4h About 80.28msec 1 1 0 1 1 1 0 0 DCh About 90.11msec 1 1 1 1 0 1 0 1 F5h About 100.35msec 1 1 1 1 1 1 1 1 FFh About 104.45msec
About 409.6µsec
52
Notes!
- The default is "Pulse width = 0 (00h)" (not output).
- The pulse width may fluctuate depending on the connection load specification.
CNT24-4(PCI)
Page 62
Input Command
Read count value
(Command CH0:00h, CH1:05h, CH2:0Ah, CH3:0Fh)
By reading the read-out register of the corresponding channel the count can be read.
To read the count, output the command to output port +0 and read input port +1 three times (lower, middle, and upper bits).
The default of the read-out register is not determined. The following sample program shows how to read the CH2 counter
value :
OUT Address+0, 0Ah (Select CH2 count data) IN Address+1, (Lower bits) IN Address+1, (Middle bits) IN Address+1, (Upper bits)
Note!
First set the CH2 data latch to "1."
I/O Ports and Registers
CNT24-4(PCI)
53
Page 63
I/O Ports and Registers
Status data (Command CH0:01h, CH1:06h, CH2:0Bh, CH3:10h)
D6 D5
01h/06h/0Bh/10h AI Z A B
D7
D4
D3 D2 D1
U/D EQ
1
D0
U
To monitor signal input, counting direction, count match and invalid input, output a command to output port +0 and read input port +1.
AI : This bit changes to "1" (pulse invalid input) if A-phase and
B-phase change at the same time for 2-phase input or if the UP pulse and DOWN pulse change at the same time.
1 : Invalid input 0 : No invalid input
Z : This bit shows the Z-phase input status
<Positive logic> 1 : Z-phase input status "1" 0 : Z-phase input status "0" <Negative logic> 1 : Z-phase input status "0" 0 : Z-phase input status "1"
A : This bit shows the A-phase input status
1 : A-phase input status "1" 0 : A-phase input status "0"
B : This bit shows the B-phase input status
1 : B-phase input status "1" 0 : B-phase input status "0"
54
U/D : Counting direction status
This status bit shows the counting direction of the current.
0 : Counting up 1 : Counting down
EQ : Detected match
0 : Counter value and register value matched. 1 : Counter value and register value did not match.
CNT24-4(PCI)
Page 64
Notes!
I/O Ports and Registers
U : Shows the general input status
1 : General input status "1" 0 : General input status "0"
- The default changes depending on the external connection status.
- Since the status data of A-phase, B-phase and Z-phase is the data after the filtering process, it has a 4 clock delay in the frequency that has been set.
- Z-phase logic is set by the ZSEL of the operation mode setting.
CNT24-4(PCI)
55
Page 65
I/O Ports and Registers
Interrupt mask (Command 15h)
D6 D5
D7
15h TIMENot used CH2
This shows the interrupt mask register status. TIME and CH3 - CH0 monitor the current interrupt mask status that
has been output to the interrupt mask set port. TIME corresponds to the programmable timer and CH3-CH0 corresponds to each channel. If these bits are "1," the interrupt is masked and an interrupt signal is not output.
To monitor the mask status, output 15h to the output port +0 and read the input port +1.
0 : Masked 1 : Not masked
Note!
The default is 1Fh.
Sense port (Command 16h)
D6 D5
D7
16h TIMENot used CH2
This shows the channel count match and count-up. To monitor the sense port, output 16h to output port +0 and read input port +1.
TIME : This bit is set to "1" when the time set in the
program mable timer has elapsed.
CH3-CH0 : For any channel between CH3-CH0, when a value
in the up/down counter and the comparison register matches, the bit for the channel is set to "1." The interrupt channel is determined by executing counting on multiple channels and generating an interrupt on the "matched" signal. 0 : Count did not match - Timer continues counting 1 : Count matches - Timer stops counting
Notes!
- The default is 00h.
- If an interrupt is e nabled and generated and the TIME bit or one of the CH3 to CH0 bits changes to "1" reset the corresponding sense bit to enable the next interrupt. For details on sense bit resetting, see "Sense Bit Reset" of the output port.
D4
D4
D3 D2 D1
CH1
D3 D2 D1
CH1
D0 CH0CH3
D0
CH0CH3
56
CNT24-4(PCI)
Page 66
I/O Ports and Registers
Default Setting
The power on or a reset signal will reset this board to the default settings.
Table 4.9. Default Setting
Item Default setting Operation mode 00h Z-phase/CLR input 04h Comparison register 0 Read register unfixed 24-bit up/down counter 000000h Digital filter 00h (0.1µsec) Status data 7Bh (not connected for external) Latch count value 00h Interrupt mask 1Fh (all disable) Sense port 00h Timer data 00000000h Timer start 00h (stop timer) One-shot pulse 00h (not output)
CNT24-4(PCI)
57
Page 67
I/O Ports and Registers
58
CNT24-4(PCI)
Page 68
5. System Reference
Specifications
Table 5.1. Specifications
Item Specification Number of Channels 4Channels Count Format Up/Down binary count Max. Count Value FFFFFFh Input Format Opto-isolated or TTL-level Input Signal OUT A (Up) 1 per channel
Internal Resistance Photo. : 220
Maximum Input Photo. : 500KHz (Duty : 50%) Frequency TTL. : 1MHz (Duty : 50%)
Counter InputCount-equal OutputGeneral
Interrupt Interrupt signal is generated when timer is up or
Interrupt Level IRQ 3 - 7, 9 - 12, 14, 15 External Power 5 - 12VDC 10%, 400mA (Min. ) Photocoupler Input 15 - 25mA Current Digital Filter 100nsec - 1056.1µsec
Timer 1msec - 200sec Number of Channels 4 Output Format Photo-coupler open-collector output Output Voltage Max. 35VDC, 50mA (per channel) Output Signal Width 0 - 104.45msec (all channels) External Power 5 - 12VDC I/O Address 8 bits x 4 ports Dimensions 179.0 x 107.0 x 18.5 mm Power Consumption 5VDC, 400mA (Max.) Operation Temperature 0 - 50°C Relative Humidity 20 - 90%
System Reference
OUT B (Down) 1 per channel OUT Z (CLR) 1 per channel Digital Input 1 per channel
TTL. : 1 LEVEL
the comparison value and the counter value of the corresponding channel watch
(each channel can be set independently)
CNT24-4(PCI)
59
Page 69
System Reference
Block Diagram
The following is a block diagram of the CNT24-4(PCI) interface board.
PCI Bus
System clock 20MHz
Sampling clock 16-bit counter for digital filter
24-bit read register
24-bit counter
Selector
PCI Bus Interface
24-bit comparator
24-bit compare register
One-shot pulse output
Digital filter
CNT24-4(PCI)
Photocoupler resistance input (4channels)
TTL level input
Buffer
(4 channels)
One-shot pulse output (4 channels) (photocoupler open collector output)
60
Figure 5.1. Block Diagram
CNT24-4(PCI)
Page 70
6. Troubleshooting
If you are having trouble with your board or program, answer the following questions to see if you can find the problem.
QUESTIONS:
STEPS TO TAKE
Is the pilot light on?
The system must be turned on and the power supply must be working. Check the main power switch and the power supply.
Did the system boot up?
If the board has been installed and the system did not boot, check the following:
- Make sure the board has been inserted firmly. Pull it out and try to reboot. If your system reboots, then re-insert the board and try to boot again.
- Check that cables attached to your other boards fit tightly.
Troubleshooting
Does your program work?
If the system booted and your program does not work, check the following:
- Rotary switches have been set correctly for the desired base address.
- Selected base address doesn't conflict with another peripheral device or card installed in the computer.
- Selected interrupt levels don't conflict with interrupts required by other devices or cards.
- Try one of the sample programs provided on the disk and see if it works.
Does the sample program work?
Check the following:
- Signals are connected to the correct pins.
CNT24-4(PCI)
61
Page 71
Troubleshooting
- Pin connections on the I/O cables are secure.
- Signals are present at the external connectors.
- Try using the CNT24-4(PCI) board with other non-essential boards removed. Remove other boards one by one, checking the CNT24-4(PCI) for successful operation after each board is removed.
Is the input data accurate?
If you believe something is wrong with either the input data or the output data, check the following:
- Environmental noise. Move the equipment and cables away from sources of electrical noise. Try an isolated power source.
- Dirty connector edge. Clean the edge.
- External connectors fit tightly. Separate and reattach external cables.
Still have a problem?
Contact CONTEC group office where you purchased as shown in the last page of this manual.
Note!
Before you call, make a list of the following information. Our technical representatives will need the following information to help you.
62
1. Your name, company, and phone number.
2. The brand and type of computer you are using (e.g. IBM-AT,
Compaq 386).
CNT24-4(PCI)
Page 72
Troubleshooting
3. DOS Version.
4. Name of the CONTEC board that you are using.
5. Names of other boards in the computer.
6. I/O addresses for the CONTEC board and all other boards.
7. Interrupt levels for the CONTEC board and all other boards.
8. DMA channels for the CONTEC board and all other boards
(if applicable).
9. The programming language that you are using (and the version
number).
CNT24-4(PCI)
63
Page 73
Troubleshooting
10. Different I/O addresses you have tried.
11. Are you using your own program or a CONTEC sample
12. List AUTOEXEC.BAT.
13. List CONFIG.SYS.
program.
64
CNT24-4(PCI)
Page 74
7. Index
Index
B
Block Diagram, 60 Board ID, 6, 15, 16, 18
C
Component Locations, 5
D
DT/B2, 23, 26
F
Features, 1
I
I/O Port Assignment, 33 I/O Ports, 33 Interface Connector, 23 Introduction, 1
R
Registers, 33
S
Setup, 5 Specification, 59 Support software, 20, 22 System Reference, 59
T
Trouble shooting, 61
W
Warranty, 2 Windows 3.1, 8 Windows 95, 14 Windows NT, 21
M
MS-DOS, 8
O
Obtain Service, 2
CNT24-4(PCI)
65
Page 75
A-41-781
000707 [971007]
LZC6961
Page 76
CONTEC Group
JAPAN : Headquarters
CONTEC CO., LTD. 3-9-31, Himesato, Nishiyodogawa-ku, Osaka 555-0025, Japan Tel : +81 (6) 6477-5219 Fax : +81 (6) 6477-1692 E-mail : intsales@osaka.contec.co.jp
U.S.A. : CONTEC MICROELECTRONICS U.S.A. INC.
2161 O’ Toole Ave. Suite I, San Jose, CA95131, U.S.A. Tel : +1 (408) 954-7700 Fax : +1 (408) 954-7710 E-mail : tech_support@contecusa.com
EUROPE : CONTEC MICROELECTRONICS EUROPE B.V.
Binnenweg 4, 2132 CT, Hoofddorp, The Netherlands Tel : +31 (23) 567-3030 Fax : +31 (23) 567-3035 E-mail : tech_support@conteceu.nl
KOREA : HYOJIN CONTEC CO., LTD.
KI-IM Bldg.#399, Shindolim-Dong, Kuro-ku, Seoul 152-070,Korea Tel : +82 (2) 2636-4277 Fax : +82 (2) 2636-4279 E-mail : product@conteck.com
CHINA : INTERNATIONAL CONTEC TECHNOLOGY CO., LTD.
B-809, Hua Tong Building, No. B19, Che Gong Zhuang West Road, Hai Dian District, Beijing 100044, China Tel : +86(10)8801-8228 Fax : +86 (10)8801-8209 E-mail : ict@ict.com.cn
SHANGHAI CONTEC MICROELECTRONICS CORPORATION. No. 481, Gui Ping Road, Cao He Jing,Hi-Tech Park, Shanghai 200233, China Tel : +86 (21) 6485-1907 Fax : +86 (21) 6485-0330 E-mail : contec@contec.com.cn
SHENYANG CONTEC MICROELECTRONICS CO., LTD. No. 169, Qingnian Street, Shenhe District, Shenyang 110015, China Tel : +86 (24) 2392-9771 Fax : +86 (24) 2392-9773
TAIWAN : MACROMATE CORP.
8F, Universal Center, No.179,Sec.1, Ta-Tung Road, Hsi-Chih, Taipei Hsien, Taiwan R.O.C. Tel : +886 (2) 2647-9353 Fax : +886 (2) 2647-9373 E-mail : intl@macromate.com.tw
A-46-368 Ver. 2003. 07. 28
Loading...