S3C2440-RTC
void GetTime(){
rRTCCON |= 0x1;
data_buffer[0] = rBCDSEC;
data_buffer[1] = rBCDMIN;
data_buffer[2] = rBCDHOUR;
data_buffer[3] = rBCDDATE;
data_buffer[4] = rBCDDAY;
data_buffer[5] = rBCDMON;
data_buffer[6] = rBCDYEAR;
rRTCCON &= 0xfe;
if(data_buffer[0] == 0){
rRTCCON |= 0x1;
data_buffer[0] = rBCDSEC;
data_buffer[1] = rBCDMIN;
data_buffer[2] = rBCDHOUR;
data_buffer[3] = rBCDDATE;
data_buffer[4] = rBCDDAY;
data_buffer[5] = rBCDMON;
data_buffer[6] = rBCDYEAR;
rRTCCON &= 0xfe;
}
}
void Paint_text(U32 x, U32 y, U32 color, unsigned char ch[]){
int i, j, test,t = 0;
for(i = 0; i < 16; i++){
test = 0x80;
for(j = 0; j < 16; j++){
if(j == 8){
test = 0x80;
t++;
}
if(ch[t] & test)
LCD_BUFFER[x+i][y+j] = color;
test >>= 1;
}
t++;
}
}
void Paint_Ascii(U32 x, U32 y, U32 color, unsigned char ch[]){
int i, j, test;
for(i = 0; i < 16; i++){
test = 0x80;
for(j = 0; j < 8; j++){
if(test & ch[ i])
LCD_BUFFER[x+i][y+j] = color;
test >>= 1;
}
}
}
//2010年12月26日星期日19:17:51
void ShowTime(){
U32 qh, wh;
unsigned char s0,s1;
int i, t, k;
char h, l;
GetTime();
//當(dāng)前時(shí)間為
for(i = 0,t = 0, k = 0; i < 5; i++){
s0 = str0[t];
s1 = str0[t+1];
qh = s0-0xa0;
wh = s1-0xa0;
temp = & __HZK[((qh-1)*94+wh-1)*32];
Paint_text(100,k,0x0,temp);
t = t + 2;
k += 16;
}
//:
temp = &__ASCII[:*16];
Paint_Ascii(100,k,0x0,temp);
k+=8;
//20
temp = &__ASCII[2*16];
Paint_Ascii(100,k,0x0,temp);
k+=8;
temp = &__ASCII[0*16];
Paint_Ascii(100,k,0x0,temp);
k+=8;
//10
h = (data_buffer[6]>>4)+48;
temp = &__ASCII[h*16];
Paint_Ascii(100,k,0x0,temp);
k+=8;
l = (data_buffer[6]&0x0f)+48;
temp = &__ASCII[l*16];
Paint_Ascii(100,k,0x0,temp);
k+=8;
//年
qh = str1[0]-0xa0;
wh = str1[1]-0xa0;
temp = & __HZK[((qh-1)*94+wh-1)*32];
Paint_text(100,k,0x0,temp);
k+=16;
//12
h = (data_buffer[5]>>4)+48;
temp = &__ASCII[h*16];
Paint_Ascii(100,k,0x0,temp);
k+=8;
l = (data_buffer[5]&0xf)+48;
temp = &__ASCII[l*16];
Paint_Ascii(100,k,0x0,temp);
k+=8;
//月
qh = str2[0]-0xa0;
wh = str2[1]-0xa0;
temp = & __HZK[((qh-1)*94+wh-1)*32];
Paint_text(100,k,0x0,temp);
k+=16;
//26
h = (data_buffer[3]>>4)+48;
temp = &__ASCII[h*16];
Paint_Ascii(100,k,0x0,temp);
k+=8;
l = (data_buffer[3]&0xf)+48;
temp = &__ASCII[l*16];
Paint_Ascii(100,k,0x0,temp);
k+=8;
//日
qh = str3[0]-0xa0;
wh = str3[1]-0xa0;
temp = & __HZK[((qh-1)*94+wh-1)*32];
Paint_text(100,k,0x0,temp);
k+=16;
//星期日
for(i = 0,t = 0; i < 3; i++){
s0 = str[0][t];
s1 = str[0][t+1];
qh = s0-0xa0;
wh = s1-0xa0;
temp = & __HZK[((qh-1)*94+wh-1)*32];
Paint_text(100,k,0x0,temp);
t = t + 2;
k += 16;
}
//19:17:51
//19
h = (data_buffer[2]>>4)+48;
temp = &__ASCII[h*16];
Paint_Ascii(100,k,0x0,temp);
k+=8;
l = (data_buffer[2]&0xf)+48;
temp = &__ASCII[l*16];
Paint_Ascii(100,k,0x0,temp);
k+=8;
//:
temp = &__ASCII[:*16];
Paint_Ascii(100,k,0x0,temp);
k+=8;
//17
h = (data_buffer[1]>>4)+48;
temp = &__ASCII[h*16];
Paint_Ascii(100,k,0x0,temp);
k+=8;
l = (data_buffer[1]&0xf)+48;
temp = &__ASCII[l*16];
Paint_Ascii(100,k,0x0,temp);
k+=8;
//:
temp = &__ASCII[:*16];
Paint_Ascii(100,k,0x0,temp);
k+=8;
//51
h = (data_buffer[0]>>4)+48;
temp = &__ASCII[h*16];
Paint_Ascii(100,k,0x0,temp);
k+=8;
l = (data_buffer[0]&0xf)+48;
temp = &__ASCII[l*16];
Paint_Ascii(100,k,0x0,temp);
k+=8;
}
關(guān)鍵詞:
S3C2440RTC實(shí)時(shí)時(shí)
相關(guān)推薦
技術(shù)專區(qū)
- FPGA
- DSP
- MCU
- 示波器
- 步進(jìn)電機(jī)
- Zigbee
- LabVIEW
- Arduino
- RFID
- NFC
- STM32
- Protel
- GPS
- MSP430
- Multisim
- 濾波器
- CAN總線
- 開關(guān)電源
- 單片機(jī)
- PCB
- USB
- ARM
- CPLD
- 連接器
- MEMS
- CMOS
- MIPS
- EMC
- EDA
- ROM
- 陀螺儀
- VHDL
- 比較器
- Verilog
- 穩(wěn)壓電源
- RAM
- AVR
- 傳感器
- 可控硅
- IGBT
- 嵌入式開發(fā)
- 逆變器
- Quartus
- RS-232
- Cyclone
- 電位器
- 電機(jī)控制
- 藍(lán)牙
- PLC
- PWM
- 汽車電子
- 轉(zhuǎn)換器
- 電源管理
- 信號(hào)放大器
評論