中文字幕无码不卡一区二区三区_少妇被又大又粗又爽毛片久久黑人_91精品国产在热久久无毒不卡_久久久久久亚洲综合网站

技術(shù)熱線: 4007-888-234

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

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

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

技術(shù)支持

QLdsPIC3]LCD12864[C30+dsPIC30F6014A]

更新時(shí)間: 2019-03-23

深圳市英銳恩科技有限公司:臺灣麥肯單片機(jī)(Micon MDT單片機(jī))亞太地區(qū)A級代理商

QLdsPIC3]LCD12864[C30+dsPIC30F6014A]
//實(shí)驗(yàn)?zāi)康模菏煜?2864LCD的使用
//12864LCD帶中文字庫
//編程讓12864LCD顯示公司LOGO和公司名字
//硬件設(shè)置:
//關(guān)斷所有撥碼開關(guān)。

 #include             //dsPIC30F6014標(biāo)準(zhǔn)頭文件

  _FOSC(CSW_FSCM_OFF & XT_PLL4);  //4倍頻晶振,F(xiàn)ailsafe 時(shí)鐘關(guān)閉
  _FWDT(WDT_OFF);                 //關(guān)閉看門狗定時(shí)器
  _FBORPOR(PBOR_OFF & MCLR_EN);   //掉電復(fù)位禁止,MCLR復(fù)位使能。
  _FGS(CODE_PROT_OFF);            //代碼保護(hù)禁止

#define  di  LATBbits.LATB4       //命令/數(shù)據(jù)選擇             
#define  rw  LATBbits.LATB5       //讀/寫選擇
#define  e   LATBbits.LATB6       //使能
#define  psb LATBbits.LATB2       //8位/4位并口選擇
#define  rst LATBbits.LATB7       //復(fù)位
        
 unsigned int __attribute__((address(0x900))) temp;
 unsigned int __attribute__((address(0x902))) temp1;   

const unsigned char TAB1[ ]={         //定義顯示圖片的數(shù)據(jù)表
0X7F,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF, 0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFE,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF, 0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X01,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF, 0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X01,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF, 0X00,0X81,0X00,0X10,0X40,0X00,0X02,0X41,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF, 0X00,0X81,0X00,0X10,0X40,0X00,0X02,0X41,
0XFF,0XFF,0XC0,0X00,0X00,0X7F,0XFF,0XFF, 0X07,0XE2,0X00,0XFE,0XC0,0X00,0X06,0X01,
0XFF,0XFF,0X00,0X00,0X00,0X1F,0XFF,0XFF, 0X01,0X87,0XE0,0X00,0X80,0X03,0XFF,0XF1,
0XFF,0XFC,0X00,0X00,0X00,0X07,0XFF,0XFF, 0X01,0X04,0X00,0X44,0XFC,0X02,0X04,0X01,

0XFF,0XF0,0X00,0X00,0X00,0X07,0XFF,0XFF, 0X01,0X08,0X00,0X48,0X04,0X02,0X04,0X41,
0XFF,0XF0,0X00,0X00,0X00,0X03,0XFF,0XFF, 0X0F,0XD8,0X00,0X08,0X04,0X03,0XF6,0X81,
0XFF,0XF0,0X00,0X00,0X00,0X01,0XFF,0XFF, 0X08,0X40,0X01,0XFE,0XFC,0X06,0X27,0X01,
0XFF,0XF0,0X00,0X00,0X00,0X01,0XFF,0XFF, 0X0F,0XCF,0X80,0X01,0X00,0X04,0X23,0X01,
0XFF,0XF0,0X3F,0XF0,0X3F,0XC1,0XFF,0XFF, 0X08,0XC1,0X00,0X01,0X00,0X04,0XE7,0X21,
0XFF,0XF0,0X7F,0XE0,0X7F,0XC1,0XFF,0XFF, 0X10,0X82,0X01,0XF9,0XF8,0X08,0X99,0XA1,
0XFF,0XF0,0X7F,0XE0,0X7F,0XC1,0XFF,0XFF, 0X1F,0X86,0X01,0X09,0X00,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0XFF, 0X03,0XFF,0XF8,0X1F,0XFF,0X87,0XFF,0XE1,
0XFF,0XF8,0X7F,0XC1,0XFF,0X83,0XFF,0XFF, 0X01,0XFF,0XFC,0X1F,0XFF,0X83,0XFF,0XC1,
0XFF,0XFC,0X3F,0X83,0XFF,0X07,0XFF,0XFF, 0X00,0X7F,0XFF,0X1F,0XFF,0X80,0XFF,0X01,
0XFF,0XFE,0X1F,0X07,0XFE,0X0F,0XFF,0XFF, 0X00,0X00,0X1F,0X00,0X00,0X00,0X00,0X01,
0XFF,0XFF,0X00,0X00,0X00,0X1F,0XFF,0XFF, 0X00,0X00,0X07,0X00,0X00,0X00,0X00,0X01,
0XFF,0XFF,0XFC,0X01,0XFF,0XFF,0XFF,0XFF, 0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X01,
0XFF,0XFF,0XF0,0X01,0XFF,0XFF,0XFF,0XFF, 0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X01,

0XFF,0XFF,0XC0,0X00,0X3F,0XFF,0XFF,0XFF, 0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X01,
0XFF,0XFF,0X80,0X00,0X1F,0XFF,0XFF,0XCF, 0X3E,0X83,0XE7,0X3E,0X78,0X21,0X14,0XE1,
0XFF,0XFE,0X00,0X00,0X07,0XFF,0XFC,0X3F, 0X20,0X82,0X09,0X88,0X44,0X51,0X15,0X31,
0XFF,0XFC,0X7C,0X00,0X00,0XFF,0XC0,0X7F, 0X20,0X82,0X08,0X88,0X44,0X51,0X95,0X11,
0XFF,0XFF,0XFF,0XF0,0X00,0X00,0X01,0XFF, 0X20,0X82,0X08,0X08,0X44,0X89,0X95,0X01,
0XFF,0XFF,0XFF,0XFE,0X00,0X00,0X03,0XFF, 0X20,0X82,0X08,0X08,0X44,0X89,0X55,0X01,
0XFF,0XFF,0XFF,0XFF,0X80,0X00,0X07,0XFF, 0X3E,0X83,0XE8,0X08,0X44,0X89,0X55,0X01,
0XFF,0XFF,0XFF,0XFF,0XE0,0X00,0X1F,0XFF, 0X20,0X82,0X08,0X08,0X78,0X89,0X55,0X01,

0XFF,0XFF,0XFF,0XFF,0XFC,0X00,0XFF,0XFF, 0X20,0X82,0X08,0X08,0X48,0X89,0X55,0X01,
0XFF,0XFF,0XFF,0XFF,0XFE,0X03,0XFF,0XFF, 0X20,0X82,0X08,0X08,0X48,0X89,0X35,0X01,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF, 0X20,0X82,0X08,0X88,0X44,0X51,0X35,0X11,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF, 0X20,0X82,0X09,0X88,0X44,0X51,0X15,0X31,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF, 0X3E,0XF3,0XE7,0X08,0X44,0X21,0X14,0XE1,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF, 0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X01,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF, 0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X01,
0X7F,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF, 0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFE,

};
 unsigned int lcd_x;               //X地址        
 unsigned int lcd_y;               //Y地址
//  bit busy;                        //忙標(biāo)志位
 
void init();                       //系統(tǒng)初始函數(shù)
void lcd_init();                   //LCD初始函數(shù)
void clear_p();                    //清屏函數(shù)
void han_wr2a();                   //寫函數(shù)   
void wr_zb();                      //寫準(zhǔn)備函數(shù)
void qushu();                      //查表函數(shù)
void send_d(unsigned char x);      //寫一字節(jié)數(shù)據(jù)函數(shù)
void send_i(unsigned char x);      //寫一字節(jié)命令函數(shù)
void chk_busy();                   //查LCD忙函數(shù)
void delay();

//-------------------------------------------
int main(void)
{
       init();                    //系統(tǒng)初始化
       lcd_init();                //LCD初始化
       clear_p();                 //清除顯示
       qushu();                   //寫數(shù)據(jù)到LCD顯示
        while(1);
}

//-------------------------------------------
void init()
{
  TRISB=0X0000;                     //設(shè)置B口為輸出  
  TRISD=0X0000;                     //設(shè)置D口為輸出
}

//-------------------------------------------
void lcd_init()
{
  rst=0;                         //復(fù)位LCD
  delay();                       
  rst=1;                         //LCD正常工作
  delay();      
  psb=1;                         //8位并行通信
  send_i(0x30);                  //基本操作指令
  send_i(0x01);                  //關(guān)顯示
  send_i(0x06);                  //指定在寫入或讀取時(shí),光標(biāo)的移動方向
  send_i(0x0c);                  //開顯示,關(guān)光標(biāo),不閃爍
}

//-------------------------------------------
void wr_zb()
{
  send_i(0x34);                  //擴(kuò)展操作指令
  send_i(lcd_y);                 //設(shè)置Y地址
  send_i(lcd_x);                 //設(shè)置X地址
  send_i(0x30);                  //基本操作指令
}

//-------------------------------------------
void clear_p()
{
  send_i(0x1);                   //清除顯示
  send_i(0x34);                  //擴(kuò)展操作指令
  send_i(0x30);                  //基本操作指令
}

//------------------------------------------
void qushu()
{
  unsigned char i,j,k;          //定義臨時(shí)變量    
  temp=0;                        //查表偏移地址
  lcd_x=0x0080;                    //上半屏X地址80H
  for(i=0;i<2;i++)               //共兩屏
     {
       lcd_y=0x0080;               //每一行的Y地址80H(即頂格顯示)
       for(j=0;j<32;j++)       //每半屏共20H行
          {
             wr_zb();            //寫準(zhǔn)備(設(shè)置X地址和Y地址)
             for(k=0;k<16;k++) //每一行16字節(jié)(因?yàn)轫敻駥懀?br/>                {
                   temp1=TAB1[temp]; //查表獲取顯示數(shù)字
                   send_d(temp1);    //送LCD顯示
                   temp++;       //查表偏移地址+1
                }
             lcd_y++;            //送下一行數(shù)據(jù)
             send_i(0x0036);       //擴(kuò)展指令操作:圖形顯示開
             send_i(0x0030);       //基本指令操作
          }
        lcd_x=0X0088;              //下半屏X地址
     }
}

//-------------------------------------------
void send_d(unsigned char x)
{
   chk_busy();                   //判斷LCD是否忙
   di=1;                         //總線上是數(shù)據(jù)   
   delay();    
   rw=0;                         //寫操作
   delay();
   PORTD=x;                      //數(shù)據(jù)送總線
   e=1;                          //使能
   delay();                      
   e=0;   
   delay();                  
}

//--------------------------------------------
void send_i(unsigned char x)
{
   chk_busy();                   //判斷忙信號
   di=0;                         //總線上是命令
   delay();
   rw=0;                         //寫操作
   delay();
   PORTD=x;                      //數(shù)據(jù)送總線
   e=1;                          //使能
   delay();
   e=0;   
   delay();             
}

//-------------------------------------------
void chk_busy()
{
//   busy=1;                       //先置忙信號    
   TRISD=0Xffff;                   //更改總線方向?yàn)檩斎?br/>   di=0;                         //總線上為命令
   delay();
   rw=1;                         //讀操作
   delay();
   while(PORTDbits.RD7)                 
      {
         delay();
         delay();
         e=1;                  
         delay();
         delay();
         e=0;                  
      }
   e=0;                        
   TRISD=0X0000;                  //總線還原為輸出  
 }

//-------------------------------------------
void delay()
{
    int m;
    for(m=0;m<10;m++)
       {;}
}

404
返回首頁 |  返回上一頁
云林县| 裕民县| 大竹县| 紫阳县| 大方县| 获嘉县| 寿宁县| 潞城市| 景东| 阳原县| 大英县| 高淳县| 沂源县| 阳城县| 济源市| 高台县| 固原市| 新巴尔虎左旗| 修水县| 和田市| 师宗县| 屯门区| 建昌县| 林周县| 罗江县| 肃南| 罗山县| 贵定县| 钟祥市| 大姚县| 沈丘县| 绍兴市| 阜城县| 信阳市| 泽州县| 镇康县| 渭源县| 洞口县| 永德县| 吉林省| 北流市|