音影先锋亚洲天堂网|电影世界尽头的爱完整版播放|国产 熟女 91|高清无码免费观看欧美日韩|韩国一区二区三区黄色录像|美女亚洲加勒比在线|亚洲综合网 开心五月|7x成人在线入口|成人网站免费日韩毛片区|国产黄片?一级?二级?三级

登錄 免費(fèi)注冊(cè) 首頁(yè) | 行業(yè)黑名單 | 幫助
維庫(kù)電子市場(chǎng)網(wǎng)
技術(shù)交流 | 電路欣賞 | 工控天地 | 數(shù)字廣電 | 通信技術(shù) | 電源技術(shù) | 測(cè)控之家 | EMC技術(shù) | ARM技術(shù) | EDA技術(shù) | PCB技術(shù) | 嵌入式系統(tǒng)
驅(qū)動(dòng)編程 | 集成電路 | 器件替換 | 模擬技術(shù) | 新手園地 | 單 片 機(jī) | DSP技術(shù) | MCU技術(shù) | IC 設(shè)計(jì) | IC 產(chǎn)業(yè) | CAN-bus/DeviceNe

hd44780驅(qū)動(dòng)

作者:stering 欄目:ARM技術(shù)
HD44780.html">HD44780驅(qū)動(dòng)
我從proteus里面改的用來(lái)學(xué)習(xí)c51.上次貼了一個(gè)程序。高手說(shuō)是用c編的匯編。-_-!,hehe.回去努力看別人程序。不止這次是不是還是匯編。^_^

//HD44780 LCD DRIVER

#include "AT89X52.H"


//LCD Commands
#define    LCD_CLS                1    //Clears entire DISPLAY and sets DDRAM address 0
#define    LCD_HOME            2    //Sets DDRAM address 0 in address counter.
#define    LCD_SETMODE            4    //Sets cursor move direction and specifies DISPLAY shift.
#define    LCD_SETVISIBLE        8    //Sets entire DISPLAY (D) on/off,cursor on/off (C), and blinking of cursor position CHARacter (B).
#define    LCD_SHIFT            16    //Moves cursor and shifts DISPLAY without changing DDRAM contents.
#define    LCD_SETFUNCTION        32    //Sets interface data length (DL), NUMBER of DISPLAY lines (N), and CHARacter font (F).
#define    LCD_SETCGADDR        64    //Sets CGRAM address.CGRAM data is sent and received after this setting.
#define    LCD_SETDDADDR        128    //Sets DDRAM address. DDRAM data is sent and received after this setting.

#define TURE    1
#define FORSE    0
#define TMH        0xf8    //delay timeh   2ms
#define TML        0xCD    //delay timel

unsigned CHAR code text[6]="hellow";
static unsigned CHAR data counter;

void     wcCHAR(unsigned CHAR   d);    //write a command CHAR
void    DISPLAY(unsigned CHAR  i);    //write a data CHAR
CHAR    wtbusy();        //wait busy sign
void    clrscr(void);        //clear screen
void    initime0(void);    //initial time0    
void     delay();    //delay

void    ISR_Timer0(void) interrupt 1
{
TL0=TML;
TH0=TMH;
counter--;     
}

//main program DISPLAY "hellow"

main(void)
{
  unsigned CHAR data k;
  initime0();    
  wcCHAR(0x38);    //initial lcd
  wcCHAR(LCD_SETVISIBLE+6);    //set lcd    visible
  clrscr();         //clear lcd

  while(1)    
    {
    for(k=0;k<=6;k++)
        {
         DISPLAY(text[k]);    //DISPLAY "hellow"
          P1_2=TURE;            //TEST code ,not effective
         counter=200;
         delay();            //delay
          P1_2=FORSE;        //TEST code ,not effective
         counter=200;        //delay
         delay();    

        }    
    }
}

//sub function || DISPLAY a CHAR
void    DISPLAY(unsigned CHAR i)  //write a CHAR
{
unsigned CHAR xdata j;
P1_0=FORSE;
P1_1=TURE;
j=i;
while (wtbusy())    
     {}

}

void wcCHAR(unsigned CHAR  d)    //write a command CHAR
{
unsigned CHAR xdata j;
P1_0=FORSE;
P1_1=FORSE;
j=d;
while (wtbusy())    
     {}
}


CHAR wtbusy()    //wait busy sign
{
unsigned CHAR xdata j;
P1_0=TURE;
P1_1=FORSE;
if(j^128)
    return FORSE;
else
    return TURE;
}

//clear screen
void    clrscr()
{
wcCHAR(LCD_CLS);
}

//initial time0
void    initime0()    
{
TL0=TML;
TH0=TMH;
TR0=TURE;
IE=0x93;             //Enable T0 and Serial PORT.
}

//sub function time  delay
void    delay()
{
     while (counter)
    {}
}

參與討論
昵稱(chēng):
討論內(nèi)容:
 
 
相關(guān)帖子
大家好,有IC需求嗎?
音頻功放IC銷(xiāo)售,接口電路,微處理品復(fù)位電路IC銷(xiāo)售
arm 芯片有工業(yè)級(jí)的嗎?
求助:關(guān)于DC-DC轉(zhuǎn)換
S3C44B0X自動(dòng)復(fù)位不正常,手動(dòng)復(fù)位才可以!
免費(fèi)注冊(cè)為維庫(kù)電子開(kāi)發(fā)網(wǎng)會(huì)員,參與電子工程師社區(qū)討論,點(diǎn)此進(jìn)入


Copyright © 1998-2006 m.58mhw.cn 浙ICP證030469號(hào)