ace1001 Fairchild Semiconductor, ace1001 Datasheet - Page 20

no-image

ace1001

Manufacturer Part Number
ace1001
Description
Arithmetic Controller Engine Acex ?for Low Power Applications
Manufacturer
Fairchild Semiconductor
Datasheet

Available stocks

Company
Part Number
Manufacturer
Quantity
Price
Part Number:
ace1001EMT8
Manufacturer:
Fairchild Semiconductor
Quantity:
135
Part Number:
ace1001LM8
Manufacturer:
Fairchild Semiconductor
Quantity:
135
Part Number:
ace1001M8
Manufacturer:
Fairchild Semiconductor
Quantity:
135
ACE1001 Product Family Rev. B.1
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
timer’s 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 “high” and “low” times 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
Instruction
Underflow
Interrupt
Clock
T1
÷ 8
÷ 4
÷ 2
Latch
Data
T1PSC[1:0]
3
2
1
0
Sel
20
1. Configure T1 as an output by setting bit 2 of PORTGC.
2. Initialize T1 to 1 (or 0) by setting (or clearing) bit 2 of
3. Load the initial PWM high (low) time into the timer register.
4. Load the PWM low (high) time into the T1RA register.
5. Write the appropriate control value to the T1CNTRL
6. Set te T1CO bit to start the timer.
7. After every underflow, load T1RA with alternate values. If
8-bit Auto-Reload
- SBIT 2, PORTGC
PORTGD.
- SBIT 2, PORTGD
- LD TMR1, #6FH
- LD T1RA, #2FH
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
- SBIT T1CP, T1CNTRL
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
- LD T1RA, #6FH
Register (T1RA)
8-bit Timer
(TMR1)
; Configure G2 as an output
; Set G2 high
; High (Low) for .444ms
; Low (High) for .188ms
; Setting the T1C0 bit starts
; T1CO equals 4
; T1PND equals 3
; Low for .444ms
(1MHz/4 clock)
(1MHz/4 clock)
the timer
(1MHz/4 clock)
Data
Bus
www.fairchildsemi.com

Related parts for ace1001