一種基于DSP實(shí)現的LCD液晶屏顯示技術(shù)
下面將給出部分C語(yǔ)言的液晶模塊驅動(dòng)子程序,首先足一些變量的聲明函數和用到的庫函數:
本文引用地址:http://dyxdggzs.com/article/266852.htm#include
#define port LCD cmd port0400
//定義液晶模塊的命令鎖存地址為I/O空間的
0400H
#define port LCD write port0800
∥寫(xiě)數據鎖存地址為0800H
#define port LCD read port0200
//讀數據鎖存地址為0200H
#define port_LCD_null;
ioport unsigned short port port_LCD_cmd;
ioport unsigned short port port_LCD_write;
ioport unsigned short port port_LCD_read;
ioport unsigned short port port_LCD_null;
讀命令的子程序:
unsigned short Icd-read-command()
{
{
unsigned short temp;
port LCD_ cmd=0x003F:
port LCD_ null=0x003F;
port LCD_ emd一0x002D;
∥LCD_ RST=1,CE=0,CD=1,WR=1,RD=0,OEW=1
port LCD_ nulI=0x002D;
temp=port LCD_ read:
port LCD_ cmd=0x003F;
port LCD_ null=0x003F;
return(temp);}
畫(huà)點(diǎn)子程序:
Void led draw point(unsigned short X,unsigned short y)
{
unsigned short temp;
temp一(y<<4)+(x>>3)+0x100;
led-write-data(temp);
led-write-data(temp>>8);
lcd-write-write-command(0x24);
//送地址指針的控制字24H到命令端口
temp=(0x07一(X&ox07))l 0xF8;
//FOH~FFH把選中的一位置1,即點(diǎn)亮,畫(huà)點(diǎn)完成
lcd-write-command(temp);
}
向液晶模塊寫(xiě)數據和寫(xiě)指令的子程序與讀數據的過(guò)程相似,只要根據控制模塊的時(shí)序圖給出相應的命令即可。然后編寫(xiě)出初始化、清屏、畫(huà)點(diǎn)等子程序,再此基礎上就可以編寫(xiě)顯示字符、數字、漢字及圖形等。每條指令的執行都是先送入參數,再送入指令代碼,然后送顯示數據。
4 結 語(yǔ)
本文提出利用高速率DSP芯片控制液晶屏顯示的技術(shù),并編寫(xiě)出針對DSP的C語(yǔ)言液晶模塊的驅動(dòng)程序,能夠廣泛地應用于各種圖像的處理和顯示場(chǎng)合,在調試和仿真過(guò)程中取得了良好的顯示效果。此電路的設計思想也可以應用在其他液晶模塊的接口設計中,只要對程序稍加改動(dòng)就可以加以。
LCD顯示屏相關(guān)文章:lcd顯示屏原理
led顯示器相關(guān)文章:led顯示器原理
lcd相關(guān)文章:lcd原理
評論