Contec CNT24-4 User Manual

CNT24-4(PCI)
24Bit Up/Down Counter Board for PCI
User’s Guide
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
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)
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
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)
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
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)
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
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)
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
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)
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
Introduction
4
CNT24-4(PCI)
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
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)
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
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)
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
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)
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
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)
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
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)
Loading...
+ 53 hidden pages