Moteur de recherche de fiches techniques de composants électroniques
  French  ▼
ALLDATASHEET.FR

X  

AN2618 Fiches technique(PDF) 13 Page - STMicroelectronics

No de pièce AN2618
Description  eTPU host interface
PDF  23 Pages
Scroll/Zoom Zoom In 100%  Zoom Out
Fabricant  STMICROELECTRONICS [STMicroelectronics]
Site Internet  http://www.st.com
Logo STMICROELECTRONICS - STMicroelectronics

AN2618 Fiches technique(HTML) 13 Page - STMicroelectronics

Back Button 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 AN2618 Datasheet HTML 16Page - STMicroelectronics AN2618 Datasheet HTML 17Page - STMicroelectronics Next Button
Zoom Inzoom in Zoom Outzoom out
 13 / 23 page
background image
AN2618
Code example 3.etpuc_pwm.c
13/23
Appendix C
Code example 3.etpuc_pwm.c
#include <etpuc_PWM.h>
/*--------------------------------------------------------------------+
|
Global Variable Definitions
|
+--------------------------------------------------------------------*/
int DutyCycle = 500;
/********************************************************************************
* FUNCTION: PWM
*
* PURPOSE:
This is the eTPU function that modulate an eTPU output pin as PWM
*
*
signal based on the host service request and the parameters passed
*
*
from the host.
*
*
*
* INPUTS NOTES: This function has 2 parameters
*
* RETURNS NOTES: N/A
*
*
*
* WARNING:
*
********************************************************************************/
void PWM(int Period, unsigned fract24 Duty)
{
static int StartTimeHi;
int HighTime;
if (hsr == hsrInitPWM)
// Init PWM HSR -- Required to initialize the signal.
{
InitPWM:
SetChannelMode(em_nb_dt);
SetupMatch_B(tcr1, Mtcr1_Ctcr1_ge, low_high);//set output high immediately
}
else if (matchA_transB)// Here on Match1 (falling edge)
{
FallingMatch:
ClearMatchALatch();
SetupMatch_B((StartTimeHi + Period), Mtcr1_Ctcr1_ge, low_high); //set up for
rising match
}
else if (matchB_transA) // Here on Match2 (rising edge)
{
RisingMatch:
ClearMatchBLatch();
StartTimeHi = GetCapRegB();
// Store the time the pulse transition to high
if (Duty == 0xffffff) // Special case for 100% modulation
{
HighTime = 32 ; // arbitrary value having no efect on the output signal
SetupMatch_A(HighTime, Mtcr1_Ctcr1_ge, match_no_change);
}
else
{
HighTime = Period * Duty + StartTimeHi;
SetupMatch_A(HighTime, Mtcr1_Ctcr1_ge, high_low);
//setup for falling
match
}
}
else



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


Fiches technique Télécharger

Go To PDF Page


Lien URL



ALLDATASHEET vous a-t-il été utile ?  [ DONATE ] 

À propos de Alldatasheet   |   Publicité   |   Contactez-nous   |   Politique de confidentialité   |   Lien vers la fiche technique    |   Echange de liens   |   Fabricants
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