gpf-2746c - interface...the gpf-2746c controls interface digital input/output boards with the 8255...

76
PPI(PCI/C-PCI) www.interface.co.jp GPF-2746C Windows Driver Software for Digital Input/Output (PPI) Product Help for Windows

Upload: others

Post on 22-Oct-2020

11 views

Category:

Documents


1 download

TRANSCRIPT

  • PPI(PCI/C-PCI)

    www.interface.co.jp

    GPF-2746C Windows Driver Software for Digital Input/Output (PPI) Product

    Help for Windows

  • GPF-2746C Help for Windows

    © 2001, 2015 Interface Corporation. All rights reserved.

    1

    Contents

    Chapter 1 Introduction ........................................................................................ 2

    1.1 Overview ...............................................................................................................................................2 1.2 Features .................................................................................................................................................2

    Chapter 2 Product Specifications........................................................................ 3 2.1 Functional Specifications ......................................................................................................................3 2.2 Product Composition.............................................................................................................................4

    Chapter 3 Programming Guide .......................................................................... 6 3.1 Installation.............................................................................................................................................6 3.2 Programming Guide ..............................................................................................................................6 3.3 The 8255 Controller ..............................................................................................................................8 3.4 Functional Descriptions.......................................................................................................................19

    Chapter 4 Reference........................................................................................... 21 4.1 List of DLL Functions .........................................................................................................................21 4.2 DLL Functions ....................................................................................................................................22 4.3 Structures.............................................................................................................................................62 4.4 Return Values ......................................................................................................................................64

    Chapter 5 Sample Programs ............................................................................. 65 5.1 Input ....................................................................................................................................................65 5.2 Output..................................................................................................................................................66 5.3 Event ...................................................................................................................................................67 5.4 PpiInAOutB.........................................................................................................................................68

    Chapter 6 Utilities............................................................................................... 69 6.1 Operation Check Program...................................................................................................................69 6.2 Diagnostic Program.............................................................................................................................70

    Chapter 7 How to Use .NET .............................................................................. 73 7.1 Summary .............................................................................................................................................73 7.2 Class Library .......................................................................................................................................73 7.3 Notes ...................................................................................................................................................74

    Chapter 8 Terms of Use...................................................................................... 75 8.1 Limited Warranty.................................................................................................................................75 8.2 Copyrights and Intellectual Property Rights .......................................................................................75 8.3 Warning Regarding Medical and Clinical Use of Our Products..........................................................75 8.4 Prohibition of Reproduction................................................................................................................75 8.5 Limitation of Liability .........................................................................................................................75 8.6 Trademark ...........................................................................................................................................75

  • GPF-2746C Help for Windows

    © 2001, 2015 Interface Corporation. All rights reserved.

    2

    Chapter 1 Introduction 1.1 Overview

    The GPF-2746C controls Interface digital input/output boards with the 8255 PPI controllers from your application running on Windows. Application software should link the provided dynamic link library (DLL) and control the digital input/output boards with the PPI controllers through the application programming interface (API). This document includes information to use the GPC-2746C on Windows.

    1.2 Features - The control modes of the 8255 controller can be arbitrarily configured and retrieved. - Input and output are switchable every port (8 pins) using the control modes of the 8255 controller. - The interval timer notifies an event to the user application at occurrence of an event. - The Help system explains how to use the supported functions. Refer to it as you develop your programs. - The diagnostic program and operation check program are included.

  • GPF-2746C Help for Windows

    © 2001, 2015 Interface Corporation. All rights reserved.

    3

    Chapter 2 Product Specifications 2.1 Functional Specifications

    Number of Ports 255 boards (max.) (Multiple models of devices can be used simultaneously. Up to 16 devices of the same model can be controlled.)

    8255 Controller The product inputs and outputs data synchronizing with an external circuit by using the STB and ACK control signals of the 8255 controller. Refer to User’s Manual for the signal behavior in the input and output circuit in the case of using the control signals.

    Interrupt Mask When an interrupt event is generated, your application can be notified by using event signaling. The following signals can trigger an interrupt:

    - 1PC0 (8255 controller_1, Port C, PC0) - 1PC3 (8255 controller_1, Port C, PC3) or IR.IN1

    * PCI-2747A does not have IR.IN1. - 2PC0 (8255 controller_2, Port C, PC0)

    * PCI-2747A does not have 8255 controller_2. -2PC3 (8255 controller_2, Port C, PC3) or IR.IN2

    * PCI-2747A does not have 8255 controller_2 and IR.IN2. -Interval timer -RSTIN

    * Interrupt source can be changed with the DLL function. Interrupt Mask Mask/unmask every event source. Interval Timer The interval timer can be used to generate an interrupt to

    the host computer at every timer cycle. (10 ms through 1500 ms) Use the interval timer interrupt in the cycle of greater than or equal to 10 ms. Windows cannot handle a large number of interrupts within a short time period and may hang up or freeze. The interrupt timer interval is influenced by the load on the host computer. As a result, the precise timing of the interrupt timer interval cannot be guaranteed.

    External Reset Input (RSTIN) The RSTIN signal resets the board from an external device. It also can reset output and each setting value of the board. The interval timer stops.

    Note:

    Some error may be generated in the cycle of interval timer interrupt as it is influenced by Windows system operations.

  • GPF-2746C Help for Windows

    © 2001, 2015 Interface Corporation. All rights reserved.

    4

    2.2 Product Composition

    Item File Name Description Management file GPC2746C.VER Management information file for Interface

    Corporation use Latest information README.HTM Latest information Installer SETUP.EXE Installation program Operation check program PPIUTIL.EXE Operation check program Diagnostic program DIAGPPI.EXE Diagnostic program Sample programs

    Visual C# .NET INPUT Input sample program for Visual C# .NET OUTPUT Output sample program for Visual C# .NET IFCPPI Class library for Visual C# .NET Visual C++ INPUT Input sample program for Visual C++(MFC) OUTPUT Output sample program for Visual C++(MFC) EVENT Interrupt sample program for Visual C++(MFC) PpiInAOutB Input/output sample program for Visual C++(MFC) Visual Basic .NET INPUT Input sample program for Visual Basic .NET OUTPUT Output sample program for Visual Basic .NET IFCPPI Class library for Visual Basic .NET Visual Basic INPUT Input sample program for Visual Basic OUTPUT Output sample program for Visual Basic EVENT Interrupt sample program for Visual Basic PpiInAOutB Input/output sample program for Visual Basic Delphi INPUT Data transmit sample program for Delphi OUTPUT Data receive sample program for Delphi EVENT Event sample program for Delphi

    PpiInAOutB Data transmit/receive sample program for Delphi DLL FBIPPI.DLL Dynamic link library file FBIPPI.LIB Import library file MSVCRT.DLL C run-time shared DLL Device Drivers CP2746C.SYS Driver for Windows 2000 and later versions GPC2XXX.INF

    (every model )number

    Driver Installation file for Windows 2000 and later versions.

    GPC2XXX.SLD (every model number)

    SLD file for Windows XP Embedded

    CP2746C.SYS Driver for Windows NT 4.0 GPC2XXX.INF

    (every model )number

    Driver installation file for Windows NT 4.0

    CP2746C.VXD Driver for Windows Me, Windows 98, and Windows 95

    GPC2XXX.INF (every model

    )number

    Driver Installation file for Windows Me, Windows 98, and Windows 95

  • GPF-2746C Help for Windows

    © 2001, 2015 Interface Corporation. All rights reserved.

    5

    Item File Name Description

    Header files FBIPPI.H Header file for Visual C++ FBIPPI.BAS Header file for Visual Basic FBIPPI.PAS Header file for Delphi Help HELP.PDF Help (PDF format)

    Note: Sample programs for Visual C#, .NET and Visual Basic .NET are created using Visual C# .NET 2003 and Visual Basic .NET 2003, respectively.

  • GPF-2746C Help for Windows

    © 2001, 2015 Interface Corporation. All rights reserved.

    6

    Chapter 3 Programming Guide 3.1 Installation

    Refer to README for installation.

    3.2 Programming Guide When using multiple boards, set the RSW1 rotary switch to a unique setting on each same type of board. Before installing multiple boards of the same type, configure the RSW1 setting value (for Compact PCI and PCI boards) not to overlap between the same type. The RSW1 setting values are used to uniquely identify each product in case multiple Interface boards of the same type are installed in the same system. If the numbers overlap, this software will not work normally. This section explains how to use the provided functions. Sample codes are written in C. 1. Initializing a Board The PpiOpen function initializes a board. DeviceHandle = PpiOpen( "FBIPPI1", FBIPPI_FLAG_SHARE ); It initializes a board specifying the device name (FBIPPI1). The device driver uniquely assigns device names as follows: FBIPPI1, FBIPPI2, . . . , FBIPPI255 The device name is not defined by the setting value of the rotary switch (RSW1) on each board. If the system configuration changes because the number of boards or slots position is changed, the assigned device name may be changed. To use it under the changeful system configuration, make the application so that the device name can be changed. The application can evaluate the board is correct. Refer to the PpiCommonGetPciDeviceInfo function for more details. A device handle is returned after the board is successfully initialized. The device handle allows you to access the board and must be specified when a function is called. Two or more processes can share the same PPI board. The processes should arbitrate with each other to retain data consistency in the hardware and software configuration. A digital input/output board can be initialized or used from different processes. A digital input/output board can be shared among different processes. When a board is shared among multiple applications, the last configured value is applied for the output data, interrupt settings, and mask setting. The settings are not saved for every application. To control a board from multiple applications at the same time, adjust output data and the settings of the board among applications to ensure consistency. All initialized boards must be closed by the PpiClose function before the application is terminated.

  • GPF-2746C Help for Windows

    © 2001, 2015 Interface Corporation. All rights reserved.

    7

    2. Input/Output The PpiControl function configures the operation mode and input/output direction of ports. Refer to "8255 PPI Controller Functional Descriptions," for more details. PpiControl( DeviceHandle, FBIPPI_8255_CONTROLLER1, ControlData ); The PpiInputPort function reads data from each port of the 8255 PPI controller. PpiInputPort(DeviceHandle, FBIPPI_8255_CONTROLLER1,FBIPPI_PORT_A, &Value); The PpiOutputPort function writes data to each port of the 8255 PPI controller. PpiOutputPort(DeviceHandle, FBIPPI_8255_CONTROLLER2,FBIPPI_PORT_B, Value ); 3.Timer and Control Signals The PpiSetTimerConfig, PpiGetTimerConfig, and PpiSetTimerConfig functions can directly control the clock on the board. The PpiGetTimerConfig function retrieves the settings of the base clock and the divisor of the timer. These functions are not available when the timer on the board is used in background processing. 4. Interrupt The PpiEventRequestPending function waits for interrupt events. Before waiting for an interrupt, mask the interrupt event correctly and select the polarity of the edge and interrupt sources with the following functions. The PpiSetEventMask, PpiGetEventMask, PpiSetEventConfig, and PpiGetEventConfig functions configure interrupt events and control the mask settings. 5. Closing the Board The PpiClose function closes the board and releases the resources. PpiClose( hDeviceHandle ); The initialized board must be closed by the PpiClose function before the application is terminated.

  • GPF-2746C Help for Windows

    © 2001, 2015 Interface Corporation. All rights reserved.

    8

    3.3 The 8255 Controller

    The 8255 controller is a programmable general purpose digital input/output device. It includes three 8-bit input/output ports and they can be used for data input, data output, status signal input, and control signal output by controlling from the program.

    3.3.1 Port A, Port B, and Port C The three ports included in the 8255 controller are called port A, port B, and port C, respectively. Because each port has unique characteristics, the selection of the port has effects on the adaptability of the 8255 controller.

    Input Latch input or buffer input operation Port A Output Latch output or buffer output operation Input Latch input or buffer input operation Port B Output Latch output or buffer output operation Input Latch input or buffer input operation Output Latch output or buffer output operation

    Port C

    Port C can be divided into two 4-bit ports by the mode control. The each of 4-bit port can be used as an output port of the control signal or an input port of the status signal with port A or port B.

    The following table shows the correspondence between pins and ports.

    Pin Port PA0 through PA7 Port A PB0 through PB7 Port B PC0 through PC7 Port C

    3.3.2 Group A Control and Group B Control

    To use the 8255 controller, divide port A, port B, and port C in two groups, group A and group B.

    Group A Port A and Port C higher 4 bits Group B Port B and Port C lower 4 bits

  • GPF-2746C Help for Windows

    © 2001, 2015 Interface Corporation. All rights reserved.

    9

    3.3.3 Operation

    The 8255 controller is classified in three modes by its usage. Mode 0 Basic input/output port Mode 1 Input/output port with control from the control signal and status signal. Mode 2 Input/output port which treats bidirectional data

    According to the purpose to use, set a mode for each group. The available combinations of the modes are the following six patterns. ・ Group A: mode 0, group B: mode 0 ・ Group A: mode 0, group B: mode 1 ・ Group A: mode 1, group B: mode 0 ・ Group A: mode 1, group B : mode 1 ・ Group A: mode 2, group B: mode 0 ・ Group A: mode 2, group B: mode 1 The PpiControl function selects the mode. The control data is specified with the following format. Control data (8-bit data)

    D7 D6 D5 D4 D3 D2 D1 D0

    0 Output D0 Port C low 1 Input 0 Output D1 Port B 1 Input 0 Mode 0 D2

    Group B

    Mode selection 1 Mode 1 0 Output D3 Port C high 1 Input 0 Output D4 Port A 1 Input 0 Mode 0 D6, D5

    Group A

    Mode selection 1 Mode 1

    0 Bit set/reset D7 Function control 1 Mode selection

  • GPF-2746C Help for Windows

    © 2001, 2015 Interface Corporation. All rights reserved.

    10

    When port C is used as an output of the control signal and an input of the status signal, the PpiControl function sets or resets bits. This operation enables or disables interrupt. Control data to set/reset bits of the control signal

    0(D7) × × × D3 D2 D1 D0 Correspondence of each bit

    0 Reset D0 Bit set/reset 1 Set Bit 0 1 2 3 4 5 6 7 D1 0 1 0 1 0 1 0 1 D2 0 0 1 1 0 0 1 1

    D1 to D3

    Port C Bit selection

    D3 0 0 0 0 1 1 1 1 D7 Function control Specifies 0 to select the bit set /reset function

    Notes: When a board is reset, or a mode is selected, all bits are reset automatically. (1) Mode 0 In this mode the controller operates as a basic input/output port. Each port set to mode 0 performs buffer input and latch output. After selecting the mode, the specified port outputs the low-level signal. And the output value is retrieved by reading the specified port. Each of Port A, Port B, Port C upper, and Port C lower can be configured as an input port or output port individually by the PpiControl function. Control data Mode 0

    1(D7) 0(D6) 0(D5) D4 D3 0(D2) D1 D0 Correspondence of each bit

    0 Output D0 Port C low PC0 through PC3 (PC0 through PC2) *1

    1 Input

    0 Output D1 Port B 1 Input

    D2

    Group B

    Mode selection Specify 0 to set group B to mode 0. 0 Output D3 Port C high

    PC4 through PC7 1 Input 0 Output D4 Port A 1 Input

    D6, D5

    Group A

    Mode selection Specify 00 (D6, D5) to select mode 0. D7 Function

    control Specify 1 to select the mode selection function.

    *1 When the Group A is in MODE 1 or MODE 2, the available bits of Port C for Group B are 3 bits from PC0 through PC2.

  • GPF-2746C Help for Windows

    © 2001, 2015 Interface Corporation. All rights reserved.

    11

    (2) Mode 1 In Mode 1, the control signals and status signals are used for the input/output control. The Group A contains Port A (PA0 through PA7) for the data port and Port C upper (PC3 through PC7) for the control/status port. The Group B contains Port B (PB0 through PB7) for the data port and Port C lower (PC0 through PC2) for the control/status port. The data are written to Port C by using the bit set/reset function. Mode 1 Port Definition

    1(D7) 0(D6) 1(D5) D4 D3 1(D2) D1 D0 Correspondence of each bit

    0 Output D0 Port C PC3 *2 1 Input 0 Output D1 Port B 1 Input

    D2

    Group B

    Mode selection Specify 1 to set to mode 1. 0 Output D3 Port C

    ・ PC6 and PC7(when Port A is input.) ・ PC4 and PC5 (when Port A is output.)

    1 Input

    0 Output D4 Port A 1 Input

    D6, D5

    Group A

    Mode selection Specify 0,1 (D6, D5) to select mode 1. D7 Function

    control Specify 1 to select the mode selection function.

    *2 PC3 in Port C is available only when the Group A is in MODE 0. Otherwise PC3 belongs to Group A. Functions of Port C in MODE 1

    Bit Data input port Data output port PC0 INT (INTerrupt) INT(INTerrupt request) PC1 IBF(Input Buffer Full F/F)

    OBF(Output Buffer Full F/F) PC2

    STB(STroBe input) RIE(Read Interrupt Enable flag)

    DAK(Data AcKnowledge input) WIE(Write Interrupt Enable flag)

    Group B

    PC3 *3 Input/output Input/output PC3 INT(INTerrupt request) INT(INTerrupt request) PC4

    STB(STroBe input) RIE(Read Interrupt Enable flag)

    Input/output

    PC5 IBF(Input Buffer Full F/F) Input/output PC6 Input/output

    DAK (Data AcKnowledge input) WIE(Write Interrupt Enable flag)

    Group A

    PC7 Input/output OBF(Output Buffer Full F/F)

    *3 While group A operates in MODE 0, the PC3 signal is applicable to input/output. In the other cases, the PC3 signal belongs to group A

  • GPF-2746C Help for Windows

    When the data port (group A - port A, group B – port B) is specified to the input port, the data port becomes input port and the control/status port (port C) is defined as follows.

    1. STB (Strobe Input)………Input

    When this signal goes low-level, the data port latches the data from peripheral. 2. IBF (Input Buffer Full F/F) ………Output

    When this signal is high-level, it means the input buffer is full of data. It notifies peripherals that the input port is in not-ready state. This signal goes high-level when the STB signal changes to low-level. After CPU reads out data from the input buffer, this signal goes low-level. The initial value is low-level.

    3. INT (Interrupt Request) ………Output The output signal becomes high-level when data from peripherals are latched to the input port and

    can be used for an interrupt signal to request service from the CPU when it is high-level. 4. RIE (Read Interrupt Enable flag)

    This signal is an interrupt enable flag to request service from the CPU. When this bit is set to 1, the interrupt is enabled. When it is set to 0, the interrupt is disabled. Even if the RIE signal is rewritten, the STB function assigned to the same bit is not affected. If the STB signal becomes low-level before the IBF signal does, the latch data in the port changes. The STB signal must be high-level until the IBF signal becomes low-level.

    To retrieve the IBF, INT, and RIE statuses, read port C with the input port of mode 1 specified.

    Mode 1 (Group A) Input

    © 2001, 2015 Interface Corporation. All rights reserved.

    12

  • GPF-2746C Help for Windows

    Mode 1 (Group B) Input

    Mode 1 Input Timing

    © 2001, 2015 Interface Corporation. All rights reserved.

    13

  • GPF-2746C Help for Windows

    © 2001, 2015 Interface Corporation. All rights reserved.

    14

    When the data port (group A - port A, group B – port B) is specified to the output port, the data port becomes output port (outputs low-level right after mode is set) and the control/status port (port C) is defined as follows. 1.OBF (Output Buffer Full F/F)……… Output

    This signal goes low-level when the data from the CPU are latched into the output port. It requests peripheral to receive the data. The OBF signal goes low-level after the CPU completes to write data in the condition that the DAK signal is 1, and goes to high-level by the falling of the DAK signal when peripherals receive data. The default value just after the mode is set is high-level.

    2.DAK (Data AcKnowledge input) ………Input

    This signal notifies that the peripheral completes receiving data from the output port. Configure the peripheral to assert this signal to low-level when it receives data.

    3.INT(INTerrupt request) ………Output

    The output signal becomes high-level when peripherals receive data, and can be used for an interrupt signal to request writing the subsequent data to the CPU.

    4.WIE (Write Interrupt Enable flag)

    This signal is an interrupt enable flag to request writing data to the CPU. When this bit is set to 1, the interrupt is enabled. When it is set to 0, the interrupt is disabled. Even if the WIE signal is rewritten, the STB function assigned to the same bit is not affected.

    Avoid writing while the OBF signal is in low level. The port output changes if data is written before the OBF signal becomes high level. The statuses of the OBF, INT, and WIE signals can be retrieved by reading Port C at output port in MODE 1.

  • GPF-2746C Help for Windows

    Mode 1 (Group A) output

    Mode 1 (Group B) output

    © 2001, 2015 Interface Corporation. All rights reserved.

    15

  • GPF-2746C Help for Windows

    Mode 1 output timing

    Note: * Do not write the data while the OBF signal is low-level to avoid duplication of writing data.

    Failure to observe this caution might result in the change of data in the output port.

    © 2001, 2015 Interface Corporation. All rights reserved.

    16

  • GPF-2746C Help for Windows

    © 2001, 2015 Interface Corporation. All rights reserved.

    17

    (3) Mode 2 This mode uses only Group A. Port A is used for the bi-directional 8-bit data port by the control of the control/status signals (5 bits of Port C upper). This operates in a similar manner to the input port and the output port of MODE 1. Port C Function in Group A at MODE 2

    Signal Function PC3 INT (INTerrupt request) PC4

    STB (STroBe input) RIE (Read Interrupt Enable flag)

    PC5 IBF (Input Buffer Full F/F) PC6

    DAK (Data AcKnowledge input) WIE (Write Interrupt Enable flag)

    PC7 OBF (Output Buffer Full F/F)

    The bi-directional data transfer is controlled switching the input/output statuses in port 0 by the DAK and STB signals. In this mode, data are written to port C using the bit operation instruction. Refer to MODE 1 about the operations and functions of each signal. The statuses of the OBF, IBF, INT, WIE, and RIE signals can be retrieved by reading port C in mode2. The input operation is similar to MODE 1. The differences of the output operation between MODE 2 and MODE 1 are as follows: - Only when the DAK signal is low-level, output data is output from port A. - The output data from the output port cannot be read.

  • GPF-2746C Help for Windows

    Mode 2 Input/output timing

    (4) Special Mode Combination Not all of bits in Port C are used for the control/status signals. Both group A and group B have bits that can be used to input/output data. Depending on the combination of mode which includes such bits, the following functions are available. 1. Programmed as inputs All input lines can be accessed during reading Port C. 2. Programmed as outputs The upper 4 bits of Port C (PC4 through PC7) and the lower 4 bits of port C (PC0 through PC3) are

    individually written with the set/reset function. The lower 3 bits of Port C (PC0 through PC2) are written in 3-bit unit.

    In MODE 1, the I/O direction of PC6 and PC7 or PC4 and PC5 is configured by bit 3 of the control word. The I/O direction of PC3 is configured by bit 0. The data 1 means the input port, and the data 0 means the output port. The data lines that are set as input are placed on the system bus by reading Port C. To write data to bits that are set as output, operate the bit set twice. Only when both upper and lower bits of port C are specified as output port in mode 0, data can be written to port C in 8-bit unit.

    © 2001, 2015 Interface Corporation. All rights reserved.

    18

  • GPF-2746C Help for Windows

    3.4 Functional Descriptions

    1. Asynchronous function

    The functions operate asynchronously by specifying the OVERLAPPED structure. The CreateEvent and WaitForSingleObject functions of Win32 API wait for event. Please refer to Microsoft Win32 API reference for more details about the CreateEvent and WaitForSingleObject functions.

    2. Selection of the 8255 controller

    The PCI-2746C and CTP/CPZ-2746 have two 8255 PPI controllers. The PCI-2747A has one 8255 PPI controller. The functional block diagrams are shown below. PCI-2746C and CTP/CPZ-2746 Block Diagram

    PCI-2747A Block Diagram

    © 2001, 2015 Interface Corporation. All rights reserved.

    19

  • GPF-2746C Help for Windows

    © 2001, 2015 Interface Corporation. All rights reserved.

    20

    Use FBIPPI_8255_CONTROLER1 or FBIPPI_8255_CONTROLER2 to select one of two 8255 controllers on the PCI-2746C and CTP/CPZ-2746. Use FBIPPI_8255_CONTROLER1 for the PCI-2747A. Signals 1PA0 through 1PA7, 1PB0 through 1PB7, 1PC0 through 1PC7 in this document correspond to PA0 through PA7, PB0 through PB7, and 1PC0 through 1PC7, respectively in the PCI-2747A.

    3. Hardware-dependent Capability Difference

    The following table shows the difference of capability between the PCI-2746C, PCI-2747A, and CTP/CPZ-2746. Some parameters are not applicable to the PCI-2747A. Capability List

    Capability Signal PCI-2746C PCI-2747A CTP/CPZ-27468255 Controller_1 Port A: 1PA7 - 1PA0

    Port B: 1PB7 - 1PB0 Port C: 1PC7 - 1PC0

    Available Available Available

    8255 Controller_2 Port A: 2PA7 - 2PA0 Port B: 2PB7 - 2PB0 Port C: 2PC7 - 2PC0

    Available N/A Available

    External Interrupt Request IR.IN1 IR.IN2 Available N/A Available N/A: Not Available

  • GPF-2746C Help for Windows

    © 2001, 2015 Interface Corporation. All rights reserved.

    21

    Chapter 4 Reference 4.1 List of DLL Functions

    No Function Description 1 PpiOpen Opens a digital I/O (PPI) board and enables to access to the board. 2 PpiClose Closes the digital I/O (PPI) board controller and releases the resources.3 PpiControl Writes a control word. 4 PpiInputPort Reads the data from the port. 5 PpiOutputPort Writes the data to the port. 6 PpiSetEventMask Masks interrupt events 7 PpiGetEventMask Retrieves interrupt mask settings. 8 PpiSetEventConfig Assigns interrupt sources and configures interrupt signals. 9 PpiGetEventConfig Retrieves the assignment of interrupt sources and interrupt signal

    configurations. 10 PpiSetTimerConfig Configures the interval timer. 11 PpiGetTimerConfig Retrieves the configuration data of an interval timer. 12 PpiGetTimerCount Retrieves the counter value of the interval timer. 13 PpiGetResetInStatus Retrieves status of the external reset signal. 14 PpiEventRequestPending Waits for interrupt events. 15 PpiCommonGetPciDeviceInfo Retrieves the information of the board such as the device ID, vendor

    ID, RSW1 value, and so on.

  • GPF-2746C Help for Windows

    © 2001, 2015 Interface Corporation. All rights reserved.

    22

    4.2 DLL Functions 4.2.1 PpiOpen

    Description The function opens a digital I/O board with the 8255 PPI controller and enables to access to the board. To open the board, specify a device name of the board automatically assigned by the device driver. If you use two or more PCI/CompactPCI boards, check the device names beforehand. In Windows, Interface digital input/output board with the 8255 PPI controller names, RSW1 values, and device names are listed under FbiPciPpi in the Device Manager. You can also verify these items by using the PPI board diagnostic program (DIAGPPI.EXE) or PPI board utility program (PPIUTIL.EXE). The list will be displayed while you use them. In Windows NT 4.0, use the PPI board diagnostic program (DIAGPPI.EXE) or PPI board utility program (PPIUTIL.EXE) to verify these items. The device name is not determined by the setting value of rotary switch (RSW1) on the board. If the system configurations change because the number of boards or the slot position is changed, the assigned device name may also be changed. If you often change the system configuration, write your application to be capable of identifying this and alter the device name at run-time. The PpiCommonGetPciDeviceInfo function associates a device name with the RSW1 value.

    Syntax

    C HANDLE PpiOpen( LPCTSTR Name, // device name DWORD Flags // open flag

    );

    Visual Basic Declare Function PpiOpen Lib "FbiPpi.DLL"( _ ByVal Name As String, ‘ device name _ ByVal Flags As Long ‘ open flag _

    )As Long

    Delphi Function PpiOpen( Name: String; // device name Flags: DWORD // open flag

    ):Thandle; stdcall; external 'FbiPpi.DLL';

    Parameter Name

    Specifies the device name to open. Flags

    Specifies the flag at opening. Specify the following code for the flag.

    Flag Description 0 Specifies that the device is opened exclusively. Redundant

    open is prohibited. FBIPPI_FLAG_SHARE Specifies that any other application can share the device.

  • GPF-2746C Help for Windows

    © 2001, 2015 Interface Corporation. All rights reserved.

    23

    Return Value The PpiOpen function returns a valid handle when the process is successfully completed. Otherwise, this function returns INVALID_HANDLE_VALUE if the process is failed. The value of INVALID_HANDLE_VALUE is FFFFFFFFh (-1).

    Comments

    ● Behavior of FBIPPI_FLAG_SHARE flag If the FBIPPI_FLAG_SHARE flag is specified when you call the PpiOpen function, two or more applications can share the same board. If you execute the PpiOpen function to the device which opens without specifying the PPI_FLAG_SHARE flag, the device will fail to open. The number of executing the PpiOpen and PpiClose functions must be same.

    ● Device name Specify a device name to open a device. Use the device manager, PPI board diagnostic program (DIAGPPI.EXE) or PPI board utility program (PPIUTIL.EXE) to confirm the device name. In Windows NT 4.0, use the PPI board diagnostic program (DIAGPPI.EXE) or PPI board utility program (PPIUTIL.EXE).

    Examples C HANDLE DeviceHandle; DeviceHandle = PpiOpen("FBIPPI1", FBIPPI_FLAG_SHARE );

    Visual Basic Dim Name As String Dim DeviceHandle As Long Name = "FBIPPI1" & Chr( 0 ) DeviceHandle = PpiOpen( Name, FBIPPI_FLAG_SHARE )

    Delphi var Name: Array[0..15] of Char; StrCopy( Name, 'FBIPPI1'); DeviceHandle := PpiOpen( @Name[0], FBIPPI_FLAG_SHARE );

    Allowing the digital input output board whose device name is “FBIPPI1” to be shared, and returning a device handle to DeviceHandle.

  • GPF-2746C Help for Windows

    © 2001, 2015 Interface Corporation. All rights reserved.

    24

    4.2.2 PpiClose

    Description The function closes the digital I/O board with the 8255 PPI controller and releases the resources. Any subsequent accesses to the board are forbidden.

    Syntax

    C INT PpiClose ( HANDLE DeviceHandle // device handle );

    Visual Basic Declare Function PpiClose Lib "FbiPpi.DLL"( _ ByVal DeviceHandle As Long ‘ device handle _ )As Long

    Delphi function PpiClose ( DeviceHandle: Thandle // device handle ): Integer; stdcall; external 'FbiPpi.DLL';

    Parameter

    DeviceHandle Specifies the device handle obtained by the PpiOpen function.

    Return Value

    The function returns FBIPPI_ERROR_SUCCESS if the process is successfully completed. Otherwise, this function returns another code. Please refer to “4.4 Return Values”.

    Comment If you access to the board again, reopen the board to call the PpiOpen function.

  • GPF-2746C Help for Windows

    © 2001, 2015 Interface Corporation. All rights reserved.

    25

    Examples

    C INT Ret; HANDLE DeviceHandle; DeviceHandle = PpiOpen(“FBIPPI1”, FBIPPI_FLAG_SHARE); : : Ret = PpiClose(DeviceHandle);

    Visual Basic Dim Name As String Dim DeviceHandle As Long Dim Ret As Integer Name = "FBIPPI1" & Chr( 0 ) DeviceHandle = PpiOpen(Name, FBIPPI_FLAG_SHARE) : : Ret = PpiClose(DeviceHandle)

    Delphi var Name: Array[0..15] of Char; Ret: Integer StrCopy( Name, 'FBIPPI1'); DeviceHandle := PpiOpen( @Name[0], FBIPPI_FLAG_SHARE ); : : Ret := PpiClose(DeviceHandle);

    Closing the digital I/O board specified by DeviceHandle

  • GPF-2746C Help for Windows

    © 2001, 2015 Interface Corporation. All rights reserved.

    26

    4.2.3 PpiControl

    Description The function controls the control register of the 8255 PPI controller.

    Syntax

    C INT PpiControl( HANDLE DeviceHandle, // device handle DWORD Controller, // Selects the 8255 controller BYTE ControlData // control data );

    Visual Basic Declare Function PpiControl Lib "FbiPpi.DLL"( ByVal DeviceHandle As Long, ‘ device handle ByVal Controller As Long, ‘ Selects the 8255 controller ByVal ControlData As Byte ‘ control data )As Long

    Delphi Function PpiControl ( DeviceHandle: THandle; // device handle Controller: Integer; // Selects the 8255 controller ControlData: Byte // control data ): Integer; stdcall; external 'FbiPpi.DLL';

    Parameter

    DeviceHandle Specifies the device handle obtained by the PpiOpen function.

    Controller

    Specifies the 8255 controller to be programmed. Code Controller

    FBIPPI_8255_CONTROLLER1 8255 controller_1 FBIPPI_8255_CONTROLLER2 8255 controller_2

    For the PCI-2747A, specify FBIPPI_8255_CONTROLLER1 only.

    ControlData Specifies the control data. Refer to the description of the 8255 PPI controller for the mode configurations and the configuration data of input/output port.

    Return Value

    The function returns FBIPPI_ERROR_SUCCESS if the process is successfully completed. Otherwise, this function returns another code. Please refer to “4.4 Return Values”.

  • GPF-2746C Help for Windows

    © 2001, 2015 Interface Corporation. All rights reserved.

    27

    Examples

    C INT Ret; HANDLE DeviceHandle; Ret = PpiControl( DeviceHandle, FBIPPI_8255_CONTROLLER1, 0x99 );

    Visual Basic Dim Ret As Long Dim DeviceHandle As Long Ret = PpiControl( DeviceHandle, FBIPPI_8255_CONTROLLER1, &h99 )

    Delphi var Ret: Integer; DeviceHandle: Integer; Ret := PpiControl( DeviceHandle, FBIPPI_8255_CONTROLLER1,$99 );

    Using port A and C as input and port B as output when group A and B of the 8255 controller (1) of the board specified by DeviceHandle are mode 0.

  • GPF-2746C Help for Windows

    © 2001, 2015 Interface Corporation. All rights reserved.

    28

    4.2.4 PpiInputPort

    Description The function reads the data from the 8255 controller port. Specify the controller and port with arguments.

    Syntax

    C INT PpiInputPort( HANDLE DeviceHandle, // device handle DWORD Controller, // Selects the 8255 controller DWORD Port, // port selection PBYTE Value // pointer to the variable to store

    // data );

    Visual Basic Declare Function PpiInputPort Lib "FbiPpi.DLL"( _ ByVal DeviceHandle As Long, ‘ device handle _ ByVal Controller As Long, ‘ Selects the 8255 controller _ ByVal Port As Long, ‘ port selection _ ByRef Value As Byte ‘ pointer to the variable to _

    ‘ store data _ )As Long

    Delphi function PpiInputPort ( DeviceHandle: THandle; // device handle Controller: Integer; // Selects the 8255 controller Port: Integer; // port selection var Value: Byte // pointer to the variable to store

    // data ): Integer; stdcall; external 'FbiPpi.DLL';

    Parameter

    DeviceHandle Specifies the device handle obtained by the PpiOpen function.

    Controller

    Specifies the 8255 controller. FBIPPI_8255_CONTROLLER1 : 8255 controller_1 FBIPPI_8255_CONTROLLER2 : 8255 controller_2 For the PCI-2747A, specify FBIPPI_8255_CONTROLLER1 only.

    Port Specifies the port to be read with the following identifier. FBIPPI_PORT_A : Port A FBIPPI_PORT_B : Port B FBIPPI_PORT_C : Port C

  • GPF-2746C Help for Windows

    © 2001, 2015 Interface Corporation. All rights reserved.

    29

    Value

    Points to a variable to receive the read data. With Visual Basic or Delphi, the variable is passed by reference. The following table shows the data logic.

    Input Data Signal Level 1 ”High” (open) 0 ”Low” (closed)

    Return Value

    The function returns FBIPPI_ERROR_SUCCESS if the process is successfully completed. Otherwise, this function returns another code. Please refer to “4.4 Return Values”.

    Examples

    C INT Ret; HANDLE DeviceHandle; BYTE Value; Ret = PpiInputPort( DeviceHandle, FBIPPI_8255_CONTROLLER1,FBIPPI_PORT_A, &Value );

    Visual Basic Dim Ret As Long Dim DeviceHandle As Long Dim Value As Byte Ret = PpiInputPort( DeviceHandle, FBIPPI_8255_CONTROLLER1,FBIPPI_PORT_A, Value )

    Delphi var Ret: Integer; DeviceHandle: Integer; Value: Byte; Ret := PpiInputPort( DeviceHandle, FBIPPI_8255_CONTROLLER1,FBIPPI_PORT_A, Value );

    Read the port A of the 8255 controller_1 on the board specified by DeviceHandle

  • GPF-2746C Help for Windows

    © 2001, 2015 Interface Corporation. All rights reserved.

    30

    4.2.5 PpiOutputPort

    Description The function writes the data to the port. Specify the controller and port with arguments.

    Syntax

    C INT PpiOutputPort ( HANDLE DeviceHandle, // device handle DWORD Controller, // Selects the 8255 controller DWORD Port, // port selection BYTE Value // Output data );

    Visual Basic Declare Function PpiOutputPort Lib "FbiPpi.DLL"( _ ByVal DeviceHandle As Long, ‘ device handle _ ByVal Controller As Long, ‘ Selects the 8255 controller _ ByVal Port As Long, ‘ port selection _ ByVal Value As Byte ‘ Output data _ )As Long

    Delphi function PpiOutputPort ( DeviceHandle: THandle; // device handle Controller: Integer; // Selects the 8255 controller Port: Integer; // port selection Value: Byte // Output data ): Integer; stdcall; external 'FbiPpi.DLL';

    Parameter

    DeviceHandle Specifies the device handle obtained by the PpiOpen function.

    Controller

    Specifies the 8255 controller. FBIPPI_8255_CONTROLLER1 : 8255 controller_1 FBIPPI_8255_CONTROLLER2 : 8255 controller_2 * For the PCI-2747A, specify “FBIPPI_8255_CONTROLLER1”.

    Port

    Specifies the port to be written. FBIPPI_PORT_A : Port A FBIPPI_PORT_B : Port B FBIPPI_PORT_C : Port C

  • GPF-2746C Help for Windows

    © 2001, 2015 Interface Corporation. All rights reserved.

    31

    Value Specifies the data to write. The following table shows the data logic.

    Output Data Signal Level 1 ”High”(open) 0 ”Low”(closed)

    Return Value

    The function returns FBIPPI_ERROR_SUCCESS if the process is successfully completed. Otherwise, this function returns another code. Please refer to “4.4 Return Values”.

    Examples C INT Ret; HANDLE DeviceHandle; BYTE Value; Value = 0x33; Ret = PpiOutputPort( DeviceHandle, FBIPPI_8255_CONTROLLER1,FBIPPI_PORT_A, Value );

    Visual Basic Dim Ret As Long Dim DeviceHandle As Long Dim Value As Byte Value = &h33 Ret = PpiOutputPort( DeviceHandle, FBIPPI_8255_CONTROLLER1,FBIPPI_PORT_A, Value )

    Delphi var Ret: Integer; DeviceHandle: Integer; Value: Byte; Value := $33; Ret := PpiOutputPort( DeviceHandle, FBIPPI_8255_CONTROLLER1,FBIPPI_PORT_A, Value );

    Writing the data to Port A of the 8255 controller_1 on the digital I/O board specified by DeviceHandle

  • GPF-2746C Help for Windows

    © 2001, 2015 Interface Corporation. All rights reserved.

    32

    4.2.6 PpiSetEventMask

    Description The function configures the mask settings.

    Syntax

    C INT PpiSetEventMask ( HANDLE DeviceHandle, // device handle BYTE EventMask // interrupt mask configuration data );

    Visual Basic Declare Function PpiSetEventMask Lib "FbiPpi.DLL"( _ ByVal DeviceHandle As Long, ‘ device handle _ ByVal EventMask As Byte ‘ interrupt mask configuration _

    ‘ data _ )As Long

    Delphi function PpiSetEventMask ( DeviceHandle: THandle; // device handle EventMask: Byte // interrupt mask configuration data ): Integer; stdcall; external 'FbiPpi.DLL';

    Parameter

    DeviceHandle Specifies the device handle obtained by the PpiOpen function.

    EventMask

    Specifies a mask/unmask data of interrupt sources. bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0

    - - SIGR SIGT SIG4 SIG3 SIG2 SIG1 * SIGR: External interrupt mask

    SIGT: Timer interrupt mask * SIG1 through SIG4: Mask bits for interrupt sources specified by the PpiSetEventConfig function. 0: Mask 1: Unmask All interrupt sources are masked at the default settings. When the PCI bus is reset or an external reset is asserted, interrupt sources except SIGR are masked (0). In this case, the mask setting of SIGR is not changed.

    Return Value

    The function returns FBIPPI_ERROR_SUCCESS if the process is successfully completed. Otherwise, this function returns another code. Please refer to “4.4 Return Values”.

  • GPF-2746C Help for Windows

    © 2001, 2015 Interface Corporation. All rights reserved.

    33

    Examples

    C INT Ret; HANDLE DeviceHandle; Ret = PpiSetEventMask( DeviceHandle, 0x36 );

    Visual Basic Dim Ret As Long Dim DeviceHandle As Long Ret = PpiSetEventMask( DeviceHandle, &h36 )

    Delphi var Ret: Integer; DeviceHandle: Integer; Ret := PpiSetEventMask( DeviceHandle, $36 );

    Masking interrupt sources, SIG1 and SIG4, on the digital I/O board specified by DeviceHandle.

  • GPF-2746C Help for Windows

    © 2001, 2015 Interface Corporation. All rights reserved.

    34

    4.2.7 PpiGetEventMask

    Description The function retrieves interrupt mask settings.

    Syntax

    C INT PpiGetEventMask ( HANDLE DeviceHandle, // device handle PBYTE EventMask // pointer to the variable to store

    // interrupt mask status );

    Visual Basic Declare Function PpiGetEventMask Lib "FbiPpi.DLL"( _ ByVal DeviceHandle As Long, ‘ device handle _ ByRef EventMask As Byte ‘ pass by reference to the variable_

    ‘ to store interrupt mask status_)As Long

    Delphi function PpiGetEventMask ( DeviceHandle: THandle; // device handle var EventMask: Byte // pass by reference to the variable to

    // store interrupt mask status ): Integer; stdcall; external 'FbiPpi.DLL';

    Parameter

    DeviceHandle Specifies the device handle obtained by the PpiOpen function.

    EventMask Points to a variable to receive an interrupt mask. With Visual Basic or Delphi, the variable is passed

    by reference.

    bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0 - - SIGR SIGT SIG4 SIG3 SIG2 SIG1

    * SIGR: External interrupt mask

    SIGT: Timer interrupt mask * SIG1 through SIG4: Mask bits for interrupt sources specified by the PpiSetEventConfig function. 0: Mask 1: Unmask

    All interrupt sources are masked at the default settings. When the PCI bus is reset or an external reset is asserted, interrupt sources except SIGR are masked. In this case, the mask setting of SIGR is not changed.

    Return Value The function returns FBIPPI_ERROR_SUCCESS if the process is successfully completed. Otherwise, this function returns another code. Please refer to “4.4 Return Values”.

  • GPF-2746C Help for Windows

    © 2001, 2015 Interface Corporation. All rights reserved.

    35

    Examples

    C INT Ret; HANDLE DeviceHandle; BYTE EventMask; Ret = PpiGetEventMask(DeviceHandle, &EventMask );

    Visual Basic Dim Ret As Long Dim DeviceHandle As Long Dim EventMask As Byte Ret = PpiGetEventMask(DeviceHandle, EventMask )

    Delphi var Ret: Integer; DeviceHandle: Integer; EventMask: Byte; Ret := PpiGetEventMask( DeviceHandle, EventMask );

    Storing the status of the interrupt mask on the digital I/O board specified by DeviceHandle in the EventMask variable.

  • GPF-2746C Help for Windows

    © 2001, 2015 Interface Corporation. All rights reserved.

    36

    4.2.8 PpiSetEventConfig

    Description The function assigns interrupt sources and configures interrupt signals.

    Syntax

    C INT PpiSetEventConfig ( HANDLE DeviceHandle, // device handle BYTE EventConfig // interrupt configuration data );

    Visual Basic Declare Function PpiSetEventConfig Lib "FbiPpi.DLL"( _ ByVal DeviceHandle As Long, ‘ device handle _ ByVal EventConfig As Byte ‘ interrupt configuration _

    ‘ data _ )As Long

    Delphi function PpiSetEventConfig ( DeviceHandle: THandle; // device handle EventConfig: Byte // interrupt configuration data ): Integer; stdcall; external 'FbiPpi.DLL';

    Parameter

    DeviceHandle Specifies the device handle obtained by the PpiOpen function.

    EventConfig

    Specifies the data to assign interrupt sources and to configure interrupt logic.

    bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0

    EDS4 EDS3 EDS2 EDS1 SIG4 SIG3 SIG2 SIG1 Interrupt logic configuration status (EDS4 through EDS1) EDS1 : Configuration of the interrupt logic of SIG1 EDS2 : Configuration of the interrupt logic of SIG2 EDS3 : Configuration of the interrupt logic of SIG3 EDS4 : Configuration of the interrupt logic of SIG4

    EDS1 through EDS4: Active interrupt edges of SIG1 through SIG4

    0: High-to-low (falling edge) 1: Low-to-high (rising edge)

    Interrupt source assignment (SIG1)

    0: 1PC3 (8255 controller_1, Port C, pin 1PC3) input signal 1: Reserved

    Interrupt source assignment (SIG2)

    0: 1PC0 (8255 controller_1, Port C, pin 1PC0) input signal 1: IR.IN

  • GPF-2746C Help for Windows

    © 2001, 2015 Interface Corporation. All rights reserved.

    37

    Interrupt source assignment (SIG3) 0: 2PC3 (8255 controller_2, Port C, pin 2PC3) input signal

    Interrupt source assignment (SIG4)

    0: 2PC0 (8255 controller_2, Port C, pin 2PC0) input signal 1: IR.IN2

    bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0 - - EDS2 EDS1 - - SIG2 SIG1

    Interrupt logic configuration status (EDS1 and EDS2) EDS1 : Configuration of the interrupt logic of SIG1 EDS2 : Configuration of the interrupt logic of SIG2

    0: High-to-low (falling edge) 1: Low-to-high (rising edge)

    Interrupt source assignment (SIG1)

    0: PC3 (8255 controller_1, Port C, pin PC3) input signal

    Interrupt source assignment (SIG2) 0: PC0 (8255 controller_1, Port C, pin PC0) input signal

    * When the PCI bus is reset, the external reset signal is asserted, or the power is turned on, the

    setting value is set to 0. * In MODE 0, the interrupt request signals from 1PC3, 1PC0, 2PC3, and 2PC0 (for 2747A, PC3 and

    PC0) cannot be generated.

    Return Value The function returns FBIPPI_ERROR_SUCCESS if the process is successfully completed. Otherwise, this function returns another code. Please refer to “4.4 Return Values”.

    Examples

    C INT Ret; HANDLE DeviceHandle; Ret = PpiSetEventConfig( DeviceHandle, 0xAA );

    Visual Basic Dim Ret As Long Dim DeviceHandle As Long Ret = PpiSetEventConfig( DeviceHandle, &hAA )

    Delphi var Ret: Integer; DeviceHandle: Integer; Ret := PpiSetEventConfig( DeviceHandle, $AA );

    Configuring to generate interrupt when the IR.IN1 and IR.IN2 signals of the digital I/O board specified by DeviceHandle change from low to high. (only in PCI-2746C)

  • GPF-2746C Help for Windows

    © 2001, 2015 Interface Corporation. All rights reserved.

    38

    4.2.9 PpiGetEventConfig

    Description The function retrieves the assignment of interrupt sources and interrupt logic configurations.

    Syntax

    C INT PpiGetEventConfig ( HANDLE DeviceHandle, // device handle PBYTE EventConfig // pointer to the variable to store

    // interrupt configuration data );

    Visual Basic Declare Function PpiGetEventConfig Lib "FbiPpi.DLL"( _ ByVal DeviceHandle As Long, ‘ device handle _ ByRef EventConfig As Byte ‘ pass by reference to the_

    ‘ variable to store interrupt_ ‘ configuration data _

    )As Long

    Delphi function PpiGetEventConfig ( DeviceHandle: THandle; // device handle var

    EventConfig: Byte // pass by reference to the variable to

    // store interrupt configuration data ): Integer; stdcall; external 'FbiPpi.DLL';

    Parameter

    DeviceHandle Specifies the device handle obtained by the PpiOpen function.

    EventConfig

    Points to a variable to receive the data of interrupt sources and interrupt logic configurations. For Visual Basic .NET, Points to a variable to receive the data of interrupt logic configurations.

    bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0 EDS4 EDS3 EDS2 EDS1 SIG4 SIG3 SIG2 SIG1

    Interrupt logic configuration status (EDS4 through EDS1) EDS1 : Configuration of the interrupt logic of SIG1 EDS2 : Configuration of the interrupt logic of SIG2 EDS3 : Configuration of the interrupt logic of SIG3 EDS4 : Configuration of the interrupt logic of SIG4

    EDS1 through EDS4: Active interrupt edges of SIG1 through SIG4

    0: High-to-low (falling edge) 1: Low-to-high (rising edge)

  • GPF-2746C Help for Windows

    © 2001, 2015 Interface Corporation. All rights reserved.

    39

    Interrupt source assignment (SIG1) 0: 1PC3 (8255 controller_1, Port C, pin 1PC3) input signal

    * 2747A: PC3 (8255 controller_1, Port C, pin PC3) input signal Interrupt source assignment (SIG2)

    0: 1PC0 (8255 controller_1, Port C, pin 1PC0) input signal 1: IR.IN * 2747A: PC0 (8255 controller_1, Port C, pin PC0) input signal0 IR. IN1 is not included.

    Interrupt source assignment (SIG3)

    0: 2PC3 (8255 controller_2, Port C, pin 2PC3) input signal * No meaning for 2747A.

    Interrupt source assignment (SIG4)

    0: 2PC0 (8255 controller_2, Port C, pin 2PC0) input signal * No meaning for 2747A.

    * When the PCI bus is reset, the external reset signal is asserted, or the power is turned on, the

    setting value is set to 0. * When in MODE 0, the interrupt request signals from 1PC3, 1PC0, 2PC3, and 2PC0 cannot be

    generated.

    Return Value The function returns FBIPPI_ERROR_SUCCESS if the process is successfully completed. Otherwise, this function returns another code. Please refer to “4.4 Return Values”.

    Examples

    C INT Ret; HANDLE DeviceHandle; BYTE EventConfig; Ret = PpiGetEventConfig( DeviceHandle, &EventConfig );

    Visual Basic Dim Ret As Long Dim DeviceHandle As Long Dim EventConfig As Byte Ret = PpiGetEventConfig( DeviceHandle, EventConfig )

    Delphi var Ret: Integer; DeviceHandle: Integer; EventConfig: Byte; Ret := PpiGetEventConfig( DeviceHandle, EventConfig );

    Storing interrupt setting data of the digital I/O board specified by DeviceHandle in EventConfig.

  • GPF-2746C Help for Windows

    © 2001, 2015 Interface Corporation. All rights reserved.

    40

    4.2.10 PpiSetTimerConfig

    Description The function configures the interrupt.

    Syntax

    C INT PpiSetTimerConfig ( HANDLE DeviceHandle, // device handle BYTE TimerConfigValue // setting value );

    Visual Basic Declare Function PpiSetTimerConfig Lib "FbiPpi.DLL"( _ ByVal DeviceHandle As Long, ‘ device handle _ ByVal TimerConfigValue As Byte ‘ setting value _ )As Long

    Delphi function PpiSetTimerConfig ( DeviceHandle: THandle; // device handle TimerConfigValue: Byte // setting value ): Integer; stdcall; external 'FbiPpi.DLL';

    Parameter

    DeviceHandle Specifies the device handle obtained by the PpiOpen function.

    TimerConfigValue Bit combination to configure the interval timer. The interval timer event period is obtained by the following equations.

    Period = base clock period × clock divisor

    bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0 - CTL7 CTL6 CTL5 CTL4 CTL3 CTL2 CTL1

    CTL1 through CTL4 divisor settings

    CTL4 CTL3 CTL2 CTL1 Timer Stop 0 0 0 0 1 divisor 0 0 0 1 2 divisor 0 0 1 0 3 divisor 0 0 1 1 4 divisor 0 1 0 0 5 divisor 0 1 0 1 6 divisor 0 1 1 0 7 divisor 0 1 1 1 8 divisor 1 0 0 0 9 divisor 1 0 0 1

    10 divisor 1 0 1 0 11 divisor 1 0 1 1 12 divisor 1 1 0 0 13 divisor 1 1 0 1 14 divisor 1 1 1 0 15 divisor 1 1 1 1

  • GPF-2746C Help for Windows

    © 2001, 2015 Interface Corporation. All rights reserved.

    41

    CTL5 through CTL7 base clock period setting

    CTL7 CTL6 CTL5 10µs 0 0 0

    100µs 0 0 1 1ms 0 1 0

    10ms 0 1 1 100ms 1 0 0

    Return Value

    The function returns FBIPPI_ERROR_SUCCESS if the process is successfully completed. Otherwise, this function returns another code. Please refer to “4.4 Return Values”.

    Examples C INT Ret; HANDLE DeviceHandle; Ret = PpiSetTimerConfig( DeviceHandle, 0x38 );

    Visual Basic Dim Ret As Long Dim DeviceHandle As Long Ret = PpiSetTimerConfig( DeviceHandle, &h38 )

    Delphi var Ret: Integer; DeviceHandle: Integer; Ret := PpiSetTimerConfig( DeviceHandle, $38 );

    Configuring the interval timer of the digital I/O board specified by DeviceHandle as follows; base clock: 8, clock divisor: 100.

  • GPF-2746C Help for Windows

    © 2001, 2015 Interface Corporation. All rights reserved.

    42

    4.2.11 PpiGetTimerConfig

    Description The function retrieves the configuration data of an interval timer.

    Syntax

    C INT PpiGetTimerConfig ( HANDLE DeviceHandle, // device handle PBYTE TimerConfigValue // pointer to the variable to store the

    // counter configuration );

    Visual Basic Declare Function PpiGetTimerConfig Lib "FbiPpi.DLL"( _ ByVal DeviceHandle As Long, ‘ device handle _ ByRef TimerConfigValue As Byte ‘ pass by reference to the_

    ‘ variable to store the counter_‘ configuration _

    )As Long

    Delphi function PpiGetTimerConfig ( DeviceHandle: THandle; // device handle var TimerConfigValue: Byte // pass by reference to the

    // variable to store the counter // configuration

    ): Integer; stdcall; external 'FbiPpi.DLL';

    Parameter DeviceHandle

    Specifies the device handle obtained by the PpiOpen function. TimerConfigValue

    Points to a variable to receive the interval timer settings. For Visual Basic and Delphi, the interval timer event period is obtained by the following equations.

    Period = base clock period × clock divisor

    bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0 - CTL7 CTL6 CTL5 CTL4 CTL3 CTL2 CTL1

  • GPF-2746C Help for Windows

    © 2001, 2015 Interface Corporation. All rights reserved.

    43

    CTL1 through CTL4 divisor settings

    CTL4 CTL3 CTL2 CTL1 Timer Stop 0 0 0 0 1 divisor 0 0 0 1 2 divisor 0 0 1 0 3 divisor 0 0 1 1 4 divisor 0 1 0 0 5 divisor 0 1 0 1 6 divisor 0 1 1 0 7 divisor 0 1 1 1 8 divisor 1 0 0 0 9 divisor 1 0 0 1

    10 divisor 1 0 1 0 11 divisor 1 0 1 1 12 divisor 1 1 0 0 13 divisor 1 1 0 1 14 divisor 1 1 1 0 15 divisor 1 1 1 1

    CTL5 through CTL7 base clock period settings

    CTL7 CTL6 CTL5 10µs 0 0 0

    100µs 0 0 1 1ms 0 1 0

    10ms 0 1 1 100ms 1 0 0

    Return Value

    The function returns FBIPPI_ERROR_SUCCESS if the process is successfully completed. Otherwise, this function returns another code. Please refer to “4.4 Return Values”.

  • GPF-2746C Help for Windows

    © 2001, 2015 Interface Corporation. All rights reserved.

    44

    Examples

    C INT Ret; HANDLE DeviceHandle; BYTE TimerConfigValue; Ret = PpiGetTimerConfig( DeviceHandle, &TimerConfigValue );

    Visual Basic Dim Ret As Long Dim DeviceHandle As Long Dim TimerConfigValue As Byte Ret = PpiGetTimerConfig( DeviceHandle, TimerConfigValue )

    Delphi var Ret: Integer; DeviceHandle: Integer; TimerConfigValue: Byte; Ret := PpiGetTimerConfig( DeviceHandle, TimerConfigValue );

    Retrieving the interval timer configuration from the digital I/O board specified by DeviceHandle and store it to TimerConfig.

  • GPF-2746C Help for Windows

    © 2001, 2015 Interface Corporation. All rights reserved.

    45

    4.2.12 PpiGetTimerCount

    Description The function retrieves the counter value of the interval timer.

    Syntax

    C INT PpiGetTimerCount ( HANDLE DeviceHandle, // device handle PBYTE TimerCount // pointer to the variable to store the

    //counter value );

    Visual Basic Declare Function PpiGetTimerCount Lib "FbiPpi.DLL"( _ ByVal DeviceHandle As Long, ‘ device handle _ ByRef TimerCount As Byte ‘ pass by reference to the

    ‘ variable to store the _ ‘ counter value _

    )As Long

    Delphi function PpiGetTimerCount ( DeviceHandle: THandle; // device handle var TimerCount: Byte // pass by reference to the

    // variable to store the // counter value

    ): Integer; stdcall; external 'FbiPpi.DLL';

    Parameter DeviceHandle

    Specifies the device handle obtained by the PpiOpen function. TimerCount

    Points to a variable to receive the current counter value of the interval timer on the board. For Visual Basic or Delphi, the variable is passed by reference.

    Comment

    The 4-bit counter retrieves the current status value for the frequency specified by the PpiSetTimerConfig function.

    bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0 - - - - CTL4 CTL3 CTL2 CTL1

  • GPF-2746C Help for Windows

    © 2001, 2015 Interface Corporation. All rights reserved.

    46

    CTL1 through CTL4 timer count value

    CTL4 CTL3 CTL2 CTL1 0 count 0 0 0 0 1 count 0 0 0 1 2 count 0 0 1 0 3 count 0 0 1 1 4 count 0 1 0 0 5 count 0 1 0 1 6 count 0 1 1 0 7 count 0 1 1 1 8 count 1 0 0 0 9 count 1 0 0 1

    10 count 1 0 1 0 11 count 1 0 1 1 12 count 1 1 0 0 13 count 1 1 0 1 14 count 1 1 1 0 15 count 1 1 1 1

    Return Value

    The function returns FBIPPI_ERROR_SUCCESS if the process is successfully completed. Otherwise, this function returns another code. Please refer to “4.4 Return Values”.

    Examples C INT Ret; HANDLE DeviceHandle; BYTE TimerCount; Ret = PpiGetTimerCount( DeviceHandle, &TimerCount );

    Visual Basic Dim Ret As Long Dim DeviceHandle As Long Dim TimerCount As Byte Ret = PpiGetTimerCount( DeviceHandle, TimerCount )

    Delphi var Ret: Integer; DeviceHandle: Integer; TimerCount: Byte; Ret := PpiGetTimerCount( DeviceHandle, TimerCount );

    Retrieving the counter value of the interval timer on the digital I/O board specified by DeviceHandle.

  • GPF-2746C Help for Windows

    © 2001, 2015 Interface Corporation. All rights reserved.

    47

    4.2.13 PpiGetResetInStatus Description

    The function retrieves status of the external reset input signal.

    Syntax C INT PpiGetResetInStatus ( HANDLE DeviceHandle, // device handle PBYTE ResetInStatus // pointer to the variable to store the status

    // of the external reset // input signal

    );

    Visual Basic Declare Function PpiGetResetInStatus Lib "FbiPpi.DLL"( _ ByVal DeviceHandle As Long, ‘ device handle _ ByRef ResetInStatus As Byte ‘ pass by reference to the _

    ‘ variable to store the status of _ ‘ the external reset input signal _

    )As Long

    Delphi function PpiGetResetInStatus ( DeviceHandle: THandle; // device handle var ResetInStatus: Byte // pass by reference to the variable

    // to store the status of the external// reset input signal

    ): Integer; stdcall; external 'FbiPpi.DLL';

    Parameter DeviceHandle

    Specifies the device handle obtained by the PpiOpen function. ResetInStatus

    Points to a variable to receive the status of the external reset input signal. 0: External reset input signal is deasserted. 1: External reset signal is asserted.

    In Visual Basic or Delphi, the variable is passed by reference.

    Return Value The function returns FBIPPI_ERROR_SUCCESS if the process is successfully completed. Otherwise, this function returns another code. Please refer to “4.4 Return Values”.

    Comment While the external reset signal is asserted (ResetInStatus = 1), you cannot configure output, interrupt masks, or sources. If the board is reset by the external reset signal, make sure that the reset input signal has been deasserted by the PpiGetResetInStatus function. Then setup the board again.

  • GPF-2746C Help for Windows

    © 2001, 2015 Interface Corporation. All rights reserved.

    48

    Examples

    C INT Ret; HANDLE DeviceHandle; BYTE ResetInStatus; Ret = PpiGetResetInStatus( DeviceHandle, &ResetInStatus );

    Visual Basic Dim Ret As Long Dim DeviceHandle As Long Dim ResetInStatus As Byte Ret = PpiGetResetInStatus( DeviceHandle, ResetInStatus )

    Delphi var Ret: Integer; DeviceHandle: Integer; ResetInStatus: Byte; Ret := PpiGetResetInStatus( DeviceHandle, ResetInStatus );

    Retrieving the status of the external reset input signal on the digital I/O board specified by DeviceHandle and storing it to the ResetInStatus.

  • GPF-2746C Help for Windows

    © 2001, 2015 Interface Corporation. All rights reserved.

    49

    4.2.14 PpiEventRequestPending

    Description The function waits for interrupt events. In the case of asynchronous call that specifies overlapped structure (Overlapped), the program returns FBIPPI_ERROR_IO_PENDING and operates asynchronously. Configure and unmask required interrupt events with the PpiSetEventMask and PpiSetEventConfig functions beforehand.

    Syntax

    C INT PpiEventRequestPending ( HANDLE DeviceHandle, // device handle DWORD EventEnableMask, // event mask PDWORD EventBuf, // pointer to the variable to store

    // the event contents LPOVERLAPPED Overlapped // pointer to the OVERLAPPED

    // structure );

    Visual Basic Declare Function PpiEventRequestPending Lib "FbiPpi.DLL"( _ ByVal DeviceHandle As Long, ‘ device handle _ ByVal EventEnableMask As Long, ‘ event mask _ ByRef EventBuf As Long, ‘ pass by reference to the_

    ‘ variable to store the event_ ‘ contents _

    ByRef Overlapped As OVERLAPPED ‘ pass by reference to the_‘ OVERLAPPED structure _

    )As Long

    Delphi function PpiEventRequestPending ( DeviceHandle: Thandle; // device handle EventEnableMask: DWORD; // event mask var EventBuf: DWORD; // pass by reference to the variable

    // to store the event contents var Overlapped: TOverlapped // pass by reference to the

    // OVERLAPPED structure ): Integer; stdcall; external 'FbiPpi.DLL';

  • GPF-2746C Help for Windows

    © 2001, 2015 Interface Corporation. All rights reserved.

    50

    Parameter

    DeviceHandle Specifies the device handle obtained by the PpiOpen function.

    EventEnableMask

    Specify the events to be enabled with bit assignment. An event is enabled when the bit is “1”. - Interrupt event In mode 0, interrupts from 1PC3, 1PC0, 2PC3, 2PC0 are not generated.

    bit 0: 1PC3 (8255 controller_1, Port C, pin 1PC3) bit 1: 1PC0(8255 controller_1, Port C, pin 1PC0) or input signal from IR.IN1(input signal from external interrupt ) * The PCI-27247A does not include IR.IN1 signal. bit2: 2PC3 (8255 controller_2, Port C, pin 2PC3) * The PCI-27247A does not include 8255 controller_2. bit 3: 2PC0(8255 controller_2, Port C, pin 2PC0) or input signal from IR.IN2(input signal from external interrupt ) * The PCI-27247A does not include IR. IN1 signal. bit 4: Interval timer bit 5: External Reset Input (RSTIN) interrupt

    EventBuf Points to a variable to store the notified event status. In Visual Basic or Delphi, specify the variable to store event status. In Visual Basic or Delphi, the variable is passed by reference. An event is enabled when the corresponding bit is “1”.

    - Interrupt event In mode 0, interrupts from 1PC3, 1PC0, 2PC3, 2PC0 are not generated.

    bit 0: 1PC3 (8255 controller_1, Port C, pin 1PC3) bit 1: 1PC0(8255 controller_1, Port C, pin 1PC0) or input signal from IR.IN1(input signal from

    external interrupt ) * The PCI-27247A does not include IR.IN1 signal.

    bit2 : 2PC3 (8255 controller_2, Port C, pin 2PC3) * The PCI-27247A does not include the 8255_2 signal.

    bit3 : 2PC0(8255 controller_2, Port C, pin 2PC0) or input signal from IR.IN2(input signal from external interrupt ) * The PCI-27247A does not include IR. IN1 signal.

    bit4 : Interval timer bit5 : External Reset Input (RSTIN) interrupt

    Overlapped

    Points to the OVERLAPPED structure. In Visual Basic or Delphi, the variable is passed by reference.

    Return Value

    The function returns FBIPPI_ERROR_SUCCESS if the process is successfully completed. Otherwise, this function returns another code. Please refer to “4.4 Return Values”. In the asynchronous call, the function returns FBIPPI_ERROR_IO_PENDING.

  • GPF-2746C Help for Windows

    © 2001, 2015 Interface Corporation. All rights reserved.

    51

    Examples

    C INT Ret; HANDLE DeviceHandle; DWORD EventBuf; OVERLAPPED EventOverlapped; EventOverlapped.hEvent = CreateEvent(NULL, TRUE, FALSE, NULL); EventOverlapped.Offset = 0; EventOverlapped.OffsetHigh = 0; Ret = PpiEventRequestPending( DeviceHandle, 0x00000005, &EventBuf, &EventOverlapped );

    Visual Basic Dim Ret As Long Dim DeviceHandle As Long Dim EventBuf As Long Dim EventOverlapped As OVERLAPPED EventOverlapped.hEvent = CreateEvent(0, True, False, 0) EventOverlapped.Offset = 0 EventOverlapped.OffsetHigh = 0 Ret = PpiEventRequestPending( DeviceHandle, &h00000005, EventBuf, EventOverlapped )

    Delphi var Ret: Integer; DeviceHandle: Integer; EventBuf: DWORD; EventOverlapped: TOVERLAPPED; EventOverlapped.hEvent := CreateEvent(nil, True, False, nil); EventOverlapped.Offset := 0; EventOverlapped.OffsetHigh := 0; Ret := PpiEventRequestPending( DeviceHandle, $00000005, EventBuf, EventOverlapped );

    Waiting for the events 1PC3 (8255 controller_1, Port C, pin 1PC3) and 2PC3 (8255 controller_2, Port C, pin 2PC3) on the digital I/O board specified by DeviceHandle.

  • GPF-2746C Help for Windows

    © 2001, 2015 Interface Corporation. All rights reserved.

    52

    4.2.15 PpiCommonGetPciDeviceInfo

    Description The function retrieves the information of the board such as the device ID, vendor ID, RSW1 value, and so on. This function retrieves the RSW1 (board ID) setting values of multiple boards and allows you to determine the board to be controlled.

    Syntax

    C INT PpiCommonGetPciDeviceInfo ( HANDLE DeviceHandle, // device handle PDWORD DeviceID, // device ID PDWORD VendorID, // vender ID PDWORD ClassCode, // class code PDWORD RevisionID, // revision ID PDWORD BaseAddress0, // resource 0 PDWORD BaseAddress1, // resource 1 PDWORD BaseAddress2, // resource 2 PDWORD BaseAddress3, // resource 3 PDWORD BaseAddress4, // resource 4 PDWORD BaseAddress5, // resource 5 PDWORD SubsystemID, // subsystem ID PDWORD SubsystemVendorID, // subsystem vender ID PDWORD InterruptLine, // interrupt line PDWORD BoardID // board ID );

    Visual Basic Declare Function PpiCommonGetPciDeviceInfo Lib "FbiPpi.DLL"( _ ByVal DeviceHandle As Long, ‘ device handle _ ByRef DeviceID As Long, ‘ device ID _ ByRef VendorID As Long, ‘ vender ID _ ByRef ClassCode As Long, ‘ class code _ ByRef RevisionID As Long, ‘ revision ID _ ByRef BaseAddress0 As Long, ‘ resource 0 _ ByRef BaseAddress1 As Long, ‘ resource 1 _ ByRef BaseAddress2 As Long, ‘ resource 2 _ ByRef BaseAddress3 As Long, ‘ resource 3 _ ByRef BaseAddress4 As Long, ‘ resource 4 _ ByRef BaseAddress5 As Long, ‘ resource 5 _ ByRef SubsystemID As Long, ‘ subsystem ID _ ByRef SubsystemVendorID As Long, ‘ subsystem vender ID _ ByRef InterruptLine As Long, ‘ interrupt line _ ByRef BoardID As Long ‘ board ID _ )As Long

  • GPF-2746C Help for Windows

    © 2001, 2015 Interface Corporation. All rights reserved.

    53

    Delphi function PpiCommonGetPciDeviceInfo ( DeviceHandle: THandle; // device handle var DeviceID: DWORD; // device ID var VendorID: DWORD; // vender ID var ClassCode: DWORD; // class code var RevisionID: DWORD; // revision ID var BaseAddress0: DWORD; // resource 0 var BaseAddress1: DWORD; // resource 1 var BaseAddress2: DWORD; // resource 2 var BaseAddress3: DWORD; // resource 3 var BaseAddress4: DWORD; // resource 4 var BaseAddress5: DWORD; // resource 5 var SubsystemID: DWORD; // subsystem ID var SubsystemVendorID: DWORD; // subsystem vender ID var InterruptLine: DWORD; // interrupt line var BoardID: DWORD // board ID ): Integer; stdcall; external 'FbiPpi.DLL';

    Parameter

    DeviceHandle Specifies the device handle obtained by the PpiOpen function.0

    DeviceID Points to a variable to receive the device ID. With Visual Basic or Delphi, the variable is passed by reference. The ID is used to identify the device. The value is the 4-digit number of the product mode. For example, PCI-2746 is 2746 (or ABAh in hexadecimal number). * The data from the device ID to the following interrupt line are the data of PCI /C-PCI bus devices specified by the PCI Rev2.1. The Board ID is the setting value of the RSW1 on the board. It is not the data that the PCI/C-PCI bus devices includes as standard.

    VendorID Points to a variable to receive the vendor ID. With Visual Basic or Delphi, the variable is passed by reference. The vendor ID of Interface Corporation is 1147h.

    ClassCode Points to a variable to receive the class code data. For Visual Basic and Delphi, the variable is passed by reference. The class code of the device and the value specified in the PCI Rev2.1 are stored.

    RevisionID

    Points to a variable to receive the revision ID of the device. For Visual Basic and Delphi, the variable is passed by reference. The revision ID of the board is stored.

  • GPF-2746C Help for Windows

    © 2001, 2015 Interface Corporation. All rights reserved.

    54

    BaseAddress0

    Points to a variable to receive the resource 0 of the board. For Visual Basic or Delphi, the variable is passed by reference.

    The I/O or memory region occupied by the board is stored. In our PCI/C-PCI PPI boards stores the occupied I/O region here. The base address of the occupied I/O region is the value masked with FFFCh.

    BaseAddress1

    Points to a variable to receive the resource 1 data. For Visual Basic or Delphi, the variable is passed by reference. The I/O or memory region occupied by the board is stored.

    Do not use for Interface digital input/output boards with the 8255 PPI controllers for PCI/C-PCI bus.

    BaseAddress2 Points to a variable to receive the resource 2 data. For Visual Basic or Delphi, the variable is passed by reference. The I/O or memory region occupied by the board is stored. Do not use for Interface digital input/output boards with the 8255 PPI controllers.

    BaseAddress3 Points to a variable to receive resource 3 data. For Visual Basic or Delphi, the variable is passed by reference. The I/O or memory region occupied by the board is stored. Do not use for Interface digital input/output boards with the 8255 PPI controllers.

    BaseAddress4 Points to a variable to receive the resource 4 data. For Visual Basic or Delphi, the variable is passed by reference. The I/O or memory region occupied by the board is stored. Do not use for Interface digital input/output boards with the 8255 PPI controllers.

    BaseAddress5 Points to a variable to receive the resource 5 data. For Visual Basic or Delphi, the variable is passed by reference. The I/O or memory region occupied by the board is stored. Do not use for Interface digital input/output boards with the 8255 PPI controllers.

    SubsystemID Points to a variable to receive the subsystem ID data. This member identifies a type of the product. For Visual Basic or Delphi, the variable is passed by reference. The subsystem ID of the board is stored.

    SubsystemVendorID Points to a variable to receive the subsystem vendor ID data. For Visual Basic or Delphi, the variable is passed by reference. The subsystem vender ID of the board is stored.

  • GPF-2746C Help for Windows

    © 2001, 2015 Interface Corporation. All rights reserved.

    55

    InterruptLine

    Points to a variable to receive the interrupt line data. For Visual Basic or Delphi, the variable is passed by reference. The interrupt level of the board is stored.

    BoardID Points to a variable to receive the board ID data. For Visual Basic or Delphi, the variable is passed by reference. The setting value of RSW1 on the board is stored.

    Return Value

    The function returns FBIPPI_ERROR_SUCCESS if the process is successfully completed. Otherwise, this function returns another code. Please refer to “4.4 Return Values”.

    Examples C #include #include #include #include "FBIPPI.h" #define BOARD_NUM 4 // the number of board typedef struct { ULONG BoardModel; // the board model number ULONG RswNumber; // RSW1 setting value char DeviceName[16]; // device name } BOARDINFO, *PBOARDINFO; void main(void){ BOARDINFO Info[BOARD_NUM]; char Name[64]; int i,j, Count, Ret; HANDLE DeviceHandle; DWORD DeviceID,VendorID, ClassCode, RevisionID; DWORD BaseAddress0, BaseAddress1, BaseAddress2, BaseAddress3; DWORD BaseAddress4, BaseAddress5, SubsystemID,

    SubsystemVendorID; DWORD InterruptLine, BoardID; // configuring the model type to retrieve the device name and RSW1

    // setting Info[0].BoardModel = 2746; Info[0].RswNumber = 0; Info[0].DeviceName[0] = '¥0'; Info[1].BoardModel = 2746; Info[1].RswNumber = 1; Info[1].DeviceName[0] = '¥0'; Info[2].BoardModel = 2746; Info[2].RswNumber = 2; Info[2].DeviceName[0] = '¥0'; Info[3].BoardModel = 2746; Info[3].RswNumber = 3;

  • GPF-2746C Help for Windows

    © 2001, 2015 Interface Corporation. All rights reserved.

    56

    Info[3].DeviceName[0] = '¥0'; // association processing for(i=1,Count=0;i

  • GPF-2746C Help for Windows

    © 2001, 2015 Interface Corporation. All rights reserved.

    57

    Ret = PpiClose(DeviceHandle); if(Ret != FBIPPI_ERROR_SUCCESS){ printf("Error : PpiClose¥n"); } // Completes when all boards are searched if(Count == BOARD_NUM) break; } // displaying the retrieved device name for(i=0;i

  • GPF-2746C Help for Windows

    © 2001, 2015 Interface Corporation. All rights reserved.

    58

    Info(1).RswNumber = 1 Info(1).DeviceName = Chr(0) Info(2).BoardModel = 2746 Info(2).RswNumber = 2 Info(2).DeviceName = Chr(0) Info(3).BoardModel = 2746 Info(3).RswNumber = 3 Info(3).DeviceName = Chr(0) ' association processing

    Count = 0 For i = 1 To 255 ' opening the board Name = "FBIPPI" & i & Chr(0) DeviceHandle = PpiOpen(Name, 0) If DeviceHandle = &HFFFFFFFF Then GoTo Continue ' retrieving the board information Ret = PpiCommonGetPciDeviceInfo(DeviceHandle, DeviceID, VendorID, _ ClassCode, RevisionID, BaseAddress0, BaseAddress1, BaseAddress2, _ BaseAddress3, BaseAddress4, BaseAddress5, SubsystemID, _ SubsystemVendorID, InterruptLine, BoardID) If Ret FBIPPI_ERROR_SUCCESS Then Ret = MsgBox("Error : PpiCommonGetPciDeviceInfo", vbOKOnly + vbCritical, _ "FBIPPI") Else For j = 0 To (BOARD_NUM - 1) ' confirming the board model type with the device ID If DeviceID = Info(j).BoardModel Then ' Confirming RSW1 setting value If BoardID = Info(j).RswNumber Then ' Saving the device name because the board model

    type ' and RSW1 setting value match.

    Info(j).DeviceName = Name Count = Count + 1 Exit For End If End If Next j End If

  • GPF-2746C Help for Windows

    © 2001, 2015 Interface Corporation. All rights reserved.

    59

    ' closing the board Ret = PpiClose(DeviceHandle) If Ret FBIPPI_ERROR_SUCCESS Then nRet = MsgBox("Error : PpiClose", vbOKOnly + vbCritical, "FBIPPI") End If ' Completes when all boards are searched If Count = BOARD_NUM Then Exit For Continue: Next i ' displaying the retrieved device name ' add c after the model number Label1.Caption = "PCI-" & Info(0).BoardModel & "C" & " : RSW1-" & Info(0).RswNumber_ & " : " & Info(0).DeviceName Label2.Caption = "PCI-" & Info(1).BoardModel & "C" & " : RSW1-" & gInfo(1).RswNumber_ & " : " & Info(1).DeviceName Label3.Caption = "PCI-" & Info(2).BoardModel & "C" & " : RSW1-" & Info(2).RswNumber_ & " : " & Info(2).DeviceName Label4.Caption = "PCI-" & Info(3).BoardModel & "C" & " : RSW1-" & Info(3).RswNumber_ & " : " & Info(3).DeviceName End Sub

    Delphi type BOARDINFO = record BoardModel : Cardinal; RswNumber : Cardinal; DeviceName : array[0..15] of Char; end; procedure TForm1.Button1Click(Sender: TObject); var Info : array[0..4] of BOARDINFO; Name : array[0..15] of Char; i,j, Count, Ret : Integer; DeviceID, VendorID, ClassCode, RevisionID: DWORD; BaseAddress0, BaseAddress1,BaseAddress2, BaseAddress3: DWORD; BaseAddress4, BaseAddress5,SubsystemID, SubsystemVendorID: DWORD; InterruptLine, BoardID:DWORD; DevcieHandle : THandle; begin // configuring the model type to retrieve the device name and RSW1

    setting // value

  • GPF-2746C Help for Windows

    © 2001, 2015 Interface Corporation. All rights reserved.

    60

    Info[0].BoardModel := 2746; Info[0].RswNumber := 0; Info[0].DeviceName[0] := #0; Info[1].BoardModel := 2746; Info[1].RswNumber := 1; Info[1].DeviceName[0] := #0; Info[2].BoardModel := 2746; Info[2].RswNumber := 2; Info[2].DeviceName[0] := #0; Info[3].BoardModel := 2746; Info[3].RswNumber := 3; Info[3].DeviceName[0] := #0; // association processing Count := 0; for i := 1 to 255 do begin // opening the board StrPCopy(Name ,'FBIPPI'+ IntToStr(i)); DeviceHandle := PpiOpen(@Name[0],0); if DeviceHandle = INVALID_HANDLE_VALUE then Continue; // retrieving the board information Ret := PpiCommonGetPciDeviceInfo( DeviceHandle, // device handle DeviceID, // device ID VendorID, // vender ID ClassCode, // class code RevisionID, // revision ID BaseAddress0, // resource 0 BaseAddress1, // resource 1 BaseAddress2, // resource 2 BaseAddress3, // resource 3 BaseAddress4, // resource 4 BaseAddress5, // resource 5 SubsystemID, // subsystem ID SubsystemVendorID, // subsystem vender ID InterruptLine, // interrupt line BoardID // board ID ); if Ret FBIPPI_ERROR_SUCCESS then MessageDlg('Error : PpiCommonGetPciDeviceInfo', mtError, [mbOk], 0) else begin for j := 0 to 4 do begin //confirming the board model type with the device ID if DeviceID = Info[j].BoardModel then begin // confirming RSW1 setting value if BoardID = Info[j].RswNumber then begin // saving the device name because the board model

    type

  • GPF-2746C Help for Windows

    © 2001, 2015 Interface Corporation. All rights reserved.

    61

    // and RSW1 setting value match StrCopy(Info[j].DeviceName, Name); Count := Count + 1; Break; end; end; end; end; // closing the board Ret := PpiClose(DeviceHandle); if Ret FBIPPI_ERROR_SUCCESS then MessageDlg('Error : PpiClose', mtError, [mbOk], 0); // Completes when all boards are searched if Count = 4 then Break; end; // displaying the retrieved device name //add c after the model number Label1.Caption := 'PCI-' + IntToStr(Info[0].BoardModel) + 'C' + ' : RSW1-' + IntToStr(Info[0].RswNumber) + ' : ' + Info[0].DeviceName; Label2.Caption := 'PCI-' + IntToStr(Info[1].BoardModel) + 'C' + ' : RSW1-' + IntToStr(Info[1].RswNumber) + ' : ' + Info[1].DeviceName; Label3.Caption := 'PCI-' + IntToStr(Info[2].BoardModel) + 'C' + ' : RSW1-' + IntToStr(Info[2].RswNumber) + ' : ' + Info[2].DeviceName; Label4.Caption := 'PCI-' + IntToStr(Info[3].BoardModel) + 'C' + ' : RSW1-' + IntToStr(Info[3].RswNumber) + ' : ' + Info[3].DeviceName; end;

    Checking the device names of four PCI-2746C boards to which the board ID are individually specified. Change the board model to the model you actually use. Write the board model actually you use into the program. Try to open FBIPPI1 through FBIPPI255. If the devices are successfully opened, the program executes the PpiCommonGetPciDeviceInfo function. Then, the program identifies the device name with the retrieved device ID and board ID. The program distinguish the PCI-2746C and CTP-2746 with the subsystem ID (dwSubsystemID) The subsystem ID of the PCI-2746C is 001h, and that of the CTP-2746C is 0101h.

  • GPF-2746C Help for Windows

    © 2001, 2015 Interface Corporation. All rights reserved.

    62

    4.3 Structures

    OVERLAPPED Structure C

    typedef struct _OVERLAPPED { DWORD Internal; DWORD InternalHigh; DWORD Offset; DWORD OffsetHigh; DWORD hEvent; } OVERLAPPED;

    Visual Basic

    Type OVERLAPPED Internal As Long InternalHigh As Long Offset As Long OffsetHigh As Long hEvent As Long End Type

    Delphi

    POverlapped = ^TOverlapped; TOverlapped = record Internal: DWORD; InternalHigh: DWORD; Offset: DWORD; OffsetHigh: DWORD; hEvent: THandle; End Type

    Member Description Reserved for an operating system. This member has a status depending on the system and is valid when the GetOverlappedResult function returns control without setting the extended error information to ERROR_IO_PENDING.

    Internal

    Reserved for an operat