当前位置:文档之家› 飞思卡尔MCU时钟模块设置

飞思卡尔MCU时钟模块设置


• 8个独立的定时器通
• 4个8位脉冲累加器,也 • 通过对寄存器编程可以
Slide 2
TM
Freescale Semiconductor Confidential and Proprietary Information. Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. © Freescale Semiconductor, Inc. 2005.
Freescale
HCS12 微控制器 MC9S12DP256
2005年8月
TM
Freescale Semiconductor Confidential and Proprietary Information. Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. © Freescale Semiconductor, Inc. 2005.
RST:
TOI
0
0
0
0
0
0
0
TCRE PR2 PR1 PR0
0 0 0 0
$000D
预分频系数选择
PR2 PR1
0 0 1 1 0 0 1 1
PR0
0 1 0 1 0 1 0 1
除以
1 2 4 8 16 32 64 128
1 – 定时器由OC7比较符合时复位 0 – 定时器自由运行
1 – 定时器溢出中断使能 0 – 定时器中断禁止 TCRE - 允许使用PWM功能
Created with SmartPrinter trail version
定时器结构
模块时钟
M Clock 预分频选择 PR[2:0]
$FFFE $FFFF $0000
******* ****** ** ****
计时器溢出时,对溢出标志位 置位,如允许中断,则向CPU 发出中断请求
Slide 4
TM
0 0 0 0 1 1 1 1
Freescale Semiconductor Confidential and Proprietary Information. Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. © Freescale Semiconductor, Inc. 2005.
RST: 0
B7 OM3
0
B6 OL3
0
B5 OM2B4 OL20来自0B3 OM10
B2 OL1
0
B1 OM0
0
B0 OL0
$0009
B7 6. CFORC
RST:
B6 FOC6
0 Slide 7
B5 FOC5
0
B4 FOC4
0
B3 FOC3
0
B2 FOC2
0
B1 FOC1
0
B0 FOC0
0
FOC7
Created with SmartPrinter trail version
定时器,预分频,计数器
寄存器:
1. TCNT
RST: 0........................................................................................................................0 B7......................................................................B0 $000F
0
B5 C5F
0
B4 C4F
0
B3 C3F
0
B2 C2F
0
B1 C1F
0
B0 C0F
0
2. TFLG1
C7F
0
$000E
RST:
比较/捕捉标志位 写 ‘1’清除中断状态标志位 比较/捕捉屏蔽位 0 = 屏蔽中断请求 1 = 中断请求允许
输出模式和输出电平 (O7–OC0)
OMX 0 0 1 1 OLX 0 1 0 1 Action on OCx No Action OCx Toggle OCx Drive OCx LO Drive OCx HI
16 位自由运行/模计数器
B15............................................................................................................................…B0 Address Offset $0004, $0005
Created with SmartPrinter trail version
ECT 模块结构
• 一个16位向上带可编程
预分频的主计数器.
• 一个16位的带可编程预
分频的模数向下计数器 道,每个通道具备输入 捕捉和输出比较功能 可设置成2个16位脉冲 累加器. 实现不同的功能
0
$0001
TM
Freescale Semiconductor Confidential and Proprietary Information. Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. © Freescale Semiconductor, Inc. 2005.
在PRM文件中,加入 VECTOR ADDRESS 0xFFDE Int_TimerOverFlow
Slide 5
TM
Freescale Semiconductor Confidential and Proprietary Information. Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. © Freescale Semiconductor, Inc. 2005.
Created with SmartPrinter trail version
输出比较功能
• 在特定的时刻输出一个信号
TCNT
16位自由运行计数器 当比较寄存器的值和计数 器的值相等时,采取行动 比如:当TCNT=0x5678 相等 置位
清零
OR Pin
OCx
翻转
OR
B7 3. TIE C7F
RST: 0
B6 C6F
0
B5 C5F
0
B4 C4F
0
B3 C3F
0
B2 C2F
0
B1 C1F
0
B0 C0F
0
$000C
B7 4. TCTL1
RST:
B6 OL7
0
B5 OM6
0
B4 OL6
0
B3 OM5
0
B2 OL5
0
B1 OM4
0
B0 OL4
0
OM7
0
$0008
5. TCTL2
Created with SmartPrinter trail version
输出比较寄存器
1. TC7 – TC0
16 位捕捉/比较寄存器 (TC7) Address Offset $0010 - $0011 $001E - $001F
16 位捕捉/比较寄存器 (TC0) B7 B6 C6F
TOF
1
2
4 8 16 32 64 128
计数器寄存器
TCNT CLK
15...........................................0
.
TEN
TCNT
Address Offset $0004, 05
B0.......……...B7 B8……..........B15
PIN DATA BUS
比较
比较器
引脚控制逻辑
TOCx
16位输出比较寄存器 比如:0x5678 软件可以修改 OCxF 状态标志位置位,
当比较发生时(值相等时)
中断屏蔽 (通过软件使能)
OCxI
中断请求
• 共有8个输出比较通道 • 每个通道有自己的向量表和控制寄存器
Slide 6
TM
Freescale Semiconductor Confidential and Proprietary Information. Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. © Freescale Semiconductor, Inc. 2005.
相关主题