Home

IP Win32 Driver Users Manual

image

Contents

1. 28 PCI Event ActiveX Control cccccccccssseseuceseeseccessesecneuseeeneoseeeeeouseeuaeeseeuaneaeseesonaeses 28 Redistribution Requirements eeeeeeeeeeeeeeeseeeeeeeeeeseeeeeeeeeeeenseneeeenenenenees 29 Windows 98 Me FILES a ANAN AASA AA AA AA AA ANA 29 Wind ws 2000 Pei AA ARN KA GandavauuacueusnseuusuweadecunvandawcueGanasantecsnsecesten 29 Windows XP Fj E a a ses pies deca caagashvewddes aetuesbdeubanaevaveveeudosnosunceasntooueuss 29 PCL Event Control files nma cdevtucisiiisedisbacuiusiadandiedavbusvdinsuiddagutidvasiindistevtuatvadvatensivnasantedes 29 DEL Location Notes aaa aan Baa hain 30 Modifying the PATH setting 30 Microsoft Windows 2000 and XP cccccsessseeeeeeeceensneeeeeeececansneeeeseceessaeeeeeeseceaasaseseeseoceaasaeessesons 30 Microsoft Windows 98 and Me ccccccceesseeeeeeeeecnsneeeeeeeeeeansseeeeeeeeeeaseeeeeeeeoeesneseeeeseeessaeeeeesons 30 Acromag Inc Tel 248 624 1541 Fax 248 624 9234 Email sales acromag com http www acromag com 4 IP Win32 Driver Software User s Manual IPSW API WIN Introduction IP Win32 Driver Software IPSW DLL WIN consists of low level drivers and Windows 32 Dynamic Link Libraries DLLs that facilitate the development of Windows applications accessing Industry Pack modules installed on Acromag PCI Carrier Cards e g APC8620 and CompactPCI Carrier Cards e g ACPC8625 The software provides custom support for all Acromag Industry Pack modules e g
2. 5 IP Win32 Driver Software User s Manual IPSW API WIN Hardware Support The list of supported Acromag Industry Pack carriers and modules is shown in Table1 Table 1 Acromag IP Carriers and Modules Description C CNOOOOCOC C Cds UrInterrupts AcPC8625 A AcPC8630 A AcPC8635 A APC8620 A APC8621 A APC8620 A APC8621 A P 1K100 Yes P 1K110 Yes P 1K125 Yes P220 A X P230 X P231 X P235 X Yes P236 X Yes P320 P330 P340 1 P400 Yes P405 P408 Yes P409 Yes P440 X P445 P470 Yes P480 X Yes P482 Yes P483 P484 Yes P500 Yes P501 Yes P502 Yes P511 P512 P520 Yes P521 Yes N A Not Applicable Model AcPC8625 AcPC8630_ AcPC8635 _ APC8620_ APC8621_ IP220 A X_ IP231 X__ IP235 X__ lt lt lt z x lt Z KIKIS ziziz Z Z Z Z Z Z Zz Acromag Inc Tel 248 624 1541 Fax 248 624 9234 Email sales acromag com http www acromag com 6 IP Win32 Driver Software User s Manual IPSW API WIN Language Support IP Win32 Driver Software has been tested in the following development environments Visual C 6 0 and NET 2003 Borland C Builder 5 and 6 Visual Basic 6 0 and NET 2003 National Instruments LabVIEW 6i and 7 Acromag Inc Tel 248 624 1541 Fax 248 624 9234 Email sales acromag com http AWwww acromag com T IP Win32 Driver Software User s Manual IPSW API WIN Getting Started Hardware Installation 1 Plug the necessary l Packs into the carrier Make sure to configure
3. Files e Your application program e The carrier DLL and all DLL s corresponding to the IP modules you are using These are typically installed in your application s directory e The Microsoft C Runtime Library msvcr71 dll This file is typically installed in your application s directory e Inthe winnt system32 drivers directory Drvxwdm sys Windows XP Files e Your application program e The carrier DLL and all DLL s corresponding to the IP modules you are using These are typically installed in your application s directory e The Microsoft C Runtime Library msvcr71 dll This file is typically installed in your application s directory e In the windows system32 drivers directory Drvxwdm sys PCI Event Control files If you are using the PCI Event ActiveX control the following files are needed in addition to those listed above e PClEvent ocx PClEvent tlb The ActiveX control needs to be registered on the system using the Regsvr32 tool Regsvr32 exe is included with Windows and is installed in the System Windows 98 Me or System32 Windows NT folder e MFCDLL Shared Library mfc71 dll This file is typically installed in your application s directory Acromag Inc Tel 248 624 1541 Fax 248 624 9234 Email sales acromag com http AWwww acromag com 30 IP Win32 Driver Software User s Manual IPSW API WIN DLL Location Notes To reduce the likelihood of DLL Conflict issues Microsoft recommends that DLLs be installe
4. IP220 as well as general read write access and interrupt support for IP modules from other vendors Note Most carrier control software functions are used identically with all Acromag PCI and CompactPCI Carrier Cards The convention of this document is to refer to all these cards using the generic term carrier DLL functions use the Windows _ stdcall calling convention and can be accessed from a number of programming languages In addition to the DLLs and drivers the software includes an Activex control for implementing interrupt notifications in programming environments that do not support the use of callback functions Several example C Visual Basic and LabVIEW applications are also provided with source code This document covers general information on software installation programming concepts application development and redistribution issues The following documents are also included in the IP Win32 Driver Software documentation set Function Reference document for the IP Carrier DLL Function Reference documents for each Acromag IP module DLL Function Reference document for the IP Generic DLL which can be used to access IPs from other vendors Windows XP Embedded Application Note After reviewing this user s manual readers will next want to consult the Function Reference documents specific to their hardware Acromag Inc Tel 248 624 1541 Fax 248 624 9234 Email sales acromag com http AWwww acromag com
5. IP408 h include IPErrorCodes h 5 Build your application Acromag Inc Tel 248 624 1541 Fax 248 624 9234 Email sales acromag com http www acromag com 1 8 IP Win32 Driver Software User s Manual IPSW API WIN BORLAND C BUILDER The steps to create a C or C application using C Builder 5 and 6 are as follows 1 Open anew or existing C Builder project Add the path to the necessary header files APC86xx h IPXXX h IPErrorCodes h to the project s Include path setting This is located under Project Options Directories Conditionals 3 The provided import libraries APC86xx lib IPXXX lib uses Microsofts COFF format Since the COFF format is not compatible with Borland s OMF format it is necessary to create a compatible import library using Borland s IMPLIB utility IMPLIB works like this IMPLIB destination lib name source di1 For example IMPLIB OMF_IP408 lib IP408 d11l 4 Add the new import library to the project by selecting Project Add to Project and browsing to the lib file 5 Include the windows h APC86xx h IPXXX h and IPErrorCodes h header files at the beginning of your c C source code or cpp C source code files e g include lt windows h gt include APC86xx h include IP408 h include IPErrorCodes h 6 Build your application Acromag Inc Tel 248 624 1541 Fax 248 624 9234 Email sales acromag com http AWwww acromag com 1 9 IP Win32 Driver Softwar
6. examples vb_include isual Basic function prototype modules IP Enumeration Utility IP Win32 Driver Software includes a command line utility IPEnum exe that may be run to display basic information about all installed Acromag IP carriers This information includes the carrier number bus number device number vendor ID device ID PCIBARO base address Irq and the names of all installed IP modules In addition the utility indicates if each carrier supports IP memory space and 32MHz operation The kernel driver and carrier DLL APC86xx dll must be Acromag Inc Tel 248 624 1541 Fax 248 624 9234 Email sales acromag com http AWwww acromag com 8 IP Win32 Driver Software User s Manual IPSW API WIN installed to use this utility Note that the carrier number is the value passed to the A86 Open function to open a connection to the carrier See the Sequence of Operations section below Software Overview The software includes a single Windows 32 DLL for carrier access and DLLs for each Acromag IP module In most cases the name of the DLL matches the name of the IP module There are a few exceptions however where groups of similar IP modules are supported by a single DLL These include IP Modules Shared DLL IP1K100 IP1K110 and IP1K125 Ip1K100 dil P340 and IP341 1p340 dll IP482 IP483 and IP484 1p482 dll IP502 and IP512 Ip502 dll The DLLs provide the Application Programming Interface API used to access the
7. hardware Each DLL is written in C and contains functions using the stdcall calling convention A DLL is loaded and linked at runtime when its functions are called by an executable application Multiple applications can access the functions of a single copy of a DLL in memory In addition to the DLLs the software also includes an ActiveX control that may be used to implement interrupt notifications in programming environments that do not support the use of callback functions Function Format All IP carrier DLL functions have the following form status A86 FunctionName argl arg2 argn The format of IP module DLL functions is similar status IPXXX FunctionName argl arg2 argn The IPXXX portion of the function name indicates the IP module the function is used with e g IP470 Every function returns a 16 bit status value This value is set to 0 when a function completes successfully or to a negative error code if a problem occurred The following Status Codes section describes the values that may be returned from the DLL functions For most functions arg is an integer handle used to reference a specific carrier or IP module See the Sequence of Operations section below Acromag Inc Tel 248 624 1541 Fax 248 624 9234 Email sales acromag com http AWwww acromag com 9 IP Win32 Driver Software User s Manual IPSW API WIN STATUS CODES The table below summarizes the 16 bit status codes that may be returned
8. to write additional functions that complement those provided through the DLL Example Read IP408 Digital Input Channel Register B DWORD base_address volatile BYTE pbase_addr WORD chan_val if IP408 GetBaseAddress Handle amp base_address 0 pbase addr BYTE base_address chan val PWORD pbase_addr 0x2 Acromag Inc Tel 248 624 1541 Fax 248 624 9234 Email sales acromag com http AWwww acromag com 1 6 IP Win32 Driver Software User s Manual IPSW API WIN Building Windows Applications This section describes the basic steps to create applications that use the IP Win32 dynamic link libraries and ActiveX control Steps are outlined for building applications in the following development environments Microsoft Visual C 6 VC6 Microsoft Visual C NET VC7 Borland C Builder Visual Basic 6 VB6 Visual Basic NET VB7 LabVIEW 6i and 7 Acromag Inc Tel 248 624 1541 Fax 248 624 9234 Email sales acromag com http AWwww acromag com 1 7 IP Win32 Driver Software User s Manual IPSW API WIN C C MICROSOFT VISUAL C 6 The steps to create a C or C application using VC6 are as follows 1 Open anew or existing Visual C project Add the path to the necessary header files APC86xx h IPXXX h IPErrorCodes h to the project s Preprocessor Include directories setting This is located under Project Settings C C 3 Add the path to the import libraries APC86xx lib IPXX
9. your application by clicking the Run button Acromag Inc Tel 248 624 1541 Fax 248 624 9234 Email sales acromag com http AWwww acromag com 20 IP Win32 Driver Software User s Manual IPSW API WIN VISUAL BASIC NET The steps to create an application using Visual Basic NET are as follows 1 Open anew or existing VB6 project 2 Add the files containing the DLL function prototypes APC86xx vb IPXXX vb and the error code constants IPErrorCodes vb to the project To do this select Project Add Existing Item from the menu and select the desired files The following steps are necessary if you will be implementing a callback function If you will not be using a callback skip to step 9 In Visual Basic NET callback functions are implemented using delegates A delegate is a class that can hold a reference to a method and is equivalent to a type safe function pointer or a callback function 3 Add anew module to the project that will contain the callback function To do this select Project Add Module from the menu select the Module template and select Open 4 Add an ISR subroutine to the new module The format of the routine is hardware specific and is given in the IPXXX_SetUserCallback topic in the IP module s Function Reference document This format however will be some variation of the following Sub ISR ByVal Handle As Short ByVal Status As Short End Sub 5 Inthe declares section of your form code declare a garbage coll
10. 1 Select Register Event Callback from the Functions Communication ActiveX subpallete and then click within the block diagram 2 Wire the previously added ActiveX control to the event source ref input on the node 3 Click the down arrow next to the event source ref input and select the ActiveX event to be handled The diagram should look as follows 4 The User Parameter input can be used to transfer data between the callback VI and the main VI For example if a reference to an indicator on the front panel of the main VI is wired to this input the callback VI can update the indicator each time the specified event occurs 5 Right click on the VI Ref portion of the node and select Create Callback VI from the context menu At this point registration of the callback is complete If necessary the node can be resized to register callbacks for additional events PCIEventlw VI Ref gt User Parameter 6 The callback VI LabVIEW creates includes several nodes by default Of primary interest are the nodes for the User Parameter and Event Data The latter can be used to access arguments passed from the ActiveX control Below is a complete block diagram for a callback VI that processes PClEvent1w Acromag Inc Tel 248 624 1541 Fax 248 624 9234 Email sales acromag com http AWwww acromag com 07 IP Win32 Driver Software User s Manual IPSW API WIN went common data R mg DigNum strict 2 In the ex
11. Acromag 9 IP Win32 Driver Software User s Manual ACROMAG INCORPORATED Tel 248 624 1541 30765 South Wixom Road Fax 248 624 9234 P O BOX 437 Wixom MI 48393 7037 U S A Copyright 2005 Acromag Inc Printed in the USA Data and specifications are subject to change without notice 9500 330C 2 IP Win32 Driver Software User s Manual IPSW API WIN The information in this document is subject to change without notice Acromag Inc makes no warranty of any kind with regard to this material and accompanying software including but not limited to the implied warranties of merchantability and fitness for a particular purpose Further Acromag Inc assumes no responsibility for any errors that may appear in this document and accompanying software and makes no commitment to update or keep current the information contained in this document No part of this document may be copied or reproduced in any form without the prior written consent of Acromag Inc Copyright 2005 Acromag Inc All trademarks are the property of their respective owners Acromag Inc Tel 248 624 1541 Fax 248 624 9234 Email sales acromag com http AWwww acromag com 3 IP Win32 Driver Software User s Manual IPSW API WIN Contents COMENIS am Aa aNG A AA AA 3 IMPFOQUCUON a GAGANA AA AA AA AA AA AA AA 4 Hardware SUP POR 5 aaa ka ats ANA kO Ue Katao aaa LAG ANA Oba toe tact 5 Language Support AA ee Ste 6 Getting Started ila ANAN AKA NANANA 7 Hardware Ins
12. X lib to the project To do this Open Project Settings Link Select the Input category and modify the Additional Library Path field Add the import library name to the Object library modules field 4 Include the windows h APC86xx h IPXXX h and IPErrorCodes h header files at the beginning of your c C source code or cpp C source code files e g include lt windows h gt include APC86xx h include IP408 h include IPErrorCodes h 5 Build your application MICROSOFT VISUAL C NET The steps to create a C or C application using VC7 are as follows 1 Open a new or existing Visual C project Add the path to the necessary header files APC86xx h IPXXX h IPErrorCodes h to the project To do this open the project s property pages open the C C folder select the General property page and modify the Additional Include Directories property 3 Add the path to the import libraries APC86xx lib IPXXX lib to the project To do this Open the project s property pages Open the Linker folder select the General property page and modify the Additional Library Directories property Select the Input property page and add the import library to the Additional Dependencies property 4 Include the windows h APC86xx h IPXXX h and IPErrorCodes h header files at the beginning of your c C source code or cpp C source code files e g include lt windows h gt include APC86xx h include
13. alue Delete this Parameter Function Prototype short int IP408 Openf short int CarrierHndl char Slot short int Handle Cancel Acromag Inc Tel 248 624 1541 Fax 248 624 9234 Email sales acromag com http www acromag com 23 IP Win32 Driver Software User s Manual IPSW API WIN 10 Wire inputs to the left side of the completed node and outputs to the right arrier Handle Blot ASCII The following steps show how to use the PCI Event ActiveX control for event notifications in the VI Adding the ActiveX control to a VI 1 LV6i Select Container from the Controls ActiveX subpallete and then click a point within the front panel to add the control to the panel LV7 Select ActiveX Container from the All Controls Containers subpallete and then click a point within the front panel to add the control to the panel 2 Right click within the container and select the PClEvent control After clicking OK the control will appear as a white box within the front panel In addition a node labeled PCIEVENTLib PClEvent will appear in the block diagram window Invoking an ActiveX method The methods EnableIPEvents and DisableIPEvents are used to associate and disassociate the control from the handle and hardware used with the DLL functions ActiveX methods are invoked as follows 1 Select Invoke Node from the Functions Communication ActiveX subpalette and then click within the block diagram 2 W
14. ample above the value of the IP408 s interrupt status register is passed from the ActiveX control to the Callback VI The VI unbundles the status value from the Event data node and writes it to the Value property of the Status indicator found on the front panel of the main VI Note that if the callback VI handles an event that does not pass any arguments the Event data node will not be present Acromag Inc Tel 248 624 1541 Fax 248 624 9234 Email sales acromag com http www acromag com 28 IP Win32 Driver Software User s Manual IPSW API WIN Distribution Files IP Win32 Driver Software IPSW DLL WIN consists of three primary sets of components Kernel mode drivers A suite of Windows 32 Dynamic Link Libraries DLLs An event notification ActiveX control Kernel mode drivers Driverx vxd and Drvxwdm sys export hardware control services from the kernel Driverx vxd provides Windows 98 and Me support Drvxwdm sys provides Windows 2000 and XP support Applications communicate indirectly with these drivers through the functions exported from the DLLs Windows 32 DLLs The software includes a single Windows 32 DLL for carrier access and DLLs for each Acromag IP module In a few cases groups of similar modules such as the IP482 483 and 484 are supported by the same DLL These DLLs provide the Application Programming Interface API used to access the hardware The carrier DLL is named APC86xx dll IP DLL filenames are in the
15. any jumpers on the l Packs as necessary 2 With power off install the carrier into an available slot on the PC Connect any field wiring at this time 3 Turn onthe PC Ifyou are running Windows 98 Me 2000 XP you will receive a dialog box shortly after boot up asking if you want to install a driver for the new device Insert the IP Win32 Driver disk into the CD drive and answer yes The New Hardware Wizard will copy and install the kernel mode driver Notes The wizard may find two carrier INF files These files are identical If the software has already been installed the New Hardware Wizard can be directed to the redist subdirectory see below instead of the CD Software Installation To install the IP Win32 Driver software insert the IP Win32 Driver Software disk into the CD drive and run Setup exe Note that administrative rights are required to perform the installation on NT based systems INSTALLED SOFTWARE The default installation directory is C Program Files Acromag IPSW_API_WIN Subdirector c_examples Microsoft Visual C and Borland C Builder examples c_include Header files c_lib COFF format import libraries config_files Example VHDL object code for reconfigurable I Packs docs User s manual DLL references application notes labview LabVIEW 6i and 7 examples examples redist Carrier INF file kernel drivers DLLs and ActiveX control files utility IPEnum utility vb_examples isual Basic 6 and NET
16. ble bit 4 The carrier ISR identifies pending IP interrupts in slot order A E Steps 2 and 3 are repeated for each interrupting IP module If all IPXXX ISRs have returned True the carrier ISR re enables the IP Module Interrupt Enable bit Note that the carrier ISR will not re enable the carrier s IP Module Interrupt Enable bit if an interrupting IP module is using an ActiveX event handler to override the IP DLL s default ISR This is because the event handler does not execute synchronously with the carrier ISR Acromag Inc Tel 248 624 1541 Fax 248 624 9234 Email sales acromag com http AWwww acromag com 1 3 IP Win32 Driver Software User s Manual IPSW API WIN CALLBACK FUNCTIONS Callback functions are supported in C C and Visual Basic NET When using the callback mechanism your application defines a function that the IP DLL will call from its internal interrupt service routine The format of this function must exactly match that expected by the DLL This format is hardware specific and is given in the IPXXX SetUserCallback topic in the IP module s Function Reference document This format however will be some variation of the following C void _stdcall ISR short Handle WORD Status VB7 Sub ISR ByVal Handle As Short ByVal Status As Short The Handle argument identifies the IP module that caused the interrupt If the function is not overriding the internal ISR the Status variable s will contain data allowing you
17. d by serial communication functions if an expected handshake signal was not received Acromag Inc Tel 248 624 1541 Fax 248 624 9234 Email sales acromag com http AWwww acromag com 1 1 IP Win32 Driver Software User s Manual IPSW API WIN Sequence of Operations Although each IP module has its own DLL with unique functions all IP modules are accessed in the following manner 1 Open a connection to the carrier where the IP module is installed by calling A86 Open This function provides an integer carrier handle that is used in all subsequent carrier function calls 2 Open connections to one or more IP modules on the carrier by calling the corresponding IPXXX Open functions IPXXX Open receives the carrier handle and carrier slot letter and provides an IP module handle that is used in subsequent function calls to that module 3 Optional Setup a callback function or ActiveX event notification for each IP that supports interrupts Callback functions and event notifications are mutually exclusive 4 Optional Enable the generation of IP module interrupts by calling A86 SetlpInterrupts 5 Implement your application logic using the carrier and IP module hardware access function calls Prior to terminating the application 6 Call DisablelPEvents for each IP module using ActiveX event notifications 7 Close each IP connection by calling IPXXX_Close 8 Close the carrier connection by calling A86_Close These steps are summa
18. d from IPxxx Open and the IP s Model Code Set the method s Replace parameter to indicate whether your event handler should override the DLL s internal ISR 3 In many cases the PCI Event control can fire two types of events for the same interrupt condition One type will pass argument s such as the value of a status register which can be inspected to determine the interrupt source The other type of event does not pass any arguments The source of the interrupt can be determined from the event name For example if interrupt conditions are sensed on input channels 0 and 6 of an IP408 the control will fire Bit 0 Bit6 and PCIEvent 1w 0x41 Consult the DLL s Function Reference document to determine which events can be fired for your hardware In general applications will include just one of the handlers for a given interrupt condition Which handlers you choose to implement will depend on the nature of your application 4 If the event handler was configured to override the IP DLL s internal ISR the handler should call A86_Set IpInterrupts to re enable the carriers IP Module Interrupt Enable bit after servicing the interrupt 5 Call DisableIPEvents to disassociate the control from a board prior to calling IPXXX Close to close the module Acromag Inc Tel 248 624 1541 Fax 248 624 9234 Email sales acromag com http AWwww acromag com 1 5 IP Win32 Driver Software User s Manual IPSW API WIN SYNCHRONIZATION The DLL s interru
19. d to the application directory with the program executable This is the preferred location when running a single executable However if several applications will be simultaneously sharing a carrier or IP DLL it is recommended that the DLL be placed in acommon directory This allows the shared DLL to properly track which boards are in use In order for the operating system to find a DLL its location must be part of the Windows search order The normal search order is as follows The directory of the executable file The current directory The Windows system directory The Windows directory The directories listed in the PATH environment variable oP ONS The easiest solution to sharing a DLL is to place it in the Windows or Windows system directory However many applications store DLLs in these directories so using these locations creates the most risk for DLL conflict issues The technique used by the IPSW API WIN installer is to append the common DLL directory typically C Program Files Acromag IPSW_API_WIN redist to the PATH environment variable This allows the appropriate DLL to be located when running each example project MODIFYING THE PATH SETTING Use the following steps if you wish to modify the PATH setting on a target machine Microsoft Windows 2000 and XP 1 Select Start Settings Control Panel and double click System 2 Select the Advanced tab and then click the Environment Variables button 3 Locate Path in th
20. e en event occurs ARR AA EES Reg a or queue is destroyed 7 f eS Hi ie Dee a Fi ma dl p gt status rror status is true when n Ee In the example above the two Wait On ActiveX Event while loops execute as long as the Run button is activated When the button is deactivated both event queues are destroyed The upper Wait On ActiveX Event VI is used to monitor an event that returns a status variable When an event occurs the VI returns the event data as a cluster The parameter data and names are then unbundled as an array Next the parameter data is extracted from the array and converted from variant to integer data Finally the status value is displayed in an indicator on the front panel The lower Wait On ActiveX Event VI is used to monitor BitO events The VI s timed out terminal returns false when an event occurs or the event queue is destroyed If the error status is also false a BitO event indicator is incremented on the front panel The error status is set to true when the event queue is destroyed Acromag Inc Tel 248 624 1541 Fax 248 624 9234 Email sales acromag com http AWwww acromag com 26 IP Win32 Driver Software User s Manual IPSW API WIN Working with ActiveX Events LabVIEW 7 The PCI Event ActiveX control fires events when an interrupt occurs in the control s corresponding IP module This section outlines how to register a VI to be called when a specific ActiveX event occurs
21. e User Variables or System Variables The PATH is a series of one or more directories separated by semicolons 4 Edit the variable by appending the path to the common DLL directory to the right of the existing value 5 Click OK Microsoft Windows 98 and Me Select Start and then click Run In the Open box type msconfig and then click OK In the System Configuration Utility window click the Autoexec bat tab 98 or Environment tab Me 4 Click the PATH line click Edit and append the path to the common DLL directory to the right of the existing value 5 Click OK 6 Reboot the PC for the new value to take effect ON gt Acromag Inc Tel 248 624 1541 Fax 248 624 9234 Email sales acromag com http AWwww acromag com
22. e User s Manual IPSW API WIN Visual Basic VISUAL BASIC 6 The steps to create an application using Visual Basic 6 are as follows 1 Open a new or existing VB6 project 2 Add the files containing the DLL function prototypes APC86xx bas IPXXX bas and the error code constants IPErrorCodes bas to the project To do this select Project Add Module from the menu click on the Existing tab and select the desired files The following steps are necessary if you will be using the ActiveX control for event notifications Skip to step 8 if you are not using the control 3 Add the ActiveX control to the Toolbox by selecting Project Components from the menu and checking PClEvent Control on the Components tab of the property sheet Click OK to close the property sheet An icon for the control will appear on the toolbox 4 Double click on the PCI Events icon to add the control to your projects form 5 Select the control on the form and note the name assigned to the control in the Properties Window e g PClEvent1 6 Use this name within your code to access the methods for the control For example Dim Status As Integer Status PCIEvent1 FnableIPEvents Handle amp H3 0 7 To create an event handler select the name of the control in the code window s Object menu and then select the event of interest from the procedure menu This adds a handler to your code that will be invoked each time the event occurs 8 Run
23. ection handle Dim gch As GCHandle Note If the editor indicates GCHand e is an undefined type add Imports System Runtime InteropServices to the top of the source file The DLL will store the delegate passed to it for later use Since the DLL is unmanaged code it is necessary to manually prevent garbage collection of the delegate until the DLL is through with it 6 Include the following statements prior to the call to IPXXX_SetUserCallback Dim dlg As IPXXX_ISRDelegate defined in IPXXX vb dlg AddressOf ISR assign delegate to callback function gch GCHandle Alloc dlg protect the delegate from garbage collection 7 Now notify the DLL that it should invoke the callback IPXXX SetUserCallback IpHandle dlg fReplace Acromag Inc Tel 248 624 1541 Fax 248 624 9234 Email sales acromag com http www acromag com 2 1 IP Win32 Driver Software User s Manual IPSW API WIN 8 At the end of your program remember to free the garbage collection handle IPXXX Close ipHandle A86 Close CarrierHandle gch Free 9 Build your application Acromag Inc Tel 248 624 1541 Fax 248 624 9234 Email sales acromag com http AWwww acromag com 22 IP Win32 Driver Software User s Manual IPSW API WIN LabVIEW The steps to create an application using LabVIEW 6i or 7 are as follows 1 Oo Open a new or existing VI In LabVIEW DLL functions are called using Call Library Function nodes The following steps
24. form IPXXX dll where XXX refers to the IP module s model number Each DLL is written in C and contains functions using the _ stdcall calling convention For each DLL there is a corresponding Function Reference document that describes the functions provided by the DLL in detail PCI Event ActiveX Control The PCI Event ActiveX control PCIEvent ocx may be used for interrupt notification and processing in environments that do not support callback functions LabVIEW or where there are complications implementing thread safe code versions of Visual Basic prior to Visual Basic NET In addition to the OCX file there is also a type library file PClEvent tlb Some development environments use this file to obtain information about the control s methods and events Acromag Inc Tel 248 624 1541 Fax 248 624 9234 Email sales acromag com http AWwww acromag com 29 IP Win32 Driver Software User s Manual IPSW API WIN Redistribution Requirements When developing an application that utilizes the driver software the following files must be installed on the target machine Windows 98 Me Files e Your application program e The carrier DLL and all DLL s corresponding to the IP modules you are using These are typically installed in your application s directory e The Microsoft C Runtime Library msvcr71 dll This file is typically installed in your application s directory e Inthe windows system directory Driverx vxd Windows 2000
25. from the DLL functions and ActiveX control methods Please note the return code of any failing functions if you should need to contact Acromag for technical support Mnemonic Description Operation Successful Value Pee nee handle Applies to most IP DLL functions occur if the carrier is in use by another application 3 E NEWDEV Returned by 286 Open if an error occurred creating a software instance of the device Returned by 4286 Open if an error occurred connecting to the carrier This will occur if the specified card number is invalid or if the kernel mode drivers are not properly installed or configured Returned by A86 Open or if an error occurred mapping the devices physical memory into the virtural address space the interrupt service routine thread interrupt support for the carrier Returned by 286 Open or IPXXX_Open if an attempt is made to have more than 255 carriers or I Packs simultaneously open E BAD PARAM Returned by a function if it received an invalid parameter This typically means the parameter was outside of the expected range or the function received a NULL pointer Consult the individual function descriptions for other possible reasons for this error Returned by a function if there was insufficient memory to created a required data structure or carry out an operation E OCX IN USE Returned by the ActiveX method EnableIPxXXEvents if the control is already configured for use by another PCI modu
26. ire the ActiveX control added previously to the refnum input on the node as shown below PCIEVENTLib PCIEvent wb PClEvent p Method 3 Right click on Methods to display a pop up menu and select the desired method from the Methods sub menu The node will now show this method along with entries for its parameters PCIEVENTLib PCIEvent D wb PClEvent p Acromag Inc Tel 248 624 1541 Fax 248 624 9234 Email sales acromag com http www acromag com 24 IP Win32 Driver Software User s Manual IPSW API WIN 4 Wire parameters constants type compatible controls and variables to the left side of the node Return values are wired to right of the method name PCIEYENTLib PCIEvent Suk PClEvent p b Working with ActiveX Events LabVIEW 6i The PCI Event ActiveX control fires events when an interrupt occurs in the control s corresponding IP module This section outlines how to monitor and respond to ActiveX events within the VI 1 Select Create ActiveX Event Queue vi from the Functions Communication ActiveX ActiveX Events subpalette and then click within the block diagram 2 Wire the previously added ActiveX control to the refnum input on the node 3 Locate and right click on the Event Name terminal Select Create Constant and type in the name of the event to monitor This name can be obtained from the PCI module s Function Reference document The name is case sensitive The diagram should look as f
27. le 1 1 12 E DLL LOAD Returned by ActiveX methods if the IPXXX DLL can not be loaded 1 1 4 1 5 7 0 1 3 Returned by 486_ReadConfigReg if an error occurred while reading data from the device s PCI configuration space 4 used by this function do not represent a valid configuration 6 17 Indicates an error occurred accessing a user defined data buffer E EX DESIGN Some DLL functions for reconfigurable Acromag IP pad modules will return this error if the IP is not configured with Acromag example design Returned if the hardware does not support the function For example not all carriers support 32MHz operation Acromag Inc Tel 248 624 1541 Fax 248 624 9234 Email sales acromag com http AWwww acromag com 1 a 26 29 1 0 IP Win32 Driver Software User s Manual IPSW API WIN E CHECKSUM Returned if a checksum mismatch is detected 40 E INVALID CRHNDL Returned if no IP carrier is associated with the specified handle Applies to most IP carrier DLL functions E EMPTY SLOT Returned by carrier and IP module functions if the specified carrier slot does not contain an I Pack Note that this error is also returned if a specified slot letter falls in the range C E but exceeds the number of slots found on the model of carrier being accessed 42 E SLOT IN USE Returned by IPXXX Open if the IP in the specified carrier slot is already open slot is not a model supported by this DLL Returne
28. n of the ActiveX control See Callback Functions and PCI Event ActiveX Control When an interrupt occurs the following sequence of events takes place 1 The kernel level driver disables the carriers IP Module Interrupt Enable bit and signals the carrier DLL s internal interrupt service routine ISR 2 The carrier ISR identifies the IP with pending interrupts and calls the device specific ISR in the corresponding IPXXX DLL 3 At this point four things can happen f no callback or event notification was configured the IPXXX ISR simply processes the interrupt and returns a True value to the carrier ISR If a callback function or event notification was configured but should not override the internal ISR the internal IPXXX ISR processes the interrupt invokes the callback or notifies the ActiveX control to fire an event and returns a True value to the carrier ISR If a callback function was configured to override the internal IPXXX ISR the ISR invokes the callback rather than process the interrupt and then returns a True value to the carrier ISR It is the responsibility of the callback function to process the IP interrupt f an ActiveX event notification was configured to override the internal IPXXX ISR the ISR notifies the ActiveX control to fire an event and returns False without processing the interrupt It is the responsibility of the event handler to process the IP interrupt and re enable the carrier s IP Module Interrupt Ena
29. ollows PCIEVENTLib PCIEvent PCIEventiw 4 Select Wait On ActiveX Event vi from the ActiveX Events subpalette and add the VI to the diagram Wire the Event Queue terminals of the two VIs together Locate the ms timeout 1 terminal and add a constant to indicate the number of milliseconds the VI will wait for the event before timing out A value of 1 means wait indefinitely The output wiring from the VI will depend on if the selected event passes an argument or not If the event passes arguments wire the Event Data terminal otherwise wire the timed out terminal See complete example at the end of this section PCIEVENTLib PCIEvent Acromag Inc Tel 248 624 1541 Fax 248 624 9234 Email sales acromag com http www acromag com 25 IP Win32 Driver Software User s Manual IPSW API WIN 5 Select Destroy ActiveX Event Queue vi for the ActiveX Events subpalette and add the VI to the diagram Wire the VI s Event Queue terminal to the Event Queue out terminal of the Wait On ActiveX Event VI In the completed example a control structure is used to determine when this VI executes See the complete example at the end of this section PCIEVENTLib PCIEvent 6 Below is acomplete block diagram showing the processing of events that do PClEvent1w and do not Bit0 pass arguments CO PCIEventiw Ka i Dy ParamData Interrupt Status aoa PH O _ s _ aa goer n E d ime out is Fals
30. outline how to add and configure one of these nodes Select Call Library Function from the Functions Advanced subpalette and then click within the block diagram Right click on the node and select Configure This opens the Call Library Function configuration dialog Click the Browse button and locate the desired DLL within the Windows System WINNT system32 or Windows system32 directory When finished the name of the DLL will be displayed in the Library Name or Path field Setting the Library Name in this manner automatically populates the Function Name Combobox Select the desired function from the Function Name Combobox Set the Calling Conventions to stdcall WINAPI Leave the menu below the Browse button set to Run in Ul Thread unless you plan on using the IsrSynch functions to make your DLL function calls thread safe Configure the return type as Numeric Signed 16 bit Integer Add and configure additional parameters until the Function Prototype field matches the LabVIEW syntax listed for the function in the DLL s Function Reference guide An example of a finished Call Library Function configuration dialog is shown below gt Call Library Function E Bi Library Name or Path aaa Browse Function Name IP408_0pen Run in UI Thread Calling Conventions stdcall WINAPI Parameter Handle E z Type Numeric Add a Parameter Before Data Type Signed 16 bit Integer Add a Parameter After Pass Pointer to v
31. pt service routine ISR executes on a different thread than that of your application Within the DLL the ISR which includes the call to any callback function is delimited as a device critical section IPXXX StartIsrSynch and IPXXX EndIsrSynch can be used to synchronize other application threads with the ISR thread DLLs for Acromag IP modules that do support interrupts also provide these functions to support the synchronization of hardware access by multiple threads within an application Bracketing a section of code between calls of IPXxxx StartIsrSynch and IPXXX_EndIsrSynch defines that code as a device critical section Two threads within a single process cannot execute critical section code simultaneously IPXXX StartIsrSynch should be called by your application before it attempts to access data or device memory that can be accessed by another thread Remember to call TPXXxX_EndIsrSynch when finished accessing these shared resources Code in an ActiveX event handler function is not automatically defined as a critical section If desired IPXXX_StartIsrSynchand IPXXX EndIsrSynch may be used to bracket this code and synchronize its execution with your application BASE ADDRESS POINTERS Each IP DLL provides a function that returns the base address of the user mode mapping of the IP module s I O space C and C programmers can cast the returned value to a byte pointer and access memory using normal pointer mechanisms This method can be used
32. rized in the diagram below IPXXX_Open IPXXX_SetUserCallback PClEvent EnablelPEvents A86 Setlplnterrupts IPXXX Hardware Access Function Calls E PClEvent DisablelPEvents IPXXX_Close A86_Close Acromag Inc Tel 248 624 1541 Fax 248 624 9234 Email sales acromag com http AWwww acromag com 1 2 IP Win32 Driver Software User s Manual IPSW API WIN Interrupts IP Win32 Driver Software provides two mechanisms for allowing your application to respond to interrupts generated by an IP module callback functions and ActiveX event notifications These techniques are mutually exclusive An application may implement one or the other for a particular module but not both It is also acceptable for your application to not implement either option In general the mechanism you use will be dictated by your choice of programming language Callback functions are the preferred technique due to lower latency but they are not fully supported by all development environments Each IP DLL that supports interrupts has its own predefined internal interrupt service routine The specifics of each routine are outlined in the IP module s corresponding Function Reference document If you choose to implement a callback function or use ActiveX event notification you have the option of overriding this routine This is done by setting a Replace parameter when designating the callback function or during configuratio
33. tallation nak AA AA aaa 7 Software Installation coi AA NAA a RA AA aan 7 Installed SoftWare ula AA 7 IP Enumeration UN aaah N ARIIN NATA BINA NANANA AGA 7 Software OV GIVI OW aaa ANAN AN AA AA AG 8 Function Format ecoin a NANA BADA AANI Naka 8 Stal s OOd AA AA RAPE 9 SEQUENCE of OperationS AA AA A nnmnnn nnmnnn nnn 11 MterrUpiS Kan a aap Aa ANG Ga AN 12 Callback FUMCUIOINS NG NADA KANA AA 13 PG l Event ActiveX contiol csccccciissescestsenssastacancasddsaadadnoadadsasuteensasauead sa cdudcasaseaadausasdcanicaedins 14 Synchronization iseen eeaeee adet dace tetee dante cece AA LANG 15 Base Address Po intelS mi AA BANA AA aa AG 15 Building Windows Applications cccccceesseseeeeeeeeeeeeeeeeeeeeeeeneeeeeeeeeeeeneees 16 G Cease AA AA 17 Microsoft Visual C tO 2ds kwan NGANGA AA NAA NAAN 17 Microsoft Visual G NE P ccssessiisasssssssnnsnssasdeasnascvansesdadensnedsaasceassdesveastacevesetceavecdsauaveneveentane 17 Borland C44 Builder ssccciec NA NAAANINAG 18 Visual BASIC iiss aan ANN NAG NA NENA NANG ANNA TA NGANGA 19 Visual Basi O O aa Zoswcscaceccsscdvnsceecucdusseshvecivacandeveswovencesons desuuauuctscsessdiecdededndusentcsceecasdeses 19 Misal Basie NE aaa Aa aa AA as 20 IG LA AA AA AA AA AA AA AE 22 Distribution BES ia AA nnna 28 Ke rnel MOdE driv lS ses cccsciccssscccisceasccscsscecasdeasatecaacceastecavansanstucaietedsscuaatesdeusnviueeteasais 28 Windows 32 DELS AA NAA jae nsbnunivnntnswoddetienditasandecasednaccannixenas
34. to determine the cause of the interrupt e g the value read from a status register by the internal ISR If the function is overriding the internal ISR the Status variable s will be zero since the internal ISR did not read any registers prior to invoking the callback function Acromag Inc Tel 248 624 1541 Fax 248 624 9234 Email sales acromag com http AWwww acromag com 1 4 IP Win32 Driver Software User s Manual IPSW API WIN PCI EVENT ACTIVEX CONTROL The PCI Event ActiveX control PCIEvent ocx may be used for interrupt notification and processing in environments that do not support callback functions LabVIEW or where there are complications implementing thread safe code versions of Visual Basic prior to Visual Basic NET Note Although the ActiveX control may also be used in Visual Basic NET VB7 and windowed C C applications the callback approach is recommended due to its lower latency Instructions on adding the ActiveX control to an application and defining event handlers is deferred until the Visual Basic 6 and LabVIEW topics of the Building Windows Applications section The general rules for using the control however are as follows 1 The PCI Event control can only be associated with one IP module at a time Add one control to the application for each IP module you wish to receive interrupt notifications from 2 To associate the control with a board call the ActiveX method EnableIPEvents passing the IP handle receive

Download Pdf Manuals

image

Related Search

Related Contents

JM20, JM25, JM30, JM20E, JM25E, JM30E  Vespa – RFPulse User Manual and Reference - VeSPA  Grues de chargement installées sur véhicules porteurs  OM, Gardena, Pompe universelle, Art 01471-20, 2002-12  T0468 Perio Mate 注意書_141120.ai  Zone Terminal - Viking Controls, Inc.  公示_台湾において情報処理機器の安全規制  Guide de mise en route rapide  Istruzioni d`uso Bilance di precisione XP Excellence Plus  P520 Users Manual - Zebra Technologies Corporation  

Copyright © All rights reserved.
Failed to retrieve file