background image

1

Copyright

This documentation and the software included with this product are
copyrighted 2002 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
manual 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 reliable.
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.

Acknowledgments

PC-LabCard is a trademark of Advantech Co., Ltd. IBM and PC are
trademarks of International Business Machines Corporation. MS-DOS,
Windows, Microsoft Visual C++ and Visual BASIC are trademarks of
Microsoft Corporation. Intel and Pentium are trademarks of Intel
Corporation. Delphi and C++ Builder are trademarks of Inprise
Corporation.

CE notification

The PCI-1784, 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.

On-line Technical Support

For technical support and service, please visit our support website at:

http://www.advantech.com/support

                                                                                                                           

Note:

✎ 

Concerning the environment protection, we’d like to reduce the paper

using for the user’s manual. Starting the page of 

Appendix C

, please find

the PDF file of the CD-ROM.

                                                                                                                           

Part No. 2003178400       1st Edition

Printed in Taiwan       July 2002

Summary of Contents for PC-LabCard PCI-1784

Page 1: ...rademarks of International Business Machines Corporation MS DOS Windows Microsoft Visual C and Visual BASIC are trademarks of Microsoft Corporation Intel and Pentium are trademarks of Intel Corporation Delphi and C Builder are trademarks of Inprise Corporation CE notification The PCI 1784 developed by ADVANTECH CO LTD has passed the CE test for environmental specifications when shielded cables are...

Page 2: ...2 ...

Page 3: ...3 1 OVERVIEW 19 3 2 SWITCH AND JUMPER SETTINGS 19 3 3 SIGNAL CONNECTIONS 21 APPENDIX A SPECIFICATIONS 25 APPENDIX B BLOCK DIAGRAM 27 APPENDIX C REGISTER STRUCTURE AND FORMAT 29 C 1 OVERVIEW 29 C 2 I O PORT ADDRESS MAP 29 C 3 COUNTER 0 1 2 3 MODE BASE 00 04 08 0CH 33 C 4 COUNTER 0 1 2 3 LATCH DATA BASE 00 04 08 0CH 35 C 5 COUNTER 0 1 2 3 COMPARE DATA BASE 10 14 18 1CH 36 C 6 INTERRUPT CONTROL REGIS...

Page 4: ...E 2CH 43 C 13 DIGITAL OUTPUT BASE 30H 44 C 14 DIGITAL INPUT OUTPUT BASE 30H 45 APPENDIX D OPERATION 47 D 1 QUADRATURE ENCODER INTRODUCTION 47 D 2 COUNTER MODES 48 D 3 DIGITAL NOISE FILTER 49 D 4 LATCH MODE 50 D 5 COUNTER RESET VALUE 51 D 6 TIMER FUNCTION 51 D 7 INTERRUPT FUNCTION 52 ...

Page 5: ...software and accessories for the PCI 1784 card 1 1 Features Four 32 bit up down counters Single ended or differential inputs Pulse direction and up down counter x1 x2 x4 counts for each encoder cycle Optically isolated up to 2500 VDC 4 stage digital filter with selectable sampling rate On board 8 bit timer with wide range time base selector Multiple interrupt sources for precision application Four...

Page 6: ...l system Flexible Digital Output function The PCI 1784 provides four digital output channels Each channel accepts digital output as a normal TTL output for a rotary encoder or as an indicated output with pulse level mode for a linear encoder The PCI 1784 can generate an indicated output based on a signal from over compare under compare of its counters The pulse width of an indicated output is depe...

Page 7: ...ne each card s ID when multiple PCI 1784 cards have been installed on the same PC chassis The board ID setting function is very useful when users build their system with multiple PCI 1784 cards With correct Board ID settings you can easily identify and access each card during hardware configuration and software programming Note For detailed specifications of the PCI 1784 please refer to Appendix A...

Page 8: ...10137H option Wiring board ADAM 3937 option Computer Personal computer or workstation with a PCI bus slot running Windows 2000 95 98 NT ME XP Some other optional components are also available for enhanced operation Application software ActiveDAQ GeniDAQ or other third party software packages After you get the necessary components and maybe some of the accessories for enhanced operation of your Mul...

Page 9: ...low Chart Install Driver from CD ROM then power off PC Install Hardware and power on PC Use driver utility to configure hardware Use test utility to test hardware Read examples driver manual Start to write your own application ...

Page 10: ...extra charge It also comes with all the Advantech DA C cards Advantech s device drivers features a complete I O function library to help boost your application performance The Advantech Device Drivers for Windows 2000 95 98 ME NT XP works seamlessly with development tools such as Visual C Visual Basic Inprise C Builder and Inprise Delphi Register level Programming Register level programming is res...

Page 11: ...tions on how to begin programming works in each development tool Advantech offers a Tutorial Chapter in the Device Drivers Manual for your reference Please refer to the corresponding sections in this chapter on the Device Drivers Manual to begin your programming efforts You can also take a look at the example source codes provided for each programming tool since they can get you very well oriented...

Page 12: ...veral 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 Function Overview chapter in the Device Drivers Manual Troubleshooting Device Drivers Error Driver functions will return a status code when they are called to perform a certain task for the application...

Page 13: ...ignal wires are twisted in such a way as to form a twisted pair cable reducing cross talk and noise from other signal sources Furthermore its analog and digital lines are separately sheathed and shielded to neutralize EMI EMC problems Wiring Boards ADAM 3937 The ADAM 3937 is a 37 pin D type wiring terminal module for DIN rail mounting This terminal module can be readily connected to the Advantech ...

Page 14: ...fully 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 discharge static electricity accumulated on your body Or one can also use a grounding strap Touch the anti static bag to a metal part of your computer chassis before opening the bag Tak...

Page 15: ...lectricity such as plastic vinyl and Styrofoam Whenever you handle the card grasp it only by its edges DO NOT TOUCH the exposed metal pins of the connector or the electronic components 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 PC or transport it elsewhere ...

Page 16: ...kage 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 Wind...

Page 17: ... the following path Start Programs Advantech Device Drivers V2 0 Device Driver Manual 2 3 Hardware Installation Note Make sure you have installed the driver first before you install the card please refer to 2 2 Driver Installation After the DLL driver installation is completed you can now go on to install the PCI 1784 card in any PCI slot on your computer But it is suggested that you should refer ...

Page 18: ...ep 7 Connect appropriate accessories 37 pin cable wiring terminals etc if necessary to the PCI card Step 8 Replace the cover of your computer chassis Re connect the cables you removed in step 2 Step 9 Plug in the power cord and turn on the computer Note In case you installed the card without installing the DLL driver first Windows 95 98 ME will recognize your card as an unknown device after reboot...

Page 19: ...r by selecting its device name and press the Remove button Then go through the driver installation process again After your card is properly installed on your system you can now configure your device using the PCI 1784 Utility program that has itself already been installed on your system during driver setup A complete device installation procedure should include board selection and device setup Af...

Page 20: ...registry These settings will be used when you call the APIs of Advantech Device Drivers Board selection After your card is properly inserted the Windows system will install the drivers properly You just need to launch the PCI 1784 Utility for board selection Click Board Selection and the board dialog box will appear as seen below Fig 2 4 Fig 2 4 The Board Selection dialog box ...

Page 21: ...17 Setting Up and configure the device Click Setup to configure each parameter The dialog box will appear as seen below Fig 2 5 Fig 2 5 The Setup dialog box ...

Page 22: ...properly installed and configured you can click the Operation button to test your hardware For more detailed information please refer to Chapter 2 of the Device Drivers Manual You can also find the rich examples on the CD ROM to speeding up your programming ...

Page 23: ...age to your PC and other hardware devices This chapter provides useful information about how to connect input and output signals to the PCI 1784 via the I O connector 3 2 Switch and Jumper Settings The PCI 1784 card has one function switch and five jumper settings Fig 3 1 Card connector jumper and switch locations Table 3 1 Summary of jumper settings Names of Jumpers Function description Keep last...

Page 24: ...tion this capability may allow counter value and the isolated digital outputs to be OFF without requiring a complete shutdown of processes controlled by the card Complete loss of power to the chip clears the chip memory Thus no matter how JP2 is set if the power to the PCI 1784 is disconnected the counter value and the isolated digital output initial power on state will be OFF Board ID setting SW1...

Page 25: ...scription Table 3 2 I O Connector Signal Description Signal Name Reference Direction Description EGND External Ground CH 0 3 A EGND Input Channel 0 3 A differential positive input CH 0 3 A EGND Input Channel 0 3 A differential negative input CH 0 3 B EGND Input Channel 0 3 B differential positive input CH 0 3 B EGND Input Channel 0 3 B differential negative input CH 0 3 Z EGND Input Channel 0 3 Z ...

Page 26: ...I 1784 connector CHnA CHnB CHnZ EGND Differential outputs of Encoder or Line driver GND A A B B I I PCI 1784 connector EGND CHnA CHnA CHnB CHnB CHnZ CHnZ Pulse Direction Counter PULSE DIR GND PCI 1784 connector CHnA CHnB EGND Figure 3 3 Quadrature encoder input connections ...

Page 27: ... CHnB EGND Two_Pulse Down Counter UP DN GND PCI 1784 connector CHnA CHnB EGND Figure 3 4 Quadrature encoder up down counter input connections Note In case you want to connect the Up Down counter signal into the PCI 1784 be sure that all the signals must be connected The floating connection will cause unexpected result ...

Page 28: ...0 IDI3 Internal External IDI COM DC 5 30V Figure 3 4 Isolated digital input connections Isolated digital output Isolated Protection Circuit TTL level TTL level Internal IDO0 IDO3 External EGND Figure 3 5 Isolated digital output connections ...

Page 29: ...ency x 1 x 2 x 4 Sample Clock Frequency 8 4 2 or 1 MHz Timer Resolution 8 bit Time base 50 K 5 K 500 50 5 Hz Isolated Digital Input Number of Channel 4 Optical Isolation 2500 VDC Opto isolator response time 25µs Over voltage Protect 70 VDC VIH max 30 VDC VIH min 10 VDC Input Voltage VIL max 3 VDC 10 VDC 1 7 mA typical 12 VDC 2 1 mA typical Input Current 24 VDC 4 4 mA typical Isolated Digital Outpu...

Page 30: ...Index input Digital input General I O Connector Type 37 pin D sub female Dimensions 175 mm x 100 mm 6 9 x 3 9 Typical 5 V 200 mA Power Consumption Max 5 V 450 mA Operation 0 60 C 32 140 F refer to IEC 68 2 1 2 Temperature Storage 20 70 C 4 158 F Relative Humidity 5 95 RH non condensing refer to IEC 68 2 3 Certification CE certified ...

Page 31: ... BIT MULTI MODE UP DOWN COUNTER 32 BIT UP DOWN COUNTER COUNTER MODE CONTROL DIGITAL FILTER PROGRAMMABLE TIME BASE GENERATOR DIFF SE ISOLA TION INPU T C IRCU IT DO I CH 0 DO I CH 1 DO I CH 2 DO I CH 3 INTERRUPT CONTROLLER CH 0 INDEX CH 0 PHASE A CH 0 PHASE B CH 1 INDEX CH 1 PHASE A CH 1 PHASE B CH 2 INDEX CH 2 PHASE A CH 2 PHASE B CH 3 INDEX CH 3 PHASE A CH 3 PHASE B ...

Page 32: ...28 ...

Page 33: ...PCI 1784 the register level is to understand the function of the card s registers The information in the following sections is provided only for users who would like to do their own low level programming C 2 I O Port Address Map The PCI 1784 requires 32 consecutive addresses in the PC s I O space The address of each register is specified as an offset from the card s base address For example BASE 0...

Page 34: ...I2 DI1 DI0 TM IX SW DF UL OL RF M2 M1 M0 W Counter 1 Latch Data D15 D14 D13 D12 D11 D10 D9 D8 D7 D6 D5 D4 D3 D2 D1 D0 04H R D31 D30 D29 D28 D27 D26 D25 D24 D23 D22 D21 D20 D19 D18 D17 D16 Counter 2 Mode DI3 DI2 DI1 DI0 TM IX SW DF UL OL RF M2 M1 M0 W Counter 2 Latch Data D15 D14 D13 D12 D11 D10 D9 D8 D7 D6 D5 D4 D3 D2 D1 D0 08H R D31 D30 D29 D28 D27 D26 D25 D24 D23 D22 D21 D20 D19 D18 D17 D16 Coun...

Page 35: ... D25 D24 D23 D22 D21 D20 D19 D18 D17 D16 Counter 1 Compare Data D15 D14 D13 D12 D11 D10 D9 D8 D7 D6 D5 D4 D3 D2 D1 D0 14H R D31 D30 D29 D28 D27 D26 D25 D24 D23 D22 D21 D20 D19 D18 D17 D16 Counter 2 Compare Data D15 D14 D13 D12 D11 D10 D9 D8 D7 D6 D5 D4 D3 D2 D1 D0 W D31 D30 D29 D28 D27 D26 D25 D24 D23 D22 D21 D20 D19 D18 D17 D16 Counter 2 Compare Data D15 D14 D13 D12 D11 D10 D9 D8 D7 D6 D5 D4 D3 D...

Page 36: ...I2 DI1 DI0 IX3 IX2 IX1 IX0 UN3 UN2 UN1 UN0 OV3 OV2 OV1 OV0 20H R IF TM UC3 UC2 UC1 UC0 OC3 OC2 OC1 OC0 Clock Control SC1 SC0 W TB2 TB1 TB0 DV7 DV6 DV5 DV4 DV3 DV2 DV1 DV0 Clear Interrupt 24H R Software Latch SL3 SL2 SL1 SL0 W Board ID BD3 BD2 BD1 BD0 28H R Reset Counter SR3 SR2 SR1 SR0 W N A 2CH R Digital Output DO3 DO2 DO1 DO0 W DM3 DM2 DM1 DM0 LE3 LE2 LE1 LE0 UC3 UC2 UC1 UC0 OC3 OC2 OC1 OC0 Digi...

Page 37: ...L RF M2 M1 M0 04H W Counter 2 Mode DI3 DI2 DI1 DI0 TM IX SW DF UL OL RF M2 M1 M0 08H W Counter 3 Mode DI3 DI2 DI1 DI0 TM IX SW DF UL OL RF M2 M1 M0 0CH W M2 M0 Counter input mode control 000 Disable 001 Quadrature input x 1 010 Quadrature input x 2 011 Quadrature input x 4 100 2 pulse input 101 1 pulse input 110 N A 111 N A RF Set counter reset value 0 80000000h 1 00000000h OL Counter overflow loc...

Page 38: ...latch counter data 0 Disable software latch 1 Enable software latch IX Index latch counter data 0 Disable index latch 1 Enable index latch TM Timer latch counter data 0 Disable timer latch 1 Enable timer latch DI0 DI0 latch counter data 0 Disable DI0 latch 1 Enable DI0 latch DI1 DI1 latch counter data 0 Disable DI1 latch 1 Enable DI1 latch DI2 DI2 latch counter data 0 Disable DI2 latch 1 Enable DI...

Page 39: ...27 D26 D25 D24 D23 D22 D21 D20 D19 D18 D17 D16 Counter 1 Latch Data D15 D14 D13 D12 D11 D10 D9 D8 D7 D6 D5 D4 D3 D2 D1 D0 04H R D31 D30 D29 D28 D27 D26 D25 D24 D23 D22 D21 D20 D19 D18 D17 D16 Counter 2 Latch Data D15 D14 D13 D12 D11 D10 D9 D8 D7 D6 D5 D4 D3 D2 D1 D0 08H R D31 D30 D29 D28 D27 D26 D25 D24 D23 D22 D21 D20 D19 D18 D17 D16 Counter 3 Latch Data D15 D14 D13 D12 D11 D10 D9 D8 D7 D6 D5 D4 ...

Page 40: ...7 D26 D25 D24 D23 D22 D21 D20 D19 D18 D17 D16 Counter 1 Compare Data D15 D14 D13 D12 D11 D10 D9 D8 D7 D6 D5 D4 D3 D2 D1 D0 14H R D31 D30 D29 D28 D27 D26 D25 D24 D23 D22 D21 D20 D19 D18 D17 D16 Counter 2 Compare Data D15 D14 D13 D12 D11 D10 D9 D8 D7 D6 D5 D4 D3 D2 D1 D0 W D31 D30 D29 D28 D27 D26 D25 D24 D23 D22 D21 D20 D19 D18 D17 D16 Counter 2 Compare Data D15 D14 D13 D12 D11 D10 D9 D8 D7 D6 D5 D4...

Page 41: ... UC1 UC0 OC3 OC2 OC1 OC0 OVn Interrupt by overflow bit n 0 3 0 Disable 1 Enable UNn Interrupt by underflow bit n 0 3 0 Disable 1 Enable IXn Interrupt by index status bit n 0 3 0 Disable 1 Enable DIn Interrupt by digital input bit n 0 3 0 Disable 1 Enable OCn Interrupt by counter over compare bit n 0 3 0 Disable 1 Enable UCn Interrupt by counter under compare bit n 0 3 0 Disable 1 Enable TM Interru...

Page 42: ... UC0 OC3 OC2 OC1 OC0 OVn Counter overflow interrupt flag n 0 3 0 Disable 1 Enable UNn Counter underflow interrupt flag n 0 3 0 Disable 1 Enable IXn Index input interrupt flag n 0 3 0 Disable 1 Enable DIn Digital input interrupt flag n 0 3 0 Disable 1 Enable OCn Counter over compare interrupt by flag n 0 3 0 Disable 1 Enable UCn Counter under compare interrupt flag n 0 3 0 Disable 1 Enable TM Timer...

Page 43: ...k Control SC1 SC0 24H W TB2 TB1 TB0 DV7 DV6 DV5 DV4 DV3 DV2 DV1 DV0 SC1 SC0 Sampling clock select 00 8 MHz sampling clock 01 4 MHz sampling clock 10 2 MHz sampling clock 11 1 MHz sampling clock DV7 DV0 Timer divider control TB2 TB0 Timer time base select 000 50 KHz time base 001 5 KHz time base 010 500 Hz time base 011 50 Hz time base 100 5 Hz time base 101 N A 110 N A 111 N A ...

Page 44: ...upt BASE 24H Read this register to clear the interrupt Table C 8 PCI 1784 Register for clear interrupt 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 Base Addr 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 Clear Interrupt 24H R ...

Page 45: ... PCI 1784 Register for software latch 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 Base Addr 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 Software Latch SL3 SL2 SL1 SL0 28H W SLn Software latch command n 0 3 0 N A 1 Latch counter to latch register ...

Page 46: ... 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 Base Addr 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 Board ID 0 0 0 0 0 0 0 0 0 0 0 0 BD3 BD2 BD1 BD0 28H R 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 BD3 DB0 Board ID BD0 LSB of the Board ID BD3 MSB of the Board ID BD3 BD2 BD1 BD0 Board ID 1 1 1 1 15 1 1 1 0 14 1 1 0 1 13 1 1 0 0 12 1 0 1 1 11 1 0 1 0 10 1 0 0 1 9 1 0 0 0 8 0 1 1 1 7 0 1 1 0 6 0 1 0 1 5 0 1 0 0 4 ...

Page 47: ...11 PCI 1784 Register for reset counter 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 Base Addr 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 Reset Counter SR3 SR2 SR1 SR0 2CH W SRn Reset counter command n 0 3 0 N A 1 Reset counter to default value ...

Page 48: ...ital Output DO3 DO2 DO1 DO0 30H W DM3 DM2 DM1 DM0 LE3 LE2 LE1 LE0 UC3 UC2 UC1 UC0 OC3 OC2 OC1 OC0 DO3 DO0 Digital output data OCn Digital output by over compare register n 0 3 UCn Digital output by under compare register n 0 3 LEn Digital output level control n 0 3 0 Pulse with counter clock 1 Level with clear interrupt DMn Digital output mode control n 0 3 0 Normal 1 Indicated ...

Page 49: ...DI3 DI2 DI1 DI0 DO3 DO2 DO1 DO0 30H R DM3 DM2 DM1 DM0 LE3 LE2 LE1 LE0 UC3 UC2 UC1 UC0 OC3 OC2 OC1 OC0 DO3 DO0 Digital output data DI3 DI0 Digital input data OCn Digital output by over compare register n 0 3 UCn Digital output by under compare register n 0 3 LEn Digital output level control n 0 3 0 Pulse with counter clock 1 Level with clear interrupt DMn Digital output mode control n 0 3 0 Normal ...

Page 50: ...46 ...

Page 51: ...indicate the shaft position The encoder output includes two signals commonly called channel A and channel B which generate N pulses revolution The two signals are shifted by a quarter of a cycle as shown below The shift between the two signals enables the controller to determine the direction of rotation depending on whether channel A leads channel B or vice versa MICROCOMPUTER BUS HOST CPU PCI 17...

Page 52: ... system clock frequency Mode Maximum input rate 8MHz 4MHz 2MHz 1MHz Quadrature x1 x2 x4 2 MHz 1 MHz 500 KHz 250 KHz 2 pulse 8 MHz 4 MHz 2 MHz 1 MHz Pulse direction 8 MHz 4 MHz 2 MHz 1 MHz Counter modes are as follows Quadrature input counter mode Quadrature input consists of two square wave inputs A and B which are 90 out of phase The PCI 1784 counts square wave transitions and determines the dire...

Page 53: ...de by programming the card s registers BASE 00H for CH0 BASE 04H for CH1 BASE 08H for CH2 and BASE 0CH for CH3 See Appendix C for more information D 3 Digital noise filter Noise immunity is the most important requirement for reliable encoder interface operation The PCI 1784 conditions the input signal with a four stage digital filter This filter reduces glitches digital noise or spikes by sampling...

Page 54: ...nter you are actually reading a value latched into a buffer The PCI 1784 provides seven different latching modes only one of which is active at any given time Make sure that you know which latching mode is current whenever you read the counter Otherwise you may read an old value or one that was latched at a different time than you expect You select the latching mode for each channel individually T...

Page 55: ...t value Bit 4 RF of registers BASE 00H 04H 08H and 0CH control the initial reset value of for each counter You can select either 00000000 or 80000000 hex When the counter is reset it will take this value When RF 0 the counter will reset to 80000000h When RF 1 the counter will reset to 00000000h D 6 Timer function The card can generate an interrupt to the system based on a signal from its digital i...

Page 56: ...in 12 Counter 3 index in 13 DI0 input 14 DI1 input 15 DI2 input 16 DI3 input 17 Counter 0 over compare 18 Counter 1 over compare 19 Counter 2 over compare 20 Counter 3 over compare 21 Counter 0 under compare 22 Counter 1 under compare 23 Counter 2 under compare 24 Counter 3 under compare 25 Timer pulse Note that you can use only one of the card s interrupt sources at a given time unless you specia...

Page 57: ...53 registers at BASE 20H You will need to set the chip s interrupt mask register to exclude all but one of the interrupt lines ...

Reviews: