unit ccapaio;

interface

uses
    Windows;

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

//======================================================================
// Range
//======================================================================
PM10			=	0;		//+-10V
PM5				=	1;		//+-5V
P10				=	50;		//0~10V
P5				=	51;		//0~5V
P20MA			=	100;	//0~20mA

//======================================================================
// Error Code
//======================================================================
AIO_ERR_SUCCESS					=	0;			//Successed
AIO_ERR_INI_MEMORY				=	3;			//Cannot allocate memory
AIO_ERR_INI_REGISTRY			=	4;			//Cannot access setting file
AIO_ERR_DLL_DEVICE_NAME			=	10000;		//Used DeviceName unwritten in setting file
AIO_ERR_DLL_INVALID_ID			=	10001;		//Invalid Id
AIO_ERR_DLL_CREATE_FILE			=	10003;		//Cannot open
AIO_ERR_DLL_CLOSE_FILE			=	10004;		//Close error
AIO_ERR_INFO_NOT_FIND_DEVICE	=	10006;		//Not find device
AIO_ERR_PTR_DEVICE_NAME			=	10007;		//DeviceName is NULL
AIO_ERR_PTR_DEVICE				=	10008;		//Device is NULL
AIO_ERR_UNKNOWN_DEVICE			=	10013;		//Unknown device
AIO_ERR_PTR_DEVICE_TYPE			=	10015;		//DeviceType is NULL
AIO_ERR_INFO_INVALID_DEVICE		=	10050;		//Invalid device
AIO_ERR_NULL_DEVICE				=	10100;		//DeviceName is NULL string
AIO_ERR_PTR_ID					=	10101;		//Id is NULL
AIO_ERR_PTR_ERR_STR				=	10180;		//ErrorString is NULL
AIO_ERR_PTR_AI_RANGE			=	11051;		//AiRange is NULL
AIO_ERR_AI_RANGE				=	11060;		//AiRange is out of range
AIO_ERR_AI_CHANNEL				=	11420;		//AiChannel is out of range
AIO_ERR_PTR_AI_DATA				=	11421;		//AiData is NULL
AIO_ERR_PTR_AI_MAX_CHANNELS		=	11720;		//AiMaxChannels is NULL
AIO_ERR_PTR_AI_RESOLUTION		=	11740;		//AiResolution is NULL
AIO_ERR_AO_CHANNEL				=	13000;		//AoChannel is out of range
AIO_ERR_AO_CHANNELS				=	13020;		//AoChannels is out of range
AIO_ERR_PTR_AO_DATA				=	13021;		//AoData is NULL
AIO_ERR_PTR_AO_RESOLUTION		=	13040;		//AoData is NULL
AIO_ERR_PTR_AO_MAX_CHANNELS		=	13080;		//AoMaxChannels is NULL
AIO_ERR_PTR_AO_RANGE			=	13111;		//AoRange is NULL
AIO_ERR_AO_RANGE				=	13120;		//AoRange is out of range
AIO_ERR_SYS_NOT_SUPPORTED		=	20001;		//Function is not supported
AIO_ERR_DEVICE_BUSY				=	20002;		//Device is busy
AIO_ERR_AI_DEVICE_RANGE			=	21060;		//AiRange is out of range
AIO_ERR_AI_SET_RANGE			=	21063;		//Range setting error
AIO_ERR_AI_DEVICE_CHANNEL		=	21420;		//AiChannel is out of range
AIO_ERR_AD_ERROR				=	21421;		//AD transter error
AIO_ERR_AI_CHANNEL_NUM_OVER		=	21441;		//Number of Channels is over
AIO_ERR_AO_DEVICE_CHANNEL		=	23000;		//AoChannel is out of range
AIO_ERR_DA_ERROR				=	23001;		//DA transfer error
AIO_ERR_AO_DATA_RANGE1			=	23002;		//AoData must be from 0 to 4095
AIO_ERR_AO_DATA_RANGE2			=	23003;		//AoData must be from 0 to 605535
AIO_ERR_AO_CHANNEL_NUM_OVER		=	23021;		//Number of Channels is over
AIO_ERR_AO_DEVICE_RANGE			=	23120;		//AoRange is out of range
AIO_ERR_AO_SET_RANGE			=	23121;		//Range setting error
AIO_ERR_START_ERROR				=	28001;		//Module start error
AIO_ERR_NOT_START				=	28002;		//Device is not started
AIO_ERR_ACCESS_RIGHT			=	28003;		//Access rights error
AIO_ERR_DLL_TIMEOUT				=	28004;		//Timeout
AIO_ERR_COMPOSITION				=	28005;		//Unknown error

//======================================================================
// Function Prototype
//======================================================================
function	AioInit(Devicename: PChar; Id: PSmallint):Longint;stdcall;external 'CCAPAIO.DLL';
function	AioExit(Id: Smallint):Longint;stdcall;external 'CCAPAIO.DLL';
function	AioGetErrorString(Err: Longint; szMsg: PChar):Longint;stdcall;external 'CCAPAIO.DLL';
function	AioQueryDeviceName(Index: Smallint; GroupID: PSmallint; UnitID: PSmallint; DeviceID: PSmallint; DeviceName:PChar; Device:PChar):Longint;stdcall;external 'CCAPAIO.DLL';
function	AioGetDeviceType(Device: PChar; DeviceType: PSmallint):Longint;stdcall;external 'CCAPAIO.DLL';

function	AioSetAccessRight(AccsRight: PByte):Longint;stdcall;external 'CCAPAIO.DLL';
function	AioSetDirectMode(Id: Smallint; DirectMode: Smallint):Longint;stdcall;external 'CCAPAIO.DLL';
function	AioSetIOInterval(Interval: Longint):Longint;stdcall;external 'CCAPAIO.DLL';
function	AioStartIO(Id: Smallint; Start: Smallint):Longint;stdcall;external 'CCAPAIO.DLL';
function	AioGetRemoteStatus(Id: Smallint; Start: PByte; Status: PByte):Longint;stdcall;external 'CCAPAIO.DLL';

function	AioSingleAi(Id: Smallint; AiChannel: Smallint; AiData: PLongint):Longint;stdcall;external 'CCAPAIO.DLL';
function	AioSingleAiEx(Id: Smallint; AiChannel: Smallint; AiData: PSingle):Longint;stdcall;external 'CCAPAIO.DLL';
function	AioMultiAi(Id: Smallint; AiChannels: Smallint; AiData: PLongint):Longint;stdcall;external 'CCAPAIO.DLL';
function	AioMultiAiEx(Id: Smallint; AiChannels: Smallint; AiData: PSingle):Longint;stdcall;external 'CCAPAIO.DLL';
function	AioGetAiResolution(Id: Smallint; AiResolution: PSmallint):Longint;stdcall;external 'CCAPAIO.DLL';
function	AioGetAiMaxChannels(Id: Smallint; AiMaxChannels: PSmallint):Longint;stdcall;external 'CCAPAIO.DLL';
function	AioSetAiRangeAll(Id: Smallint; AiRange: Smallint):Longint;stdcall;external 'CCAPAIO.DLL';
function	AioGetAiRange(Id: Smallint; AiChannel: Smallint; AiRange: PSmallint):Longint;stdcall;external 'CCAPAIO.DLL';

function	AioSingleAo(Id: Smallint; AoChannel: Smallint; AoData: Longint):Longint;stdcall;external 'CCAPAIO.DLL';
function	AioSingleAoEx(Id: Smallint; AoChannel: Smallint; AoData: Single):Longint;stdcall;external 'CCAPAIO.DLL';
function	AioSingleAoEcho(Id: Smallint; AoChannel: Smallint; AoData: PLongint):Longint;stdcall;external 'CCAPAIO.DLL';
function	AioMultiAo(Id: Smallint; AoChannels: Smallint; AoData: PLongint):Longint;stdcall;external 'CCAPAIO.DLL';
function	AioMultiAoEx(Id: Smallint; AoChannels: Smallint; AoData: PSingle):Longint;stdcall;external 'CCAPAIO.DLL';
function	AioMultiAoEcho(Id: Smallint; AoChannels: Smallint; AoData: PLongint):Longint;stdcall;external 'CCAPAIO.DLL';
function	AioGetAoResolution(Id: Smallint; AoResolution: PSmallint):Longint;stdcall;external 'CCAPAIO.DLL';
function	AioGetAoMaxChannels(Id: Smallint; AoMaxChannels: PSmallint):Longint;stdcall;external 'CCAPAIO.DLL';
function	AioSetAoRangeAll(Id: Smallint; AoRange: Smallint):Longint;stdcall;external 'CCAPAIO.DLL';
function	AioGetAoRange(Id: Smallint; AoChannel: Smallint; AoRange: PSmallint):Longint;stdcall;external 'CCAPAIO.DLL';

implementation

end.