
253
CHAPTER 12 16-BIT RELOAD TIMER
12.8
Sample Programs for the 16-bit Reload Timer
This section contains sample programs for the 16-bit reload timer in internal clock
mode and event count mode.
■
Sample Program in Internal Clock Mode
●
Processing
•
A 25 ms interval timer interrupt is generated with 16-bit reload timer 0.
•
The timer is used in reload mode to repeatedly generate an interrupt.
•
The timer is started with a software trigger. External trigger input is not used.
•
EI
2
OS is not used.
•
16 MHz is used for the machine clock, and 2
µ
s is used for the count clock.
●
Coding example
ICR09 EQU 0000B9H ;Interrupt control register for the 16-bit reload timer
TMCSR EQU 000082H ;Timer control status register
TMR EQU 000084H ;16-bit timer register
TMRD EQU 000084H ;16-bit reload register
UF EQU TMCSR:2 ;Interrupt request flag bit
CNTE EQU TMCSR:1 ;Counter operation enable bit
TRG EQU TMCSR: ;Software trigger bit
;-------Main program------------------------------------------------------------------------------------------------
CODE CSEG
START:
; : ;Assumes that stack pointer (SP) has already been
initialized
AND CCR,#0BFH ;Interrupt disable
MOV I:ICR09,#00H ;Interrupt level 0 (strongest)
CLRB I:CNTE ;Temporary stopping of counter
MOVW I:TMRD,#30D3H ;Sets data for 25-ms timer
MOVW I:TMCSR,#00001000000011011B
;Interval timer operation, 2
µ
s clock
;Disables external trigger and external output
;Selects reload mode, and enables interrupts
;Clears interrupt flag, and starts counter
MOV ILM,#07H ;Sets ILM in PS to level 7
OR CCR,#40H ; Interrupt enable
Summary of Contents for MB90460 Series
Page 1: ...The following document contains information on Cypress products ...
Page 3: ......
Page 5: ......
Page 9: ...iv ...
Page 41: ...22 CHAPTER 1 OVERVIEW ...
Page 45: ...26 CHAPTER 2 NOTES ON HANDLING DEVICES ...
Page 83: ...64 CHAPTER 3 CPU ...
Page 95: ...76 CHAPTER 4 RESET ...
Page 107: ...88 CHAPTER 5 CLOCK ...
Page 131: ...112 CHAPTER 6 LOW POWER CONSUMPTION MODE ...
Page 175: ...156 CHAPTER 7 INTERRUPT ...
Page 181: ...162 CHAPTER 8 MODE SETTING ...
Page 223: ...204 CHAPTER 9 I O PORT ...
Page 237: ...218 CHAPTER 10 TIME BASE TIMER ...
Page 247: ...228 CHAPTER 11 WATCHDOG TIMER ...
Page 275: ...256 CHAPTER 12 16 BIT RELOAD TIMER ...
Page 373: ...354 CHAPTER 14 MULTI FUNCTIONAL TIMER ...
Page 485: ...466 CHAPTER 16 PWC Timer ...
Page 531: ...512 CHAPTER 17 UART ...
Page 559: ...540 CHAPTER 19 DELAYED INTERRUPT GENERATOR MODULE ...
Page 589: ...570 CHAPTER 20 8 10 BIT A D CONVERTER ...
Page 601: ...582 CHAPTER 21 ROM CORRECTION FUNCTION ...
Page 633: ...614 CHAPTER 23 512K 1024K BIT FLASH MEMORY ...
Page 645: ...626 CHAPTER 24 EXAMPLE OF F2 MC 16LX MB90F462 F462A F463A CONNECTION FOR SERIAL WRITING ...
Page 715: ...696 APPENDIX ...
Page 716: ...697 INDEX INDEX The index follows on the next page This is listed in alphabetic order ...
Page 739: ......