S3C2440-LCD字符顯示
void Init_LCD(){
rLCDCON1=(CLKVAL<<8)|(MMODE<<7)|(PNRMODE<<5)|(BPPMODE<<1)|0; //設(shè)置CLKVAL,VCLK=HCLK/[(CLKVAL+1)*2],決定VM的觸發(fā)方式,選擇顯示模式和BPP模式,暫時(shí)不要開啟LCD,因?yàn)檫€沒有設(shè)置好
rLCDCON2=(VBPD<<24)|(LINEVAL<<14)|(VFPD<<6)|(VSPW); //rLCDCON2,rLCDCON3和rLCDCON4主要設(shè)置時(shí)序
rLCDCON3=(HBPD<<19)|(HOZVAL<<8)|(HFPD);
rLCDCON4=(HSPW);
rLCDCON5 = (BPP24BL<<12) | (INVVCLK<<10) | (INVVLINE<<9) | (INVVFRAME<<8) | (0<<7) | (INVVDEN<<6) | (PWREN<<3) |(BSWP<<1) | (HWSWP); //INVVLINE和INVVFRAME需要進(jìn)行翻轉(zhuǎn),因?yàn)镃PU發(fā)出的是正脈沖,LCD使用的是負(fù)脈沖,所以要改變極性,PWREN使能電源信號(hào)
rLCDSADDR1=(((U32)LCD_BUFFER>>22)<<21)|M5D((U32)LCD_BUFFER>>1);
rLCDSADDR2=M5D(((U32)LCD_BUFFER+(SCR_XSIZE*SCR_YSIZE*4))>>1 );
rLCDSADDR3=PAGEWIDTH*32/16;
rLCDINTMSK|=(3);
rTCONSEL = 0;
rGPCUP = 0x0;
rGPDCON = 0xaaaaaaaa;
rGPCCON = 0xaaaa02a9;
rGPDUP = 0x0;
rGPGUP=rGPGUP&("(1<<4))|(1<<4);
rGPGCON=rGPGCON&("(3<<8))|(3<<8);
rLCDCON1 |= 1; //使能數(shù)據(jù)輸出和LCD控制信號(hào)
}
void Paint_text16(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;
}
}
}
void Paint_background(U32 c){
unsigned int i, j;
for(j = 0; j < LCD_YSIZE; j++)
for(i = 0; i < LCD_XSIZE; i++)
LCD_BUFFER[j][ i] = c;
}
int LcdMain(){
int qu, wei, i, test = 0x80, t;
unsigned char * head;
unsigned char fuck[] = "李萬鵬專注于linux+arm";
Init_LCD();
Paint_background(0xFFFFFF);
for(i = 0,t = 0; i < sizeof(fuck); i++){
if(test & fuck[ i]){
qu = fuck[ i] - 0xA0;
wei = fuck[i+1] - 0xA0;
head = &__HZK[((qu-1)*94+wei-1)*32];
Paint_text16(100, 100+t*16, 0x000000, head);
i++;
}
else{
head = &__ASCII[fuck[ i]*16];
Paint_Ascii(100, 100+i*8 , 0x000000, head);
}
t++;
}
while(1);
關(guān)鍵詞:
S3C2440LCD字符顯
相關(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)放大器
評(píng)論