timer0a_int.c

来自「EasyARM615的KEIL下的调试程序,包含IO口,串口,SPI口等」· C语言 代码 · 共 39 行

C
39
字号
#include "hw_memmap.h"
#include "hw_types.h"
#include "hw_timer.h"
#include "gpio.h"
#include "sysctl.h"
#include "timer.h"
#include"interrupt.h"
#include "hw_ints.h"
#include "TIMER0A_int.h"

extern TIME_FORMAT time;

void Timer1a_int(void)
{
                   
    SysCtlPeripheralEnable(SYSCTL_PERIPH_TIMER1);        // 使能定时器0外设。

    SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOD);         // 使能GPIO D口外设。

    IntMasterEnable();                                   // 处理器使能。

	GPIOPinTypeTimer(GPIO_PORTD_BASE ,CCP0);			//设置PB0为32K输入口
    
	TimerConfigure(TIMER1_BASE, TIMER_CFG_32_RTC|TIMER_CFG_32_BIT_PER);   
                                                         // 设置RTC模式。
    TimerMatchSet(TIMER1_BASE,TIMER_A,2);			 // 设置RTC的匹配值
	TimerLoadSet(TIMER1_BASE, TIMER_A, 1);
	TimerRTCEnable(TIMER1_BASE);  						//使能RTC计数
	
	TimerIntEnable(TIMER1_BASE,TIMER_RTC_MATCH);		//使RTC中断

    TimerEnable(TIMER1_BASE, TIMER_A);		 //	RTC模式使能
	
	IntEnable(INT_TIMER1A);					// 使能中断

}


⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?