• <tbody id="w8jhq"><dfn id="w8jhq"><pre id="w8jhq"></pre></dfn></tbody>
  • <fieldset id="w8jhq"><pre id="w8jhq"></pre></fieldset>

    久久黄色 视频|我草AV|AV在线网站导航|色色97激情|无码人妻一区二区有奶水|日韩精品|大香蕉97视频|成人a站免费|日本黄色片|久久久久无码AV

    技術(shù)熱線: 4007-888-234
    設(shè)計開發(fā)

    專注差異化嵌入式產(chǎn)品解決方案 給智能產(chǎn)品定制注入靈魂給予生命

    開發(fā)工具

    提供開發(fā)工具、應(yīng)用測試 完善的開發(fā)代碼案例庫分享

    技術(shù)支持

    從全面的產(chǎn)品導(dǎo)入到強(qiáng)大技術(shù)支援服務(wù) 全程貼心伴隨服務(wù),創(chuàng)造無限潛能!

    新品推廣

    提供新的芯片及解決方案,提升客戶產(chǎn)品競爭力

    新聞中心

    提供最新的單片機(jī)資訊,行業(yè)消息以及公司新聞動態(tài)

    LCM12864 C語言驅(qū)動程序

    更新時間: 2019-03-26
    閱讀量:2942

    /*************************************************************************

    程序說明:

    LCD驅(qū)動采用4位元(這個4位元方式,在網(wǎng)上搜索來看,還沒有人采用,可以節(jié)省4I/O口),并口方式,晶體4M,注意此LCD有點不同盡量很普通,沒有CS1CS2頁選擇腳,帶串口方式,型號是TS-12864-3IC 16F877A

    在屏幕上顯示“Atilla tester"

                         "~_~"

    RD7----------LCD D7

    RD6-----------LCD D6

    RD5-----------LCD D5

    RD4-----------LCD D4

    RD3-----------LCD E

    RD2--------  LCD RS

    RD1---------R/W

    /***********************程序如下**********************************/

    #include "pic.h"

    #define lcd_cursor(x) lcd_write(((x)&0x7F)|0x80)//Set the cursor position


    #define  LCD_RS RD2
    #define  LCD_EN RD3
    #define  LCD_RW RD1

    #define LCD_STROBE ((LCD_EN = 1),(LCD_EN=0))


    void delay_10us(unsigned char x)
    {
      while(x--);
    }

    void delay_ms(unsigned char cnt)
    {
        unsigned char i;
    do {
      i = 4;
      do {
       delay_10us(39);
      } while(--i);
    } while(--cnt);

    }

    /* write a byte to the LCD in 4 bit mode */

    void lcd_write(unsigned char c)
    {
    PORTD = (PORTD & 0x0F) | (c & 0xF0); //先送高位D7 D6 D5 D4
    LCD_STROBE;
    PORTD = (PORTD & 0x0F) | (c << 4); //再送低位
    LCD_STROBE;
    delay_10us(4);
    }

    /* Clear and home the LCD */

    void lcd_clear(void)
    {
    LCD_RS = 0;
    lcd_write(0x1);
    delay_ms(2);
    }

    /* write a string of chars to the LCD */

    void lcd_puts(const char * s)
    {
    LCD_RS = 1; // write characters
    while(*s)
      lcd_write(*s++);
    }

    /* write one character to the LCD */

    void lcd_putch(char c)
    {
    LCD_RS = 1; // write characters
    PORTD = (PORTD & 0x0F) | (c & 0xF0); //先送高位
    LCD_STROBE;
    PORTD = (PORTD & 0x0F) | (c << 4);   //再送低位
    LCD_STROBE;
    delay_10us(4);
    }

    /*Go to the specified position*/
    void lcd_goto(unsigned char pos)
    {
    LCD_RS = 0;
    lcd_write(0x80+pos);
    }

    /* initialise the LCD - put into 4 bit mode */
    //嚴(yán)格按照LCD的復(fù)位要求。

    void lcd_init(void)
    {
    LCD_RS = 0;         // write control bytes
    delay_ms(40);     // power on delaywait time>40ms
    PORTD = 0x20;     // Function set,set 4 bit mode
    LCD_STROBE;
    delay_10us(10);     //wait time >100us
        lcd_write(0x20); // Function set:4 bit mode.
        delay_10us(10);     //wait time >100us
    lcd_write(0x0C); // display ON/OFF control.
        delay_10us(10);     //wait time >100us
        lcd_write(0x01); // display clear
        delay_ms(10);       //wait time >10ms
    lcd_write(0x06); // entry mode set
    }

    void main(void)

    {
       TRISD=0X00;
       PORTD=0X00;
       lcd_init();
       lcd_goto(0x00);
       lcd_puts("Atilla tester");
       lcd_goto(0x11);
       lcd_puts("~_~");
       while(1);
    }

     



    久久黄色 视频|我草AV|AV在线网站导航|色色97激情|无码人妻一区二区有奶水|日韩精品|大香蕉97视频
  • <tbody id="w8jhq"><dfn id="w8jhq"><pre id="w8jhq"></pre></dfn></tbody>
  • <fieldset id="w8jhq"><pre id="w8jhq"></pre></fieldset>