datasheetbank_Logo
Integrated circuits, Transistor, Semiconductors Search and Datasheet PDF Download Site

ACE1202BV View Datasheet(PDF) - Fairchild Semiconductor

Part Name
Description
View to exact match
ACE1202BV Datasheet PDF : 39 Pages
First Prev 11 12 13 14 15 16 17 18 19 20 Next Last
5.2 Mode 1: Pulse Width Modulation (PWM) Mode
In the PWM mode, the timer counts down at the instruction clock
rate. When an underflow occurs, the timer register is reloaded from
T1RA and the count down proceeds from the loaded value. At every
underflow, a pending flag (T1PND) located in the T1CNTRL regis-
ter is set. Software must then clear the T1PND flag and load the
T1RA register with an alternate PWM value. In addition, the timer
can be configured to toggle the T1 output bit upon underflow.
Configuring the timer to toggle T1 results in the generation of a
signal outputted from port G2 with the width and duty cycle
controlled by the values stored in the T1RA. A block diagram of the
timers PWM mode of operation is shown in Figure 15.
The timer has one interrupt (TMRI1) that is maskable through the
T1EN bit of the T1CNTRL register. However, the core is only
interrupted if the T1EN bit and the G (Global Interrupt enable) bit of
the SR is set. If interrupts are enabled, the timer will generate an
interrupt each time T1PND flags is set (whenever the timer
underflows provided that the pending flag was cleared.) The
interrupt service routine is responsible for proper handling of the
T1PND flag and the T1EN bit.
The interrupt will be synchronous with every rising and falling edge
of the T1 output signal. Generating interrupts only on rising or falling
edges of T1 is achievable through appropriate handling of the T1EN
bit or T1PND flag through software.
The following steps show how to properly configure Timer 1 to
operate in the PWM mode. For this example, the T1 output signal
is toggled with every timer underflow and the highand lowtimes
for the T1 output can be set to different values. The T1 output signal
can start out either high or low depending on the configuration of
G2; the instructions below are for starting with the T1 output high.
Follow the instructions in parentheses to start the T1 output low.
1. Configure T1 as an output by setting bit 2 of PORTGC.
- SBIT 2, PORTGC
; Configure G2 as an output
2. Initialize T1 to 1 (or 0) by setting (or clearing) bit 2 of
PORTGD.
- SBIT 2, PORTGD
; Set G2 high
3. Load the initial PWM high (low) time into the timer register.
- LD TMR1LO, #6FH
; High (Low) for 1.391ms
(1MHz clock)
- LD TMR1HI, #05H
4. Load the PWM low (high) time into the T1RA register.
- LD T1RALO, #2FH
; Low (High) for .303ms
(1MHz clock)
- LD T1RAHI, #01H
5. Write the appropriate control value to the T1CNTRL
register to select PWM mode with T1 toggle, to clear the
enable bit and pending flag, and to start the timer. (See
Table 12 and 13)
- LD T1CNTRL, #0B0H
; Setting the T1C0 bit starts
the timer
6. After every underflow, load T1RA with alternate values. If
the user wishes to generate an interrupt on a T1 output
transition, reset the pending flags and then enable the
interrupt using T1EN. The G bit must also be set. The
interrupt service routine must reset the pending flag and
perform whatever processing is desired.
- RBIT T1PND, T1CNTRL ; T1PND equals 3
- LD T1RALO, #6FH
; High (Low) for 1.391ms
(1MHz clock)
- LD T1RAHI, #05H
Figure 15: Pulse Width Modulation Mode
Underflow
Interrupt
16-bit Auto-Reload
Register (T1RA)
Data
Bus
T1
Data
Latch
16-bit Timer (TMR1)
Instruction
Clock
20
ACE1202 Product Family Rev. B.1
www.fairchildsemi.com
 

Share Link: 

datasheetbank.com [ Privacy Policy ] [ Request Datasheet ] [ Contact Us ]