s3c44b0 定时器中断问题 请教
#include "option.h"#include "def.h"
#include "44b.h"
#include "44blib.h"
static U32 TimerCnt=0;
static int LedStatus=0;
void __irq Timer_Tick(void)
{
rI_ISPC=BIT_TIMER3;
if(TimerCnt++ == 10) {
TimerCnt=0;
Led_Display(LedStatus);
LedStatus=(~(LedStatus)&0x7);
Uart_Printf("\nTIMER interrupt... ");
}
}
void Timer_Init(void)
{
/*
* Timer Clock Frequency = MCLK/pre/mux
*/
rTCFG0=0x00000f00; //dead zone=0,pre2=0,pre1=0xf,pre0=0
rTCFG1=0x00001000; //all interrupt,mux5=1/2,mux2=1/2,mux3=1/4,mux2=1/2,mux1=1/2,mux0=1/2
rTCNTB3=0xc350; //(1/(60MHz/4/15))*0xc350=50ms
//(1/(60MHz/4/15))*0x4320=20ms
rTCMPB3=0x0;
rTCON=0x0020000; //update T3
rTCON=0x0090000; //T3=auto reload,start
rINTCON=0x5; //Non-vectored,IRQ enable,FIQ disable
rINTMOD=0x0; //All=IRQ mode
pISR_TIMER3=(unsigned)Timer_Tick;
rINTMSK=BIT_GLOBAL;
rINTMSK=~(BIT_GLOBAL|BIT_TIMER3); //start timer INT
}
void Main(void)
{
rSYSCFG=CACHECFG; // Using 8KB Cache//
Port_Init();
Uart_Init(0,57600);
Delay(10);
Uart_Select(0); //Select UART0
Led_Display(0x07);
Uart_Printf("\nFS44B0X TIMER ");
Uart_Printf("\n定时器中断DEMO");
while(1)
Timer_Init();
//while(1);
}
中断进不了,不知道什么问题,麻烦大侠们解决下,谢谢 允许IRQ中断没有?记得开总中断 我自己解决好了传个可以用的程序
#include "option.h"
#include "def.h"
#include "44b.h"
#include "44blib.h"
static U32 TimerCnt=0;
static int LedStatus=0;
void __irq Timer_Tick(void)
{
rI_ISPC=BIT_TIMER0;
TimerCnt++;
if(TimerCnt>19) {
TimerCnt=0;
Led_Display(LedStatus);
LedStatus=(~(LedStatus)&0x7);
//Uart_Printf("\nTIMER interrupt... ");
}
else ;
return ;
}
void Timer_Init(void)
{
/*
* Timer Clock Frequency = MCLK/pre/mux
*/ rINTCON=0x5; //Non-vectored,IRQ enable,FIQ disable
rINTMOD=0x0; //All=IRQ mode
rINTMSK=~(BIT_GLOBAL|BIT_TIMER0);//start timer INT
pISR_TIMER0=(U32)Timer_Tick;
rTCFG0=0x0000000f; //dead zone=0,pre2=0,pre1=0xf,pre0=0
rTCFG1=0x00000001; //all interrupt,mux5=1/2,mux4=1/2,mux3=1/4,mux2=1/2,mux1=1/2,mux0=1/2
rTCNTB0=0xc350; //(1/(60MHz/4/15))*0xc350=50ms
//(1/(60MHz/4/15))*0x4320=20ms
rTCMPB0=0x0;
rTCON=0x0000003; //update T0
rTCON=0x0000009;//0x00B0000; //T3=auto reload,start
//rTCON=0x00;
//while(1);
//rINTMSK=BIT_GLOBAL;
}
void Main(void)
{
rSYSCFG=CACHECFG; // Using 8KB Cache//
Port_Init();
// Uart_Init(0,57600);
Delay(10);
// Uart_Select(0); //Select UART0
Led_Display(1);
//Uart_Printf("\nFS44B0X TIMER ");
//Uart_Printf("\n定时器中断DEMO");
Timer_Init();
while(1);
}
页:
[1]