Electronic Components Datasheet Search
  English  ▼

X  

AN2618 Datasheet(PDF) 11 Page - STMicroelectronics

Part # AN2618
Description  eTPU host interface
PDF  23 Pages
Scroll/Zoom Zoom In 100%  Zoom Out
Manufacturer  STMICROELECTRONICS [STMicroelectronics]
Direct Link  http://www.st.com
Logo STMICROELECTRONICS - STMicroelectronics

AN2618 Datasheet(HTML) 11 Page - STMicroelectronics

Back Button AN2618 Datasheet HTML 7Page - STMicroelectronics AN2618 Datasheet HTML 8Page - STMicroelectronics AN2618 Datasheet HTML 9Page - STMicroelectronics AN2618 Datasheet HTML 10Page - STMicroelectronics AN2618 Datasheet HTML 11Page - STMicroelectronics AN2618 Datasheet HTML 12Page - STMicroelectronics AN2618 Datasheet HTML 13Page - STMicroelectronics AN2618 Datasheet HTML 14Page - STMicroelectronics AN2618 Datasheet HTML 15Page - STMicroelectronics Next Button
Zoom Inzoom in Zoom Outzoom out
 11 / 23 page
background image
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);
}



Html Pages

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23


Datasheet Download

Go To PDF Page


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


Mirror Sites
English : Alldatasheet.com  |   English : Alldatasheet.net  |   Chinese : Alldatasheetcn.com  |   German : Alldatasheetde.com  |   Japanese : Alldatasheet.jp
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