Download Print this page

Infineon PWM Buzzer 1 Manual page 6

Pwm controlled melody on buzzer, aurix tc2xx microcontroller training

Advertisement

Implementation
Configuration of the variable timerCfg
Setting of the timerCfg variable is done once in the setup phase in the function
initPWMBuzzer() with the following steps:
Set TOM1 as the timer for generating the PWM signal
timerCfg.tom = IfxGtm_Tom_1
Set the channel 4 of TOM1 as the channel used for the timer
timerCfg.timerChannel = IfxGtm_Tom_Ch_4
Select the clock source
timerCfg.clock = IfxGtm_Tom_Ch_ClkSrc_cmuFxclk2
Set port and pin for PWM output
timerCfg.triggerOut = &IfxGtm_TOM1_4_TOUT22_P33_0_OUT
Enable TOM channel
timerCfg.base.trigger.enabled = TRUE
Enable TOM channel output
timerCfg.base.trigger.outputEnabled = TRUE
Starting PWM with rising edge
timerCfg.base.trigger.risingEdgeAtPeriod = TRUE
2019-10-17
Copyright © Infineon Technologies AG 2019. All rights reserved.
6

Advertisement

loading