#ifdef _8074W_EXPORTS #define I8074WAPI __declspec(dllexport) #else #define I8074WAPI __declspec(dllimport) #endif #ifdef __cplusplus // for C++ compile use extern "C" { #endif /* __cplusplus */ #define NoError 0 #define ID_ERROR -1 #define SSI_NOT_CONFIG -2 // Basic Information // return 0: NoError, -1: ID Error I8074WAPI short pac_i8074W_Init(int slot); // No return code I8074WAPI short pac_i8074W_GetLibVersion(void); // No return code I8074WAPI void pac_i8074W_GetLibDate(char libDate[]); // return firmware version I8074WAPI short pac_i8074W_GetFirmwareVersion(int slot); /* the following decresption and API function parameters are according to http://www.trelectronic.com/brochures/LinearEncoders-InterfaceDescription.pdf page 12 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 ----|_|-|_|-|_|-|_|-|_|-|_|-|_|-|_|-|_|-|_|-|_|-|_|-|_|-|_|-|_|-|_|-|_|-|_|-|_|-|_|-|_|-|_|-|_|-|_|-|_|- |<------------------------------------------ totalClockBits-------------------------------------| | |central pos | | | | | revolutionBits <-- |--> stepBits | b24 b23 b22 b21 b20 b19 b18 b17 b16 b15 b14 b13 b12 b11 b10 b9 b8 b7 b6 b5 b4 b3 b2 b1 b0 To Read Data from SSI Encoder Step 1: use pac_i8074W_SetSSIConfig to configure the SSI interface parameters Step 2: use pac_i8074W_ReadSSIData to check the revolution counts and step counts for each revolution is correct or not Step 3: use pac_i8074W_ReadEncoder to read the converted result of Encoder data, (revolution count * steps/revolution) + steps position */ // SSI Operation functions // i8074W_SetSSIConfig // return default :0 // totalClockBits : the total clock count for SSI interface // revoltionBits : the revolution bit count for SSI interface // stepBits: the step bit count of single revolution for SSI interface // centralPos: the central line of Tree-Format data for SSI interface // freqType: 0: 1MHz, 1: 500KHz, 2: 250KHz, 3: 125KHz I8074WAPI short pac_i8074W_SetSSIConfig(int slot,int ch, unsigned char totalClockBits,unsigned char revoltionBits,unsigned char stepBits,unsigned char centralPos ,unsigned char freqType,unsigned char codeType); // parameters the same as pac_i8074W_SetSSIConfig // return default :NoError , if not use i8074W_SetSSIConfig it will return SSI_NOT_CONFIG I8074WAPI short pac_i8074W_GetSSIConfig(int slot,int ch,unsigned char* totalClockBits,unsigned char* revoltionBits,unsigned char* stepBits,unsigned char* centralPos ,unsigned char* freqType,unsigned char *codeType); // get the SSI revolution count and steps of revolution count. // return default :NoError , if not use i8074W_SetSSIConfig it will return SSI_NOT_CONFIG I8074WAPI short pac_i8074W_ReadSSIData(int slot,int ch,long * revolutionCnt, long* stepsPerRevolution,long* rawData ); // get the SSI real encoder data, converted by revolution count and steps of revolution count // return default :NoError , if not use i8074W_SetSSIConfig it will return SSI_NOT_CONFIG I8074WAPI short pac_i8074W_ReadEncoder(int slot, int ch, long* encoderData); #ifdef __cplusplus } #endif /* __cplusplus */