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

ACE1001EM8 View Datasheet(PDF) - Fairchild Semiconductor

Part Name
Description
View to exact match
ACE1001EM8 Datasheet PDF : 32 Pages
First Prev 11 12 13 14 15 16 17 18 19 20 Next Last
5.2 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 14.
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
I/O G2; the instructions below are for starting with the T1 output high.
Follow the instructions in parentheses to start the T1 output low.
Figure 14: Pulse Width Modulation Mode
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 TMR1, #6FH
; High (Low) for .444ms
(1MHz/4 clock)
4. Load the PWM low (high) time into the T1RA register.
- LD T1RA, #2FH
; Low (High) for .188ms
(1MHz/4 clock)
5. Write the appropriate control value to the T1CNTRL
register to select PWM mode with T1 toggle, to select the
divide by 4 pre-scalar, and to clear the enable and pending
flags. (See Table 12)
- LD T1CNTRL, #22H
; Setting the T1C0 bit starts
the timer
6. Set te T1CO bit to start the timer.
- SBIT T1CP, T1CNTRL ; T1CO equals 4
7. After every underflow, load T1RA with alternate values. If
the user wishes to generate an interrupt on timer output
transitions, 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 T1RA, #6FH
; Low for .444ms
(1MHz/4 clock)
Underflow
Interrupt
8-bit Auto-Reload
Register (T1RA)
T1
Instruction
Clock
Data
Latch
÷8
3
÷4
2
÷2
1
0
Sel
8-bit Timer
(TMR1)
Data
Bus
T1PSC[1:0]
20
ACE1001 Product Family Rev. B.1
www.fairchildsemi.com
 

Share Link: 

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