background image

 

I-8088W API Reference Manual, Version 1.0.0, Aug. 2010          ---    58 

4.7. pac_i8088W_SetPWMDuty_float 

The function is used to set the PWM parameters precisely. 

Syntax 

 

short pac_i8088W_SetPWMDuty_Float(int slot,int ch,float f_Hz,float f_Duty); 

 

Note:   

pac_i8088W_SetPWMDuty_

Deci

 is the same as 

pac_i8088W_SetPWMDuty_

float 

in usage, but the 

pac_i8088W_SetPWMDuty_Deci will 

run faster

 than 

pac_i8088W_SetPWMDuty_floa for the floating calculation reason

 

Parameter 

1. slot 0 ~ 7 

 2. ch 0 ~ 7 

 3. f_Hz 100 means f_Hz = 10 Hz 

 4. f_Duty 0.0~99.9, for example: 50.3 means 50.3% High Part 

 5. Low Part =100.0- f_Duty = 49.7 means = 49.7% 

Return Values 

Please refer to Error Code Table. 

 

 

 

 

 

 

 

 

Содержание I-8088W

Страница 1: ...W API Reference Manual Version 1 0 0 Aug 2010 1 I 8088W API Reference Manual Version 1 0 0 Aug 2010 Service and usage information for MiniOS7 CE and XPE Platform Written by Martin Hsu Edited by Janice...

Страница 2: ...ing from the use of this product ICP DAS reserves the right to change this manual at any time without notice The information furnished by ICP DAS is believed to be accurate and reliable However no res...

Страница 3: ...it 25 3 2 i8088W_GetFirmwareVersion 26 3 3 i8088W_GetLibVersion 27 3 4 i8088W_GetLibDate 28 3 5 i8088W_SetPWMDuty 29 3 6 i8088W_SetPWMDuty_Deci 30 3 7 i8088W_SetPWMDuty_float 31 3 8 i8088W_GetRealPWMD...

Страница 4: ...etPWMDuty_float 58 4 8 pac_i8088W_GetRealPWMDuty_Deci 60 4 9 pac_i8088W_SetPWMCountMode 62 4 10 pac_i8088W_SetBurstCount 64 4 11 pac_i8088W_PWM_Start 66 4 12 pac_i8088W_PWM_Stop 68 4 13 pac_i8088W_Set...

Страница 5: ...effective analog control system Features Automatic generation of PWM outputs by hardware without software intervention 10 Hz 500 kHz non continuous PWM output frequency with 0 1 99 9 duty cycle Softw...

Страница 6: ...to Logic 3750 Vrms ESD Protection 4 kV Contact for each channel Digital Input Input Channels 8 Sink Source Input Type One Common for All Digital Input On Voltage Level 5 30 V Off Voltage Level 0 8V In...

Страница 7: ...ignment Pin 1 8 PWM0 PWM7 are designed for PWM output Pin 9 10 PWM GND is isolated ground Pin 11 18 DI0 DI7 are designed for digital input that also capable of setting as an external trigger signal to...

Страница 8: ...I 8088W API Reference Manual Version 1 0 0 Aug 2010 8 1 3 Block Diagram...

Страница 9: ...I 8088W API Reference Manual Version 1 0 0 Aug 2010 9 1 4 Wiring Connection...

Страница 10: ...s ipac8000 document You can find the related files in the product CD or below website WinPAC Document ftp ftp icpdas com pub cd winpac napdos wp 8x4x_ce50 document sdk_document eVC SDK ftp ftp icpdas...

Страница 11: ...PWM command to ensure the operation properly Set Burst Count Set Continous 0 1 Choice Burst Count Mode 1 65535 Set integer Duty Set x10 integer Duty Set float Duty 0 1 2 Set PWM Mode Set PWM Duty Fre...

Страница 12: ...as Continuous mode and its frequency is 10 Hz PWM duty is 50 When we send the Start Normal PWM commend the DI0 will blinking per 0 5s Wire connection of I 8088W To do this you need to wire PW0 to DI0...

Страница 13: ...ion You can also refer to chapter 3 for miniOS7 PAC or chapter 4 for WinCE PAC to learn how to use these instrctions NO Info API 1 Initialize i 8088W Refer to section 3 1 i8088W_Init or section 4 1 pa...

Страница 14: ...In this example we enter 1 to set it as Continous mode API Refer to section 3 9 or section 4 9 There are three options in this setting if you choose 0 means you can enter an integer value ex input 50...

Страница 15: ...PWM duty as 50 API Refer to section 3 5 section 3 6 section 3 7 or section 4 5 section 4 6 section 4 7 You will see three modes in below picture please enter 0 to set it as Normal PWM Then enter 0 to...

Страница 16: ...10 16 If you have completed the correct setup you will see below picture In this example it will send the start PWM command to channel 0 7 the condition is 10 Hz with 50 duty and we has connected the...

Страница 17: ...lect 2 0 1 99 9 Set Burst Count Set Continous 0 1 Choice Burst Count Mode 1 65535 Set integer Duty Set x10 integer Duty Set float Duty 0 1 2 Input Frequency Input Duty Set PWM Mode Set PWM Duty Config...

Страница 18: ...in section 2 2 2 to configure PWM output mode and set PWM duty and frequency Step 2 Enter 1 to set Hardware Trigger PWM There are three options to set the DI channels as PWM trigger signal 0 Normal DI...

Страница 19: ...gure the DI signal to start or stop the PWM output One is rising edge to trigger the PWM to start or stop the wiring like below two pictures Rising edge to Start PWM Rising edge to Stop PWM 5 30 V Ris...

Страница 20: ...Aug 2010 20 The other is falling edge to trigger the PWM to start or stop the wiring like below two pictures Falling edge to Start PWM Falling edge to Stop PWM Falling edge to trigger the PWM to STAR...

Страница 21: ...received an external trigger signal Start the PWM Using the i8088W_PWM_Start section 3 11 or pac_ i8088W_PWM_Start section 4 11 function Stop the PWM Using the i8088W_PWM_Stop section 3 12 or pac_ i80...

Страница 22: ...Hz Select 2 0 1 500000 0 Hz Select 0 1 99 Select 1 1 99 Select 2 0 1 99 9 Set Burst Count Set Continous 0 1 Choice Burst Count Mode 1 65535 Set integer Duty Set x10 integer Duty Set float Duty 0 1 2 I...

Страница 23: ...Step 2 Enter 2 to set Synchronous PWM and then enter 1 to enable it Note You can use i8088W_SetSyncChannel section 3 13 or pac_ i8088W_SetSyncChannel section 4 13 function to set the specific channel...

Страница 24: ...ious sections we can start PWM by software command or DI trigger signal but you can see the signal is non synchronous in below picture Start Synchronous PWM So we can call i8088W_Sync_Start or pac_i80...

Страница 25: ...return value is 0 that means there is an I 8088W module in that slot If return 1 that means there is no I 8088W module Syntax short i8088W_Init int slot Parameter slot 0 7 Return Values Please refer t...

Страница 26: ...eVersion The function is used to get the firmware version of I 8088W Syntax short i8088W_GetFirmwareVersion int slot Parameter slot 0 7 Return Values The firmware version of I 8088W hardware Examples...

Страница 27: ...Aug 2010 27 3 3 i8088W_GetLibVersion The function is used to get the version of library file Syntax short i8088W_GetLibVersion void Parameter None Return Values The versions of library file Examples C...

Страница 28: ...LibDate The function is used to get the built date of library file Syntax short i8088W_GetLibDate char LibDate Parameter LibDate the string buffer of library built date Return Values The built dates o...

Страница 29: ...ted PWM parameters Syntax short i8088W_SetPWMDuty int slot int ch unsigned long hz unsigned int duty Parameter 1 slot 0 7 2 ch 0 7 3 hz 0 450K 4 duty High part 0 99 5 Low part 100 High part Return Val...

Страница 30: ...ci is the same as i8088W_SetPWMDuty_float in usage but the i8088W_SetPWMDuty_Deci will run faster than i8088W_SetPWMDuty_floa for the floating calculation reason Parameter 1 slot 0 7 2 ch 0 7 3 deci_H...

Страница 31: ...is the same as i8088W_SetPWMDuty_float in usage but the i8088W_SetPWMDuty_Deci will run faster than i8088W_SetPWMDuty_floa for the floating calculation reason Parameter 1 slot 0 7 2 ch 0 7 3 f_Hz 100...

Страница 32: ...of 8088W PWM is discrete not continuous when we use i8088W_SetPWMDuty to configure the duty and frequency we have to use this function to check the real duty and frequency which can be produced by 80...

Страница 33: ...ce Manual Version 1 0 0 Aug 2010 33 Examples C unsigned long deci_hz unsigned int deci_duty slot 0 for ch 0 ch 8 ch i8088W_GetRealPWMDuty_Deci slot ch deci_hz deci_duty Print CH d PWM Hz lu Duty u n c...

Страница 34: ...short i8088W_SetPWMCountMode int slot int ch unsigned char countMode Parameter 1 slot 0 7 2 ch 0 7 3 count Mode 1 Continuos 0 Burst count Return Values Please refer to Error Code Table Examples C int...

Страница 35: ...e BurstCount of I 8088W Syntax short i8088W_SetBurstCount int slot int ch unsigned int burstCount Parameter 1 slot 0 7 2 ch 0 7 3 burstCount 0 65536 Return Values Please refer to Error Code Table Exam...

Страница 36: ...11 i8088W_PWM_Start The function is used to start the PWM pulse Syntax short i8088W_PWM_Start int slot int ch Parameter slot 0 7 ch 0 7 Return Values Please refer to Error Code Table Examples C int s...

Страница 37: ...3 12 i8088W_PWM_Stop The function is used to stop the PWM pulse Syntax short i8088W_PWM_Stop int slot int ch Parameter slot 0 7 ch 0 7 Return Values Please refer to Error Code Table Examples C int sl...

Страница 38: ...annel as synchronous Syntax short i8088W_SetSyncChannel int slot int ch int enBit Parameter 1 slot 0 7 2 ch 0 7 3 enBit 1 define channel as synchronous mode 0 not synchronous mode Return Values Please...

Страница 39: ...e synchronous channel by using array Syntax short i8088W_GetSyncChannel int slot int syncArr Parameter 1 slot 0 7 2 syncArr is an 8 bit array 3 syncArr i 1 means channel i is set as synchronous Return...

Страница 40: ...10 40 3 15 i8088W_Sync_Start The function is used to start the synchronization of PWM pulse Syntax short i8088W_Sync_Start int slot Parameter 1 slot 0 7 Return Values Please refer to Error Code Table...

Страница 41: ...010 41 3 16 i8088W_Sync_Stop The function is used to stop the synchronization of PWM pulse Syntax short i8088W_Sync_Stop int slot Parameter 1 slot 0 7 Return Values Please refer to Error Code Table Ex...

Страница 42: ...Syntax short i8088W_SetHardwareTrigChannel int slot int ch int triggerState Parameter 1 slot 0 7 2 ch 0 7 3 triggerState 0 disabled hardware trigger Normal DI pin 4 triggerState 1 means this DI has be...

Страница 43: ...I 8088W API Reference Manual Version 1 0 0 Aug 2010 43 Examples C int slot ch triggerState slot 0 triggerState 0 for ch 0 ch 8 ch i8088W_ SetHardwareTrigChannel slot ch triggerState...

Страница 44: ...annels Syntax i8088W_GetHardwareTrigChannel int slot int ch int triggerState Parameter 1 slot 0 7 2 ch 0 7 3 trigState 0 means the hardware trigger function is disable Normal DI pin 1 means this DI ha...

Страница 45: ...I 8088W API Reference Manual Version 1 0 0 Aug 2010 45 Examples C int slot ch triggerState slot 0 triggerState 0 for ch 0 ch 8 ch i8088W_ GetHardwareTrigChannel slot ch triggerState...

Страница 46: ...PWM generate pulse output the state will be 1 we can know which PWM channel is sending PWM output If we configure PWM as Burst Count mode the PWM output will be stop when it sends confgured count of P...

Страница 47: ...et DI status The user can view which channels have received the signals Syntax short i8088W_GetDI int slot unsigned int diVal int diArr Parameter 1 slot 0 7 2 diVal the DI status of i 8088 value 0 0xf...

Страница 48: ...Examples C int slot ch enBit 8 Slot 0 unsigned int dival 0 i8088W_GetDI slot diVal enBit Print DI Vaule 02X n diVal for ch 0 ch 8 ch Print DI d d n ch enBit ch...

Страница 49: ...88W and then check the hardware ID for each slot If the return value is 0 that means there is an I 8088W module in that slot If return 1 that means there is no I 8088W module Syntax short pac_i8088W_I...

Страница 50: ...ex if err 0 printf There is an I 8088W at slot d n slotIndex else printf There is no I 8088W at slot d n slotIndex C using pac8088WNet int slotIndex err err pac8088W Init slotIndex if err 0 Console Wr...

Страница 51: ...re version of I 8088W Syntax short pac_i8088W_GetFirmwareVersion int slot Parameter slot 0 7 Return Values The firmware version of I 8088W hardware Examples C short firmware_version firmware_version p...

Страница 52: ...he function is used to get the version of library file Syntax short pac_i8088W_GetLibVersion Parameter none Return Values The versions of library file i8088W dll Examples C short version version pac_i...

Страница 53: ...the built date of library file Syntax short pac_i8088W_GetLibDate char LibDate Parameter LibDate the string buffer of library built date Return Values The built dates of library file Examples C char...

Страница 54: ...y The function is used to set the related PWM parameters Syntax short pac_i8088W_SetPWMDuty int slot int ch unsigned long hz unsigned int duty Parameter 1 slot 0 7 2 ch 0 7 3 hz 0 450K 4 duty High par...

Страница 55: ...Reference Manual Version 1 0 0 Aug 2010 55 Examples C int slot ch slot 0 for ch 0 ch 8 ch pac_i8088W_SetPWMDuty slot ch 50 C using pac8088WNet int slot ch slot 0 for ch 0 ch 8 ch pac8088W SetPWMDuty...

Страница 56: ...deci_duty Note pac_i8088W_SetPWMDuty_Deci is the same as pac_i8088W_SetPWMDuty_float in usage but the pac_i8088W_SetPWMDuty_Deci will run faster than pac_i8088W_SetPWMDuty_floa for the floating calcul...

Страница 57: ...nce Manual Version 1 0 0 Aug 2010 57 Examples C int slot ch slot 0 for ch 0 ch 8 ch pac_i8088W_ SetPWMDuty_Deci slot ch 50 3 C using pac8088WNet int slot ch slot 0 for ch 0 ch 8 ch pac8088W SetPWMDuty...

Страница 58: ...oat f_Duty Note pac_i8088W_SetPWMDuty_Deci is the same as pac_i8088W_SetPWMDuty_float in usage but the pac_i8088W_SetPWMDuty_Deci will run faster than pac_i8088W_SetPWMDuty_floa for the floating calcu...

Страница 59: ...ce Manual Version 1 0 0 Aug 2010 59 Examples C int slot ch slot 0 for ch 0 ch 8 ch pac_i8088W_ SetPWMDuty_Float slot ch 50 3 C using pac8088WNet int slot ch slot 0 for ch 0 ch 8 ch pac8088W SetPWMDuty...

Страница 60: ...W Syntax short pac_i8088W_GetRealPWMDuty_Deci int slot int ch unsigned long deci_hz unsigned int deci_duty Note 8088W frequency and duty is non continuous range we have to use this function to get the...

Страница 61: ...h 0 ch 8 ch pac_i8088W_GetRealPWMDuty_Deci slot ch deci_hz deci_duty printf CH d PWM Hz lu Duty u n ch deci_hz deci_duty C using pac8088WNet int slot ch UInt32 deci_hz 0 Uint16 deci_duty 0 slot 0 for...

Страница 62: ...W_SetPWMCountMode The function is used to set the count mode of I 8088W Syntax short pac_i8088W_SetPWMCountMode int slot int ch unsigned char countMode Parameter 1 slot 0 7 2 ch 0 7 3 count Mode 1 Con...

Страница 63: ...1 0 0 Aug 2010 63 Examples C int slot ch slot 0 mode 0 burst mode for ch 0 ch 8 ch pac_i8088W_ SetPWMCountMode slot ch mode C using pac8088WNet int slot ch slot 0 mode 0 burst mode for ch 0 ch 8 ch p...

Страница 64: ...10 pac_i8088W_SetBurstCount The function is used to set the BurstCount of I 8088W Syntax short pac_i8088W_SetBurstCount int slot int ch unsigned int burstCount Parameter 1 slot 0 7 2 ch 0 7 3 burstCou...

Страница 65: ...0 65 Examples C int slot ch burstCount slot 0 burstCount 10000 for ch 0 ch 8 ch pac_i8088W_SetBurstCount slot ch burstCount C using pac8088WNet int slot ch burstCount slot 0 burstCount 10000 for ch 0...

Страница 66: ...nual Version 1 0 0 Aug 2010 66 4 11 pac_i8088W_PWM_Start The function is used to start the PWM pulse Syntax short pac_i8088W_PWM_Start int slot int ch Parameter slot 0 7 ch 0 7 Return Values Please re...

Страница 67: ...API Reference Manual Version 1 0 0 Aug 2010 67 Examples C int slot ch slot 0 for ch 0 ch 8 ch pac_i8088W_PWM_Start slot ch C using pac8088WNet int slot ch slot 0 for ch 0 ch 8 ch pac8088W PWM_Start s...

Страница 68: ...Manual Version 1 0 0 Aug 2010 68 4 12 pac_i8088W_PWM_Stop The function is used to stop the PWM pulse Syntax short pac_i8088W_PWM_Stop int slot int ch Parameter slot 0 7 ch 0 7 Return Values Please ref...

Страница 69: ...W API Reference Manual Version 1 0 0 Aug 2010 69 Examples C int slot ch slot 0 for ch 0 ch 8 ch pac_i8088W_PWM_Stop slot ch C using pac8088WNet int slot ch slot 0 for ch 0 ch 8 ch pac8088W PWM_Stop sl...

Страница 70: ...annel The function is used to set the specific channel as synchronous Syntax short pac_i8088W_SetSyncChannel int slot int ch int enBit Parameter 1 slot 0 7 2 ch 0 7 3 enBit 1 define channel as synchro...

Страница 71: ...sion 1 0 0 Aug 2010 71 Examples C int slot ch enBit slot 0 enBit 1 for ch 0 ch 8 ch pac_i8088W_ SetSyncChannel slot ch enBit C using pac8088WNet int slot ch enBit slot 0 enBit 1 for ch 0 ch 8 ch pac80...

Страница 72: ...annel The function is used to get the synchronous channel by using array Syntax short pac_i8088W_GetSyncChannel int slot int syncArr Parameter 1 slot 0 7 2 syncArr is an 8 bit array 3 syncArr i 1 mean...

Страница 73: ...8W API Reference Manual Version 1 0 0 Aug 2010 73 Examples C int slot syncArr slot 0 pac_i8088W_ GetSyncChannel slot syncArr C using pac8088WNet int slot syncArr slot 0 pac8088W GetSyncChannel slot sy...

Страница 74: ...function is used to start the synchronization of PWM pulse Syntax short pac_i8088W_Sync_Start int slot Parameter 1 slot 0 7 Return Values Please refer to Error Code Table Examples C int slot slot 0 pa...

Страница 75: ...e function is used to stop the synchronization of PWM pulse Syntax short pac_i8088W_Sync_Stop int slot Parameter 1 slot 0 7 Return Values Please refer to Error Code Table Examples C int slot slot 0 pa...

Страница 76: ...Syntax short pac_i8088W_SetHardwareTrigChannel int slot int ch int triggerState Parameter 1 slot 0 7 2 ch 0 7 3 triggerState 0 disabled hardware trigger Normal DI pin 4 triggerState 1 means this DI ha...

Страница 77: ...es C int slot ch triggerState slot 0 triggerState 0 for ch 0 ch 8 ch pac_i8088W_SetHardwareTrigChannel slot ch triggerState C using pac8088WNet int slot ch triggerState slot 0 triggerState 0 for ch 0...

Страница 78: ...els Syntax short pac_i8088W_GetHardwareTrigChannel int slot int ch int triggerState Parameter 4 slot 0 7 5 ch 0 7 6 trigState 0 means the hardware trigger function is disable Normal DI pin 1 means thi...

Страница 79: ...C int slot ch triggerState slot 0 triggerState 0 for ch 0 ch 8 ch pac_i8088W_GetHardwareTrigChannel slot ch triggerState C using pac8088WNet int slot ch triggerState slot 0 triggerState 0 for ch 0 ch...

Страница 80: ...te int ActiveArr Parameter 1 slot 0 7 2 State the PWM output status of i 8088 value 0 0xff 3 ActiveArr the State value will be parse into Bit Array Return Values Please refer to Error Code Table Examp...

Страница 81: ...ng pac8088WNet int slot 0 ch activatedBit 8 Uint16 activatedState 0 pac8088W GetPWMActiveState slot ref activatedState enBit Console WriteLine PWM output state 0 X2 activatedState for ch 0 ch 8 ch if...

Страница 82: ...ew which channels have received the signals Syntax short pac_i8088W_GetDI int slot unsigned int diVal int diArr Parameter 1 slot 0 7 2 diVal the DI status of i 8088 value 0 0xff 3 diArr the DI value w...

Страница 83: ...d int dival 0 pac_i8088W_GetDI slot diVal enBit Print DI Vaule 02X n diVal for ch 0 ch 8 ch Print DI d d n ch enBit ch C using pac8088WNet int slot 0 ch enBit 8 Uint16 dival 0 pac8088W GetDI slot diVa...

Страница 84: ...APPENDIX A ERROR CODE 0 OK 1 ID_ERROR 2 SLOT_OUT_RANGE 3 CHANNEL_OUT_RANGE 4 SELECT_CHANNEL_ERROR 5 HI_DUTY_OUT_RANGE 6 LO_DUTY_OUT_RANGE...

Отзывы: