OPTO 22 PCI-AC5 User manual

PCI-AC5, PCIE-AC5, AC5, AND
G4AC5 USER’S GUIDE
Form 1211-170216—February 2017
43044 Business 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

PCI-AC5, PCIe-AC5, AC5, and G4AC5 User’s Guide
ii
PCI-AC5, PCIe-AC5, AC5, and G4AC5 User’s Guide
Form 1211-170216—February 2017
Copyright © 2003–2017 Opto 22.
All rights reserved.
Printed in the United States of America.
The information in this manual has been checked carefully and is believed to be accurate; however, Opto 22 assumes no
responsibility for possible inaccuracies or omissions. Specifications are subject to change without notice.
Opto 22 warrants all of its products to be free from defects in material or workmanship for 30 months from the
manufacturing date code. This warranty is limited to the original cost of the unit only and does not cover installation, labor,
or any other contingent costs. Opto 22 I/O modules and solid-state relays with date codes of 1/96 or newer are guaranteed
for life. This lifetime warranty excludes reed relay, SNAP serial communication modules, SNAP PID modules, and modules
that contain mechanical contacts or switches. Opto 22 does not warrant any product, components, or parts not
manufactured by Opto 22; for these items, the warranty from the original manufacturer applies. Refer to Opto 22 form
1042 for complete warranty information.
Wired+Wireless controllers and brains are licensed under one or more of the following patents: U.S. Patent No(s). 5282222,
RE37802, 6963617; Canadian Patent No. 2064975; European Patent No. 1142245; French Patent No. 1142245; British Patent
No. 1142245; Japanese Patent No. 2002535925A; German Patent No. 60011224.
Opto 22 FactoryFloor, groov, Optomux, and Pamux are registered trademarks of Opto 22. Generation 4, groov Server,
ioControl, ioDisplay, ioManager, ioProject, ioUtilities, mistic, Nvio, Nvio.net Web Portal, OptoConnect, OptoControl,
OptoDataLink, OptoDisplay, OptoEMU, OptoEMU Sensor, OptoEMU Server, OptoOPCServer, OptoScript, OptoServer,
OptoTerminal, OptoUtilities, PAC Control, PAC Display, PAC Manager, PAC Project, PAC Project Basic, PAC Project Professional,
SNAP Ethernet I/O, SNAP I/O, SNAP OEM I/O, SNAP PAC System, SNAP Simple I/O, SNAP Ultimate I/O, and Wired+Wireless
are trademarks of Opto 22.
ActiveX, JScript, Microsoft, MS-DOS, VBScript, Visual Basic, Visual C++, Windows, and Windows Vista are either registered
trademarks or trademarks of Microsoft Corporation in the United States and other countries. Linux is a registered
trademark of Linus Torvalds. ARCNET is a registered trademark of Datapoint Corporation. Modbus is a registered trademark
of Schneider Electric, licensed to the Modbus Organization, Inc. Wiegand is a registered trademark of Sensor Engineering
Corporation. Allen-Bradley, CompactLogix, ControlLogix, MicroLogix, SLC, and RSLogix are either registered trademarks or
trademarks of Rockwell Automation. CIP and EtherNet/IP are trademarks of ODVA. Raspberry Pi is a trademark of the
Raspberry Pi Foundation.
groov includes software developed by the OpenSSL Project for use in the OpenSSL Toolkit. (http://www.openssl.org)
All other brand or product names are trademarks or registered trademarks of their respective companies or organizations.
Opto 22
Automation Made Simple.

PCI-AC5, PCIe-AC5, and AC5 User’s Guide iii
iii
Table of Contents
Chapter 1: Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
PC-Based Direct I/O SDK. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
Prerequisites . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
What’s in this Guide. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
For Help . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
Chapter 2: Installing the Adapter Card . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
Installing the PCI-AC5 and PCIe-AC5 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
Installing the AC5 or G4AC5 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
Configuring Jumpers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
Installing the Card . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
Chapter 3: Installing and Using the SDK . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
Installing the SDK . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
Using the Direct I/O Scan Utility . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
Developing Custom Applications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
Developing the Application . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
Special Considerations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
Building an Application and Driver Installer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
Error Messages and Troubleshooting. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
Troubleshooting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .15
Porting Legacy Applications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
Converting VB Legacy Programs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
Changing Hardware Access . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
Updating Data Sizes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
Function Reference Help File . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
Appendix A: System Specifications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .19
Specifications. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
Connecting Cables. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
Pinouts for Connecting Cables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20

PCI-AC5, PCIe-AC5, and AC5 User’s Guide
iv
Power Supplies. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
Rack Compatibility Information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
Bus and LED Locations. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
PCIe-AC5 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
PCI-AC5 (newer version) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
PCIe-AC5 (older version) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
AC5 and G4AC5 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
Appendix B: Converting Applications to a Newer Card . . . . . . . . . . . . . . . . . . 25
Changing Hardware Access . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
Updating Data Sizes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
Converting Applications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
Migrating 16-bit inp and outp Applications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
Microsoft Visual Basic Applications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
Microsoft Visual C/C++ Applications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
Migrating OptoPMux.dll Applications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
Visual Basic Applications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
Visual C/C++ Applications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
Appendix C: PCIe/PCI-AC5 Hardware Description . . . . . . . . . . . . . . . . . . . . . . . 29
Hardware Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
PCI-AC5/PCIe-AC5 Direct I/O Memory Map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
Register Descriptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
Using the Status Indicators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
Configuring Points . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
Reading On/Off Status . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
Turning Outputs On and Off . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
Appendix D: AC5 and G4AC5 Technical Reference . . . . . . . . . . . . . . . . . . . . . . 33
Hardware Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
AC5/G4AC5 Memory Map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
Configuring Points . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
Reading On/Off Status . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
Turning Outputs On and Off . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34

PCI-AC5, PCIe-AC5, AC5, and G4AC5 User’s Guide
1
1
Chapter 1February 16, 2017 11:14 am
1: Introduction
Opto 22 PCI-AC5, PCIe-AC5, AC5 and G4AC5 adapter cards provide an interface between a PC and
Opto 22 digital input/output (I/O) mounting racks for direct connection to I/O points.
The PCI-AC5 and PCIe-AC5 offer expanded operation and support for modern computers with PCI and
PCIe slots; the AC5 and G4AC5 cards support older computers with ISA slots.
The following table provides a quick look at card features; detailed specifications begin on
page 19
.
PC-Based Direct I/O SDK
For software developers building applications for the PCI-AC5 or PCIe-AC5, the PC-Based Direct I/O
software development kit (SDK) is included free on the Opto 22 CD that comes with the cards.
1
(You
can also download the SDK from our website.)
The SDK includes sample applications with source code, Windows drivers, and documentation. In
addition, the SDK provides drivers for porting existing applications to newer platforms. For more
information, see Chapter 3: Installing and Using the SDK.
Prerequisites
•This guide assumes that you are familiar with Opto 22 mounting racks and input/output
modules.
•If you’re planning to use the PC-Based Direct I/O SDK, this guide assumes that you are already
familiar with Microsoft .NET and programming languages such as C#, Visual Basic, or Visual C++.
Feature PCIe-AC5 PCI-AC5 AC5 and G4AC5
Interface PCIe 1.1 bus 33 MHz PCI 2.1 bus ISA bus
I/O Points controlled 48 48 24
Jumpers Jumperless configuration Jumperless configuration Seven (used to configure
base address)
LEDs Four Four One
1The PC-Based Direct I/O SDK does not support AC5 and G4AC5 cards. For these cards, you must create drivers
on your own. For more information, see Appendix D: AC5 and G4AC5 Technical Reference.

WHAT’S IN THIS GUIDE
PCI-AC5, PCIe-AC5, AC5, and G4AC5 User’s Guide
2
What’s in this Guide
The guide includes the following chapters and appendices:
Chapter 1: Introduction provides Product Support information.
Chapter 2: Installing the Adapter Card describes how to install the cards.
Chapter 3: Installing and Using the SDK describes installing and using the SDK to write custom
applications for the PCI-AC5 and PCIe-AC5 on Windows platforms.
Appendix A: System Specifications
provides system requirements and specifications for the
PCI-AC5, PCIe-AC5, AC5, and G4AC5 adapter cards, and information about the bus and LED locations.
Appendix C: PCIe/PCI-AC5 Hardware Description provides additional technical information you
need to create custom applications if you aren’t using the PC-Based Direct I/O SDK.
Appendix D: AC5 and G4AC5 Technical Reference includes additional technical information
necessary only if you are writing your own driver for the AC5 or G4AC5.
For Help
If you have problems installing or programming the AC5, PCI-AC5, or PCIe-AC5 adapter card and
cannot find the help you need in this guide, contact Opto 22 Product Support.
Phone: 800-TEK-OPTO (800-835-6786
toll-free in the U.S. and Canada)
951-695-3080
Monday through Friday,
7 a.m. to 5 p.m. Pacific Time
Fax: 951-695-3017
Email: suppor[email protected]
Opto 22 website: www.opto22.com
When calling for technical support, be prepared to provide the following information about your
system to the Product Support engineer:
•Version of this product
•PC configuration including operating system, type of processor, speed, and memory. (A screen
shot of your system information or system settings can be helpful.)
•Complete description of your hardware system, including:
– Jumper configuration
– Type of power supply
– Specific error messages
NOTE: Email messages and phone
calls to Opto 22 Product Support
are grouped together and
answered in the order received.

PCI-AC5, PCIe-AC5, AC5, and G4AC5 User’s Guide
3
3
Chapter 1
2: Installing the Adapter Card
This chapter describes how to install your PCI-AC5, PCIe-AC5, AC5, or G4AC5, and how to configure
the jumpers on the AC5 or G4AC5.
In this chapter:
Installing the PCI-AC5 and PCIe-AC5............................................................................................................page 3
Installing the AC5 or G4AC5 .............................................................................................................................page 4
Installing the PCI-AC5 and PCIe-AC5
You can install the PCI-AC5 adapter card into any PCI expansion slot of a computer; the PCIe-AC5
can be installed into any PCIe expansion slot. Note the power requirements listed in the
Specifications table on page 19.
1. Turn off the computer. Remove the power cord and the computer’s cover.
The power cord must be removed, as a spike may cause the computer to boot.
2. Before handling the card, discharge static electricity by touching the computer’s metal chassis.
3. Starting with the connector end that allows the cable to lie flat, push the ribbon cable through
one of the slot openings in the computer, and then attach the cable to the adapter card.
CAUTION: Do not scratch this card or other cards in the computer, as scratching may irreversibly
damage the card or other devices.
4. Install the card in the expansion slot. Verify that the card is properly seated in the motherboard
socket. Secure the card to the chassis.

INSTALLING THE AC5 OR G4AC5
PCI-AC5, PCIe-AC5, AC5, and G4AC5 User’s Guide
4
5. Connect the other end of the ribbon cable to the I/O mounting rack. For cable part numbers
and pinouts, see page 20.
6. Reinstall the power cord. To see the card’s LED (for testing purposes), leave the computer cover
off temporarily.
7. Turn on the computer. The BIOS automatically performs configuration the first time you boot
up the computer with the card installed.
If a “Found New Hardware”message appears, simply click Cancel. The PC-Based Direct I/O SDK setup
program will install the device driver automatically.
Installing the AC5 or G4AC5
The AC5 and G4AC5 adapter cards install into any ISA expansion slot of an ISA-capable computer.
The driver can support up to 64 AC5 adapter cards. Before you install the AC5 or G4AC5 adapter
card, you must set the address jumpers as described below.
Configuring Jumpers
These instructions apply to the AC5 or G4AC5 adapter card. The card is the same for either part
number; only the cable is different.

CHAPTER 2: INSTALLING THE ADAPTER CARD
PCI-AC5, PCIe-AC5, AC5, and G4AC5 User’s Guide
5
5
Seven jumpers (Group A, 3 through 9) define the base I/O address, which identifies a unique
eight-byte address space for the adapter. The factory-set base I/O address is 220 (hex).
Select an I/O location that is not currently used by any other device. The following diagram
shows examples of jumper settings you might use:
Installing the Card
A 50-conductor ribbon cable connects the adapter card to the I/O rack. The cable included with the
AC5 connects the card to racks with edge connectors (such as the PB16A). The cable included with
the G4AC5 connects the card to racks with header-style connectors (such as the G4PB24).
1. Turn off the computer. Remove the power cord and the computer’s cover.
2. Before handling the card, discharge static electricity by touching the computer’s
metal chassis.
3. Install the card in one of the ISA expansion slots. Verify that the adapter card is properly seated
in the motherboard ISA socket. Secure the card to the chassis.
CAUTION: Do not scratch this card or other cards in the computer, as scratching may irreversibly
damage the card or other devices.
4. Connect the cable from the adapter card to the I/O
mounting rack.
The diagram at right shows how to connect the
cable to the card.
5. Reinstall the power cord.
If you wish, leave the computer cover
off temporarily to see the card’s LEDs.
6. Turn on the computer.

INSTALLING THE AC5 OR G4AC5
PCI-AC5, PCIe-AC5, AC5, and G4AC5 User’s Guide
6

PCI-AC5, PCIe-AC5, AC5, and G4AC5 User’s Guide
7
7
Chapter 1
3: Installing and Using the SDK
The PC-Based Direct I/O software development kit (SDK) helps developers build custom
applications for the PCI-AC5 and PCIe-AC5. (The SDK does not support the AC5 or G4AC5.)
The SDK is available on the CD that comes with the adapter card
1
, and contains sample applications
with source code, Windows drivers, and user documentation. It works with .NET platform languages
including C#® and VB.NET®, and supports both 64-bit and 32-bit versions of:
•Windows® 10 Professional
•Windows 8.1 Professional
•Windows 7 Professional
2
NOTE: If you’re using an unsupported operatingsystem, you’ll need to write your own driver. For details, see
“Developing Custom Applications” on page 11 and Appendix D: AC5 and G4AC5 Technical Reference.
To help you get started, the SDK includes a fully functioning Visual C# solution (.sln file) that
interfaces with the PCI-AC5 and PCIe-AC5. You can use this solution as an example for building your
own custom applications. When you install the SDK, the solution is copied to the C:\Program
Files\Opto22\PC-DIRECT-SDK\Examples\DirectScan folder.
For help troubleshooting your custom application, see “Error Messages and Troubleshooting”on
page 15.
To update existing applications to run on Windows 10, Windows 8.1, or Windows 7, see “Porting
Legacy Applications”on page 16.
In this chapter:
Installing the SDK ...................................................................................................................................................page 8
Using the Direct I/O Scan Utility ......................................................................................................................page 9
Developing Custom Applications ................................................................................................................page 11
Error Messages and Troubleshooting .........................................................................................................page 15
Porting Legacy Applications...........................................................................................................................page 16
Function Reference Help File..........................................................................................................................page 18
1
If you don’t have the CD, you can download the SDK from our website, or you can request the CD by calling Opto 22
at 800-321-6786 (toll-free in the U.S. and Canada) or 951-695-3000.
2
For Windows 7 to properly identify the SDK’s digital signatures and files, Microsoft Security Advisory 3123479 update
(or higher) must be installed. To download the update, see https://support.microsoft.com/en-us/kb/3123479.

INSTALLING THE SDK
PCI-AC5, PCIe-AC5, AC5, and G4AC5 User’s Guide
8
Installing the SDK
NOTE: The SDK does not support the AC5 or G4AC5 adapter cards. To create drivers for these cards, you
must build them yourself. For technical specifications, see Appendix D: AC5 and G4AC5 Technical
Reference.
TIP: To ensure reliable control operations and prevent applications from closing unexpectedly, disable
Sleep and Hibernation modes (by setting Windows Power Options to “Never”) on computers that test or
run applications built with the SDK. For more information, see
https://support.microsoft.com/en-us/help/13770/windows-shut-down-sleep-hibernate-your-pc.
1. To start the PC-Based Direct I/O SDK, insert the CD in your CD-ROM drive (or, if you’ve
downloaded the SDK from our website, double-click the installer).
NOTE: If Windows Security dialog boxes appear, click the appropriate buttons (for example, Yes,Open,
Run, or Install) to continue.
2. Follow the Setup Wizard’s prompts to accept the License Agreement and select the location
where the SDK will be installed. Note that if the SDK is already installed, the Setup Wizard
prompts you to uninstall it before continuing.
3. On the Device Driver Installation Wizard screen, click Next to install the driver.

CHAPTER 3: INSTALLING AND USING THE SDK
PCI-AC5, PCIe-AC5, AC5, and G4AC5 User’s Guide
9
9
After the driver is installed, this screen appears:
4. Click Finish to complete the driver installation, and then click Finish again to complete the SDK
installation and launch DirectScan.exe.
Using the Direct I/O Scan Utility
Direct I/O Scan is a diagnostic utility that allows you to configure points as either input or output,
and test your system by turning digital points on and off.
For software developers, the Direct I/O Scan source code can be an example for developing your
own custom code. Direct I/O Scan is written in Visual C#, and the source code (DirectScan.sln) is
located in the C:\Program Files\Opto22\PC-DIRECT-SDK\Examples\DirectScan folder.
To use the Direct I/O Scan application:
1. If Direct I/O Scan is not already open, start it by pressing the Windows Start key , typing
directscan.exe and then pressing the Enter key.
In the Direct I/O Scan window, Bus 0 and Bus 1 refer to the two ribbon cable interfaces
connected to the card. For more information, see “Bus and LED Locations”on page 22.

USING THE DIRECT I/O SCAN UTILITY
PCI-AC5, PCIe-AC5, AC5, and G4AC5 User’s Guide
10
2. If you have only one PCI-AC5 or PCIe-AC5 card installed, continue to step 3.
If you have more than one card installed:
a. Click the Open button.
b. In the Choose PCI Device Form dialog box, select a card.
c. (Optional) To identify which card you selected, you can flash its LEDs:
– Open your computer’s case to see the installed adapter cards.
–ClickFlashLEDs.
The LEDs of the selected card will flash five times. If the LEDs don’t flash on the card you are
looking at, you may have selected the wrong card. Try selecting a different card from the
list, and then click Flash LEDs again to make sure you’ve selected the right card.
d. When you’re done, click OK to close the dialog box.
3. Use the main screen to experiment with selecting points, configuring points as inputs or
outputs, and turning points on and off until you have finished testing the application.
The images in this section show a PCI-AC5 card.
(Instructions are the same for the PCIe-AC5.) Click here if you have more than one card.
Flash LEDs button

CHAPTER 3: INSTALLING AND USING THE SDK
PCI-AC5, PCIe-AC5, AC5, and G4AC5 User’s Guide
11
11
Developing Custom Applications
NOTE: To upgradeexisting applications to work with Windows 10, Windows 8.1, and Windows 7 operating
systems, see page 16.
When you install the SDK, new folders are created in the C:\Program Files\Opto22\PC-DIRECT-SDK
directory. These folders contain the sample code, documentation, demo utility, and, most
importantly, software stacks and kernel driver installers that you need for building custom
applications.
To display the settings shown in this image:
First, click the Select All button for BUS 0.
Then, click the Configure Selected Points As Output button.
Finally, click the Turn Selected Output Points On button.
PC-Based Direct I/O
SDK folder

DEVELOPING CUSTOM APPLICATIONS
PCI-AC5, PCIe-AC5, AC5, and G4AC5 User’s Guide
12
The SDK contains several .NET managed software stacks.
Applications built with any of the software
stacks will work with both the PCI-AC5 and PCIe-AC5 adapter cards.
Although the files in each stack have the same filenames, each stack is different. When you create a
custom application, you must
use the stack that matches your development
environment and the target platform
.
Software stacks are located in the C:\Program Files\Opto22\PC-DIRECT-SDK\Development directory,
and folder names are designed to help you find the stack you need.
For example, if:
•Your development computer is a 64-bit machine
•You’re are using .NET 4.0
•Your .NET solution is configured for a 32-bit platform
...then use the software stack located in
C:\Program Files\Opto22\
PC-DIRECT-SDK
\Development\
32Bit
\
TargetedToNETFramework4AndAbove
.
If you’re developing on a
computer with this kind
of operating system:
...and your .NET solution is configured to run on this platform:
Any CPU x86 x64
32-bit Use a 32-bit SDK
software stack.
Use a 32-bit SDK
software stack. Not applicable.*
64-bit Use a 64-bit SDK
software stack.
Use a 32-bit SDK
software stack.
Use a 64-bit SDK
software stack.
*This option isn’t applicable, because if you’re coding on a 32-bit machine, you won’t be able to run or debug
code targeted to a 64-bit platform.
1. Building an app for a 32-bit platform?
Open the 32Bit folder
2. Developing with .NET 4.0 or higher?
Choose a stack from the
TargetedToNETFramework4AndAbove folder
3. This is the stack to use

CHAPTER 3: INSTALLING AND USING THE SDK
PCI-AC5, PCIe-AC5, AC5, and G4AC5 User’s Guide
13
13
Developing the Application
TIP: To ensure reliable control operations and prevent applications from closing unexpectedly, disable
Sleep and Hibernation modes (by setting Windows Power Options to “Never”) on computers that test or
run applications built with the SDK. For more information, see
https://support.microsoft.com/en-us/help/13770/windows-shut-down-sleep-hibernate-your-pc.
For a functional reference of the classes and methods in the SDK, see page 16.
To use the SDK in a .NET application:
1. Copy the appropriate software stack to the folder where the application’s executable (.exe) file
resides.
3
2. Add the PCIAC5.dll from the chosen software stack as a reference to your solution.
To identify which software stack to use, see page 12.
3. Add this .NET using statement to your solution:
using Opto22.Adapters.DirectIO
4. Instantiate the PCIAC5_CardList object by accessing the public property TheCardList.
Example: public PCIAC5_CardList pciac5cards;
pciac5cards = PCIAC5_CardList.TheCardList;
5. Call GetCard( ) on the PCIAC5_CardList object.
Example:
pciac5cards.GetCard(0,
PCIAC5_Card.eResetLevel.BrainSetForResetActiveLow, True);
6. Call WriteDigitalConfig( ) to configure input and output points.
7. Create a loop that reads or writes points.
8. When the loop is complete, call ReleaseCard( ) to close the card properly.
Special Considerations
When developing custom applications, here are some special considerations to keep in mind:
Error Codes.
If one of the function calls returns false, it’s an indication that an error or warning has
occurred. To inspect the message, use the
lastError
property on either the PCIAC5_CardList object
or the PCIAC5_Card object, depending on what function was called.
Error and warning messages are also logged in the Application area of the Windows Event Log. The
messages are grouped under the application name, Opto 22 PCI-AC5.
Multi-threaded Applications.
The PC-Based Direct I/O SDK permits only a single handle to a
card. If your application uses multiple threads, you should implement a mutex on the handle to
avoid thread collision.
Also, multiple applications cannot access the adapter card simultaneously. If you want multiple
applications to access the card, you’ll need to use or build a program to control and synchronize
access.
3
In Visual Studio®, the bin folder is the default location for a solution’s .exe files. For details on how .NET applications
locate DLLs, see the Microsoft Dev Center, https://msdn.microsoft.com/en-us/library/windows/desk-
top/ms682586(v=vs.85).aspx

DEVELOPING CUSTOM APPLICATIONS
PCI-AC5, PCIe-AC5, AC5, and G4AC5 User’s Guide
14
PCI Express Slot Width.
While Opto 22’s PCI-Express adapter cards are a 1x form factor, they
may be installed in wider PCI-Express sockets, like 4x, 8x, and 16x. For expansion slot availability, see
the user’s manuals for your computer or motherboard.
Building an Application and Driver Installer
The SDK’s adapter card installer places both 32-bit and 64-bit driver and library components in the
application installation directory. This allows you to build and distribute your application to specific
platforms.
To install the adapter card kernel mode driver, the SDK includes 32-bit and 64-bit versions of
Microsoft’s Driver Package Installer (dpinst.exe).
If your operating
system is:
...and your
processor is: ...Use the Driver Package Installer in this folder:
Windows 7 Professional or
Windows 8.1 Professional 32-bit C:\Program Files\Opto22\PC-DIRECT-SDK\KernelDrivers\
Windows7_8\32Bits
Windows 10 Professional 32-bit C:\Program Files\Opto22\PC-DIRECT-SDK\KernelDrivers\
Windows10\32Bits
Windows 7 Professional or
Windows 8.1 Professional 64-bit C:\Program Files\Opto22\PC-DIRECT-SDK\KernelDrivers\
Windows7_8\64Bits
Windows 10 Professional 64-bit C:\Program Files\Opto22\PC-DIRECT-SDK\KernelDrivers\
Windows10\64Bits
1. Windows 7 Professional?
Open the Windows7_8 folder
2. 32-bit processor?
Open the 32Bits folder
3. This is the stack to use

CHAPTER 3: INSTALLING AND USING THE SDK
PCI-AC5, PCIe-AC5, AC5, and G4AC5 User’s Guide
15
15
To install the driver, run dpinst.exe in the folder that contains the driver’s installation components.
For more information about the Driver Package Installer, see Microsoft’s Hardware Dev Center
website at https://developer.microsoft.com/en-us/windows/hardware.
Opto 22 encourages OEMs that distribute software to wrap their applications and the necessary
DLLs in an installer.
Error Messages and Troubleshooting
If one of the function calls returns false, it is an indication that an error or warning has occurred. To
inspect the message, use the lastError property on either the PCIAC5_CardList object or the
PCIAC5_Card object (depending on which function was called).
All error or warning messages are also logged in the Application section of the Windows Event
Viewer (Control Panel > Administrative Tools > Event Viewer). The messages are grouped under the
application name, “Opto 22 PCI-AC5.
Troubleshooting
Symptom Remedy
Outputs don’t turn on
•May indicate that the points were not configured as outputs. Try
configuring the point using the function WriteConfig. Also, remember that
point numbering begins with zero, not one.
•Measure the voltage at the terminals on the rack and verify that it is 5.00 to
5.20 VDC (using a high quality meter).
•Check the continuity of the 50-wire ribbon cable with a meter.
•Make sure the cable is connected to the proper bus.
•Make sure that output modules are installed in correct locations.
•If output module or rack LEDs are on, this indicates the issue is on the field
side of the module. Inspect wiring diagrams and see if there is excitation
across the module's field output. Inspect the output module fuse with a
meter.
•For
DC
outputs that are always on, the outputs may be reverse biased
(wired backwards with respect to polarity).
•If
AC
outputs stick on, it may be that the steady state load current is too low
compared to the module's leakage current. A resistive shunt may be
necessary across the load device to shunt excess current. For details, see
form 1104, Guide to Troubleshooting Legacy Opto 22 Products.
Inputs don’t read correctly
•Verify that input modules are plugged into the correct locations.
•Measure the voltage at the terminals on the rack and verify that it is 5.00 to
5.20 VDC (using a high quality meter).
•Verify that the input modules are on by looking at the LED indicators.
•Ensure that the 50-wire ribbon cable is properly seated.
•Ensure that the 50-wire ribbon cable is plugged into the proper bus
number.
•Validate continuity of the 50-wire ribbon cable.
The computer’s CPU usage is
always at 100% or the com-
puter runs slowly when the
control application is running
•In time-independent applications, consider adding a Thread.Sleep(1) into
your control or monitoring loop. This will allow the application to release
time back to the operating system. Try larger numbers in Sleep’s argument
if the improvement is not too noticeable.

PORTING LEGACY APPLICATIONS
PCI-AC5, PCIe-AC5, AC5, and G4AC5 User’s Guide
16
Porting Legacy Applications
NOTE: To convert applications for AC5 and G4AC5 cards to run on PCI-AC5 and PCIe-AC5 cards, see
Appendix B: Converting Applications to a Newer Card.
Programs developed for the PCI-AC5 or PCIe-AC5 with older versions of the PC-Based Direct I/O SDK
will not work with Windows 10, Windows 8.1, or Windows 7 due to an incompatibility at the driver
level of these operating systems.
To update existing PCI-AC5 and PCIe-AC5 applications to run on these newer operating systems,
you must use the Legacy-OPTOPCI unmanaged software stack. When you install the SDK, these files
are copied to the C:\Program Files\Opto22\PC-DIRECT-SDK\Legacy-OptoPCI\FilesFor32BitApps
folder.
The files in this stack are 32-bit only and consist of these components:
•
OptoPCI_StdApi.dll
NOTE: Include this file only for applications that require a STDAPI calling convention with OptoPCI.dll
(for example, Delphi).
•
OptoPCI.dll
•
pciac5_unmanaged.dll
•
vc140runtime.dll
To upgrade a legacy program to work with Windows 10, Windows 8.1, and Windows 7:
1. Copy the legacy program files to the target computer.
2. Install the PC-Based Direct I/O SDK on the target computer. (For details, see page 8.)
3. Copy the files from C:\Program Files\Opto22\PC-DIRECT-SDK\Legacy-OptoPM32\
FilesFor32BitApps to the folder where the legacy application’s executable (.exe) file resides.
To recompile the legacy program on the target operating system:
•
Include this file with the legacy program files: optopci.h
•
Link this file to legacy program: OptoPCI.lib
To run the legacy program without recompiling:
•
Include these files with the legacy program files: OptoPCI.dll
pciac5_unmanaged.dll
Copy the files in this folder
to the folder that contains
the legacy app’s .exe file
This manual suits for next models
3
Table of contents
Other OPTO 22 Computer Hardware manuals

OPTO 22
OPTO 22 Optomux B1 User manual

OPTO 22
OPTO 22 PCI-AC51 User manual

OPTO 22
OPTO 22 groov RIO Manual

OPTO 22
OPTO 22 AC422AT User manual

OPTO 22
OPTO 22 BD-DEVNET User manual

OPTO 22
OPTO 22 PCI-AC51 User manual

OPTO 22
OPTO 22 AC24AT User manual

OPTO 22
OPTO 22 AC24AT User manual

OPTO 22
OPTO 22 PCI-AC48 User manual

OPTO 22
OPTO 22 Optomux B1 User manual