background image

USING THE SDK ON WINDOWS 2000/XP

PCI-AC51 User’s Guide

14

Porting Programs Developed with the Older SDK (Using 
OptoPM32.dll) to Windows 7 and Vista

Programs developed previously with the older OptoPM32.dll SDK will not work with Windows 7 or 
Vista due to an incompatibility at the driver level of these operating systems. If you want to convert 
your existing program to work on Windows 7 or Windows Vista, follow these steps:

1.

Copy the files from the existing application to the Windows 7 or Vista computer.

2.

Install the PCI-AC51 SDK on the same computer.

The setup program will install the appropriate files and driver for the target operating system.

3.

Use the files in the directory listed below based on the target operating system:

For 64-bit Windows 7 or Vista
C:\Program Files\Opto22\PCI-AC51\Legacy-OptoPM32\FilesFor32BitAppsOn64BitSystems

For 32-bit Windows 7 or Vista
C:\Program Files\Opto22\PCI-AC51\Legacy-OptoPM32\FilesFor32BitAppsOn32BitSystems

4.

(For Development) If you want to compile the old program on Windows 7 or Vista, use the files 
as follows. If you just want to run the old program, skip to the next step.

OptoPM32.h – Include this file in your existing application.

OptoPM32.lib – Link this file into your existing application.

5.

(For Deployment) To run the old program on Windows 7 or Vista, use the files as follows.

OptoPM32.dll – Put this file in the same directory as your application.

wdapi1031.dll – Put this file in the same directory as your application.

NOTE for VB Applications: Be sure to register any OCX files. For example, to register the file, 
COMCT232.OCX, open a command prompt with “run as administrator” permissions. Navigate to the 
directory where COMCT232.OCX resides, type regsvr32 COMCT32.OCX, then press Enter. If successful, 
a dialog box will notify you.

Using the SDK on Windows 2000/XP

Use this section if you have Windows 2000/XP. If you are using the SDK for Windows 7 or Vista, see 

“Using the SDK on Windows 7 and Vista” on page 9

.

This section shows you what’s in this version of the PCI-AC51 SDK and how to use it to simplify 
application development with the PCI-AC51 adapter card.

NOTE: If you are migrating current applications to use with the newer PCI card, also see 

Appendix C: 

Converting Applications to the PCI-AC51

.

This version of the SDK runs in 32-bit Windows XP as well the 32-bit version of Windows 2000. The 
SDK supports Microsoft Visual Basic (version 6) and Microsoft Visual C++ (version 6).

SDK Contents

The PCI-AC51 SDK includes a driver, sample applications, and tools to help you develop applications 
for the PCI-AC51 adapter card and integrate it with your system. The driver saves you time and effort 

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

Страница 1: ...siness Park Drive Temecula CA 92590 3614 Phone 800 321 OPTO 6786 or 951 695 3000 Fax 800 832 OPTO 6786 or 951 695 2712 www opto22 com Product Support Services 800 TEK OPTO 835 6786 or 951 695 3080 Fax 951 695 3017 Email support opto22 com Web support opto22 com ...

Страница 2: ...1142245 French Patent No 1142245 British Patent No 1142245 Japanese Patent No 2002535925A German Patent No 60011224 Opto 22 FactoryFloor Optomux and Pamux are registered trademarks of Opto 22 Generation 4 ioControl ioDisplay ioManager ioProject ioUtilities mistic Nvio Nvio net Web Portal OptoConnect OptoControl OptoDataLink OptoDisplay OptoEMU OptoEMU Sensor OptoEMU Server OptoOPCServer OptoScript...

Страница 3: ...Windows 7 and Vista 14 Using the SDK on Windows 2000 XP 14 SDK Contents 14 Pamux Functions 15 Required Function Calls 15 Naming Conventions 15 Banks and Points 15 Common Function Parameters and Return Values 15 Developing an I O Application 16 Special Directions for Visual Basic Programmers 16 Special Directions for Visual C Programmers 16 Function Reference for Windows 2000 XP 17 PCI AC51 Operati...

Страница 4: ...35 Converting Applications that Use Inp and Outp 35 Appendix D PCI AC51 Technical Reference 37 Architecture 38 PCI Identification 38 PCI Base Address Configuration 38 BAR1 Register Table 38 Register Description 39 Powerup Conditions 40 Controlling the Reset Line 40 Controlling the Reset Line Using the Pamux Driver 40 Controlling the Reset Line When Not Using the Pamux Driver 40 Default Power Up St...

Страница 5: ...ss up to 32 remote brains Each Pamux bus supports up to 512 points Free with these adapter cards is the PCI AC51 Pamux SDK included on the CD that came with the card and also available on our website www opto22 com The PCI AC51 Pamux SDK supports up to 32 PCI AC51 adapter cards This file includes two SDKs Windows 7 and Vista operating systems samples source code and the driver This SDK supports C ...

Страница 6: ...the PCI AC51 adapter card It also shows the location and function of the card s LEDs Appendix C Converting Applications to the PCI AC51 describes how to convert applications that used the AC28 and PCI AC28 adapter cards Appendix D PCI AC51 Technical Reference provides technical information for authoring a device driver for an unsupported operating system or a Windows kernel mode driver For Help If...

Страница 7: ...CHAPTER 1 INTRODUCTION PCI AC51 User s Guide 3 3 third party devices installed for example barcode readers Software and version being used Specific error messages and or numbers seen ...

Страница 8: ...FOR HELP PCI AC51 User s Guide 4 ...

Страница 9: ...e you install the SDK software The PCI AC51 adapter card installs into any PCI expansion slot of a computer Note the power requirements listed in the Specifications table on page 32 1 Turn off the computer Remove the power cord and the computer s cover The power cord must be removed as a sudden spike may cause the computer to boot 2 Before handling the card discharge excess static electricity by t...

Страница 10: ...ed by the BIOS when the card is installed If you are using Windows Vista or an earlier version of Windows and a Found New Hardware message appears simply click Cancel The setup program will install the device driver automatically If you have been using an AC28 adapter card for the ISA bus you will need to make some changes to your application because of the new PCI adapter card See Appendix C Conv...

Страница 11: ...dapter cards Running the SDK Setup Program The PCI AC51 SDK comes on a CD with the card If you do not have the CD you can order it through Product Support or you can download the SDK free from our website www opto22 com This PCI AC51 Pamux SDK includes a sample application Windows drivers and user documentation NOTE If you are using a different operating system or a non PC hardware platform you wi...

Страница 12: ...UP PROGRAM PCI AC51 User s Guide 8 There is a 64 bit version and a 32 bit version for Windows 7 and Vista 4 If a Windows Security dialog box appears click the Run or Install button to continue Select the operating system ...

Страница 13: ...cture The SDK supports C VB NET and other NET languages NOTE Version 2 0 and higher support only the PCI AC51 not the AC28 and PCI AC28 adapter cards Using the PamScan Utility The PamScan utility is available on the Windows Start menu It demonstrates turning digital points on and off and configuring points as either input or output In addition analog point values can be displayed and output values...

Страница 14: ...result on the card s LEDs The program flashes the LEDs five times If no flashing occurs you may have selected the wrong card Select the next card in the list and click the Flash LEDs button again 6 Click OK to close the dialog box In the PamScan graphical user interface GUI click Open PCI AC51 This screen shows all four banks available on a 32 channel Pamux board Each bank has eight I O points and...

Страница 15: ...ank s address on the mounting rack In the following example 5 is entered as the address to match the address on the mounting rack 8 Select the I O type either Analog or Digital 9 For output modules select each point that is an output then click Configure Selected Points As Outputs The first bank on the attached rack has an address of 0 Match the bank s address on the rack Select the I O type ...

Страница 16: ... selected click Turn Selected Output Points On Notice that the selected output points change from Off to On 11 Continue to experiment as you like with selecting points configuring points as inputs or outputs and turning points on and off Developing an I O Application Your application should include the following basic steps Select outputs Click here Theselectedpoints change to Output Click here Th...

Страница 17: ...oints using the WriteConfig function Inspect the error code from the configuration function 5 Start an application loop that continuously reads or writes points At the same time continue to inspect the error codes from the PCIAC51 dll 6 When the application loop is complete call ReleaseCard to close the card properly Function Reference for Windows 7 and Vista The function reference for the Windows...

Страница 18: ...your existing application 5 For Deployment To run the old program on Windows 7 or Vista use the files as follows OptoPM32 dll Put this file in the same directory as your application wdapi1031 dll Put this file in the same directory as your application NOTE for VB Applications Be sure to register any OCX files For example to register the file COMCT232 OCX open a command prompt with run as administr...

Страница 19: ...re PamuxDigPoint the object is first and Read the operation follows Utility functions provided primarily for Visual Basic start with PamuxUtil Example PamuxUtilBitEqual Specific PCI AC51 functions start with PamuxPCI Banks and Points Some I O points can be addressed in multiple ways A 16 channel I O board has two banks Point 0 the first point is accessed using a bank number of 0 and a point number...

Страница 20: ...L 5 When the application loop is complete close the handle to the board using PamuxPCICardClose Special Directions for Visual Basic Programmers Include the OptoPM32 bas file as a module in your project This file includes subroutine declarations function declarations and access paths to the OptoPM32 dll These files may be found in the SDK under Vb VB dll header Special Directions for Visual C Progr...

Страница 21: ... card phHandle gets a handle BoardID is the PCI AC51 ID The first PCI AC51 is at ID 0 ResetLevel 1 high reset 0 low reset Set the reset level to match the reset level configured on the Pamux brains This function does not reset the Pamux bus long BoardID long ResetLevel long PamuxPCICardClose long hHandle Releases the handle to the PCI AC51 and turns on LEDs 1 and 2 long PamuxCardReset long hHandle...

Страница 22: ...ter in PamuxDig BankConfig indicates how many banks to configure Byte Qty 4 for 32 points long Bank long OutputMask long Byte Qty long PamuxDigBank16Config long hHandle long Bank long OutputMask long PamuxDigBank32Config long hHandle long Bank long OutputMask long PamuxDigBankRead long int hHandle Reads inputs and outputs and places the result in pData Use PamuxDig BankRead for reading eight point...

Страница 23: ...he value in pData The value is either 1 for on or 0 for off long Bank long Point long pData long PamuxDigPointWrite long hHandle Writes to a point using the value in Data A non zero value for Data turns the point on long Bank long Point long Data Note for Visual Basic users indicates a by reference argument Function Type Function Parameter Type Parameter Description long PamuxDigIoPortGet long hHa...

Страница 24: ...long PamuxAnaBank16Write long hHandle Writes values to a bank of analog points channel 0 value in element 0 long Bank long DataArray16 Note for Visual Basic users indicates a by reference argument Function Type Function Parameter Type Parameter Description long PamuxAnaPointConfig long hHandle Configures an analog point as either an input or output A non zero value to bOutput configures the point ...

Страница 25: ...reset the watchdog error flag if it has tripped This and any other ana log function can be used to tickle the watchdog to prevent it from tripping long Bank long Time100 Note for Visual Basic users indicates a by reference argument Function Type Function Parameter Type Parameter Description long PamuxAnaStatusGetAsError long hHandle Gets an analog board s status and returns an equivalent error Ana...

Страница 26: ... end of the parameter name BitNumber0 serves as a reminder of this fact for anyone looking through the function definitions in either the BAS file or the H header files PamuxUtilBitTest returns true if bit number BitNumber0 in Data is set long BitNumber0 long bBitValue void PamuxUtilBitSet long pData long BitNumber0 void PamuxUtilBitClr long pData long BitNumber0 long PamuxUtilBitTest long Data lo...

Страница 27: ...n 0 and FFF hex 4 095 decimal These values typically correspond to engineering units such as pH and psi For example to convert raw counts from 0 to FFF hex to a percentage use float fPercent PamuxUtilScaleI2F 0 0xFFF 0 0 100 0 RawCount long X2 long Y1 long Y2 long Xin float PamuxUtilScaleI2F long X1 long X2 float Y1 float Y2 long Xin float PamuxUtilScaleF2F float X1 float X2 float Y1 float Y2 floa...

Страница 28: ...the reset line is LOW 0 VDC The reset line is considered to be HIGH when the voltage on the reset line is HIGH 3 5 to 5 0 VDC Brain Reset Configuration Active HIGH and Active LOW Each Pamux brain has a jumper to configure whether the brain will reset when the reset line is HIGH or LOW This is referred to as reset Active HIGH or reset Active LOW If the brains are jumpered for reset Active HIGH then...

Страница 29: ... to 32 PCI AC51 cards to be used Only a single handle to a card is permitted If you use a multiple threaded application implement a mutex on the handle to avoid thread collision If multiple applications are required to access the hardware another application is required to synchronize the access Multiple applications cannot access the PCI AC51s simultaneously ...

Страница 30: ...SPECIAL PRECAUTIONS FOR THE SOFTWARE DEVELOPER PCI AC51 User s Guide 26 ...

Страница 31: ...n Remedy 0 0x0000 No Error Occurred Not an error 8192 0x2000 Invalid Handle The handle that was passed to the OptoPM32 DLL is invalid The handle may represent a closed handle or the value of the handle may be corrupted Inspect when the handle flaw is first detected and ensure that the handle was allocated with a successful open Also trace a sudden change in the value of the handle The handle shoul...

Страница 32: ... This may represent corruption of the handle failure to success fully open the handle or a PamuxPCICardClose may have been previously executed on this handle 8205 0x200D A handle number out of range tried to be used The handle submitted is invalid as it is beyond the number of handles the OptoPM32 DLL supports Inspect the han dle for corruption Also validate that the handle number does not change ...

Страница 33: ...requested PCI board doesn t exist or the device layer is improp erly configured With a DOS prompt box try the command wdreg install If this command fails reinstall the SDK Otherwise call Prod uct Support 8390 0x20C6 The PCI board failed to register with the PCI BIOS Try on a system with a newer PCI BIOS or see if the manu facturer has a PCI BIOS or BIOS ugrade for the system Code Decimal Code Hex ...

Страница 34: ...ERROR CODES FOR WINDOWS 2000 XP PCI AC51 User s Guide 30 ...

Страница 35: ...e location and function of the card s LEDs System Requirements Here s what you need to install and run the software provided for the PCI AC51 A computer with x86 compatible processor 1 GHz or higher The most recent version of BIOS must be installed Microsoft Windows 7 Professional 32 bit or 64 bit Windows Vista Business 32 bit or Windows XP Professional 32 bit with Service Pack 2 or higher ...

Страница 36: ...bit 33 MHz PCI bus SDK compatibility Microsoft Windows 2000 XP supports Visual Basic 6 and Visual C 6 Windows 7 and Vista 32 bit and 64 bit supports C VB NET and other NET languages PCI compliance PCI Specification Revision 2 2 Opto 22 brain compatibility B4 B5 B6 SNAP B4 SNAP B6 LEDs Four indicating board access reset level read and write Operating temperature 0 to 70 C Storage temperature 30 to ...

Страница 37: ...he state of the reset line which can be either High or Low On High LED2 Blinks when the PCI AC51 is accessed LED3 Blinks when a Pamux write is executed LED4 Blinks when a Pamux read is executed NOTE IfthePCI AC51israpidlyorcontinuallyaccessed theblinkingindicatorsmayappeartostickon will not blink This is normal LED 1 Reset line state On High LED 2 Hardware accessed LED 3 Write LED 4 Read ...

Страница 38: ...LEDS PCI AC51 User s Guide 34 ...

Страница 39: ...erting Applications that Use Inp and Outp This PCI SDK library provides a consistent application code model for Windows 2000 and Windows XP operating systems Inp and Outp function calls at the user level are unsupported because of the Windows hardware abstraction layer The PCI AC51 interfaces to the existing Pamux interface by mimicking the 50 wire IDC connector and the Pamux timing interface The ...

Страница 40: ...CONVERTING APPLICATIONS THAT USE INP AND OUTP PCI AC51 User s Guide 36 ...

Страница 41: ...you use this information at your own risk Opto 22 does not support any kernel layer or drivers other than those we provide In this appendix Architecture page 38 PCI Identification page 38 PCI Base Address Configuration page 38 Register Description page 39 Powerup Conditions page 40 Controlling the Reset Line page 40 DIP Switches page 41 Strobe Duration page 42 High and Low Latency Modes page 42 Pe...

Страница 42: ...ddress Register 1 BAR1 is memory mapped It is configured as a 16 consecutive byte only array Only the first 7 bytes are used Accessing unmapped registers may cause the computer to bus lock BAR1 Register Table An X indicates that data is ignored Offset Direction Name Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0 0x00 R Reset Status Register Reset Busy X X X X X X Reset Level 0x00 W Reset Control ...

Страница 43: ...lds the data that was read from the Pamux brain Start Read Register 0x03 A read initiates a Pamux read bus cycle Reading from this register initiates a Pamux read The bank Address Register must be configured before reading from this register A value of 0xAB is always returned in this register and can be ignored The data read from the Pamux brain is returned in the Data Register Do not access this ...

Страница 44: ... You can also reset the brains in the system and take the brains back out of reset using a single function which does a 150 mSec rest ResetBrainsAndReturnToNormal Controlling the Reset Line When Not Using the Pamux Driver Bit 0 of the Reset Control Register on the PCI AC51 is used to control the reset line When bit 0 is set to 0 the reset line will be HIGH and LED 1 will be ON When bit 0 is set to...

Страница 45: ... establish communication with the PCI AC51 card and brains DIP Switches The PCI AC51 has six DIP switches the DS1 bank The DIP switches may be modified on a system that is powered however the applications that use the PCI AC51 must be stopped A switch in the ON position will read as a zero and OFF will read as a one Switches 1 through 4 are provided for custom implementation One common use will be...

Страница 46: ...ble Performing Pamux Operations Issuing Pamux Reset The PCI AC51 provides a level oriented reset control feature 1 Assert the Pamux Reset by writing a value to the Reset Control Register BAR1 offset 0x00 bit 0 A zero sets the Pamux reset level to low A one sets the Pamux reset level to high 2 Poll the status register and inspect the state of Reset Busy Wait for the bit to negate return to zero The...

Страница 47: ...tten to the register is ignored 5 Read the Status Register BAR1 offset 4 and inspect the Busy Bit Bit 0 If the bit is one a Pamux cycle is in progress Do not modify the Bank Address Register Data Register or the Start Cycle Register while the busy status is asserted Wait until the Busy Bit negates 6 To read the Pamux brain identification read the Status Register BAR1 offset 4 and mask bits 1 and 2...

Страница 48: ...before the next register operation occurs 3 For PCIAC51 dll use Set Slow Mode Delay and Enable Slow Mode to control the timing of operations If you are using the OptoPM32 dll for the PCI AC51 use the Pamux_Set_Slow_Bank_Range function 4 If high speed digital is required use a SNAP B4 and separate the analog and digital I O Alternate Method OptoPM32 dll only Create a text file named o22_pamux_slow_...

Отзывы: