| Electronic Components Datasheet Search |
|
AN2618 Datasheet(PDF) 11 Page - STMicroelectronics |
|
|
|||||||||||||||||||||||||||||
AN2618 Datasheet(HTML) 11 Page - STMicroelectronics |
|
11 / 23 page ![]() AN2618 Code example 1.main.c 11/23 Appendix A Code example 1.main.c #include "etpu_image.h" #include "etpu_PWMControl.h" /*********************************************************************************************** * FUNCTION: main * * PURPOSE: This function is the entry point of the host PWM application. The main function * * initializes the eTPU to execute PWM function. Once the eTPU PWM function is initialized, * * the main function calls the API function periodically to update the * PWM function parameters.* ***********************************************************************************************/ void main(void) { unsigned long DutyCycle_host = 0x200000; uint16_t delay_counter; uint32_t pulseStartTime; /* init device */ init_error = etpu_init(); /* main user code goes here */ while(1) { for (delay_counter=0; delay_counter <= 0x0FEE; delay_counter++) {} if (DutyCycle_Host == 0x800000) DutyCycle_Host = 0x400000; else DutyCycle_Host = 0x800000; etpu_pwm_update(PWM0, 4000, DutyCycle_Host); etpu_pwm_getPulseTime(PWM0, &pulseStartTime); } /********************************************************************************************** * FUNCTION: etpu_init * * PURPOSE: This function initializes eTPU module & configures each eTPU channel. The channel * * The eTPU PWM functions initialization APIs are called to initiate eTPU function execution. * **********************************************************************************************/ int16_t etpu_init () { int16_t error_code; uint32_t chanConfigParam = 0; /* initialize eTPU hardware */ mc_etpu_init(etpu_config_A, (uint32_t *)etpu_code,(uint8_t)ETPU_CODE_RAM_SIZE, (uint32_t *)etpu_globals); /* initialize eTPU channels */ chanConfigParam = (ETPU_PWM_INT_REQ | ETPU_PWM_DMA_REQ | ETPU_PWM_OUT_DISABLE | \ (ETPU_PWM_TABLE_SELECT << 24) | (PWM0_CHAN_PRIORITY << 28)); mc_etpu_chan_init(PWM0, ETPU_PWM_FUNCTION_NUMBER, ETPU_PWM_FUNC_MODE, \ ETPU_PWM_NUM_PARMS, chanConfigParam, AUTO_FUNC_FRAME); /* initialize eTPU functions */ etpu_pwm_init(PWM0, 4000, DutyCycle_Host); /* enable all timebases */ mc_mpc5500_timer_start(); return (0); } |
|
|
Link URL |
| Does ALLDATASHEET help your business so far? [ DONATE ] |
About Alldatasheet | Advertisement | Contact us | Privacy Policy | Link to Datasheet | Link Exchange | Manufacturer List All Rights Reserved©Alldatasheet.com |
| Russian : Alldatasheetru.com | Korean : Alldatasheet.co.kr | Spanish : Alldatasheet.es | French : Alldatasheet.fr | Italian : Alldatasheetit.com Portuguese : Alldatasheetpt.com | Polish : Alldatasheet.pl | Vietnamese : Alldatasheet.vn Indian : Alldatasheet.in | Mexican : Alldatasheet.com.mx | British : Alldatasheet.co.uk | New Zealand : Alldatasheet.co.nz |
|
Family Site : ic2ic.com |
icmetro.com |