Programming Examples
15-58
ADSP-BF537 Blackfin Processor Hardware Reference
Since hardware only updates the written period and width values at the
end of periods, software can write new values immediately after the timers
have been enabled. Note that both timers’ period expires at exactly the
same times with the exception of the first timer 5 interrupt (at
IRQ1
)
which is not visible to timer 4.
Listing 15-5. Non-Overlapping Clock Pulses
#define P 0x1000 /* signal period */
#define W 0x0600 /* signal pulse width */
#define N 4 /* number of pulses before disable */
timer45_toggle_hi:
[--sp] = (r7:1, p5:5);
p5.h = hi(TIMER_ENABLE);
p5.l = lo(TIMER_ENABLE);
/* config timers */
r7.l = IRQ_ENA | PERIOD_CNT | TOGGLE_HI | PULSE_HI | PWM_OUT;
w[p5 + TIMER5_CONFIG - TIMER_ENABLE] = r7;
r7.l = PERIOD_CNT | TOGGLE_HI | PULSE_HI | PWM_OUT;
w[p5 + TIMER4_CONFIG - TIMER_ENABLE] = r7;
/* calculate timers widths and period */
r0.l = lo(P);
r0.h = hi(P);
r1.l = lo(W);
r1.h = hi(W);
r2 = r1 >> 1; /* W/2 */
r3 = r0 >> 1; /* P/2 */
r4 = r3 - r2; /* P/2 - W/2 */
r5 = r0 - r2; /* P - W/2 */
/* write values for initial period */
[p5 + TIMER4_PERIOD - TIMER_ENABLE] = r0;
[p5 + TIMER4_WIDTH - TIMER_ENABLE] = r5;
[p5 + TIMER5_PERIOD - TIMER_ENABLE] = r3;
[p5 + TIMER5_WIDTH - TIMER_ENABLE] = r4;
Summary of Contents for Blackfin ADSP-BF537
Page 42: ...Contents xlii ADSP BF537 Blackfin Processor Hardware Reference ...
Page 90: ...Development Tools 1 32 ADSP BF537 Blackfin Processor Hardware Reference ...
Page 138: ...Programming Examples 4 26 ADSP BF537 Blackfin Processor Hardware Reference ...
Page 340: ...SDC Programming Examples 6 84 ADSP BF537 Blackfin Processor Hardware Reference ...
Page 606: ...Programming Examples 9 94 ADSP BF537 Blackfin Processor Hardware Reference ...
Page 660: ...Programming Examples 10 54 ADSP BF537 Blackfin Processor Hardware Reference ...
Page 720: ...Electrical Specifications 11 60 ADSP BF537 Blackfin Processor Hardware Reference ...
Page 840: ...Programming Examples 13 42 ADSP BF537 Blackfin Processor Hardware Reference ...
Page 876: ...Programming Examples 14 36 ADSP BF537 Blackfin Processor Hardware Reference ...
Page 938: ...Programming Examples 15 62 ADSP BF537 Blackfin Processor Hardware Reference ...
Page 958: ...Programming Examples 17 12 ADSP BF537 Blackfin Processor Hardware Reference ...
Page 986: ...Programming Examples 18 28 ADSP BF537 Blackfin Processor Hardware Reference ...
Page 1162: ...G 26 ADSP BF537 Blackfin Processor Hardware Reference ...
Page 1218: ...Index I 56 ADSP BF537 Blackfin Processor Hardware Reference ...