/******************************** i8088 Error Code definition *******************************/ #define OK 0 #define ID_ERROR -1 #define SLOT_OUT_RANGE -2 #define CHANNEL_OUT_RANGE -3 #define SELECT_CHANNEL_ERROR -4 #define HI_DUTY_OUT_RANGE -5 #define LO_DUTY_OUT_RANGE -6 #ifdef _8088W_EXPORTS #define I8088W_API __declspec(dllexport) #else #define I8088W_API __declspec(dllimport) #endif #ifdef __cplusplus // for C++ compile use extern "C" { #endif /* __cplusplus */ #define pac_i8088W_SetPWMDutyDeci pac_i8088W_SetPWMDuty_Deci #define pac_i8088W_SetPWMDutyFloat pac_i8088W_SetPWMDuty_Float #define pac_i8088W_GetRealPWMDutyDeci pac_i8088W_GetRealPWMDuty_Deci #define pac_i8088W_PWMStart pac_i8088W_PWM_Start #define pac_i8088W_PWMStop pac_i8088W_PWM_Stop #define pac_i8088W_SyncStart pac_i8088W_Sync_Start #define pac_i8088W_SyncStop pac_i8088W_Sync_Stop /******************************** pac_i8088W_Get_LatticeVersion can get the Lattice version return Lattice version *******************************/ I8088W_API short pac_i8088W_GetFirmwareVersion(int slot); /******************************** pac_i8088W_Get_LibVersion can get the version i8080 Lib return Lib version *******************************/ I8088W_API short pac_i8088W_GetLibVersion(void); I8088W_API short pac_i8088W_GetLibDate(char *LibDate); /******************************** pac_i8088W_Init can will check the basic condition of i-8088 1. slot 0 ~ 7 return value: please refer to i8088 Error Code definition *******************************/ I8088W_API short pac_i8088W_Init(int slot); I8088W_API short pac_i8088W_SetPWMDutyCount(int slot,int ch,unsigned long Hi,unsigned long Lo); /******************************** pac_i8088W_SetPWMDuty is the standard PWM function 1. slot 0 ~ 7 2. ch 0 ~ 7 3. hz 0 ~ 500K 4. duty High part 1~99 return value: please refer to i8088 Error Code definition *******************************/ I8088W_API short pac_i8088W_SetPWMDuty(int slot,int ch,unsigned long hz,unsigned int duty); /******************************** pac_i8088W_SetPWMDuty_Deci is the more precission PWM function 1. slot 0 ~ 7 2. ch 0 ~ 7 3. deci_Hz example:10 deci_Hz = 1 Hz 4. deci_duty 1~999, for example: 503 deci_duty = 50.3% High Part return value: please refer to i8088 Error Code definition Note: pac_i8088W_SetPWMDuty_Deci is the same as pac_i8088W_SetPWMDuty_float in usage but the pac_i8088W_SetPWMDuty_Deci will run more fast than pac_i8088W_SetPWMDuty_float for the floating calculation reason *******************************/ I8088W_API short pac_i8088W_SetPWMDuty_Deci(int slot,int ch,unsigned long deci_Hz,unsigned int deci_duty); /******************************** pac_i8088W_SetPWMDuty_float is the more precission PWM function 1. slot 0 ~ 7 2. ch 0 ~ 7 3. f_Hz f_Hz = 1 Hz 4. f_Duty 0.1~99.9, for example: 50.3 means 50.3% High Part return value: please refer to i8088 Error Code definition Note: pac_i8088W_SetPWMDuty_Deci is the same as pac_i8088W_SetPWMDuty_float in usage but the pac_i8088W_SetPWMDuty_Deci will run more fast than pac_i8088W_SetPWMDuty_float for the floating calculation reason *******************************/ I8088W_API short pac_i8088W_SetPWMDuty_Float(int slot,int ch,float f_Hz,float f_Duty); /******************************** i8088W_GetRealPWMDuty_Deci is the more precission PWM function 1. slot 0 ~ 7 2. ch 0 ~ 7 3. deci_hz 10 ~ 5000000 4. deci_duty 1~999 return value: please refer to i8088 Error Code definition Note: 8088W frequency and duty is non-continuous range, we have to use this function to get the real frequency and duty which 8088W can produce. *******************************/ I8088W_API short pac_i8088W_GetRealPWMDuty_Deci(int slot,int ch,unsigned long* deci_hz,unsigned int* deci_duty) ; /******************************** pac_i8088W_SetPWMCountMode to set the counting mode of i-8088 1. slot 0 ~ 7 2. ch 0 ~ 7 3. countMode 1: Continuos ;0: Burst count return value: please refer to i8088 Error Code definition Note: if pac_i8088W_SetPWMChannelMode set as Burst count mode 0, it must use pac_i8088W_SetBurstCount to define the pulse counts *******************************/ I8088W_API short pac_i8088W_SetPWMCountMode(int slot,int ch,unsigned char countMode); /******************************** pac_i8088W_SetBurstCount to set the counting mode of i-8088 1. slot 0 ~ 7 2. ch 0 ~ 7 3. burstCount 0~65536 *******************************/ I8088W_API short pac_i8088W_SetBurstCount(int slot,int ch,unsigned int burstCount); /******************************** pac_i8088W_PWM_Start to start the PWM pulse 1. slot 0 ~ 7 2. ch 0 ~ 7 *******************************/ I8088W_API short pac_i8088W_PWM_Start(int slot,int ch); /******************************** pac_i8088W_PWM_Stop to stop the PWM pulse 1. slot 0 ~ 7 2. ch 0 ~ 7 *******************************/ I8088W_API short pac_i8088W_PWM_Stop(int slot,int ch); /******************************** pac_i8088W_SetSyncChannel can set the specific channel as synchrous . 1. slot 0 ~ 7 2. ch 0 ~ 7 3. enBit 1: define channel as synchrous mode, 0:not synchrous mode return value: please refer to i8088 Error Code definition *******************************/ I8088W_API short pac_i8088W_SetSyncChannel(int slot,int ch,int enBit); /******************************** pac_i8088W_GetSyncChannel can get the specific synchrous channel as bit array. 1. slot 0 ~ 7 2. syncArr[] is an 8 bit array 3. syncArr[i]=1 means channel[i] is set as synchrous return value: please refer to i8088 Error Code definition *******************************/ I8088W_API short pac_i8088W_GetSyncChannel(int slot,int syncArr[]); /******************************** pac_i8088W_SetSyncStart to start the synchrous PWM pulse 1. slot 0 ~ 7 *******************************/ I8088W_API short pac_i8088W_Sync_Start(int slot); /******************************** pac_i8088W_SetSyncStop to stop the synchrous PWM pulse 1. slot 0 ~ 7 *******************************/ I8088W_API short pac_i8088W_Sync_Stop(int slot); /******************************** HardwareTrigChannel use the same pin as DI, the DI pin can be set as hardware trigger pin or simply DI pin. if user call pac_i8088W_SetHardwareTrigChannel function then the assigned channel will be acted as hardware trigger pin 1. slot 0 ~ 7 2. ch 0 ~ 7 3. triggerState =0 means ch have been set as normal DI, hardware trigger function to be disabled 4. triggerState =1 means ch have been set as hardware trigger start function, if this DI to be activated,it will start PWM output 5. triggerState =2 means ch have been set as hardware trigger stop function, if this DI to be activated,it will stop PWM output return value: please refer to i8088 Error Code definition *******************************/ I8088W_API short pac_i8088W_SetHardwareTrigChannel(int slot,int ch,int triggerState); /******************************** HardwareTrigChannel use the same pin as DI, the DI pin can be set as hardware trigger pin or simply DI pin. 1. slot 0 ~ 7 2. startArr[] is an 8 bit array,when startArr[i]=1 means channel[i] have been set as hardware trigger and when startArr[i]=1 then channel[i] begins to send PWM pulse if startArr[i]=0, it means channel[i] is not defined as start flag 3. stopArr[] is an 8 bit array,when stopArr[i]=1 means channel[i] have been set as hardware trigger and when stopArr[i]=1 then channel[i] stop to send PWM pulse, if stopArr[i]=0, it means channel[i] is not defined as stop flag return value: please refer to i8088 Error Code definition *******************************/ I8088W_API short pac_i8088W_GetHardwareTrigChannel(int slot,int ch,int* triggerState); /******************************** To Get DI status 1. slot 0 ~ 7 2. *diVal the DI status of i-8088 value 0~0xff 3. diArr[], the *DI value will be parse into Bit Array return value: please refer to i8088 Error Code definition *******************************/ I8088W_API short pac_i8088W_GetDI(int slot,unsigned int *diVal,int diArr[]); /******************************** To Get PWM Active State 1. slot 0 ~ 7 2. *State the pwm status of i-8088 value 0~0xff 3. ActiveArr[], the *State value will be parse into Bit Array return value: please refer to i8088 Error Code definition *******************************/ I8088W_API short pac_i8088W_GetPWMActiveState(int slot,unsigned int *State,int ActiveArr[]); #ifdef __cplusplus } #endif /* __cplusplus */