Set_EBILED(LED_temp);
Delay(1000000);
}
break;
case0:
LCDFIFOBufferSet(BlackBoard);
temp=(U32)BlackBoard;
LCDDisplayOn();
Delay(2000000);
break;
case1:
LCDFIFOBufferSet(gImage_123);
temp=(U32)gImage_123;
LCDDisplayOn();
Delay(2000000);break;
}
}
return0;
}
/*******************************************************************************
*FunctionName:
LCDInit
*Description:
LCD初始化
*Input:
None
*Output:
None
*Return:
None
*******************************************************************************/
voidLCDInit(void)
{
REG_GPIO_CFG6=0x555555;
REG_LCD_LCDCON=0x30c05;
REG_LCD_FIFO1PRM=0xa;
REG_LCD_F1DREQCNT=0x1e000f0;
REG_LCD_FIFO1RELACOLCNT=0x1e0;
//LCDCLK
REG_LCD_LCDTCON1=0x3b166;
REG_LCD_LCDTCON2=0x3bf00f1;
REG_LCD_LCDTCON3=0x105401;
REG_LCD_LCDTCON4=0x20101;
REG_LCD_LCDTCON5=0xe;
}
/*******************************************************************************
*FunctionName:
LCDShow
*Description:
设置LCD显示位置
*Input:
None
*Output:
None
*Return:
None
*******************************************************************************/
voidLCDShow(LCD_IMAGE_TSize,LCD_LOCATION_TLocation)
{
REG_LCD_F1DREQCNT=(Size.width<<15)+Size.height;
REG_LCD_FIFO1RELACOLCNT=(Size.width>>1);
REG_LCD_DISPWINS=(Location.StartY<<16)+Location.StartX;
REG_LCD_DISPWINE=(Location.EndY<<16)+Location.EndX;
}
/*******************************************************************************
*FunctionName:
LCDShow
*Description:
设置LCD显示位置
*Input:
None
*Output:
None
*Return:
None
*******************************************************************************/
voidLCDFIFOBufferSet(PUINT8Buffer)
{
REG_LCD_F1SADDR=(U32)Buffer;
}
/*******************************************************************************
*FunctionName:
LCDDisplayOn
*Description:
打开LCD
*Input:
None
*Output:
None
*Return:
None
*******************************************************************************/
voidLCDDisplayOn(void)
{
lcdIoctl(1,1,0);
}
/*******************************************************************************
*FunctionName:
LCDDisplayOff
*Description:
关闭LCD
*Input:
None
*Output:
None
*Return:
None
*******************************************************************************/
voidLCDDisplayOff(void)
{
lcdIoctl(1,2,0);
}
/*******************************************************************************
*FunctionName:
Delay
*Description:
用于不精确延时
*Input:
延时时间
*Output:
None
*Return:
None
*******************************************************************************/
voidDelay(U32t)
{
do
{
t--;
}while(t);
}
/*******************************************************************************
*FunctionName:
KPIInit
*Description:
KPI初始化
*Input:
None
*Output:
None
*Return:
None
*******************************************************************************/
voidKPIInit(void)
{
REG_GPIO_CFG2|=0x000aaaaa;//将GPIO设置为KPI模式
REG_GPIO_CFG2&=0xfffaaaaa;
REG_AIC_SCR29=0x00000045;//将KPI中断设置为高电平有效,优先级为5
REG_AIC_MECR=0x20000000;
REG_KPICONF=0x00142fff;
}
voidInit_EBILED(charcValue)
{
REG_EXT0CON=EBI_EXT0_VALUE;
Set_EBILED(cValue);
}
/*******************************************************************************
*FunctionName:
Set_EBILED
*Description:
LED显示
*Input:
LED每一位的亮灭
*Output:
None
*Return:
None
*******************************************************************************/
voidSet_EBILED(charcValue)
{
EBILED_ADDRESS=~cValue;
}
/*******************************************************************************
*FunctionName:
nIRQ3_INT
*Description:
nIRQ3中断初始化
*Input:
*Output:
None
*Return:
None
*******************************************************************************/
voidnIRQ3_INT(void)
{
REG_AIC_SCR5=0x00000005;
REG_AIC_MECR=0x20;
}
/*******************************************************************************
*FunctionName:
rtcwrite
*Description:
写入时间信息
*Input:
对应内容结构体及显示方式(12/24)
*Output:
None
*Return:
None
*******************************************************************************/
voidrtcwrite(RTC_TIMErtc_data,intTSSR)
{
U32temp,TLR,CLR,DWR;
TLR=((rtc_data.tm_hour/10)<<20)+((rtc_data.tm_hour%10)<<16)+((rtc_data.tm_min/10)<<12)+((rtc_data.tm_min%10)<<8)+((rtc_data.tm_sec/10)<<4)+(rtc_data.tm_sec%10);
CLR=(((rtc_data.tm_year%100)/10)<<20)+((rtc_data.tm_year%10)<<16)+((rtc_data.tm_mon/10)<<12)+((rtc_data.tm_mon%10)<<8)+((rtc_data.tm_mday/10)<<4)+(rtc_data.tm_mday%10);
DWR=rtc_data.tm_week;
do
{REG_RTC_AER=0xa965;
temp=(REG_RTC_AER&0x10000);
if(temp==0x10000)
{
REG_RTC_FCR=0x00000734;
REG_RTC_TLR=TLR;
REG_RTC_CLR=CLR;
REG_RTC_TSSR=TSSR;
REG_RTC_DWR=DWR;
REG_RTC_RIER=0x2;
break;
}
}while
(1);
}
/*******************************************************************************
*FunctionName:
rtcread
*Description:
读取显示信息
*Input:
要显示内容对应结构体的地址
*Output:
None
*Return:
None
*******************************************************************************/
voidrtcread(RTC_TIME*p)
{
U32YearH;
YearH=((L/1000)<<12)+(((L/100)%10)<<8);
(*p).tm_hour=((REG_RTC_TLR>>16)&0xff);
(*p).tm_min=((REG_RTC_TLR>>8)&0xff);
(*p).tm_sec=(REG_RTC_TLR&0xff);
(*p).tm_year=YearH+((REG_RTC_CLR&0x00ff0000)>>16);
(*p).tm_mon=((REG_RTC_CLR&0x0000ff00)>>8);
(*p).tm_mday=(REG_RTC_CLR&0x000000ff);
(*p).tm_week=REG_RTC_DWR;
}
/*******************************************************************************
*FunctionName:
Timing_Value
*Description:
定时设置
*Input:
None
*Output:
None
*Return:
None
*******************************************************************************/
voidTiming_Value(void)
{
REG_RTC_CAR=0x980301;
REG_RTC_TAR=0x0;
REG_RTC_RIER=0x1;
}
/*******************************************************************************
*FunctionName:
Display_RTC_Time
*Description:
控制台显示
*Input:
要显示内容对应结构体
*Output:
None
*Return:
None
********************************************************************