欢迎访问ic37.com |
会员登录 免费注册
发布采购

EM6603 参数 Datasheet PDF下载

EM6603图片预览
型号: EM6603
PDF下载: 下载PDF文件 查看货源
内容描述: 超低功耗多I / O微控制器 [Ultra Low Power Multi I/O Microcontroller]
分类和应用: 微控制器
文件页数/大小: 39 页 / 670 K
品牌: EMMICRO [ EM MICROELECTRONIC - MARIN SA ]
 浏览型号EM6603的Datasheet PDF文件第12页浏览型号EM6603的Datasheet PDF文件第13页浏览型号EM6603的Datasheet PDF文件第14页浏览型号EM6603的Datasheet PDF文件第15页浏览型号EM6603的Datasheet PDF文件第17页浏览型号EM6603的Datasheet PDF文件第18页浏览型号EM6603的Datasheet PDF文件第19页浏览型号EM6603的Datasheet PDF文件第20页  
EM6603
8
Timer/Event Counter
The EM6603 has a built-in 8 bit countdown auto-reload Timer/Event counter that takes an input from either the
prescaler or Port PA3. If the Timer/Event counter counts down to $00 the interrupt request flag
IntTim
is set to
1. If the Timer/Event counter interrupt is enabled by setting the mask flag
MTimC
set to 1, then an interrupt
request is generated to the CPU. See also section 9. If used as an event counter, pulses from the PA3 terminal
are input to the event counter. See figure 10 and tables 28 and 29 on the next page for PA3 source selection
(debounced or not, Rising/Falling edge). By default rising and debounced PA3 input is selected.
The timer control register
TimCtr
selects the auto-reload function and input clock source. At initial RESET this
bit is cleared to 0 selecting no auto-reload. To enable auto-reload
TimAuto
must be set to 1. The Timer/Event
counter can be enabled or disabled by writing to the
TIMen
control bit in the
BEEP
register. At initial RESET it is
cleared to 0. When used as timer, it is initialised according to the data written into the timer load/status registers
LTimLS
(low 4 bits) and
HTimLS
(high four bits). The timer starts to count down as soon as the
LTimLS
value
is written. When loading the Timer/Event counter registers the correct order must be respected: First, write
either the control register
TimCtr
or the high data nibble
HTimLS.
The last register written should be the low
data nibble
LTimLS.
During count down, the timer can always be reloaded with a new value, but the high four
bits will only be accepted during the write of the low four bits.
In the case of the auto-reload function, the timer is initialised with the value of the load registers
LTimLS
and
HTimLS.
Counting with the auto-reload function is only enabled during the write to the low four bits, (writing
TimAuto
to 1 does not start the timer counting down with the last value in the timer load registers but it waits
until a new
LTimLS
load). The timer counting to $00 generates a timer interrupt event and reloads the registers
before starting to count down again. To stop the timer at any time, a write of $00 can be made to the timer load
registers, this sets the
TimAuto
flag to 0. If the timer is stopped by writing the
TimEn
bit to 0, the timer status
can be read. The current timer status can be always obtained by reading the timer registers
LTimLS
and
HTimLS.
For proper operation read ordering should be respected such that the first read should be of the
LTimLS
register followed by the
HTimLS
register. Example: To have continuos 1sec timer IRQ with 128Hz one
has to write 128dec (80hex) in Timer registers with auto-reload.
Using the Timer/Event Counter as the event counter allows several possibilities:
1.) Firstly, load the number of PA3 input edges expected into the load registers and then generate an interrupt
request when counter reaches $00.
2.) The second is to write timer/counter to $FF, then select the event counter mode, and lastly enable the event
counter by setting the
TimEn
bit to 1, which starts the count.
Because the counter counts down, a binary complement has to be done in order to get the number of events at
the PA3 input.
3) Another option is to use the Timer/Event counter in conjunction with the prescaler interrupt, such that it is
possible to count the number of the events during two consecutive 32Hz, 8Hz or 1Hz prescaler interrupts.
Figure 10.Timer / Event Counter
03/02 REV. G/439
Copyright
2002, EM Microelectronic-Marin SA
16
www.emmicroelectronic.com