/******************************** i8093 Error Code definition *******************************/ #define OK 0 #define ID_ERROR -1 #define SLOT_OUT_RANGE -2 #define CHANNEL_OUT_RANGE -3 #define MODE_ERROR -4 #define FIRMWARENOTSUPPORT -5 #ifdef _8093W_EXPORTS #define I8093W_API __declspec(dllexport) #else #define I8093W_API __declspec(dllimport) #endif #ifdef __cplusplus // for C++ compile use extern "C" { #endif /* __cplusplus */ /******************************** pac_i8093W_GetLatticeVersion can get the Lattice version 1. slot: 0 ~ 7 return Lattice version *******************************/ I8093W_API short pac_i8093W_GetFirmwareVersion(int slot); /******************************** pac_i8093W_GetLibVersion can get the version i8093 Lib return Lib version *******************************/ I8093W_API short pac_i8093W_GetLibVersion(void); /******************************** pac_i8093W_GetLibDate can get the builded date of i8093 Lib 1.*LibDate: library date *******************************/ I8093W_API void pac_i8093W_GetLibDate(char *LibDate); /******************************** pac_i8093W_Init can initialize i-8093 1. slot: 0 ~ 7 return value: please refer to i8093 Error Code definition *******************************/ I8093W_API int pac_i8093W_Init(int slot); /******************************** pac_i8093W_SetMode can set encoder counting mode 1. slot: 0 ~ 7 2. ch: 0 ~ 2 3. Mode value: 1 ==> CW/CCW counting mode 2 ==> Pulse/Direction counting mode 3 ==> Quadrant counting mode return value: please refer to i8093 Error Code definition *******************************/ I8093W_API int pac_i8093W_SetMode(int slot, int ch, int Mode); /******************************** pac_i8093W_GetMode can get encoder counting mode 1. slot: 0 ~ 7 2. ch: 0 ~ 2 3. *Mode value: *Mode=1 ==> CW/CCW counting mode *Mode=2 ==> Pulse/Direction counting mode *Mode=3 ==> Quadrant counting mode return value: please refer to i8093 Error Code definition *******************************/ I8093W_API int pac_i8093W_GetMode(int slot, int ch, int* Mode); /******************************** pac_i8093W_GetLineStatus can read A/B/Z status 1. slot: 0 ~ 7 2. ch: 0 ~ 2 3. *A_Status: 0/1 4. *B_Status: 0/1 5. *C_Status: 0/1 return value: please refer to i8093 Error Code definition *******************************/ I8093W_API int pac_i8093W_GetLineStatus(int slot, int ch, int* A_Status,int* B_Status,int* C_Status); /******************************** pac_i8093W_GetIndex can read Index(Z) value 1. slot: 0 ~ 7 2. ch: 0 ~ 2 3. *index: 0/1 return value: please refer to i8093 Error Code definition *******************************/ I8093W_API int pac_i8093W_GetIndex(int slot, int ch,int* index); /******************************** pac_i8093W_SetXOR can set XOR value 1. slot: 0 ~ 7 2. ch: 0 ~ 2 3. Xor: 0/1 return value: please refer to i8093 Error Code definition *******************************/ I8093W_API int pac_i8093W_SetXOR(int slot, int ch, int Xor); /******************************** pac_i8093W_GetXOR can get XOR value 1. slot: 0 ~ 7 2. ch: 0 ~ 2 3. *Xor: 0/1 return value: please refer to i8093 Error Code definition *******************************/ I8093W_API int pac_i8093W_GetXOR(int slot, int ch, int* Xor); /******************************** pac_i8093W_Read32BitEncoder can read 32-bit counter value 1. slot: 0 ~ 7 2. ch: 0 ~ 2 3. *EnCode32: 32-bit counter value return value: please refer to i8093 Error Code definition *******************************/ I8093W_API int pac_i8093W_Read32BitEncoder(int slot,int ch, long* EnCode32); /******************************** pac_i8093W_ResetEncoder can clear A/B/Z and 32 bit counter 1. slot 0 ~ 7 2. ch 0 ~ 2 *******************************/ I8093W_API int pac_i8093W_ResetEncoder(int slot, int ch); /******************************** pac_i8093W_SetPresetValue can set the preset value of i-8093 1. slot 0 ~ 7 2. ch 0 ~ 2 3. PresetVal 0 ~ 0xffffffff return value: please refer to i8093W Error Code definition Note1: preset value is supported at lib version 0x1007 or above *******************************/ I8093W_API int pac_i8093W_SetPresetValue(int slot, int ch, long presetVal); /******************************** pac_i8093W_GetPresetValue can get the preset value of i-8093 1. slot 0 ~ 7 2. ch 0 ~ 2 3. PresetVal 0 ~ 0xffffffff return value: please refer to i8093W Error Code definition Note1: preset value is supported at lib version 0x1007 or above *******************************/ I8093W_API int pac_i8093W_GetPresetValue(int slot, int ch, long* presetVal); /******************************** 8093W firmware must be 3 or above to support pac_i8093W_ReadFreq function pac_i8093W_ReadFreq read the frequency value of i-8093 1. slot 0 ~ 7 2. ch 0 ~ 2 3. Freq readback frequency of i-8093, Note1: if there is no encoder input, the frequency will be 0.093 not 0 return value: please refer to i8093W Error Code definition *******************************/ I8093W_API int pac_i8093W_ReadFreq(int slot,int ch,float* freq); /******************************** 8093W firmware must be 4 or above to support pac_i8093W_SetIndexLatchStatus function pac_i8093W_SetIndexLatchStatus to disable/enable the index latch function of i-8093 1. slot 0 ~ 7 2. ch 0 ~ 2 3. ifEnableLatch to enable or disable the index latch function of i-8093, Note1: normally we can use pac_i8093W_GetIndex to read the index (z ) status, but sometimes it is not easy to let the encoder to match the right position, so 8093W add this function to latch the z index status Note2: if enable the latch index function and the z index latched, the encoder value will also be latched at the position where z index latched point, so we can adjust the encoder position to the latched point. Note3: disable the index latch function, pac_i8093W_Read32BitEncoder can read the normal encoder value as usual. return value: please refer to i8093W Error Code definition *******************************/ I8093W_API int pac_i8093W_SetIndexLatchStatus(int slot, int ch, int ifEnableLatch); /******************************** 8093W firmware must be 4 or above to support pac_i8093W_SetIndexLatchStatus function pac_i8093W_GetIndexLatchStatus read the index latched status and enable latch configuration of i-8093 1. slot 0 ~ 7 2. ch 0 ~ 2 3. *latchedStatus check z index latched or not 4. *ifEnableLatch readback enable latched of i-8093, Note1: normally we can use pac_i8093W_GetIndex to read the index (z ) status, but sometimes it is not easy to let the encoder to match the right position, so 8093W add this function to latch the z index status Note2: if enable the latch index function and the z index latched, the encoder value will also be latched at the position where z index latched point, so we can adjust the encoder position to the latched point. Note3: disable the index latch function, pac_i8093W_Read32BitEncoder can read the normal encoder value as usual. return value: please refer to i8093W Error Code definition *******************************/ I8093W_API int pac_i8093W_GetIndexLatchStatus(int slot, int ch, int* latchedStatus, int* ifEnableLatch); /******************************** 8093W firmware must be 4 or above to support pac_i8093W_SetIndexLatchStatus function pac_i8093W_ClearLatchedIndex clear Index Latch status of i-8093 1. slot 0 ~ 7 2. ch 0 ~ 2 Note1: normally we can use pac_i8093W_GetIndex to read the index (z ) status, but sometimes it is not easy to let the encoder to match the right position, so 8093W add this function to latch the z index status Note2: if enable the latch index function and the z index latched, the encoder value will also be latched at the position where z index latched point, so we can adjust the encoder position to the latched point. Note3: disable the index latch function, pac_i8093W_Read32BitEncoder can read the normal encoder value as usual. return value: please refer to i8093W Error Code definition *******************************/ I8093W_API int pac_i8093W_ClearLatchedIndex(int slot, int ch); #ifdef __cplusplus } #endif /* __cplusplus */