Advantech PCM-3780 User Manual

PCM-3780
2-ch Counter/Timer with 24-ch TTL DIO Module
User Manual
Copyright
The documentation and the software included with this product are copy­righted 2006 by Advantech Co., Ltd. All rights are reserved. Advantech Co., Ltd. reserves the right to make improvements in the products described in this manual at any time without notice. No part of this man­ual may be reproduced, copied, translated or transmitted in any form or by any means without the prior written permission of Advantech Co., Ltd. Information provided in this manual is intended to be accurate and reli­able. However, Advantech Co., Ltd. assumes no responsibility for its use, nor for any infringements of the rights of third parties, which may result from its use.
Acknowledgements
Windows is a trademark of Microsoft Corporation
Inprise Delphi is a registered trademark of Inprise Corporation
All other product names or trademarks are properties of their respective owners.
Part No. 2003M37800 Edition 1.1
Printed in Taiwan October 2006
PCM-3780 User Manual ii
Two Years Product Warranty
Advantech warrants to you, the original purchaser, that each of its prod­ucts will be free from defects in materials and workmanship for two years from the date of purchase.
This warranty does not apply to any products which have been repaired or altered by persons other than repair personnel authorized by Advantech, or which have been subject to misuse, abuse, accident or improper instal­lation. Advantech assumes no liability under the terms of this warranty as a consequence of such events.
Because of Advantech.s high quality-control standards and rigorous test­ing, most of our customers never need to use our repair service. If an Advantech product is defective, it will be repaired or replaced at no charge during the warranty period. For out-of-warranty repairs, you will be billed according to the cost of replacement materials, service time and freight. Please consult your dealer for more details.
If you think you have a defective product, follow these steps:
1. Collect all the information about the problem encountered. (For exam­ple, CPU speed, Advantech products used, other hardware and software used, etc.) Note anything abnormal and list any onscreen messages you get when the problem occurs.
2. Call your dealer and describe the problem. Please have your manual, product, and any helpful information readily available.
3. If your product is diagnosed as defective, obtain an RMA (return mer­chandize authorization) number from your dealer. This allows us to pro­cess your return more quickly.
4. Carefully pack the defective product, a fully completed Repair and Replacement Order Card and a photocopy proof of purchase date (such as your sales receipt) in a shippable container. A product returned without proof of the purchase date is not eligible for warranty service.
5. Write the RMA number visibly on the outside of the package and ship it prepaid to your dealer.
iii
CE Notification
The PCM-3780, developed by Advantech Co., Ltd., has passed the CE test for environmental specifications when shielded cables are used for external wiring. We recommend the use of shielded cables. This kind of cable is available from Advantech. Please contact your local supplier for ordering information.
FCC Class A
This equipment has been tested and found to comply with the limits for a Class A digital device, pursuant to Part 15 of the FCC Rules. These limits are designed to provide reasonable protection against harmful interfer­rence when the equipment is operated in a commercial environment. This equipment generates, uses and can radiate radio frequency energy and, if not installed and used in accordance with the instruction manual, may cause harmful interference to radio communications. Operation of this equipment in a residential area is likely to cause harmful interference in which case the user will be required to correct the interference at his own expense.
Technical Support and Assistance
1. Visit the Advantech web site at www.advantech.com/support where you can find the latest information about the product.
2. Contact your distributor, sales representative, or Advantech's cus­tomer service center for technical support if you need additional assistance. Please have the following information ready before you call:
- Product name and serial number
- Description of your peripheral attachments
- Description of your software (operating system, version, applica­tion software, etc.)
- A complete description of the problem
- The exact wording of any error messages
PCM-3780 User Manual iv
Packing List
Before setting up the system, check that the items listed below are included and in good condition. If any item does not accord with the table, please contact your dealer immediately.
The package should contain the following items:
• 1 x PCM-3780 DA&C card
• 1 x PCM-3780 User Manual
• 1 x Advantech DLL Drivers CD-ROM
v
PCM-3780 User Manual vi
Contents
Chapter 1 Introduction ..................................................... 2
1.1 Features ............................................................... ...... 2
1.2 Applications ...................................................................... 5
1.3 Installation Guide .............................................................. 5
1.4 Software Overview............................................................ 7
1.5 Device Drivers Programming Roadmap ........................... 8
1.6 Accessories...................................................................... 10
Chapter 2 Hardware Installation................................... 12
2.1 Unpacking ....................................................................... 12
2.2 Driver Installation ........................................................... 13
2.3 Hardware Installation ..................................................... 15
Chapter 3 Pin Assignments & Jumper Settings ........... 18
3.1 Overview ......................................................................... 18
3.2 Signal Connections.......................................................... 18
3.3 Switch and Jumper Settings ............................................ 19
3.4 Connectors Pin Assignment ............................................ 21
3.5 Period Measurement........................................................ 23
3.6 Frequency Measurement ................................................. 24
Table 1.1:PCM-3780 Counter Mode ............................. 3
Table 1.2:PCM-3780 Counter Mode ............................. 4
Figure 1.1:Installation Flow Chart ................................. 6
1.4.1 Device Drivers (on the companion CD-ROM) .............. 7
1.4.2 Device Drivers ............................................................... 7
1.4.3 Register-level Programming .......................................... 7
1.5.1 Programming Tools ....................................................... 8
1.5.2 Programming with Device Drivers Function Library .... 9
1.5.3 Troubleshooting Device Drivers Error .......................... 9
1.6.1 Wiring Cables .............................................................. 10
1.6.2 Wiring Boards .............................................................. 10
Figure 2.1:The Setup Screen of Advantech Automation
Software 13
Figure 2.2:Different Options for Driver Setup ............ 14
2.3.1 Installing the Module ................................................... 15
Figure 3.1:Connectors Locations ................................. 18
Table 3.1:Connectors Table ......................................... 19
Table 3.2:Base Address Setting ................................... 20
Figure 3.2:I/O Port Connector ..................................... 21
Figure 3.3:Counter Interface Connector ...................... 21
Table 3.3:I/O Connector Signal Descriptions .............. 22
3.5.1 Using Advantech 32-bit DLL Driver ........................... 23
3.5.2 Using Direct I/O ........................................................... 23
Figure 3.4:Period Measurement ................................... 23
3.6.1 Using Advantech 32-bit DLL Driver ........................... 24
vii
3.6.2 Using Direct I/O ........................................................... 24
Figure 3.5:Frequency Measurement ............................ 24
Appendix A Specifications ................................................. 26
A.1 Programmable Counter ................................................... 26
A.2 Digital Input/Output ........................................................ 26
A.3 General ............................................................................ 27
Appendix B Block Diagram ............................................... 30
Appendix C Register Structure & Format ....................... 32
C.1 Overview ......................................................................... 32
C.2 I/O Port Address Map ..................................................... 32
C.2.1 Register Format ............................................................ 33
C.3 Counter 0/1 Mode Register ............................................. 35
C.4 Counter 0/1 Load Register: ............................................. 37
C.5 Counter 0/1 Hold Register............................................... 37
C.6 Counter 0/1 Command Register ...................................... 38
C.7 Counter Command Enable Register ................................ 38
C.8 Interrupt Control Register ............................................... 39
C.9 Interrupt Status Register.................................................. 39
C.10 Interrupt Clear Register ................................................... 40
C.11 I/O Direction Control Register ........................................ 40
C.12 Port A/B/C Interrupt Status Register............................... 40
C.13 FOUT Register ................................................................ 41
Table C.1:Register Offset Address Table .................... 33
Appendix D Waveform of Each Mode .............................. 44
D.1 Counter Mode Descriptions ............................................ 44
D.2 Mode A Waveforms ........................................................ 47
D.3 Mode B Waveforms ....................................................... 48
D.4 Mode C Waveforms ........................................................ 49
D.5 Mode D Waveforms ....................................................... 50
D.6 Mode E Waveforms ........................................................ 51
D.7 Mode F Waveforms ........................................................ 52
D.8 Mode G Waveforms ........................................................ 53
D.9 Mode H Waveforms ........................................................ 54
D.10 Mode I Waveforms.......................................................... 55
D.11 Mode J Waveforms ......................................................... 56
D.12 Mode K Waveforms ........................................................ 57
D.13 Mode L Waveforms ........................................................ 58
D.14 Mode O Waveforms ....................................................... 59
D.15 Mode R Waveforms ........................................................ 60
D.16 Mode U Waveforms ........................................................ 61
D.17 Mode X Waveforms ....................................................... 62
Table D.1:PCM-3780 Counter Mode .......................... 45
Table D.2:PCM-3780 Counter Mode .......................... 46
PCM-3780 User Manual viii
2
1
CHAPTER
Introduction
This chapter provides an introduction to the PCM-3780.
Sections include:
• Introduction
• Features
• Applications
• Installation Guide
• Accessories

Chapter 1 Introduction

Thank you for buying the Advantech PCM-3780. The PCM-3780 is a general purpose multiple channel counter/timer card for the PC/104 bus. It targets the AM9513 to implement the counter/timer function by CPLD. It provides two 16-bit counter channels and 24-ch digital TTL I/O.
The I/O bits are divided into three 8-bit I/O ports: A0, B0 and C0. You can configure each port as either input or output via software. The power­ful Advantech-designed counter functions fulfill your industrial or labo­ratory application needs.
The following sections of this chapter will provide further information about features of the multifunction cards, a quick startup guide for instal­lation, together with some brief information on software for the PCM-
3780 card.

1.1 Features

The Advantech PCM-3780 offers the following main features:
• 2 independent 16-bit counters
• 2 programmable clock sources
• 24-ch digital TTL I/O
• Up to 20 MHz input frequency
• Multiple counter clock source selectable
• Counter output programmable
• Counter gate function
• Flexible interrupt source select
PCM-3780 User Manual 2
Counter Modes
Table 1.1: PCM-3780 Counter Mode
Counter Mode A B C D E F G H I J K L
Special Gate (CM6) 0 0 0 0 0 0 0 0 0 0 0 0
Reload Source (CM5) 000000111111
Repetition (CM4) 0 0 0 1 1 1 0 0 0 1 1 1
Gate Control (CM15~CM12)
Count to TC once, then disarm
Count to TC twice, then disarm
Count to TC repeatedly without disarming
Gate input dose not gate counter input
Count only during active gate level
Start count on active gate edge and stop count on next TC
Start count on active gate edge and stop count on second TC
Start count on active gate edge and stop count on inactive gate edge
Reload counter from Load Register on TC
Reload counter on each TC, alternating reload source between Load and Hold Registers
NLENLENLENLE
YY Y
YYY
YYY YYY
YY Y Y
YYY Y
YY
YY
YY Y Y Y Y
YYYYYY
(N: No gate control, L: Level gate control, E: Edge gate control)
3 Chapter 1
Table 1.2: PCM-3780 Counter Mode
Counter Mode M N O P Q R S T U V W X
Special Gate (CM6) 0 0 0 0 0 0 0 0 0 0 0 0
Reload Source (CM5) 000000111111
Repetition (CM4) 0 0 0 1 1 1 0 0 0 1 1 1
Gate Control (CM15~CM12)
Count to TC once, then disarm
Count to TC twice, then disarm
Count to TC repeatedly without disarming
Gate input dose not gate counter input
Count only during active gate level
Start count on active gate edge and stop count on next TC
Start count on active gate edge and stop count on second TC
Start count on active gate edge and stop count on inactive gate edge
Reload counter from Load Register on TC
Reload counter on each TC, alternating reload source between Load and Hold Registers
NLENLENLENLE
YY Y
YYY
YYY YYY
YY Y Y
YYY Y
YY
YY
YYY Y
YY Y Y Y Y
YYYYYY
Note: For detailed specifications of the PCM-3780, please refer to
Appendix A Specifications.
PCM-3780 User Manual 4

1.2 Applications

• Event counting
• One shot output
• Programmable frequency output
• Frequency measurement
• Pulse width measurement
• PWM output
• Periodic interrupt generation
• Time-delay generation

1.3 Installation Guide

Before you install your PCM-3780 card, please make sure you have the following necessary components:
• PCM-3780 DA&C card
• PCM-3780 User Manual
Driver software Advantech DLL drivers (included in the companion CD-ROM)
Wiring cable: PCL-10120 & PCL-10150
Wiring board: ADAM-3920 (Option) ADAM-3950 (Option)
Computer Personal computer or workstation with a PC/104 slot (run­ning Windows 2000/XP)
Some other optional components are also available for enhanced opera­tion:
Application software ActiveDAQ, GeniDAQ or other third-party soft­ware packages
After you get the necessary components and maybe some of the accesso­ries for enhanced operation of your Multifunction card, you can then begin the Installation procedures. Figure 1-1 on the next page provides a concise flow chart to give users a broad picture of the software and hard­ware installation procedures:
5 Chapter 1
Install Driver from CD-ROM
Install Hardware on PC
Use driver utility to configure hardware
Use test utility to test hardware
Read examples & driver manual
Start to write your own application

Figure 1.1: Installation Flow Chart

PCM-3780 User Manual 6

1.4 Software Overview

Advantech offers a rich set of DLL drivers, third-party driver support and application software to help fully utilize the functions of your PCM-3780 card:

1.4.1 Device Drivers (on the companion CD-ROM)

• LabVIEW driver
• Advantech ActiveDAQ
• Advantech GeniDAQ
Programming choices for DA&C cards: You may use Advantech applica­tion software such as Advantech Device Drivers. On the other hand, advanced users can use another option for register-level programming, although it is not recommended due to its laborious and time-consuming nature.

1.4.2 Device Drivers

The Advantech Device Drivers software is included on the companion CD-ROM at no extra charge. It also comes with all Advantech DA&C cards. Advantech’s device drivers feature a complete I/O function library to help boost your application performance. The Advantech
Device Drivers for Windows 2000/XP works seamlessly with develop­ment tools such as Visual C++, Visual Basic, Inprise C++ Builder and Inprise Delphi.

1.4.3 Register-level Programming

Register-level programming is reserved for experienced programmers who find it necessary to write code directly at the level of device regis­ters. Since register-level programming requires much effort and time, we recommend that you use the Advantech Device Drivers instead. How­ever, if register-level programming is necessary, you should refer to the relevant information in Appendix C, Register Structure and Format, or to the example codes included on the companion CD-ROM.
7 Chapter 1

1.5 Device Drivers Programming Roadmap

This section will provide a roadmap to demonstrate how to build an appli­cation from scratch using Advantech Device Drivers with your favorite development tools such as Visual C++, Visual Basic, Delphi and C++ Builder. The step-by-step instructions on how to build your own applica­tions using each development tool will be given in the
Manual
your reference.
. Moreover, a rich set of example source code is also given for

1.5.1 Programming Tools

Programmers can develop application programs with the following tools:
• Visual C++
• Visual Basic
• Delphi
• C++ Builder
For instructions on how to begin programming works in each develop­ment tool, Advantech offers a
Manual
this chapter of the efforts. You can also look at the example source code provided for each programming tool, since they can get you very well oriented.
The Or if you have already installed the Device Drivers on your system, The
Device Drivers Manual can be readily accessed through the Start button:
Start/Programs/Advantech Automation/Device Manager /Device Driver's Manual
for your reference. Please refer to the corresponding sections in
Device Drivers Manual to begin your programming
Device Drivers Manual can be found on the companion CD-ROM.
Tut orial Chapter in the Device Drivers
Device Drivers
The example source codes could be found under the corresponding instal­lation folder such as the default installation path:
\Program Files\Advantech\ADSAPI\Examples
For information about using other function groups or other development tools, please refer to the
Device Drivers Drivers Manual
PCM-3780 User Manual 8
chapter and the Function Overview chapter on the Device
.
Creating Windows 2000/XP Application with

1.5.2 Programming with Device Drivers Function Library

Advantech Device Drivers offers a rich function library to be utilized in various application programs. This function library consists of numerous APIs that support many development tools, such as Visual C++, Visual Basic, Delphi and C++ Builder.
According to their specific functions or services, those APIs can be cate­gorized into several function groups:
• Digital Input/Output Function Group
• Counter Function Group
• Port Function Group (direct I/O)
• Event Function Group
For the usage and parameters of each function, please refer to the
tion Overview
chapter in the Device Drivers Manual.
Func-

1.5.3 Troubleshooting Device Drivers Error

Driver functions will return a status code when they are called to perform a certain task for the application. When a function returns a code that is not zero, it means the function has failed to perform its designated func­tion. To troubleshoot the Device Drivers error, you can pass the error code to you can refer to the
Drivers Manual
Error Message.
DRV_GetErrorMessage function to return the error message. Or
Device Drivers Error Codes Appendix in the Device
for a detailed listing of the Error Code, Error ID and the
9 Chapter 1

1.6 Accessories

Advantech offers a complete set of accessory products to support the PCM-3780 card. These accessories include:

1.6.1 Wiring Cables

PCL-10120 PCL-10120 cable is a 20-pin flat cable for PCM-3780 cards.
PCL-10150
• PCL-10150 cable is a 50-pin flat cable for PCM-3780 cards.

1.6.2 Wiring Boards

The ADAM-3900 series consists of universal screw terminal modules designed for field signal wiring in industrial applications. They can be connected to the analog and digital ports of Advantech products such as the PCI, PCM and PCL series.
ADAM-3920
• ADAM-3920 is a 20-Pin Flat Cable Wiring Terminal.
ADAM-3950
ADAM-3950 is a 50-Pin Flat Cable Wiring Terminal.
PCM-3780 User Manual 10
2
2
CHAPTER
Hardware Installation
This chapter provides a packaged items checklist, proper instructions about unpacking and step-by-step procedures
for card
hardware installation.

Chapter 2 Hardware Installation

2.1 Unpacking

After receiving your PCM-3780 package, please inspect its contents first. The package should contain the following items:
• PCM-3780 card
• Companion CD-ROM (DLL driver included)
• User Manual
The PCM-3780 card has electronic components vulnerable to
static discharge
and certain components if preventive measures are not carefully paid attention to. Before removing the card from the antistatic plastic bag, you should take following precautions to ward off possible ESD damage:
• Touch the metal part of your computer chassis with your hand to dis­charge static electricity accumulated on your body. Or use a grounding strap.
• Touch the anti-static bag to a metal part of your computer chassis before opening the bag.
• Take hold of the card only by the metal bracket when removing it from the bag.
After taking out the card you should first inspect the card for any possible signs of external damage (loose or damaged components, etc.). If the card is visibly damaged, please notify Advantech’s service department or the local sales representative immediately. Avoid installing a damaged card into your system. Also, pay extra caution to the following aspects to ensure proper installation:
• Avoid physical contact with materials that could hold static electricity such as plastic, vinyl and Styrofoam.
• Whenever you handle the card, hold it only by its edges. DO NOT TOUCH the exposed metal pins of the connector or the electronic com­ponents.
(ESD). ESD could easily damage the integrated circuits
electro-
Note Keep the anti-static bag for future use. You might
need the original bag to store the card if you have to remove the card from the PC or transport it else­where.
PCM-3780 User Manual 12

2.2 Driver Installation

We recommend you to install the driver before you install the PCM-3780 card into your system, since this will guarantee a smooth installation pro­cess.
The Advantech Device Drivers Setup program for the PCM-3780 card is included on the companion CD-ROM that is shipped with your DA&C card package. Please follow the steps below to install the driver software:
Step 1: Insert the companion CD-ROM into your CD-ROM drive.
Step 2: The Setup program will be launched automatically if you have the
autoplay function enabled on your system. When the Setup Program is launched, you’ll see the following Setup Screen.
Note: If the autoplay function is not enabled on your
computer, use Windows Explorer or the Windows Run command to execute SETUP.EXE on the companion CD-ROM.

Figure 2.1: The Setup Screen of Advantech Automation Software

13 Chapter 2
Loading...
+ 49 hidden pages