Download Print this page

Infineon PWM Buzzer 1 Manual page 7

Pwm controlled melody on buzzer, aurix tc2xx microcontroller training

Advertisement

Implementation
Playing song
The song is played by repeatedly calling the function playTone() for each note, which contains
the following steps:
1.
Set the PWM frequency (in Hz) through the iLLD function
IfxGtm_Tom_Timer_setFrequency()
2.
Set the volume level by calling the function setVolume(). This is done by setting the PWM
duty cycle with the function IfxGtm_Tom_Timer_setTrigger()
3.
Start the timer with the iLLD function IfxGtm_Tom_Timer_run()
4.
Wait until the end of the note through the service function waitTime()
5.
Stop the timer with the iLLD function IfxGtm_Tom_Timer_stop()
PWM signal
Period of PWM
Sound duration
2019-10-17
Duty cycle of the PWM
Copyright © Infineon Technologies AG 2019. All rights reserved.
t
7

Advertisement

loading