SOURCE TR28335_Timer.c
/*==========================================
*
* FILE : TR28335_Timer.h .2017
* TITLE : TR28335 Timer Interrupt Control
*
*==========================================*/
#include "header/TR28335_Timer.h"
#include "header/TR28335_Led.h"
static interrupt void cpu_Timer0_Isr(void);
Uint32 tickCnt;
/*=============================================
*
* Name : InitTimer
* Type : Fucntion
* Description : Timer Interrupt Initialization
*
===============================================*/
void InitTimer0(void)
{
tickCnt = 0;
EALLOW;
PieVectTable.TINT0 = &cpu_Timer0_Isr;
EDIS;
InitCpuTimers();
/* CPU Timer0 을 1초 주기로 설정 */
ConfigCpuTimer(&CpuTimer0, 150, 1000000);
/* CPU Timer0 시작 */
StartCpuTimer0();
/* CPU Timer0 인터럽트 활성화 */
PieCtrlRegs.PIEIER1.bit.INTx7 = 1; /* PIE 인터럽트 (TINT0) 활성화 */
IER |= M_INT1; /* CPU 인터럽트 (INT1) 활성화 */
return ;
}
/*==============================================
*
* Name : cpu_Timer0_Isr
* Type : Interrupt
* Description : Timer0 Interrupt Service Routine
*
================================================*/
static interrupt void cpu_Timer0_Isr(void)
{
/* Interrupt 발생시 동작 Code */
tickCnt++;
CtrlLed(LED_ALL, LED_TOGGLE);
PieCtrlRegs.PIEACK.all = PIEACK_GROUP1; /* Acknowledge interrupt to PIE */
return ;
}
코드 분석
💡 결과
tickCnt 가 1초 주기로 카운팅 되며 TR28835 LED가 1초 주기로 토글 된다.
TR28335 개발 KIT Potentiometer 가변저항 ADC 로 Control (0) | 2017.06.26 |
---|---|
TR28335 개발 KIT Switch GPIO Input (0) | 2017.06.23 |
TR28335 개발 KIT GPIO LED 제어 (0) | 2017.06.23 |
TR28335 개발 KIT SCI 통신 (0) | 2017.06.22 |
TR28335 개발 KIT CAN 통신 (1) | 2017.06.21 |