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

HT48R063 参数 Datasheet PDF下载

HT48R063图片预览
型号: HT48R063
PDF下载: 下载PDF文件 查看货源
内容描述: 增强I / O型8位OTP MCU [Enhanced I/O Type 8-Bit OTP MCU]
分类和应用:
文件页数/大小: 93 页 / 511 K
品牌: HOLTEK [ HOLTEK SEMICONDUCTOR INC ]
 浏览型号HT48R063的Datasheet PDF文件第36页浏览型号HT48R063的Datasheet PDF文件第37页浏览型号HT48R063的Datasheet PDF文件第38页浏览型号HT48R063的Datasheet PDF文件第39页浏览型号HT48R063的Datasheet PDF文件第41页浏览型号HT48R063的Datasheet PDF文件第42页浏览型号HT48R063的Datasheet PDF文件第43页浏览型号HT48R063的Datasheet PDF文件第44页  
HT48R063/064/065/066/0662/067  
Programming Considerations  
Configuring the Timer/Event Counter Input Clock  
Source  
Within the user program, one of the first things to con-  
sider is port initialisation. After a reset, the I/O data reg-  
ister and I/O port control register will be set high. This  
means that all I/O pins will default to an input state, the  
level of which depends on the other connected circuitry  
and whether pull-high options have been selected. If the  
port control registers, are then programmed to setup  
some pins as outputs, these output pins will have an ini-  
tial high output value unless the associated port data  
register is first programmed. Selecting which pins are in-  
puts and which are outputs can be achieved byte-wide  
by loading the correct value into the port control register  
or by programming individual bits in the port control reg-  
ister using the ²SET [m].i² and ²CLR [m].i² instructions.  
Note that when using these bit control instructions, a  
read-modify-write operation takes place. The  
microcontroller must first read in the data on the entire  
port, modify it to the required new bit values and then re-  
write this data back to the output ports.  
The Timer/Event Counter clock source can originate  
from various sources, an internal clock or an external  
pin. The internal clock source source is used when the  
timer is in the timer mode or in the pulse width capture  
mode. For some Timer/Event Counters, this internal  
clock source is first divided by a prescaler, the division  
ratio of which is conditioned by the Timer Control Regis-  
ter bits T0PSC0~T0PSC2 or T2PSC0~ T2PSC2. For  
Timer/Event Counter 0, the internal clock source can be  
either fSYS or the LXT Oscillator, the choice of which is  
determined by the T0S bit in the TMR0C register.  
An external clock source is used when the timer is in the  
event counting mode, the clock source being provided  
on an external timer pin TCn. Depending upon the con-  
dition of the TnEG bit, each high to low, or low to high  
transition on the external timer pin will increment the  
counter by one.  
Timer Registers - TMR0, TMR1, TMR2  
T
1
T
2
T
3
T
4
T
1
T
2
T
3
T
4
S
y
s
t
e
m
C
l
o
c
k
The timer registers are special function registers located  
in the Special Purpose Data Memory and is the place  
where the actual timer value is stored. These registers  
are known as TMR0, TMR1 and TMR2. The value in the  
timer registers increases by one each time an internal  
clock pulse is received or an external transition occurs  
on the external timer pin. The timer will count from the  
initial value loaded by the preload register to the full  
count of FFH at which point the timer overflows and an  
internal interrupt signal is generated. The timer value  
will then be reset with the initial preload register value  
and continue counting.  
P
o
r
t
D
a
t
a
R
e
a
d
f
r
o
m
P
W
o
r
r
i
t
t
e
t
o
P
o
r
t
Read Modify Write Timing  
Pins PA0 to PA7 each have a wake-up functions, se-  
lected via the PAWK register. When the device is in the  
Idle/Sleep Mode, various methods are available to wake  
the device up. One of these is a high to low transition of  
any of the these pins. Single or multiple pins on Port A  
can be setup to have this function.  
Note that to achieve a maximum full range count of FFH,  
the preload register must first be cleared to all zeros. It  
should be noted that after power-on, the preload regis-  
ters will be in an unknown condition. Note that if the  
Timer/Event Counter is in an OFF condition and data is  
written to its preload register, this data will be immedi-  
ately written into the actual counter. However, if the  
counter is enabled and counting, any new data written  
into the preload data register during this period will re-  
main in the preload register and will only be written into  
the actual counter the next time an overflow occurs.  
Timer/Event Counters  
The provision of timers form an important part of any  
microcontroller, giving the designer a means of carrying  
out time related functions. The devices contain from one  
to three count-up timer of 8-bit capacity. As the timers  
have three different operating modes, they can be con-  
figured to operate as a general timer, an external event  
counter or as a pulse width capture device. The provi-  
sion of an internal prescaler to the clock circuitry on  
gives added range to the timers.  
There are two types of registers related to the  
Timer/Event Counters. The first is the register that con-  
tains the actual value of the timer and into which an ini-  
tial value can be preloaded. Reading from this register  
retrieves the contents of the Timer/Event Counter. The  
second type of associated register is the Timer Control  
Register which defines the timer options and deter-  
mines how the timer is to be used. The device can have  
the timer clock configured to come from the internal  
clock source. In addition, the timer clock source can also  
be configured to come from an external timer pin.  
Timer Control Registers - TMR0C, TMR1C, TMR2C  
The flexible features of the Holtek microcontroller  
Timer/Event Counters enable them to operate in three  
different modes, the options of which are determined by  
the contents of their respective control register.  
The Timer Control Register is known as TMRnC. It is the  
Timer Control Register together with its corresponding  
timer register that control the full operation of the  
Timer/Event Counter. Before the timer can be used, it is  
essential that the Timer Control Register is fully pro-  
Rev. 1.10  
40  
June 9, 2009  
 复制成功!