📄 main.c
字号:
#include <string.h>
#include <stdio.h>
#include "option.h"
#include "44b.h"
#include "44blib.h"
#include "def.h"
#include "lcd.h"
#include "lcdlib.h"
char Have_1S=0;
volatile char p_bmp = 0 ;
//*******************************
volatile unsigned int err=0;
void Isr_Init(void);
void __irq Uerror(void);
extern int Image$$RO$$Limit;
extern int Image$$RW$$Base;
//***************************************************************************
//不允许ATMEGA16产生复位44B0X的信号,开机要有复位电路
//***************************************************************************
void Main(void)
{
//U16 j_temp;
//U16 i_temp,jw,iw;
//U8 ib,jb,kb,repeat_send_count;
rSYSCFG=CACHECFG; // Using 8KB Cache////8K字节cache,写缓冲使能,data abort使能
Port_Init();
ChangePllValue( 0x34, 3, 1 ); //晶振10MHz,修改系统主频为6倍频(60MHz)
Beep(0x01000);
Led_Display(1); //LOW 灯灭
Beep_On();
Delay(100);
Beep_Off();
Led_Display(0); //LOW 灯亮
//Sysloader_LoadFont1616(); //16*16 国标字库
Uart_Init(0,UART_BAUD);
//Rtc_Init(); //set rtc time
Get_Rtc();
Delay(100);
Uart_Select(0); //Select UART0
Uart_Printf("\n* RO_Limit=0x%8x",Image$$RO$$Limit);
Uart_Printf("\n* RW_BASE =0x%8x",Image$$RW$$Base);
Delay(100);
//rINTMSK=~BIT_GLOBAL;
rNCACHBE0=( (0x2000000>>12)<<16 )|(0>>12); //flash area must be non-cachable area.
rSYSCFG=rSYSCFG&(~0x8); //write buffer has to be off for proper timing.
// ProgramSST39LF160();
//for(;;);
Isr_Init();
TimerInt();
// Close_Machine();
GLCD_LcdInit();
GLCD_ClearScreen(0);
Delay(1);
set_menu();
Delay(1);
GLCD_ClearScreen(0);
Display_Date();
bool_start_count=1;
rTCON=rTCON|1; //start T0 count
while(1)
{
//0.display time.....
if (display_time_arrive)
{
display_time_program();
}
}//while(1)
}//main
//*****************************************************************************
void Isr_Init(void)
{
rI_ISPC=0x3ffffff ; //clear pending bits,Default value=0x0000000//
rINTCON=0x1; //vectored,IRQ enable,FIQ disable //两种方式都可
//rINTCON=0x5; //Non-vectored,IRQ enable,FIQ disable //两种方式都可
rINTMOD=0x0; //All=IRQ mode//
rEXTINT=0x11; //EINT0/1 is high level mode
pISR_EINT0=(unsigned)Eint0RTL;
pISR_EINT1=(unsigned)Eint1GPS;
rINTMSK=~(BIT_GLOBAL|BIT_URXD0|BIT_TIMER0|BIT_TIMER1);
//rINTMSK=~(BIT_GLOBAL|BIT_URXD0|BIT_TIMER0|BIT_TIMER1|BIT_EINT0);
if (0)
{
pISR_TICK=(unsigned)Rtc_Tick; //指定中断服务子程序
//rINTMSK=~(BIT_EINT0 | BIT_GLOBAL); //Default value=0x7ffffff//
rINTMSK=~(BIT_GLOBAL|BIT_TICK);
rTICINT = 127 + (1<<7); //START COUNT SECOND
}
}
void __irq Uerror(void)
{
rI_ISPC=BIT_UERR01 ; //clear pending bits,Default value=0x0000000//
err++;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -