📄 main.c
字号:
#include "..\inc\44b.h"
#include "..\inc\44blib.h"
#include "..\inc\def.h"
#include "..\inc\option.h"
void Display_Rtc(void);
int Test_Rtc_Alarm(void);
void Test_Rtc_Tick(void);
void DisplayRtc(void);
void Isr_Init(void);
void Main(void)
{
char c;
Isr_Init();
Port_Init ();
Uart_Init (0,115200);
Uart_Select (0);
Uart_Printf("hahahaha\n");
while(1)
{Uart_Printf("\n0. RTC(display)\n");
Uart_Printf("1. RTC(Alarm)\n");
Uart_Printf("2. RTC Tick\n");
Uart_Printf("3. DisplayRtc\n");
c= Uart_Getch();
switch(c)
{case '0':Display_Rtc();break; //实时报时
case '1': Test_Rtc_Alarm();Uart_Getch();break;//闹钟报警
case '2':Test_Rtc_Tick();break; //秒表计时
case '3':DisplayRtc();Uart_Getch();break; //预设时间
default:Uart_Printf("error\n");break;
}
}
}
void Isr_Init(void)
{
U32 i;
for(i=_RAM_STARTADDRESS;i<(_RAM_STARTADDRESS+0x20);i+=4)
{
*((volatile unsigned *)i)=0xEA000000+0x1FFE;
} //相当于B指令,计算了一下它跳到哪里:1FFE<<2 + PC + 8
//跳到0x0c008000->0x0c008020
rINTCON=0x5; // Non-vectored,IRQ enable,FIQ disable
rINTMOD=0x0; // All=IRQ mode
rINTMSK|=BIT_GLOBAL|BIT_EINT4567; // All interrupt is masked.
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -