beautypg.com

ADLINK ACL-8454/12 User Manual

Page 36

background image

28

Registers Format

BASIC language

To write an output port:
10

BASE=&H240

20

VALUE% = &H2F

30

OUT( BASE+2), VALUE %

or

10

OUT( &H242 ), &H20

To read an input port
10

BASE=&H240

20

VALUE=INP(

BASE+2)

or
10

VALUE=INP( &H242 )

C language (Borland C++)

To write an output port:
#define

BASE

0x240

unsigned

int Value=0x2F;

outportb( BASE+2 , Value );

or

outportb( 0x242 , 0x2F );


To read an input port
#define

BASE

0x240

unsigned

int Value;

Value = inportb( BASE+2 );

or

Value = inportb( 0x242 );

Perform Functions
Users should study the operation theorem and the relative data sheet to
understand how to operate this card, and then use the low-level
programming to perform those functions. Generally, the DIO control can be
easily performed by only a few instructions, it is very suitable to use the low
level programming.

As to the higher-level functions such as the interrupt service routines, pulse
width measurement, frequency measurement, etc, user may use the library
or modify the examples to carry them out. However, fully understanding of
the PC system is necessary for certain applications.