📄 main.c
字号:
/****************************************Copyright (c)**************************************************
** Guangzou ZLG-MCU Development Co.,LTD.
** graduate school
** http://www.zlgmcu.com
**
**--------------File Info-------------------------------------------------------------------------------
** File name: main.c
** Last modified Date: 2004-09-16
** Last Version: 1.0
** Descriptions: The main() function example template
**
**------------------------------------------------------------------------------------------------------
** Created by: zhangmingjie
** Created date: 2007-3-26
** Version: 1.0
** Descriptions: 定时器3捕获实验。
**------------------------------------------------------------------------------------------------------
** Modified by: wuzhijian
** Modified date: 2007-09-02
** Version:
** Descriptions: 对程序的风格以及注释略作调整,并检查代码。
**
** Rechecked by: Litiantian
********************************************************************************************************/
#include "config.h"
/**********************************************************************************************************
** 函数名称: main
** 函数功能: 从定时器角度观察捕获功能
** 调试说明: 需要使用杜邦线连接JP24(第24脚)的P0.24到JP1跳线组上KEY1
**********************************************************************************************************/
int main(void)
{
PCONP |= 1 << 23; // 打开定时器3的功率控制,定时器3默认是关闭的;注意不能改变其他的功率控制位
PINSEL1 = 3 << 16; // P0.24连接捕获CAP3.1
T3PR = 99; // 分频系数
T3CCR = (1 << 4) | // 设置CAP3.1下降沿捕获T3TC的值装入T3CR1
(1 << 5); // 捕获的同时产生中断
T3TC = 0;
T3TCR = 0x01; // 启动定时器
while ((T3IR & 0x20) == 0); // 查询中断标志,等待捕获事件发生
T3TCR = 0x00; // 停止定时器
while (1);
return (0);
}
/*********************************************************************************************************
** End Of File
********************************************************************************************************/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -