⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 main.c

📁 S3C44BX0 IO口的开发应用
💻 C
字号:
#include "option.h"
#include "def.h"
#include "44b.h"
#include "44blib.h"

static int mt0cnt=0;
static int ledstatus=0;

void __irq timer0_int(void)
{
   rI_ISPC=BIT_TIMER0;
   mt0cnt++;
   	
   if (mt0cnt>100)
   {
	   Uart_Printf("let's begin \n");
       Uart_Printf("in 1 second \n");
       mt0cnt=0;
	Led_Display(ledstatus);
	ledstatus=(~ledstatus)&0x7;
   }
   else ;
   return ;
}

void init_timer0(void)
{
    rTCFG0=0x00000064;    //timer0 prescaler=200
    rTCFG1=0x00000004;     //timer0 divider value=1/32; (all interrupt)
    rTCNTB0=(unsigned int)(MCLK/(rTCFG0&0x000000ff)/32/100 );   //40*1000000/200/32/100==63   (10ms)
    rTCON=0x00a;
    rTCON=0x009;
    rINTCON=0x5;    //Non-vectored,IRQ enable,FIQ disable 
    rINTMOD=0x0;    //All=IRQ mode
    pISR_TIMER0=(U32) timer0_int; 
    rINTMSK=~(BIT_GLOBAL|BIT_TIMER0);
}

void closetimer0(void)
{    
    rINTMSK=~(BIT_TIMER0)|rINTMSK;
}





void Main(void)
{
    rSYSCFG=CACHECFG;   // Using 8KB Cache//

    Port_Init();
    
    Led_Display(0x0);

    Uart_Init(0,57600);
    Delay(10);
    Uart_Select(0); //Select UART0

    Uart_Printf("\nHello,world!");
    init_timer0();
    while(1); 
       
}

⌨️ 快捷键说明

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