Mode 1 Output Programming Example; Figure C-3. Port C Pin Assignments, Mode 1 Output - National Instruments PC-DIO-24/PnP User Manual

24-bit digital i/o board for isa computers
Table of Contents

Advertisement

Appendix C
Register-Level Programming
Main() {
#define BASE_ADDRESS
#define PORTAoffset
#define PORTBoffset
#define PORTCoffset
#define CNFGoffset
unsigned int porta, portb, portc, cnfg;
char valread;
/*
Calculate register addresses */
porta = BASE_ADDRESS + PORTAoffset;
portb = BASE_ADDRESS + PORTBoffset;
portc = BASE_ADDRESS + PORTCoffset;
cnfg
= BASE_ADDRESS + CNFGoffset;
/* EXAMPLE 1–port A output */
outp(cnfg,0xA0);
while (!(inp(portc) & 0x80));
outp(porta,0x12);
PC-DIO-24/PnP User Manual
Group A
Group B

Figure C-3. Port C Pin Assignments, Mode 1 Output

Mode 1 Output Programming Example

The following example shows how to configure PPI A for various
combinations of mode 1 output. This code is strictly an example and is
not intended to be used without modification in a practical situation.
0x180
0x00
0x01
0x02
0x03
/* Variable to store data read from a port */
PC7
OBFA*
PC6
ACKA*
PC5
PC4
PC3
INTRA
PC2
ACKB*
PC1
OBFB*
PC0
INTRB
/* Board located at address 180 */
/* Offset for port A */
/* Offset for port B */
/* Offset for port C */
/* Offset for CNFG */
/* Port A is an output in mode 1.*/
/* Wait until OBFA* is set,
indicating that the data last
written to port A has been
read.*/
/* Write data to port A. */
C-16
I/O
I/O
© National Instruments Corporation

Advertisement

Table of Contents
loading

Table of Contents