DioSet8255Mode


Function

Sets 8255 mode chip by chip.

Format

Ret = DioSet8255Mode ( Id , ChipNo , CtrlWord )

Parameters

Id [ VB.NET: Short ] [ C, C++: short ] [ C#: short ] [ Python: ctypes.c_short ]
Specify the device ID retrieved from DioInit.

ChipNo [ VB.NET: Short ] [ C, C++: short ] [ C#: short ] [ Python: ctypes.c_short ]
Specify the chip number of LSIi8255.
Chip number begins from 0 and increases by 1 every three ports.

CtrlWord [ VB.NET: Short ] [ C, C++: short ] [ C#: short ] [ Python: ctypes.c_short ]
Specify the control word. The setting value list of control word is shown below.

D7

D6

D5

D4

D3

D2

D1

D0

Hex

Port A

Port C

(High 4bit)

Port B

Port C

(Low 4bit)

1

0

0

0

0

0

0

0

80

OUTPUT

OUTPUT

OUTPUT

OUTPUT

1

0

0

0

0

0

0

1

81

OUTPUT

OUTPUT

OUTPUT

INPUT

1

0

0

0

0

0

1

0

82

OUTPUT

OUTPUT

INPUT

OUTPUT

1

0

0

0

0

0

1

1

83

OUTPUT

OUTPUT

INPUT

INPUT

1

0

0

0

1

0

0

0

88

OUTPUT

INPUT

OUTPUT

OUTPUT

1

0

0

0

1

0

0

1

89

OUTPUT

INPUT

OUTPUT

INPUT

1

0

0

0

1

0

1

0

8A

OUTPUT

INPUT

INPUT

OUTPUT

1

0

0

0

1

0

1

1

8B

OUTPUT

INPUT

INPUT

INPUT

1

0

0

1

0

0

0

0

90

INPUT

OUTPUT

OUTPUT

OUTPUT

1

0

0

1

0

0

0

1

91

INPUT

OUTPUT

OUTPUT

INPUT

1

0

0

1

0

0

1

0

92

INPUT

OUTPUT

INPUT

OUTPUT

1

0

0

1

0

0

1

1

93

INPUT

OUTPUT

INPUT

INPUT

1

0

0

1

1

0

0

0

98

INPUT

INPUT

OUTPUT

OUTPUT

1

0

0

1

1

0

0

1

99

INPUT

INPUT

OUTPUT

INPUT

1

0

0

1

1

0

1

0

9A

INPUT

INPUT

INPUT

OUTPUT

1

0

0

1

1

0

1

1

9B

INPUT

INPUT

INPUT

INPUT

Please refer to the supplied manual of a board for details.

Return Value

Ret [ VB.NET: Integer ] [ C, C++: long ] [ C#: int ] [ Python: ctypes.c_long ]

Definition

Value

[Dec]

Description

DIO_ERR_SUCCESS

0

Normal completed.

DIO_ERR_SYS_RECOVERED_FROM_STANDBY

7

Execute DioResetDevice function because the device has recovered from standby mode.

DIO_ERR_DLL_INVALID_ID

10001

Invalid ID specified.

DIO_ERR_DLL_CALL_DRIVER

10002

Not call the driver (Failure on DEVICE I/O CONTROL).

DIO_ERR_DLL_BUFF_ADDRESS

10100

Invalid data buffer address.

DIO_ERR_SYS_NOT_SUPPORTED

20001

This board couldn't use this function.

DIO_ERR_SYS_8255

20600

8255 chip number is outside of the range.

The others (See also: Details of Error Code)

Initial Value

The default setting is that all ports are set to input at system startup.

Remarks

For the device equipped with 0 mode of i8255 equivalent function, please execute DioInit first, and then set I/O ports (I/O channels) by using this function, after all, use I/O functions.

Example

Sets 80H to chip 0 of LSIi8255.

VB.NET

Dim Ret As Integer
Ret = DioSet8255Mode ( Id , 0 , &H80 )
 

C, C++

long Ret;
Ret = DioSet8255Mode ( Id , 0 , 0x80 );
 

C#

int Ret;
Ret = dio.Set8255Mode ( Id , 0 , 0x80 );
 

Python

Ret = ctypes.c_long()
Ret.value = cdio.DioSet8255Mode ( Id , 0 , 0x80 )