|
|
Número de pieza | AN2701 | |
Descripción | PWM Generation | |
Fabricantes | Freescale Semiconductor | |
Logotipo | ||
Hay una vista previa y un enlace de descarga de AN2701 (archivo pdf) en la parte inferior de esta página. Total 14 Páginas | ||
No Preview Available ! www.DataSheet4U.com
Freescale Semiconductor
Application Note
AN2701
Rev. 0, 10/2004
PWM Generation with the HC08
Timer
by: Alban Rampon
8/16-bit Division
East Kilbride
Introduction
All HC08 microcontrollers (MCUs) include at least one timer module (TIM). This module is very useful for
generating or capturing time-dependent signals.
The data sheet describes what the timer module is capable of and how to use it.
This application note gives further explanation of how the TIM behaves in the following situations.
• Unbuffered pulse width modulation (PWM) signal generation
• Rolling PWM generation
• Timer activity during Break and software interrupts
PWM signals are used in many applications from dimmers (duty cycle variation gives more/less light from
LEDs) to IR transceivers (modulation/demodulation).
An example illustrating rolling generation is included, with sample code, in the appendix at the end of this
document.
© Freescale Semiconductor, Inc., 2004. All rights reserved.
1 page PWM Generation
Assignment must be done sequentially (using BSET 4,+ 0x25, for example)
following the steps of the PWM Initialization procedure described above.
MSxB
x
x
0
0
0
0
0
0
0
1
1
1
Table 2. Mode, Edge, and Level Selection
MSxA
0
1
0
ELSxB ELSxA
00
00
01
Mode
Output Preset
Configuration
Pin under port control; initial output level high
Pin under port control; initial output level low
Capture on rising edge only
0 1 0 Input Capture Capture on falling edge only
011
Capture on rising or falling edge
100
Software compare only
1 0 1 Output Compare or Toggle output on compare
110
PWM
Clear output on compare
111
Set output on compare
x01
Toggle output on compare
Buffered Output
x10
Compare or
Clear output on compare
Buffered PWM
x11
Set output on compare
If this procedure is not followed, the PWM signal generated will not be as expected.
Freescale Semiconductor
PWM Generation with the HC08 Timer, Rev. 0
5
5 Page Conclusion
Channel 1: PWM signal generated
Channel 2: High during SWI ISR
Figure 6. PWM Generation During and SWI
To summarize, when this interrupt has to be used in normal operation, it is advisable to use an SWI
instruction, instead of a Break, to minimize the impact on the microcontroller operations (timer and other
modules).
NOTE
The Break (BRK) and Software Interrupt (SWI) share the same interrupt
vector. Therefore, the effect really depends on how the ISR is called and
not on its content.
Conclusion
The HC08 timer is easy to use and can be used in a myriad of applications. However, the user must take
care to set it up properly to ensure that the desired function is achieved.
Depending on the user’s priority (code size, complexity, resource utilization, for example), it will be
possible to find a solution to suit the application.
Freescale Semiconductor
PWM Generation with the HC08 Timer, Rev. 0
11
11 Page |
Páginas | Total 14 Páginas | |
PDF Descargar | [ Datasheet AN2701.PDF ] |
Número de pieza | Descripción | Fabricantes |
AN2701 | PWM Generation | Freescale Semiconductor |
Número de pieza | Descripción | Fabricantes |
SLA6805M | High Voltage 3 phase Motor Driver IC. |
Sanken |
SDC1742 | 12- and 14-Bit Hybrid Synchro / Resolver-to-Digital Converters. |
Analog Devices |
DataSheet.es es una pagina web que funciona como un repositorio de manuales o hoja de datos de muchos de los productos más populares, |
DataSheet.es | 2020 | Privacy Policy | Contacto | Buscar |