东北大学ARM课程设计
- 格式:doc
- 大小:88.00 KB
- 文档页数:15
#include #include "710defs.h" #include "HB_it.h" #include "main.h" #include "lcd_pattern.h" unsigned int L;
U8 wchar[50]; U8 wchar1[46]="0123456789星期一二三四五六天:年月日"; U32 temp = 0; U32 i = 0x3c0; U32 key=9; U32 a;
void switch1 (int m,int n) { switch (m){ case 0: wchar[n]=wchar1[0]; wchar[n+1]=wchar1[1]; break; case 1: wchar[n]=wchar1[2]; wchar[n+1]=wchar1[3]; break; case 2: wchar[n]=wchar1[4]; wchar[n+1]=wchar1[5]; break; case 3: wchar[n]=wchar1[6]; wchar[n+1]=wchar1[7]; break; case 4: wchar[n]=wchar1[8]; wchar[n+1]=wchar1[9]; break; case 5: wchar[n]=wchar1[10]; wchar[n+1]=wchar1[11]; break; case 6: wchar[n]=wchar1[12]; wchar[n+1]=wchar1[13]; break; case 7: wchar[n]=wchar1[14]; wchar[n+1]=wchar1[15]; break; case 8: wchar[n]=wchar1[16]; wchar[n+1]=wchar1[17]; break; case 9: wchar[n]=wchar1[18]; wchar[n+1]=wchar1[19]; break;
default:break; } Delay(10000); }
//-------------------------------------------------------------- void switch2 (int m,int n) { switch (m){
case MONDAY: wchar[n]=wchar1[24]; wchar[n+1]=wchar1[25]; break; case TUESDAY: wchar[n]=wchar1[26]; wchar[n+1]=wchar1[27]; break; case WEDNESDAY: wchar[n]=wchar1[28]; wchar[n+1]=wchar1[29]; break; case THURSDAY: wchar[n]=wchar1[30]; wchar[n+1]=wchar1[31]; break; case FRIDAY: wchar[n]=wchar1[32]; wchar[n+1]=wchar1[33]; break; case SATURDAY: wchar[n]=wchar1[334]; wchar[n+1]=wchar1[35]; break; case SUNDAY: wchar[n]=wchar1[36]; wchar[n+1]=wchar1[37]; break; default:break;
} Delay(10000); } int main(void) { char LED; char LED_temp; char i; char temp1=0x0f; LCD_IMAGE_T LCD_Size; LCD_LOCATION_T LCD_Location; LCDShowParameter LSP;
RTC_TIME rtc_data,rtc_data2; LCD_Size.width = 480; LCD_Size.height = 240;
LCD_Location.StartX = 0; LCD_Location.StartY = 0; LCD_Location.EndX = 960; LCD_Location.EndY = 240;
LCDInit(); LCDShow(LCD_Size, LCD_Location);
LCDFIFOBufferSet(gImage_123); LCDDisplayOn();
LSP.StartX = 6; LSP.StartY = 0; LSP.LibPlace = 0x400000; LSP.Color = 0x07ff; LSP.LetterChar = wchar; LSP.LCDBuffer = gImage_123;
REG_RTC_INIR = 0xa5eb1357; RTCInit(); rtc_data.tm_year = 2011; rtc_data.tm_mon = 06; rtc_data.tm_mday = 25; rtc_data.tm_hour = 00; rtc_data.tm_min = 00; rtc_data.tm_sec = 00; rtc_data.tm_week = 00;
L=rtc_data.tm_year; rtcwrite(rtc_data,1); Timing_Value();
wchar[8]=wchar1[40]; wchar[9]=wchar1[41]; wchar[14]=wchar1[42]; wchar[15]=wchar1[43]; wchar[20]=wchar1[44]; wchar[21]=wchar1[45]; wchar[26]=wchar1[38]; wchar[27]=wchar1[39]; wchar[32]=wchar1[38]; wchar[33]=wchar1[39]; wchar[38]=wchar1[38]; wchar[39]=wchar1[39]; wchar[38]=wchar1[38]; wchar[39]=wchar1[39]; wchar[40]=wchar1[20]; wchar[41]=wchar1[21]; wchar[42]=wchar1[22]; wchar[43]=wchar1[23];
KPIInit(); printf("Please press keys.\n"); Init_EBILED(0xff); nIRQ3_INT();
while(1) { rtcread(&rtc_data2); Display_RTC_Time(rtc_data2); Delay(1000000); LCDOutputShow(LSP,23);
switch(key) {
case 3: LCDFIFOBufferSet(gImage_1); temp = (U32)gImage_1;
LCDDisplayOn(); Delay(2000000); for(i=0;i<8;i++) { temp1=(temp1<<4)|(temp1>>4); Set_EBILED(temp1); Delay(1000000); } break;
case 2: for(LED = 0 ;LED < 8; LED++) { LED_temp= 0x1 } break; case 0: LCDFIFOBufferSet(BlackBoard); temp = (U32)BlackBoard; LCDDisplayOn(); Delay(2000000); break; case 1: LCDFIFOBufferSet(gImage_123); temp = (U32)gImage_123; LCDDisplayOn(); Delay(2000000);break; } } return 0; } /******************************************************************************* * Function Name : LCDInit * Description : LCD初始化 * Input : None * Output : None * Return : None *******************************************************************************/ void LCDInit(void) { REG_GPIO_CFG6 = 0x555555; REG_LCD_LCDCON = 0x30c05; REG_LCD_FIFO1PRM = 0xa; REG_LCD_F1DREQCNT = 0x1e000f0; REG_LCD_FIFO1RELACOLCNT = 0x1e0; //LCD CLK REG_LCD_LCDTCON1 = 0x3b166; REG_LCD_LCDTCON2 = 0x3bf00f1; REG_LCD_LCDTCON3 = 0x105401; REG_LCD_LCDTCON4 = 0x20101; REG_LCD_LCDTCON5 = 0xe; } /*******************************************************************************