unit ccapdio;

interface

uses
    Windows;

//======================================================================
//======================================================================
//	API-CAP(W32)
//	CCAPDIO.PAS					CONTEC.CO.,LTD.
//======================================================================
//======================================================================

const
//======================================================================
// Error Code
//======================================================================
DIO_ERR_SUCCESS					=	0;			//Successed
DIO_ERR_INI_MEMORY				=	3;			//Cannot allocate memory
DIO_ERR_INI_REGISTRY			=	4;			//Cannot acceess setting file
DIO_ERR_DLL_DEVICE_NAME			=	10000;		//Used DeviceName unwritten in setting file
DIO_ERR_DLL_INVALID_ID			=	10001;		//Invalid Id
DIO_ERR_DLL_CREATE_FILE			=	10003;		//Cannot open
DIO_ERR_DLL_CLOSE_FILE			=	10004;		//Close error
DIO_ERR_ACCESS_RIGHT			=	10005;		//Access rights error
DIO_ERR_DLL_TIMEOUT				=	10006;		//Timeout
DIO_ERR_COMPOSITION				=	10007;		//System error
DIO_ERR_INFO_INVALID_DEVICE		=	10050;		//Invalid device
DIO_ERR_INFO_NOT_FIND_DEVICE	=	10051;		//Not find device
DIO_ERR_DLL_BUFF_ADDRESS		=	10100;		//Buffer address error
DIO_ERR_SYS_NOT_SUPPORTED		=	20001;		//Function is not supported
DIO_ERR_SYS_PORT_NO				=	20100;		//PortNo error
DIO_ERR_SYS_PORT_NUM			=	20101;		//PortNum error 
DIO_ERR_SYS_BIT_NO				=	20102;		//BitNo error
DIO_ERR_SYS_BIT_NUM				=	20103;		//BitNum error
DIO_ERR_SYS_BIT_DATA			=	20104;		//Bit data error
DIO_ERR_SYS_DIRECTION			=	20106;		//Direction error
DIO_ERR_SYS_FILTER				=	20400;		//Filter value error

//======================================================================
// Function Prototype
//======================================================================
function	DioInit(Devicename: PChar; Id: PSmallint):Longint;stdcall;external 'CCAPDIO.DLL';
function	DioExit(Id: Smallint):Longint;stdcall;external 'CCAPDIO.DLL';
function	DioGetErrorString(Err: Longint; szMsg: PChar):Longint;stdcall;external 'CCAPDIO.DLL';
function	DioQueryDeviceName(Index: Smallint; GroupID: PSmallint; UnitID: PSmallint; DeviceID: PSmallint; DeviceName: PChar; Device: PChar):Longint;stdcall;external 'CCAPDIO.DLL';
function	DioSetAccessRight(AccsRight: PByte):Longint;stdcall;external 'CCAPDIO.DLL';
function	DioSetDirectMode(Id: Smallint; DirectMode: Smallint):Longint;stdcall;external 'CCAPDIO.DLL';
function	DioSetIOInterval(Interval: Longint):Longint;stdcall;external 'CCAPDIO.DLL';
function	DioGetRemoteStatus(Id: Smallint; Start: PByte; Status: PByte):Longint;stdcall;external 'CCAPDIO.DLL';
function	DioSetDigitalFilter(Id: Smallint; FilterValue: Smallint):Longint;stdcall;external 'CCAPDIO.DLL';
function	DioGetDigitalFilter(Id: Smallint; FilterValue: PSmallint):Longint;stdcall;external 'CCAPDIO.DLL';
function	DioSetIoDirection(Id: Smallint; Dir: Longint):Longint;stdcall;external 'CCAPDIO.DLL';
function	DioGetIoDirection(Id: Smallint; Dir: PLongint):Longint;stdcall;external 'CCAPDIO.DLL';
function	DioInpByte(Id: Smallint; PortNo: Smallint; Data: PByte):Longint;stdcall;external 'CCAPDIO.DLL';
function	DioInpBit(Id: Smallint; BitNo: Smallint; Data: PByte):Longint;stdcall;external 'CCAPDIO.DLL';
function	DioOutByte(Id: Smallint; PortNo: Smallint; Data: Byte):Longint;stdcall;external 'CCAPDIO.DLL';
function	DioOutBit(Id: Smallint; BitNo: Smallint; Data: Byte):Longint;stdcall;external 'CCAPDIO.DLL';
function	DioEchoBackByte(Id: Smallint; PortNo: Smallint; Data: PByte):Longint;stdcall;external 'CCAPDIO.DLL';
function	DioEchoBackBit(Id: Smallint; BitNo: Smallint; Data: PByte):Longint;stdcall;external 'CCAPDIO.DLL';
function	DioInpMultiByte(Id: Smallint; PortNo: PSmallint; PortNum: Smallint; Data: PByte):Longint;stdcall;external 'CCAPDIO.DLL';
function	DioInpMultiBit(Id: Smallint; BitNo: PSmallint; BitNum: Smallint; Data: PByte):Longint;stdcall;external 'CCAPDIO.DLL';
function	DioOutMultiByte(Id: Smallint; PortNo: PSmallint; PortNum: Smallint; Data: PByte):Longint;stdcall;external 'CCAPDIO.DLL';
function	DioOutMultiBit(Id: Smallint; BitNo: PSmallint; BitNum: Smallint; Data: PByte):Longint;stdcall;external 'CCAPDIO.DLL';
function	DioEchoBackMultiByte(Id: Smallint; PortNo: PSmallint; PortNum: Smallint; Data: PByte):Longint;stdcall;external 'CCAPDIO.DLL';
function	DioEchoBackMultiBit(Id: Smallint; BitNo: PSmallint; BitNum: Smallint; Data: PByte):Longint;stdcall;external 'CCAPDIO.DLL';
function	DioGetMaxPorts(Id: Smallint; InPortNum: PSmallint; OutPortNum: PSmallint):Longint;stdcall;external 'CCAPDIO.DLL';
function	DioGetMaxBits(Id: Smallint; InBitNum: PSmallint; OutBitNum: PSmallint):Longint;stdcall;external 'CCAPDIO.DLL';

implementation

end.
