background image

30 

 C/C++ Libraries 

C/C++ Libraries

 

This chapter describes the software library for operating these card. Only 
the functions in DOS library and Windows 95 DLL are described. Please 
refer to the PCI

 

DASK function reference manual, which 

is 

included 

with

the 

CD, for the descriptions of the Windows 98/NT/2000

/XP

 DLL functions.  

The functions of 

PCIDIO 48H 

can also be applied to 

PCIDIO 24H

.  

Therefore, in the following section, there 

are 

no special functions for 

the 

PCIDIO 24H

. The software driver of 

PCIDIO 24H 

is fully compatible 

with that of 

PCIDIO 48H

.  In the following sections, each function call 

that

has a name associated with “

DIO48H"

 

can 

be applied to 

PCIDIO 24H 

directly

.

 

The function prototypes and  some useful constants are defined in the 
header files LIB directory (DOS) and INCLUDE directory (Windows 95). For 
Windows 95 DLL, the developing environment can be Visual Basic 4.0 or 
above, Visual C/C++ 4.0 or above, Borland C++ 5.0 or above, Borland 
Delphi 2.x (32-bit) or above, or any Windows programming language that 
allows calls to a DLL. It provides the C/C++, VB, and Delphi include files. 

5.1   Libraries Installation 

Please refer to the “

Software Installation Guide

” for the detail information 

about how to install the software libraries for DOS, or Windows 95 DLL, or 
PCI

 

DASK for Windows 98/NT/2000

/XP

The device drivers and DLL functions of Windows 98/NT/2000

/XP

 are included 

with

 PCI

 

DASK.  Please refer the PCI

 

DASK user’s guide and function 

reference, which

 are

 included in the 

CyberResearch

®

 CD

, for detailed 

programming 

information. 

 

Summary of Contents for PCIDIO 24H

Page 1: ...r Branford CT 06405 USA 203 483 8815 9am to 5pm EST FAX 203 483 9024 Digital I O PCIDIO 24H High Density PCI Bus Parallel Digital Board with 24 Channels 24mA Channel Sink PCIDIO 48H High Density PCI Bus Parallel Digital Board with 48 Channels 24mA Channel Sink PCIDIO 96H High Density PCI Bus Parallel Digital Board with 96 Channels 24mA Channel Sink ...

Page 2: ......

Page 3: ...ther product names mentioned herein are used for identification purposes only and may be trademarks and or registered trademarks of their respective companies NOTICE CyberResearch Inc does not authorize any CyberResearch product for use in life support systems medical equipment and or medical devices without the written approval of the President of CyberResearch Inc Life support devices and system...

Page 4: ......

Page 5: ...4 PCI DAQB ActiveX Controls 5 1 4 5 DASYLab TM PRO 5 1 4 6 PCI DDE DDE Server and InTouch TM 5 Chapter 2 Installation 7 2 1 What You Have 7 2 2 Unpacking 8 2 3 PCB Layout 9 2 3 1 PCIDIO 48H 24H PCB Layout 9 2 3 2 PCIDIO 96H PCB Layout 10 2 4 Hardware Installation 11 2 5 Device Installation for Windows Systems 12 2 6 Connector Pin Assignment 13 2 6 1 Pin Assignment of PCIDIO 24H 48H 96H 13 2 7 Jump...

Page 6: ...rpose Timer Counter 25 4 2 2 Cascaded 32 Bits Timer 26 4 2 3 Event Counter and Edge Control 26 4 3 Interrupt Multiplexing 26 4 3 1 Architecture 26 4 3 2 IRQ Level Setting 27 4 3 3 Note for Dual Interrupts 27 4 3 4 Interrupt Source Control 28 4 4 12V and 5V Power Supply 29 Chapter 5 C C Libraries 30 5 1 Libraries Installation 30 5 2 Programming Guide 31 5 2 1 Naming Convention 31 5 2 2 Data Types 3...

Page 7: ...Table of Contents iii 5 13 Get IRQ Status 44 5 14 Clear IRQ 45 5 15 Software Reset 45 5 16 Interrupt Start under Windows 46 5 17 Interrupt Stop under Windows 47 Product Service 48 Warranty 49 ...

Page 8: ...how to install the 24H 48H 96H series products The layout of are shown the jumper settings the connectors specifications and the notes for installation are described l Chapter 3 Registers Format describes the low level register structure and format of the PCIDIO 24H 48H 96H l Chapter 4 Operation Theorem describes more details about the versatile functions including DIO timer counter and interrupt ...

Page 9: ... 96H are 48 channel and 96 channel DIO cards respectively PCIDIO 24H is a reduced version of PCIDIO 48H all the functions are exactly the same as PCIDIO 48H except there are 24 channels only The PCIDIO 48H emulates two industry standard 8255 Programmable Peripheral Interface PPI chips operated under mode zero configuration The PCIDIO 96H emulates four PPI chips These two cards are compatible not o...

Page 10: ... 1 2 Timer Counter and Interrupt System l A 32 bits timer to generate watchdog timer interrupt l A 16 bits event counter to generate event interrupt l Programmable interrupt source l Dual interrupt system 1 1 3 Miscellaneous l Provide 12V and 5V power supply on OPTO 22 connectors l On board resettable fuses to protect power supply for external devices 1 2 Applications l Programmable mixed digital ...

Page 11: ...ent 15 0 mA Logic Low Current 24 0 mA Operating Temperature 0 C 60 C Storage Temperature 20 C 80 C Humidity 5 95 non condensing I O Connectors 50 pin male ribbon cable connectors for PCIDIO 24H 48H 96H or Bus PCI bus for PCIDIO 24H 48H 96H Power Consumption without external devices PCIDIO 24H 330mA 5VDC Typical 350mA 5VDC Maximum PCIDIO 48H 500mA 5VDC Typical 540mA 5VDC Maximum PCIDIO 96H 860mA 5V...

Page 12: ...ovide function libraries for many different operating systems including l DOS Library Borland C C and Microsoft C the functions descriptions are included in this user s guide l Windows 95 DLL For VB VC Delphi BC5 the functions descriptions are included in this user s guide l PCI DASK Include device drivers and DLL for Windows 98 Windows N Windows 2000 and XP DLL is binary compatible across Windows...

Page 13: ... CD Manuals PCI VEE Man_d pdf 1 4 4 PCI DAQB ActiveX Controls We suggest the customers who are familiar with ActiveX controls and VB VC programming use the PCI DAQB ActiveX Control components library for developing applications The PCI DAQB is designed under Windows NT 98 For more detailed information about PCI DAQB please refer to the user s guide on the CD Manual_PDF Software PCI DAQB PCI DAQB M...

Page 14: ...6 Introduction ...

Page 15: ... Device Installation for Windows System section 2 5 l Connector pin assignment section 2 6 l Jumpers setup section 2 7 l Termination boards connection section 2 8 2 1 What You Have In addition to this User s Manual the package includes the following items l The PCI board l CyberResearch CD l Software Installation Guide If any of these items is missing or damaged contact CyberResearch immediately B...

Page 16: ...ling may cause damage to your module Be sure there is no shipping and handling damage on the module before processing After opening the card module carton extract the system module and place it only on a grounded anti static surface with components side up Again inspect the module for damages Press down on all the socketed IC s to make sure that they are properly seated Do this only with the modul...

Page 17: ...Installation 9 2 3 PCB Layout 2 3 1 PCIDIO 48H 24H PCB Layout Figure 2 3 1 PCIDIO 48H 24H PCB Layout ...

Page 18: ...10 Installation PCI Controller CN1 C N 2 CN3 CN4 2 3 2 PCIDIO 96H PCB Layout Figure 2 3 2 PCIDIO 96H PCB Layout ...

Page 19: ...I slot selection The PCI card can be inserted to any PCI slot without any configuration for system resource Please note that the PCI system board and slot must provide bus mastering capability to operate this board properly PCI Installation Procedures 1 Turn off your computer 2 Turn off all accessories printer modem monitor etc connected to your computer 3 Remove the cover from your computer 4 Set...

Page 20: ...will find the new PCIDAQ cards If this is the first time you re installing a PCIDAQ card in your Windows system you will be prompted to input the device information source Please refer to the Software Installation Guide for the steps of installing the device 2 5 Device Installation for Windows Systems ...

Page 21: ... with OPTO 22 Figure 2 4 shows the circuits and pinout of PCIDIO 24H 48H 96H s connectors CN1 CN4 1 2 3 JPn 12V FUSE 1 2 3 4 5 6 7 8 9 1 0 11 1 2 13 1 4 15 1 6 17 1 8 19 2 0 21 2 2 23 2 4 25 2 6 27 2 8 29 3 0 31 3 2 33 3 4 35 3 6 37 3 8 39 4 0 41 4 2 43 4 4 45 4 6 47 4 8 49 5 0 CNn HEADER 25X2 PnC7 PnC6 PnC5 PnC4 PnC3 PnC2 PnC1 PnC0 PnB7 PnB6 PnB5 PnB4 PnB3 PnB2 PnB1 PnB0 PnA7 PnA6 PnA5 PnA4 PnA3 ...

Page 22: ...connector reference number n 1 4 X means the port name X A B or C b means the bit number of a port b 0 7 For example P1C4 means bit 4 of port C on connector CN1 Note 1 The pinout of the CN1 CN4 connectors are identical 2 The power supply pins are protected by resetable fuses Refer to section 4 4 for details of the power supply 2 6 1 Continued ...

Page 23: ...Installation 15 For Your Notes ...

Page 24: ...16 Installation For Your Notes ...

Page 25: ...48H 96H JB1 P1B Port B of CN1 for PCIDIO 24H 48H 96H JC1 P1C Port C of CN1 for PCIDIO 24H 48H 96H JA2 P2A Port A of CN2 for PCIDIO 48H 96H JB2 P2B Port B of CN2 for PCIDIO 48H 96H JC2 P2C Port C of CN2 for PCIDIO 48H 96H JA3 P3A Port A of CN3 for PCIDIO 96H JB3 P3B Port B of CN3 for PCIDIO 96H J C3 P3C Port C of CN3 for PCIDIO 96H JA4 P4A Port A of CN4 for PCIDIO 96H JB4 P4B Port B of CN4 for PCID...

Page 26: ...setting of JP2 connecting the pin 2 and pin 4 of CN2 to ground 12V 1 2 Ground JP2 2 8 Termination Boards Connection There are many termination boards that can connect with PCIDIO 48H 96H for isolated I O expansion 1 TB 24R 12 TP DIN024R 24 The TB 24R 12 and TP DIN024R 24 provide 24 Form C relays for digital output control P C I D I O 9 6 H P C I D I O 4 8 H TB 24R 12 o r T P D I N 0 2 4 R 2 4 2 TB...

Page 27: ...Installation 19 For Your Notes ...

Page 28: ...Intentionally Blank ...

Page 29: ...ications is initialized and controlled by the plug play PnP PCI BIOS User s can study the PCI BIOS specification to understand the operation of the PCR The PCI bus controller PCI 9050 is provided by PLX technology Inc www plxtech com For more detailed information of LCR please visit PLX technology s web site to download relative information It is not necessary for users to understand the details o...

Page 30: ... PCIDIO 96H 0x03 P1Ctrl Not used 0x04 P2A P2A PCIDIO 48H 0x05 P2B P2B PCIDIO 96H 0x06 P2C P2C 0x07 P2Ctrl Not used 0x08 P3A P3A P1AE 1 PCIDIO 96H 0x09 P3B P3B P1BE 1 0x0A P3C P3C P1CE 1 1 doesn t apply to 0x0B P3Ctrl Not used Not used PCIDIO series 0x0C P4A P4A P2AE 1 0x0D P4B P4B P2BE 1 0x0E P4C P4C P2CE 1 0x0F P4Ctrl Not used Not used 0x10 Timer Counter 0 Timer Counter 0 PCIDIO 24H 0x11 Timer Co...

Page 31: ...t I O ports port A PA and port B PB l Two nibble wide 4 bit ports C PC upper and PC lower l Each port can be used as either input or output l Outputs are latched whereas inputs are buffered l 16 different input output configurations are available 4 1 3 Special Function of the DIO Signals Two I O signals PC0 and PC3 of CN1 and CN2 can be used to generate hardware interrupt Refer to section 4 3 for ...

Page 32: ...L Table 4 1 I O Port Names There are four ports on every 8255 PPI including port A B C and the control port PA PB and PC could be written or read but the control port is write only Refer to chapter 5 for details about programming of DIO ports 4 1 5 Control Word The control word written in the control port is used to setup PA PB and PC as input or output port Figure 4 1 shows the format of the cont...

Page 33: ...trol word D0 D4 power on default configuration 4 1 6 Power on Configuration The default configuration after power on hardware reset or software reset sets all ports as input ports and therefore users don t have to worry about damaging the external devices when system is power on In addition the default signal level can be pulled high or pulled low by setting the jumpers Refer to section 2 7 for se...

Page 34: ...32 bit programmable timer In software library the timer 1 and 2 are always set as mode 2 rate generator In software library the counter 0 is used as an event counter that is interrupt on terminal count of 8254 mode 0 Please refer to chapter 5 for programming the timer counter functions 4 2 2 General Purpose Timer Counter The counter 0 is a general purpose timer counter for users applications It ca...

Page 35: ...4 of CN1 P1C4 The counter clock trigger direction H to L or L to H is programmable The gate control is always enabled The output is send to interrupt system which named as event IRQ If counter 0 is set as 8254 mode 0 the event counter IRQ will generate when the counter value is counting down to zero 4 3 Interrupt Multiplexing 4 3 1 Architecture The 48H 96H series products have a powerful and flexi...

Page 36: ...RQ to PCI bus the two IRQ sources must be distinguished by the ISR of the application software if the two IRQs are both used The application software can use the _dioxxh_Get_Irq_Status function to distinguish which interrupt is inserted After an ISR is completed users must check if another IRQ is also asserted then clear current IRQ to allow the next IRQ coming in The two IRQs are named as INT1 an...

Page 37: ...0 This register is write only The 4 LSBs are used to control the source of INT1 and INT2 INT1 D3 D2 D1 D0 IRQ Sources IRQ Trigger Condition Disable X X 0 0 INT1 disable Mode 1 X X 0 1 P1C0 falling edge of P1C0 Mode 2 X X 1 0 P1C0 OR P1C3 see following Mode 3 X X 1 1 Event Counter Counter count down to 0 INT2 D3 D2 D1 D0 IRQ Sources IRQ Trigger Condition Disable 0 0 X X INT2 disable Mode 1 0 1 X X ...

Page 38: ...rger than 0 5 A the resistance of resetable fuse will increase because of the rising temperature The rising resistance will cause the power supply drop and reduce current If the overload or short condition is removed the fuse will get to normal condition It is not necessary to repair or re install the fuse The maximum current of 12 volts for all the four connectors is also 0 5 A The action of the ...

Page 39: ...H directly The function prototypes and some useful constants are defined in the header files LIB directory DOS and INCLUDE directory Windows 95 For Windows 95 DLL the developing environment can be Visual Basic 4 0 or above Visual C C 4 0 or above Borland C 5 0 or above Borland Delphi 2 x 32 bit or above or any Windows programming language that allows calls to a DLL It provides the C C VB and Delph...

Page 40: ...s 95 DLL driver e g W_DIO48H_Initial 5 2 2 Data Types We defined some data type in DIO48H h DOS and Acl_pci h Windows 95 These data types are used by the PCIDAQ Card library We suggest you to use these data types in your application programs The following table shows the data type names and their range Type Name Description Range U8 8 bit ASCII character 0 to 255 I16 16 bit signed integer 32768 to...

Page 41: ...al Basic Windows 95 W_DIO48H_Initial existCards As Integer pciInfo As PCI_INFO As Integer W_DIO96H_Initial existCards As Integer pciInfo As PCI_INFO As Integer Argument existCards The numbers of installed PCIDIO 24H 48H 96H cards The returned value shows how many PCIDIO 24H 48H 96H cards are installed in your system pciinfo It is a structure to record the PCI bus plug and play initiallization info...

Page 42: ...PC2 PC1 PC0 Syntax PCIDIO 24H 48H C C DOS U16 _DIO48H_DI U16 cardNo U16 channelPort U8 diData U16 _DIO96H_DI U16 cardNo U16 channelPort U8 diData C C Windows 95 U16 W_DIO48H_DI U16 cardNo U16 channelPort U16 diData U16 W_DIO96H_DI U16 cardNo U16 channelPort U16 diData Visual Basic Windows 95 W_DIO48H_DI ByVal cardNo As Integer ByVal channelPort As Integer diData As Integer As Integer W_DIO96H_DI B...

Page 43: ... CH2 s Port C Upper Nibble PCI_CH2_PCL CH2 s Port C Low Nibble PCI_CH3_PA CH3 s Port A PCI_CH3_PB CH3 s Port B PCI_CH3_PC CH3 s Port C PCI_CH3_PCU CH3 s Port C Upper Nibble PCI_CH3_PCL CH3 s Port C Low Nibble PCI_CH0_PAE CH1 s Port A uses External Latch PCI_CH0_PBE CH1 s Port B uses External Latch PCI_CH0_PCE CH1 s Port C uses External Latch PCI_CH1_PAE CH2 s Port A uses External Latch PCI_CH1_PBE...

Page 44: ...6 channelPort U16 doData U16 W_DIO96H_DO U16 cardNo U16 channelPort U16 doData Visual Basic Windows 95 W_DIO48H_DO ByVal cardNo As Integer ByVal channelPort As Integer ByVal doData As Integer As Integer W_DIO96H_DO ByVal cardNo As Integer ByVal channelPort As Integer ByVal doData As Integer As Integer Argument cardNo card number to select board channelPort The same as channelPort in section 5 5 do...

Page 45: ... 95 U16 W_DIO48H_Config_Port U16 cardNo U16 channelPort U16 direction U16 W_DIO96H_Config_Port U16 cardNo U16 channelPort U16 direction Visual Basic Windows 95 W_DIO48H_Config_Port ByVal cardNo As Integer ByVal channelPort As Integer ByVal direction As Integer As Integer W_DIO96H_Config_Port ByVal cardNo As Integer ByVal channelPort As Integer ByVal direction As Integer As Integer Argument cardNo ...

Page 46: ... channelNo U16 ctrlValue C C Windows 95 U16 W_DIO48H_Config_Channel U16 cardNo U16 channelNo U16 ctrlValue U16 W_DIO96H_Config_ Channel U16 cardNo U16 channelNo U16 ctrlValue Visual Basic Windows 95 W_DIO48H_Config_Channel ByVal cardNo As Integer ByVal channelNo As Integer ByVal ctrlValue As Integer As Integer W_DIO96H_Config_ Channel ByVal cardNo As Integer ByVal channelNo As Integer ByVal ctrlVa...

Page 47: ...OO OUT IN OUT OUT PORT_OIOI OUT IN OUT IN PORT_OIIO OUT IN IN OUT PORT_OIII OUT IN IN IN PORT_IOOO IN OUT OUT OUT PORT_IOOI IN OUT OUT IN PORT_IOIO IN OUT IN OUT PORT_IOII IN OUT IN IN PORT_IIOO IN IN OUT OUT PORT_IIOI IN IN OUT IN PORT_IIIO IN IN IN OUT PORT_IIII IN IN IN IN The ctrlValue constants are defined in acl_pci h and acl_pci bas Return Code ERR_NoError ...

Page 48: ...rol U16 cardNo U16 ctrlValue void W_DIO96H_Set_INT_Control U16 cardNo U16 ctrlValue Visual Basic Windows 95 W_DIO48H_Set_INT_Control ByVal cardNo As Integer ByVal ctrlValue As Integer W_DIO96H_Set_INT_Control ByVal cardNo As Integer ByVal ctrlValue As Integer Argument cardNo card number to select board ctrlValue the valid values of configuring the interrupt are INT1 0x00 à disable 0x01 à mode1 0x0...

Page 49: ..._Timer_Start U16 cardNo U16 timer0Mode U16 c0 void W_DIO96H_Timer_Start U16 cardNo U16 timer0Mode U16 c0 Visual Basic Windows 95 W_DIO48H_Timer_Start ByVal cardNo As Integer ByVal timer0Mode As Integer ByVal c0 As Integer W_DIO96H_Timer_Start ByVal cardNo As Integer ByVal timer0Mode As Integer ByVal c0 As Integer Argument cardNo card number to select board timer0Mode the six modes of 8254 please r...

Page 50: ...oid _DIO96H_Timer_Read U16 cardNo U16 counterValue C C Windows 95 void W_DIO48H_Timer_Read U16 cardNo U16 counterValue void W_DIO96H_Timer_Read U16 cardNo U16 counterValue Visual Basic Windows 95 W_DIO48H_Timer_Read ByVal cardNo As Integer counterValue As Integer W_DIO96H_Timer_Read ByVal cardNo As Integer counterValue As Integer Argument cardNo card number to select board counterValue the value o...

Page 51: ...dNo U16 counterValue C C Windows 95 void W_DIO48H_Timer_Stop U16 cardNo U16 counterValue void W_DIO96H_Timer_Stop U16 cardNo U16 counterValue Visual Basic Windows 95 W_DIO48H_Timer_Stop ByVal cardNo As Integer counterValue As Integer W_DIO96H_Timer_Stop ByVal cardNo As Integer counterValue As Integer Argument cardNo card number to select board counterValue the value of current count when the count...

Page 52: ...6 c1 U16 c2 C C Windows 95 void W_DIO48H_Cascaded_Timer U16 cardNo U16 c1 U16 c2 void W_DIO96H_Cascaded_Timer U16 cardNo U16 c1 U16 c2 Visual Basic Windows 95 W_DIO48H_Cascaded_Timer ByVal cardNo As Integer ByVal c1 As Integer ByVal c2 As Integer W_DIO96H_Cascaded_Timer ByVal cardNo As Integer ByVal c1 As Integer ByVal c2 As Integer Argument cardNo card number to select board c1 the value of divis...

Page 53: ...tatus void W_DIO96H_Get_IRQ_Status U16 cardNo U16 int1Status U16 int2Status Visual Basic Windows 95 W_DIO48H_Get_IRQ_Status ByVal cardNo As Integer int1Status As Integer int2Status As Integer W_DIO96H_Get_IRQ_Status ByVal cardNo As Integer int1Status As Integer int2Status As Integer Argument cardNo card number to select board int1Status the status of INT1 int1Status 0 à no interrupt int1Status 1 à...

Page 54: ...W_DIO96H_CLR_IRQ ByVal cardNo As Integer Argument cardNo card number to select board 5 15 Software Reset Description This function is used to reset the I O port configuration After reseting the 24H 48H 96H all the ports will be set as input ports Note that this function can not re start the PCI bus and all the hardware setting won t be change either Syntax PCIDIO 24H 48H C C DOS U16 _DIO48H_Softwa...

Page 55: ...me an interrupt request signal generated a software event is signaled So that in your program you can use wait operation to wait for the event When the event is signaled it means an interrupt is generated Please refer to the sample program DIO48Hint c or DIO96Hint c Syntax C C Windows 95 void W_DIO48H_INT_Start U16 cardNo U16 c1 U16 c2 U16 ctrlValue HANDLE hIntEvent void W_DIO48H_INT_Start U16 car...

Page 56: ...or INT2 is INT2_OFF INT2_P2C0 INT2_P2C3C0 or INT2_TIMER_IRQ Please refer to section 3 3 4 for detailed description hIntEvent the handle of the event for interrupt signals Return Code ERR_NoError 5 17 Interrupt Stop under Windows Description This function is only available in the Windows 95 98 driver It is used to disable the interrupt signal generation Syntax C C Windows 95 void W_DIO48H_INT_Stop ...

Page 57: ...ter handy to take measurements of the signals you are trying to measure as well as the signals on the board module or power supply 4 Isolate problem areas that are not working as you expected 5 Have the source code to the program you are having trouble with available so that preceding and prerequisite modes can be referenced and discussed 6 Have the manual at hand Also have the product s utility d...

Page 58: ...nnection with equipment purchased and in lieu of all other war ranties expressed implied or statutory including but not limited to any implied warranty of merchant ability or fitness and all other obligations or liabilities of seller its successors or assigns The equipment must be returned postage prepaid Package it securely and insure it You will be charged for parts and labor if the warranty per...

Page 59: ......

Reviews: