Mode 1 input programming example, Figure c-2. port c pin assignments, mode 1 input, Figure c-2 – National Instruments PC-DIO-24/PnP User Manual

Page 73

Advertising
background image

Appendix C

Register-Level Programming

© National Instruments Corporation

C-13

PC-DIO-24/PnP User Manual

0

INTRB

Interrupt Request Status for Port B—When INTEB
and IBFB are high, this bit is high, indicating that an
interrupt request is pending for port B.

At the digital I/O connector, port C has the following pin assignments
when in mode 1 input. Notice that the status of STBA* and the status of
STBB* are not included in the port C status word.

Figure C-2. Port C Pin Assignments, Mode 1 Input

Mode 1 Input Programming Example

The following example shows how to configure PPI A for various
combinations of mode 1 input. This code is strictly an example and is
not intended to be used without modification in a practical situation.

Main() {

#define BASE_ADDRESS

0x180

/* Board located at address 180 */

#define PORTAoffset

0x00

/* Offset for port A */

#define PORTBoffset

0x01

/* Offset for port B */

#define PORTCoffset

0x02

/* Offset for port C */

#define CNFGoffset

0x03

/* Offset for CNFG */

unsigned int porta, portb, portc, cnfg;

char valread;

/* Variable to store data read from a port */

/* Calculate register addresses */

porta = BASE_ADDRESS + PORTAoffset;

portb = BASE_ADDRESS + PORTBoffset;

portc = BASE_ADDRESS + PORTCoffset;

cnfg = BASE_ADDRESS + CNFGoffset;

PC7

PC6

PC5

PC4

PC3

PC2

PC1

PC0

I/O

I/O

IBFA

STBA*

INTRA

STBB*

IBFB

INTRB

Group A

Group B

Advertising