ADSP-BF50x Blackfin Processor Hardware Reference
13-27
General-Purpose Counter
Programming Examples
Listing 13-1
illustrates how to initialize the GP counter for various modes.
The required interrupts are first unmasked. The GP counter is then con-
figured for the required mode of operation. Note that at this point we do
not yet enable the counter. Finally, some GP counter MMRs are cleared,
as well as any interrupts that may be pending in the
CNT_STATUS
register.
Listing 13-1. Initializing the GP Counter
/* Setup Counter Interrupts */
P5.H = hi(CNT_IMASK);
P5.L = lo(CNT_IMASK);
R5 = nCZMZIE
/* Counter zeroed by zero marker interrupt */
| CZMEIE
/* Zero marker error interrupt */
| CZMIE
/* CZM pin interrupt (push-button) */
| CZEROIE /* Counts to zero interrupt */
| nCOV15IE /* Counter bit 15 overflow interrupt */
| nCOV31IE /* Counter bit 31 overflow interrupt */
| MAXCIE
/* Max count interrupt */
| MINCIE
/* Min count interrupt */
| DCIE
/* Downcount interrupt */
| UCIE
/* Upcount interrupt */
| ICIE (z);
/* Illegal gray/binary code interrupt */
w[P5] = R5;
/* Configure the GP Counter mode of operation */
P5.H = hi(CNT_CONFIG);
P5.L = lo(CNT_CONFIG);
R5 = nINPDIS
/* Enable CUD and CDG inputs */
| BNDMODE_COMP
/* Boundary compare mode */
| nZMZC
/* Disable Zero Counter Enable */
| CNTMODE_QUADENC /* Quadrature Encoder Mode */
| CZMINV
/* Polarity of CZM pin */
Summary of Contents for EZ-KIT Lite ADSP-BF506F
Page 50: ...Contents l ADSP BF50x Blackfin Processor Hardware Reference ...
Page 92: ...Development Tools 1 30 ADSP BF50x Blackfin Processor Hardware Reference ...
Page 110: ...Interface Overview 3 12 ADSP BF50x Blackfin Processor Hardware Reference ...
Page 236: ...Internal Flash Memory Control Registers 6 92 ADSP BF50x Blackfin Processor Hardware Reference ...
Page 650: ...Programming Examples 15 56 ADSP BF50x Blackfin Processor Hardware Reference ...
Page 804: ...Programming Examples 17 92 ADSP BF50x Blackfin Processor Hardware Reference ...
Page 1194: ...Programming Examples 24 90 ADSP BF50x Blackfin Processor Hardware Reference ...
Page 1256: ...ACM Registers A 50 ADSP BF50x Blackfin Processor Hardware Reference ...
Page 1264: ...Boundary Scan Architecture B 8 ADSP BF50x Blackfin Processor Hardware Reference ...