📄 main.c
字号:
#include "..\inc\option.h"
#include "..\inc\def.h"
#include "..\inc\44b.h"
#include "..\inc\44blib.h"
void Isr_Init(void);
void HaltUndef(void);
void HaltSwi(void);
void HaltPabort(void);
void HaltDabort(void);
int main(void)
{
rSYSCFG=SYSCFG_8KB;//define in option.h
#if (PLLON==1)
ChangePllValue(PLL_M,PLL_P,PLL_S);//declare in 44blib.h ,despcribe in 44blib.c
#endif
Isr_Init();
Port_Init();//from 44blib.c
Uart_Init(0,115200);//from 44blib.c
Uart_Select(0);// from 44blib.c
Delay(0); //calibrate Delay()
Led_Display(0x07);
Delay(1000); //calibrate Delay()
Led_Display(0);
Delay(5000); //calibrate Delay()
Led_Display(0x07);// from 44blib.c
Uart_Printf("\n startledshow \n");// from 44blib.c
while(1)
{
Delay(50000); //calibrate Delay()
Led_Display(1);
Delay(50000); //calibrate Delay()
Led_Display(3);
Delay(50000); //calibrate Delay()
Led_Display(0);
}
}
void Isr_Init(void)
{
U32 i;
pISR_UNDEF=(unsigned)HaltUndef;//#define pISR_UNDEF (*(unsigned *)(_ISR_STARTADDRESS+0x4));#define _ISR_STARTADDRESS 0xc7fff00
pISR_SWI =(unsigned)HaltSwi;//
pISR_PABORT=(unsigned)HaltPabort;//
pISR_DABORT=(unsigned)HaltDabort;//
for(i=_RAM_STARTADDRESS;i<(_RAM_STARTADDRESS+0x20);i+=4)//#define _RAM_STARTADDRESS 0xc000000
{
*((volatile unsigned *)i)=0xEA000000+0x1FFE;
}
rINTCON=0x5; //中断控制寄存器Non-vectored interrupt mode,IRQ interrupt enable,FIQ disable define from 44.b
rINTMOD=0x0; //中断模式寄存器 All=IRQ mode
rINTMSK|=BIT_GLOBAL|BIT_EINT3; //中断屏蔽寄存器 All interrupt is masked.Global位与EINT3都置1 1=mask
}
U32 pIrqStart, pIrqFinish, pIrqHandler;
void HaltUndef(void)
{
Uart_Printf("Undefined instruction exception!!!\n");
while(1);
}
void HaltSwi(void)
{
Uart_Printf("SWI exception!!!\n");
while(1);
}
void HaltPabort(void)
{
Uart_Printf("Pabort exception!!!\n");
while(1);
}
void HaltDabort(void)
{
Uart_Printf("Dabort exception!!!\n");
while(1);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -