background image

44 

 C/C++ Libraries 

5.5 

_8554_Read_Counter 

@ Description 

User can directly read counter information by this function.  

@ Syntax 

C/C++ (DOS) 

U16 _8554_Read_Counter (U16 cardNo,U16 cntNo,U16 *mode,U16 

*cntrVal) 

C/C++ (Windows 95) 

U16 W_8554_Read_Counter (U16 cardNo,U16 cntNo,U16 *mode,U16 

*cntrVal) 

Visual Basic (Windows 95) 

W_8554_Read_Counter (ByVal cardNo As Integer, ByVal cntNo 

As Integer, mode As Integer, cntrVal As Integer) As Integer 

@ Arguments 

cardNo:

  

card number to select board 

cntNo:

  

Counter / Timer number. This value must between 
1 and 12. 

mode: 

Counter operation m ode.  

cntrVal: 

Counter value read back from counter

 

@ Return Value 

ERR_NoError ,  ERR_BoardNoInit

  

ERR_InvalidCounterNo:

 

 

cntNo

 is out of range. 

Содержание PCI-8554

Страница 1: ...NuDAQ PCI 8554 Multi functions Counter Timer Card User s Guide Recycled Paper...

Страница 2: ......

Страница 3: ...ial damages arising out of the use or inability to use the product or documentation even if advised of the possibility of such damages This document contains proprietary information protected by copyr...

Страница 4: ...tw NuPRO nupro adlink com tw Technical Support Software sw adlink com tw TEL 886 2 82265877 FAX 886 2 82265717 Address 9F No 166 Jian Yi Road Chungho City Taipei 235 Taiwan R O C Please inform or FAX...

Страница 5: ...king 8 2 3 PCB Layout of PCI 8554 9 2 4 Default Jumper Setting 10 2 5 PCI 8554 Installation Outline 10 2 6 Device Installation for Windows Systems 11 2 7 Pin Assignment of Connector 12 2 8 Clock Syste...

Страница 6: ...8 4 8 Dual Interrupt System 39 Chapter 5 C C Library 40 5 1 Libraries Installation 40 5 2 Programming Guide 41 5 2 1 Naming Convention 41 5 2 2 Data Types 41 5 3 _8554_Initial 42 5 4 _8554_Write_Count...

Страница 7: ...d read through this chapter to understand the configurations of the PCI 8554 The chapter will also teach user how to install the PCI 8554 Chapter 3 Register Format describes the details of register fo...

Страница 8: ......

Страница 9: ...k source It is possible to use this card on variety of powerful counter timer functions to match your industry and laboratory applications Users can set the configuration to fit the variety of applica...

Страница 10: ...anced features Four 8254 chips provide twelve 16 bits down counters Multi configurations of counters timers Flexible setting for each independent counter the clock source could be external internal or...

Страница 11: ...Introduction 3 The second interrupt source comes from external source 100 pin SCSI II female connector PCI Bus...

Страница 12: ...Clock sources of independent counters External clock Prior counter output CK1 Programmable Clock 10 output CK1 clock sources Programmable 8MHz internal base clock Programmable counter 11 output Gate...

Страница 13: ...Introduction 5 Humidity 5 95 non condensing Power Consumption 5 V 350 mA typical Dimension 134mm L X 107mm W...

Страница 14: ...s descriptions are included in this user s guide u Windows 95 DLL For VB VC Delphi BC5 the functions descriptions are included in this user s guide u PCIS DASK Include device drivers and DLL for Windo...

Страница 15: ...sed to interface with HP VEE software package PCIS VEE supports Windows 95 98 NT The HP VEE drivers are free shipped with the board You can install and use them without license For detail information...

Страница 16: ...In addition to this User s Manual the package includes the following items PCI 8554 Enhanced Multi function Counter Timer Card ADLINK CD Software Installation Guide If any of these items is missing o...

Страница 17: ...damage Press down on all the socketed IC s to make sure that they are properly seated Do this only with the module place on a firm flat surface Note DO NOT APPLY POWER TO THE CARD IF IT HAS BEEN DAMA...

Страница 18: ...ECLK10 Debounce function JP10 E_INT Debounce function JP11 Table 2 1 Default Configuration of PCI 8554 There are eleven jumpers on PCI 8554 these jumpers are used to select debounce function You can...

Страница 19: ...ver from your computer 4 Setup jumpers on the PCI or CompactPCI card 5 Select a 32 bit PCI slot PCI slot are short than ISA or EISA slots and are usually white or ivory 6 Before handling the PCI cards...

Страница 20: ...D 53 GIN2 78 GATE8 4 Vcc 29 GND 54 GND 79 ECLK8 5 Vcc 30 GND 55 GOUT1 80 COUT7 6 Vcc 31 GND 56 GIN1 81 GATE7 7 NC 32 GND 57 E_INT 82 ECLK7 8 DI_6 33 GND 58 DI7 83 COUT6 9 DI_4 34 GND 59 DI5 84 GATE6 1...

Страница 21: ...r timer 1 10 can be one of the 4 sources external clock source or cascaded source from the last channel or CK1 or COUT10 The next section will give you detail description about setting clock for each...

Страница 22: ...5 Independent or Cascaded Counter 6 Independent or Cascaded Counter 7 Independent or Cascaded Chip 3 U5 Counter 8 Independent or Cascaded Counter 9 Independent or Cascaded Counter 10 Independent or C...

Страница 23: ...COUT11 COUT12 Counter 12 8254 Chip 4 Counter 11 C G O C G C G C G C G C G C G C G C G C G C G C G O O O O O O O O O O O H H 8M Hz CLK5 GATE5 CLK6 GATE6 COUT5 Figure 2 4 Counters Architectural Indepen...

Страница 24: ...t the signals COUT12 can also be used as interrupt source See Interrupt Sources section for details The following figure demonstrates cascaded counter counter 11 and 12 8 MHz COUT11 Counter 11 COUT11...

Страница 25: ...on 17 CLK1 COUT1 GATE1 Counter 1 8254 Chip 1 C G O CLK2 COUT2 GATE2 Counter 2 C G O VCC VCC Cascaded Counters Output selectable by function _SET_cntCLK_ Figure 2 7 Example of user programmable cascade...

Страница 26: ...te 1 The clock source of the cascaded counters 11 is fixed to C8M and counter 12 is fixed to COUT11 2 The external clock source named as ECK n comes from jumper JP1 JP10 please see section 2 12 for de...

Страница 27: ...on _8554_SET_CK1 and counters can be set to cascaded mode then clock source comes from the output of the counter with smaller channel number For example the COUT1 is cascaded to CLK2 the COUT3 is casc...

Страница 28: ...r 11 and 12 are always enable GATE n To 8254 VCC GATE n From 100 pin SCSI II Connector Figure 2 10 Gate source of counter 1 10 2 12 Counter Outputs The timer counter output signals COUT n of 8254 are...

Страница 29: ...te for four DB_CLK otherwise the input signal will be treated as glitch and the debounce output signal will keep previous state figure 2 11 show you the how to set these jumpers figure 2 12 show you h...

Страница 30: ...22 Installation DB_CLK input signal output signal glitch is eliminated Figure 2 13 Basic theorem of debounce system...

Страница 31: ...Counter 12 8254 Chip 4 Counter 11 8254 Chip 4 H H 8MHz IRQ Flip Flops IRQ Flip Flops P Controller INT A INT1 INT2 Clear by 8554_CLR_IRQ1 Clear by 8554_CLR_IRQ2 EXTINT E_INT debounce system DB_CLK JP1...

Страница 32: ...one IRQ you can disable one of the IRQ sources by software If your application do not need any IRQ source you can disable both the two interrupts However the PCI BIOS still assign a IRQ level to the P...

Страница 33: ...the fuses are added on all the power supply signals The maximum current for 5 volts on every fuse is 0 5 A If the load current is larger than 0 5 A the resistance of the fuse will increase because of...

Страница 34: ...on Registers LCR and PCI 6308 registers The PCR which is compliant to the PCI bus specifications is initialized and controlled by the plug play PnP PCI BIOS User s can study the PCI BIOS specification...

Страница 35: ...The users can access these registers by 8 bits I O instructions The following table shows the registers map including descriptions and their offset addresses relative to the base address I O Address...

Страница 36: ...0x0F Attribute read write Data Format Base 0 Counter 1 Register R W Base 1 Counter 2 Register R W Base 2 Counter 3 Register R W Base 3 8254 Mode Control Register W 8254 Read Back Register R Base 4 Co...

Страница 37: ...N1 CnN1 CnN2 these two bits are used to control clock source of Timer Counter n n 1 10 CK1SEL select source of CK1 DBCSEL select debounce clock 3 5 Digital Input Registers There are 8 digital input ch...

Страница 38: ...I 8554 including the signal connection between the PCI 8554 and external devices 4 1 Connectors Pin Assignment The PCI 8554 comes equipped with a 100 pin SCSI II female connector CN1 The CN1 is locate...

Страница 39: ...8554 provides 8 digital input and 8 digital output channels through the connector CN1 The digital I O signals are fully TTL compatible Digital Output DO GND Digital Input DI From TTL Devices To TTL De...

Страница 40: ...ource must be used and go to step 3 2 Calculate the frequency of clock according to your application and decide the clock source internal external or cascaded then decide which counter is used 3 If ex...

Страница 41: ...554_SET_CK1 Figure 4 2 Example of frequency generator 1 Example 2 To generate a very low frequency of 1 pulse 1 hour step 1 To use fixed clock source because the output is a fixed frequency step 2 Bec...

Страница 42: ...8MHz COUT11 set by function 8554_SET_cntCLK set by function _8554_SET_CK1 COUT2 Counter 2 8254 Chip 1 H set by function 8554_SET_cntCLK ECK2 COUT1 CK1 COUT10 COUT3 Counter 3 8254 Chip 1 H ECK3 COUT2...

Страница 43: ...use counter 2 to measure pulse width then the count range can increase but the resolution will decrease Counter 1 2 3 are used in this example step 3 Skip these steps step 4 Connect GATE1 to the sign...

Страница 44: ...n 65535 For measuring 100 K Hz frequency the time interval should be within 1 100 K Hz x 65535 0 655 sec If the time interval is wider then the measurement resolution is better however the counting va...

Страница 45: ...enable counter 1 ECK2 COUT1 CK1 COUT10 8MHz COUT11 set by function _8554_SET_CK1 set by function _8554_SET_cntCLK connect by user ECK1 GND CK1 COUT10 debounce system DB_CLK JP1 2MHz COUT11 selectable...

Страница 46: ...l and the frequency is not fixed step 2 Skip this steps step 3 Connect ECLK1 to the signal to be measured and adjust JP1 to select debounce function Step 4 The gate source of counter 1 is always enabl...

Страница 47: ...m periodically hence an IRQ channel is used In addition the emergency control may be necessary hence an additional external IRQ channel is helpful to handle the situation Therefore dual interrupt leve...

Страница 48: ...ping environment can be Visual Basic 4 0 or above Visual C C 4 0 or above Borland C 5 0 or above Borland D elphi 2 x 32 bit or above or any Windows programming language that allows calls to a DLL It p...

Страница 49: ...We defined some data type in Pci_8554 h DOS and Acl_pci h Windows 95 These data types are used by NuDAQ Cards library We suggest you to use these data types in your application programs The following...

Страница 50: ...5 U16 W_8554_Initial U16 existCards PCI_INFO pciinfo Visual Basic Windows 95 W_8554_Initial existCards As Integer pciInfo As PCI_INFO As Integer Arguments existCards The numbers of installed PCI 8554...

Страница 51: ...4_Write_Counter U16 cardNo U16 cntNo U16 mode U16 cntrVal Visual Basic Windows 95 W_8554_Write_Counter ByVal cardNo As Integer ByVal cntNo As Integer ByVal mode As Integer ByVal cntrVal As Integer As...

Страница 52: ...ardNo U16 cntNo U16 mode U16 cntrVal Visual Basic Windows 95 W_8554_Read_Counter ByVal cardNo As Integer ByVal cntNo As Integer mode As Integer cntrVal As Integer As Integer Arguments cardNo card numb...

Страница 53: ...indows 95 U16 W_8554_Stop_Counter U16 cardNo U16 cntNo U16 cntrVal Visual Basic Windows 95 W_8554_Stop_Counter ByVal cardNo As Integer ByVal cntNo As Integer cntrVal As Integer As Integer Arguments ca...

Страница 54: ...Basic Windows 95 W_8554_Read_Status ByVal cardNo As Integer ByVal cntNo As Integer cntrVal As Integer status As Integer As Integer Arguments cardNo card number to select board cntNo Counter Timer num...

Страница 55: ...number to select board doData the value to write to digital output port Return Value ERR_NoError ERR_PCIBiosNotExist 5 9 _8554_DI Description To read 8 bits data from digital input port Syntax C C DO...

Страница 56: ...ardNo U16 cntNo U16 clkMODE Visual Basic Windows 95 W_8554_SET_cntCLK ByVal cardNo As Integer ByVal cntNo As Integer ByVal clkMODE As Integer As Integer Arguments cardNo card number to select board cn...

Страница 57: ...ck1 1 then CK1 is COUT11 Return Value ERR_NoError ERR_BoardNoInit ERR_InvalidMode selCK1 is out of range 5 12 _8554_SET_DBCLK Description To select debounce clock Syntax C C DOS U16 _8554_SET_DBCLK U1...

Страница 58: ...counter 12 output COUT12 INT1 or external interrupt signal EXTINT INT2 Syntax C C DOS U16 _8554_Set_INT_Control U16 cardNo U16 int1Flag U16 int2Flag C C Windows 95 U16 W_8554_Set_INT_Control U16 cardN...

Страница 59: ...INT2 interrupts are used Syntax C C DOS U16 _8554_Get_IRQ_Status U16 cardNo U16 ch1 U16 ch2 C C Windows 95 U16 W_8554_Get_IRQ_Status U16 cardNo U16 ch1 U16 ch2 Visual Basic Windows 95 W_8554_Get_IRQ_...

Страница 60: ...Basic Windows 95 W_8554_INT_Enable ByVal cardNo As Integer hEvent As Long As Integer Arguments cardNo card number to select board hEvent the address of an array of two handles HEvent 0 and hEvent 1 a...

Страница 61: ...e generated Syntax C C Windows 95 U16 _8554_CLR_IRQ1 U16 cardNo Arguments cardNo card number to select board 5 18 _8554_CLR_IRQ2 Description This function is only needed in DOS driver It is used to cl...

Страница 62: ...its specifications or if the serial number has been removed Seller does not assume any liability for consequential damages as a result from our products uses and in any event our liability shall not...

Отзывы: