unit AR4000_Dec; interface // HS_RANGE_DATA, this structure is used internally for calibration type HSIF_DATA_PT = class range,EN1,EN2 : Single; RawEN1,RawEN2,Amp,Amb : Integer; Temp : Single; RawRange : Integer; InputFmt : Integer; end; // Raw sample directly from the Hsif card type HSIF_SAMPLE = class status,encoder1,encoder2,range : word; end; // Processed, or calibrated, data sample type HSIF_PROC_SAMPLE = class status : shortint; // Fifo and encorer index latches, same as HSIF_SAMPLE angle1 : double; // In radians from offset entered by HsifSetEncoderCalibration angle2 : double; // In radians from offset entered by HsifSetEncoderCalibration distance : double; // calbrated distance caltemp : double; // calibrated temperature, degrees F. ambient : double; // background illumination same as HSIF_SAMPLE amplitude : double; // reflected signal strength same as HSIF_SAMPLE timeout : boolean; // Will fold into Status on next rev rawRange : word; // raw range after conversion from CC and FC to an integer value end; // Copyright(c) 2002-2006 Crandun Technologies Inc. All rights reserved. // // Programmer's Notes: // Delphi declarations for the CTI-HSIF-PCI library functions // THIS IS UNSUPPORTED CODE // Const CTI_SUCCESS = 0; Const CTI_ERROR_BASE = 0; Const CTI_FAILURE = CTI_ERROR_BASE -1; Const CTI_BAD_PARAM = CTI_ERROR_BASE -2; Const CTI_BUFFER_TOO_SMALL = CTI_ERROR_BASE -3; Const CTI_ILLEGAL_CALL = CTI_ERROR_BASE -4; Const CTI_INTERNAL_ERROR = CTI_ERROR_BASE -5; Const CTI_THREAD_EXIT = CTI_ERROR_BASE -6; Const CTI_NO_MEMORY = CTI_ERROR_BASE-50; Const CTI_AR600_ERR_BASE = -60; Const CTI_SPAN_NOT_SET = CTI_AR600_ERR_BASE-1; Const CTI_HSIF_ERROR_BASE = -100; Const CTI_BUFFER_OVERFLOW = CTI_HSIF_ERROR_BASE-1; Const CTI_BUFFER_OVERFLOW_1 =(CTI_HSIF_ERROR_BASE-2); Const CTI_BUFFERSIZE_UNKNOWN =(CTI_HSIF_ERROR_BASE-3); Const CTI_HSIFOVERFLOW =(CTI_HSIF_ERROR_BASE-4); Const CTI_BOARDPARAMS_NOT_SET = (CTI_HSIF_ERROR_BASE-5); Const CTI_CANNOT_OPEN = (CTI_HSIF_ERROR_BASE-6); Const CTI_HW_INIT_FAILURE = (CTI_HSIF_ERROR_BASE-7); Const CTI_BUFFER_OVERFLOW_2 = (CTI_HSIF_ERROR_BASE-8); Const CTI_CALIBFILE_NOT_SET = (CTI_HSIF_ERROR_BASE-9); Const CTI_FILE_READ_ERROR = (CTI_HSIF_ERROR_BASE-10); Const CTI_CALIBRATION_ERROR =(CTI_HSIF_ERROR_BASE-11); Const CTI_COMM_ERROR_BASE = -200; Const CTI_COMM_ERROR = (CTI_COMM_ERROR_BASE-1); Const CTI_COMM_TIMEOUT =(CTI_COMM_ERROR_BASE-2); Const CTI_COMM_OPEN_ERROR =(CTI_COMM_ERROR_BASE-3); Const CTI_COMM_NOT_OPEN =(CTI_COMM_ERROR_BASE-4); Const CTI_THREAD_ERROR_BASE = -400; Const CTI_THREAD_CREATE_FAILURE =(CTI_THREAD_ERROR_BASE-1); Const CTI_MUTEX_FAILURE =(CTI_THREAD_ERROR_BASE-2); Const CTI_EVENT_CREATE_FAILURE =(CTI_THREAD_ERROR_BASE-3); Const CTI_WAIT_TIMEOUT = (CTI_THREAD_ERROR_BASE-4); Const CTI_LIC_EXPIRED = -998; Const CTI_LICENSE_ERR = -999; //======================== Driver Setup Functions ========================= function getNewCTIHSIF_PCI(): Integer; stdcall; external 'CTI_HSIF_PCI_DLL.DLL' name '_getNewCTIHSIF_PCI@0'; function setReleaseHandle(sensorIndex: Integer): Integer; stdcall; external 'CTI_HSIF_PCI_DLL.DLL' name '_setReleaseHandle@4'; function setDriverOpen(sensorIndex: Integer): Integer; stdcall; external 'CTI_HSIF_PCI_DLL.DLL' name '_setDriverOpen@4'; function setCalibrationFile(sensorIndex: Integer; filename: PChar): Integer; stdcall; external 'CTI_HSIF_PCI_DLL.DLL' name '_setCalibrationFile@8'; function getCalibrationFile(sensorIndex: Integer; filename: PChar; buflen: Integer): Integer; stdcall; external 'CTI_HSIF_PCI_DLL.DLL' name '_getCalibrationFile@12'; function setEncoderCountsPerRev(sensorIndex,encoderNum: Integer; countsPerRev: Integer): Integer; stdcall; external 'CTI_HSIF_PCI_DLL.DLL' name '_setEncoderCountsPerRev@12'; function getEncoderCountsPerRev(sensorIndex,encoderNum: Integer): Integer; stdcall; external 'CTI_HSIF_PCI_DLL.DLL' name '_getEncoderCountsPerRev@8'; function setCommOpen(sensorIndex: Integer; commPortName: PChar; baudRate: Integer): Integer; stdcall; external 'CTI_HSIF_PCI_DLL.DLL' name '_setCommOpen@12'; function getIsCommOpen(sensorIndex: Integer): Integer; stdcall; external 'CTI_HSIF_PCI_DLL.DLL' name '_getIsCommOpen@4'; function setCommClosed(sensorIndex: Integer): Integer; stdcall; external 'CTI_HSIF_PCI_DLL.DLL' name '_setCommClosed@4'; function setBaudRate(sensorIndex: Integer; baudRate: Integer): Integer; stdcall; external 'CTI_HSIF_PCI_DLL.DLL' name '_setBaudRate@8'; function getBaudRate(sensorIndex: Integer): Integer; stdcall; external 'CTI_HSIF_PCI_DLL.DLL' name '_getBaudRate@4'; function setBufferSize(sensorIndex: Integer; nSamples: Integer): Integer; stdcall; external 'CTI_HSIF_PCI_DLL.DLL' name '_setBufferSize@8'; function getBufferSize(sensorIndex: Integer): Integer; stdcall; external 'CTI_HSIF_PCI_DLL.DLL' name '_getBufferSize@4'; function setClearBuffer(sensorIndex: Integer): Integer; stdcall; external 'CTI_HSIF_PCI_DLL.DLL' name '_setClearBuffer@4'; function getDidBufferOverflow(sensorIndex: Integer): Integer; stdcall; external 'CTI_HSIF_PCI_DLL.DLL' name '_getDidBufferOverflow@4'; function setResetBufferOverflow(sensorIndex: Integer): Integer; stdcall; external 'CTI_HSIF_PCI_DLL.DLL' name '_setResetBufferOverflow@4'; function setMotorMaxRPM(sensorIndex,motorNum,maxRPM: Integer): Integer; stdcall; external 'CTI_HSIF_PCI_DLL.DLL' name '_setMotorMaxRPM@12'; function getMotorMaxRPM(sensorIndex,motorNum: Integer): Integer; stdcall; external 'CTI_HSIF_PCI_DLL.DLL' name '_getMotorMaxRPM@8'; // ================ Sensor Configuration Functions ======================== function setFactoryDefaults(sensorIndex: Integer): Integer; stdcall; external 'CTI_HSIF_PCI_DLL.DLL' name '_setFactoryDefaults@4'; function setResetHSIFBoard(sensorIndex: Integer): Integer; stdcall; external 'CTI_HSIF_PCI_DLL.DLL' name '_setResetHSIFBoard@4'; function setAnalogOutputCalibrated(sensorIndex: Integer): Integer; stdcall; external 'CTI_HSIF_PCI_DLL.DLL' name '_setAnalogOutputCalibrated@4'; function setAnalogOutputUnCalibrated(sensorIndex: Integer): Integer; stdcall; external 'CTI_HSIF_PCI_DLL.DLL' name '_setAnalogOutputUnCalibrated@4'; function getIsAnalogOutputCalibrated(sensorIndex: Integer): Integer; stdcall; external 'CTI_HSIF_PCI_DLL.DLL' name '_getIsAnalogOutputCalibrated@4'; function setAnalogOutputOff(sensorIndex: Integer): Integer; stdcall; external 'CTI_HSIF_PCI_DLL.DLL' name '_setAnalogOutputOff@4'; function getIsAnalogOutputOn(sensorIndex: Integer): Integer; stdcall; external 'CTI_HSIF_PCI_DLL.DLL' name '_getIsAnalogOutputOn@4'; function setAnalogZeroCurrent(sensorIndex,microAmp: Integer): Integer; stdcall; external 'CTI_HSIF_PCI_DLL.DLL' name '_setAnalogZeroCurrent@8'; function getAnalogZeroCurrent(sensorIndex: Integer): Integer; stdcall; external 'CTI_HSIF_PCI_DLL.DLL' name '_getAnalogZeroCurrent@4'; function getHSIFBufSizeBytes(sensorIndex: Integer): Integer; stdcall; external 'CTI_HSIF_PCI_DLL.DLL' name '_getHSIFBufSizeBytes@4'; function getHSIFBufSizeSamples(sensorIndex: Integer): Integer; stdcall; external 'CTI_HSIF_PCI_DLL.DLL' name '_getHSIFBufSizeSamples@4'; function setMotorPower(sensorIndex,motorNum,motorPower,dir: Integer): Integer; stdcall; external 'CTI_HSIF_PCI_DLL.DLL' name '_setMotorPower@16'; function getMotorPower(sensorIndex,motorNum: Integer): Integer; stdcall; external 'CTI_HSIF_PCI_DLL.DLL' name '_getMotorPower@8'; function getMotorDirection(sensorIndex,motorNum: Integer): Integer; stdcall; external 'CTI_HSIF_PCI_DLL.DLL' name '_getMotorDirection@8'; function setMotorRPM(sensorIndex,motorNum,RPM,dir: Integer): Integer; stdcall; external 'CTI_HSIF_PCI_DLL.DLL' name '_setMotorRPM@16'; function getMotorRPM(sensorIndex,motorNum: Integer): Integer; stdcall; external 'CTI_HSIF_PCI_DLL.DLL' name '_getMotorRPM@8'; function setSensorMaxRange(sensorIndex,maxInches: Integer): Integer; stdcall; external 'CTI_HSIF_PCI_DLL.DLL' name '_setSensorMaxRange@8'; function getSensorMaxRange(sensorIndex: Integer): Integer; stdcall; external 'CTI_HSIF_PCI_DLL.DLL' name '_getSensorMaxRange@4'; function setSpan(sensorIndex,dist: Integer): Integer; stdcall; external 'CTI_HSIF_PCI_DLL.DLL' name '_setSpan@8'; function getSpan(sensorIndex: Integer): Integer; stdcall; external 'CTI_HSIF_PCI_DLL.DLL' name '_getSpan@4'; function setTempHoldLevel(sensorIndex,t: Integer): Integer; stdcall; external 'CTI_HSIF_PCI_DLL.DLL' name '_setTempHoldLevel@8'; function getTempHoldLevel(sensorIndex: Integer): Integer; stdcall; external 'CTI_HSIF_PCI_DLL.DLL' name '_getTempHoldLevel@4'; function setZeroPt(sensorIndex,dist: Integer): Integer; stdcall; external 'CTI_HSIF_PCI_DLL.DLL' name'_setZeroPt@8'; function getZeroPt(sensorIndex: Integer): Integer; stdcall; external 'CTI_HSIF_PCI_DLL.DLL' name '_getZeroPt@4'; function setZeroPtUncalibrated(sensorIndex,dist: Integer): Integer; stdcall; external 'CTI_HSIF_PCI_DLL.DLL' name '_setZeroPtUncalibrated@8'; function getZeroPtUncalibrated(sensorIndex: Integer): Integer; stdcall; external 'CTI_HSIF_PCI_DLL.DLL' name '_getZeroPtUncalibrated@4'; //============== Data Acquisition Functions ================== function setLaserOn(sensorIndex: Integer): Integer; stdcall; external 'CTI_HSIF_PCI_DLL.DLL' name '_setLaserOn@4'; function setLaserOff(sensorIndex: Integer): Integer; stdcall; external 'CTI_HSIF_PCI_DLL.DLL' name '_setLaserOff@4'; function getIsLaserOn(sensorIndex: Integer): Integer; stdcall; external 'CTI_HSIF_PCI_DLL.DLL' name '_getIsLaserOn@4'; function setSampleInterval(sensorIndex,microSecPerSample: Integer): Integer; stdcall; external 'CTI_HSIF_PCI_DLL.DLL' name '_setSampleInterval@8'; function getSampleInterval(sensorIndex: Integer): Integer; stdcall; external 'CTI_HSIF_PCI_DLL.DLL' name '_getSampleInterval@4'; function setSamplesPerSec(sensorIndex,samplesPerSec: Integer): Integer; stdcall; external 'CTI_HSIF_PCI_DLL.DLL' name '_setSamplesPerSec@8'; function getSamplesPerSec(sensorIndex: Integer): Integer; stdcall; external 'CTI_HSIF_PCI_DLL.DLL' name '_getSamplesPerSec@4'; function setContinuousHSIFOff(sensorIndex: Integer): Integer; stdcall; external 'CTI_HSIF_PCI_DLL.DLL' name '_setContinuousHSIFOff@4'; function setContinuousHSIFOn(sensorIndex: Integer): Integer; stdcall; external 'CTI_HSIF_PCI_DLL.DLL' name '_setContinuousHSIFOn@4'; function getIsContinuousHSIFOn(sensorIndex: Integer): Integer; stdcall; external 'CTI_HSIF_PCI_DLL.DLL' name '_getIsContinuousHSIFOn@4'; function getNumSamples(sensorIndex: Integer): Integer; stdcall; external 'CTI_HSIF_PCI_DLL.DLL' name '_getNumSamples@4'; function getSamples(sensorIndex: Integer; sampleArray : Pointer; arraySize,minSamplesToTake,msWait : Integer): Integer; stdcall; external 'CTI_HSIF_PCI_DLL.DLL' name '_getSamples@20'; function getSingleSample(sensorIndex: Integer; Range : Pointer): Integer; stdcall; external 'CTI_HSIF_PCI_DLL.DLL' name '_getSingleSample@8'; function getExtSingleSample(sensorIndex: Integer; extDataPt : Pointer): Integer; stdcall; external 'CTI_HSIF_PCI_DLL.DLL' name '_getExtSingleSample@8'; function getNumDataLost(sensorIndex: Integer): Integer; stdcall; external 'CTI_HSIF_PCI_DLL.DLL' name '_getNumDataLost@4'; function setResetDataLost(sensorIndex: Integer): Integer; stdcall; external 'CTI_HSIF_PCI_DLL.DLL' name '_setResetDataLost@4'; //============ Data Format Functions ==================== function setAngleOutputPolar(sensorIndex: Integer): Integer; stdcall; external 'CTI_HSIF_PCI_DLL.DLL' name '_setAngleOutputPolar@4'; function setAngleOutputCartesian(sensorIndex: Integer): Integer; stdcall; external 'CTI_HSIF_PCI_DLL.DLL' name '_setAngleOutputCartesian@4'; function getIsAngleOutputPolar(sensorIndex: Integer): Integer; stdcall; external 'CTI_HSIF_PCI_DLL.DLL' name '_getIsAngleOutputPolar@4'; function setOutputFormatEnglish(sensorIndex: Integer): Integer; stdcall; external 'CTI_HSIF_PCI_DLL.DLL' name '_setOutputFormatEnglish@4'; function setOutputFormatMetric(sensorIndex: Integer): Integer; stdcall; external 'CTI_HSIF_PCI_DLL.DLL' name 'setOutputFormatMetric@4'; function getIsOutputFormatEnglish(sensorIndex: Integer): Integer; stdcall; external 'CTI_HSIF_PCI_DLL.DLL' name '_getIsOutputFormatEnglish@4'; //================= Data Filtering Functions ======================= function setAngleOffset(sensorIndex,encoderNum: Integer; offset: Single): Integer; stdcall; external 'CTI_HSIF_PCI_DLL.DLL' name '_setAngleOffset@12'; function getAngleOffset(sensorIndex,encoderNum: Integer): Single; stdcall; external 'CTI_HSIF_PCI_DLL.DLL' name '_setAngleOffset@8'; function setDiscardInvalidOn(sensorIndex: Integer): Integer; stdcall; external 'CTI_HSIF_PCI_DLL.DLL' name '_setDiscardInvalidOn@4'; function setDiscardInvalidOff(sensorIndex: Integer): Integer; stdcall; external 'CTI_HSIF_PCI_DLL.DLL' name '_setDiscardInvalidOff@4'; function getIsDiscardInvalidOn(sensorIndex: Integer): Integer; stdcall; external 'CTI_HSIF_PCI_DLL.DLL' name '_getIsDiscardInvalidOn@4'; function setMaxValidAmbient(sensorIndex,amb: Integer): Integer; stdcall; external 'CTI_HSIF_PCI_DLL.DLL' name '_setMaxValidAmbient@8'; function getMaxValidAmbient(sensorIndex: Integer): Integer; stdcall; external 'CTI_HSIF_PCI_DLL.DLL' name '_getMaxValidAmbient@4'; function setMinValidAmbient(sensorIndex,amb: Integer): Integer; stdcall; external 'CTI_HSIF_PCI_DLL.DLL' name '_setMinValidAmbient@8'; function getMinValidAmbient(sensorIndex: Integer): Integer; stdcall; external 'CTI_HSIF_PCI_DLL.DLL' name '_getMinValidAmbient@4'; function setMaxValidAmplitude(sensorIndex: Integer; amp: Integer): Integer; stdcall; external 'CTI_HSIF_PCI_DLL.DLL' name '_setMaxValidAmplitude@8'; function getMaxValidAmplitude(sensorIndex: Integer): Integer; stdcall; external 'CTI_HSIF_PCI_DLL.DLL' name '_getMaxValidAmplitude@4'; function setMinValidAmplitude(sensorIndex,amp: Integer): Integer; stdcall; external 'CTI_HSIF_PCI_DLL.DLL' name '_setMinValidAmplitude@8'; function getMinValidAmplitude(sensorIndex: Integer): Integer; stdcall; external 'CTI_HSIF_PCI_DLL.DLL' name '_getMinValidAmplitude@4'; function setMaxValidAngle(sensorIndex,encoderNum: Integer; angle: Single): Integer; stdcall; external 'CTI_HSIF_PCI_DLL.DLL' name '_setMaxValidAngle@12'; function getMaxValidAngle(sensorIndex,encoderNum: Integer): Single; stdcall; external 'CTI_HSIF_PCI_DLL.DLL' name '_getMaxValidAngle@4'; function setMinValidAngle(sensorIndex,encoderNum: Integer; angle: Single): Integer; stdcall; external 'CTI_HSIF_PCI_DLL.DLL' name '_setMinValidAngle@12'; function getMinValidAngle(sensorIndex,encoderNum: Integer): Single; stdcall; external 'CTI_HSIF_PCI_DLL.DLL' name '_getMinValidAngle@4'; function setMaxValidRange(sensorIndex: Integer; rng: Single): Integer; stdcall; external 'CTI_HSIF_PCI_DLL.DLL' name '_setMaxValidRange@8'; function getMaxValidRange(sensorIndex: Integer): Single; stdcall; external 'CTI_HSIF_PCI_DLL.DLL' name '_getMaxValidRange@4'; function setMinValidRange(sensorIndex: Integer; rng: Single): Integer; stdcall; external 'CTI_HSIF_PCI_DLL.DLL' name '_setMinValidRange@8'; function getMinValidRange(sensorIndex: Integer): Single; stdcall; external 'CTI_HSIF_PCI_DLL.DLL' name '_getMinValidRange@4'; function setRangeOffset(sensorIndex: Integer; offset: Single): Integer; stdcall; external 'CTI_HSIF_PCI_DLL.DLL' name '_setRangeOffset@8'; function getRangeOffset(sensorIndex: Integer): Single; stdcall; external 'CTI_HSIF_PCI_DLL.DLL' name '_getRangeOffset@4'; function setRangeScaleFactor(sensorIndex: Integer; scaleFactor: Single): Integer; stdcall; external 'CTI_HSIF_PCI_DLL.DLL' name '_setRangeScaleFactor@8'; function getRangeScaleFactor(sensorIndex: Integer): Single; stdcall; external 'CTI_HSIF_PCI_DLL.DLL' name '_getRangeScaleFactor@4'; function setMaxValidTemp(sensorIndex: Integer; Temp: Single): Integer; stdcall; external 'CTI_HSIF_PCI_DLL.DLL' name '_setMaxValidTemp@8'; function getMaxValidTemp(sensorIndex: Integer): Single; stdcall; external 'CTI_HSIF_PCI_DLL.DLL' name '_getMaxValidTemp@4'; function setMinValidTemp(sensorIndex: Integer; Temp: Single): Integer; stdcall; external 'CTI_HSIF_PCI_DLL.DLL' name '_setMinValidTemp@8'; function getMinValidTemp(sensorIndex: Integer): Single; stdcall; external 'CTI_HSIF_PCI_DLL.DLL' name '_getMinValidTemp@4'; //================ Error Handling and Miscellaneous Functions ===================== function getIsError(sensorIndex: Integer): Integer; stdcall; external 'CTI_HSIF_PCI_DLL.DLL' name '_getIsError@4'; function getErrorMessage(sensorIndex: Integer; errMsg: PChar; strLen: Integer): Integer; stdcall; external 'CTI_HSIF_PCI_DLL.DLL' name '_getErrorMessage@12'; function setClearError(sensorIndex: Integer): Integer; stdcall; external 'CTI_HSIF_PCI_DLL.DLL' name '_setClearError@4'; function getFirmwareVersion(sensorIndex: Integer; firmwareVersion: PChar; strLen: Integer): Integer; stdcall; external 'CTI_HSIF_PCI_DLL.DLL' name '_getFirmwareVersion@12'; function getLibraryVersion(sensorIndex: Integer): Integer; stdcall; external 'CTI_HSIF_PCI_DLL.DLL' name '_getLibraryVersion@4'; function getLibraryName(sensorIndex: Integer; libName: PChar; strLen: Integer): Integer; stdcall; external 'CTI_HSIF_PCI_DLL.DLL' name '_getLibraryName@12'; implementation end.