Timer Programming Examples
Timer Programming Examples
This section provides three programming examples written for the
ADSP-2126x.
The first listing,
mode, using DAI pin 1 as its input. The Timer generates an interrupt
when it senses the number of edges are equal to the Timer Period setting.
The second listing,
is set up in PWMOUT mode, using DAI pin 1 as its output. Timer 1 is
set up in Width Capture mode, using Timer 0 as its input. The period and
pulse width measured by Timer 1 are identical to the settings of Timer 0.
Listing 14-1. External Watchdog Mode Example
/* Register Definitions */
#define TMSTAT
#define TM0CTL
#define TM0PRD
#define TM0W
#define SRU_EXT_MISCB
/* SRU definitions */
#define DAI_PB01_O
/* Bit Positions */
#define TIMER0_I
/* Bit Definitions */
#define TIMODEEXT 0x00000003
#define PULSE
#define PRDCNT
#define IRQEN
14-14
Listing
14-1, sets up Timer 0 in External Watchdog
Listing
14-2, uses both Timer 0 and Timer 1. Timer 0
(0x1400)
/* GP Timer 0 Status register
(0x1401)
/* GP Timer 0 Control register */
(0x1403)
/* GP Timer 0 Period register
(0x1404)
/* GP Timer 0 Width register
(0x2471)
0x00
0
0x00000004
0x00000008
0x00000010
ADSP-2126x SHARC Processor Hardware Reference
*/
*/
*/
Need help?
Do you have a question about the ADSP-21261 SHARC and is the answer not in the manual?
Questions and answers