OpenEdv-开源电子网

 找回密码
 立即注册
正点原子全套STM32/Linux/FPGA开发资料,上千讲STM32视频教程免费下载...
查看: 4288|回复: 1

这段程序的显示接口函数是哪一段呢?求帮忙吧

[复制链接]

3

主题

8

帖子

0

精华

新手上路

积分
40
金钱
40
注册时间
2014-4-25
在线时间
0 小时
发表于 2014-4-28 09:37:00 | 显示全部楼层 |阅读模式
#include <reg52.h>
#include <string.h>

#define uchar unsigned char
#define uint  unsigned int

uchar code IC_DAT[];
uchar code pic1[];
uchar code pic2[];
uchar code pic3[]; 

sbit RS  = P0^7;
sbit WRD = P0^6;
sbit E   = P0^5;
sbit PSB = P0^4;
sbit RES = P0^3;

void TransferData(char data1,bit DI);
void display(void);
void display_grapic(void);
void delayms(uint n);
void DisplayLine(uchar line1,uchar line2);
void Extended Function Set RE=1: extended instruction(uchar code *adder);
void delay(uint m);
void lcd_mesg(uchar code *adder1);

uchar code IC_DAT[]={
"     HOT-51     "  
"                "
"  ?????ú??·?°?  "
"    ???è??×?    "
};

uchar code IC_DAT2[]={
"  1111111  " //0x80
"  111111111  " //0x90
" 1111111  " //0x88
"  1111111 " //0x98
};

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

***********************************************************************/
unsigned char Convert(unsigned char In_Date)
{
    unsigned char i, Out_Date = 0, temp = 0;
    for(i=0; i<8; i++)
    {
        //temp = (In_Date >> i) & 0x01;
        //Out_Date |= (temp << (7 - i));
Out_Date=  In_Date;

    }
    return Out_Date;
}

void initinal(void)          
{
           delay(40);             
           SB=1;                 
           delay(1);              
           RES=0;                 
           delay(1);              
           RES=1;                 
           delay(10);
           TransferData(0x30,0);  
           delay(100);            
           TransferData(0x30,0);  
           delay(37);             
           TransferData(0x08,0); 
           delay(100);            
           TransferData(0x10,0);
           delay(100);           
           TransferData(0x0C,0);  
           delay(100);            
           TransferData(0x01,0);  
           delay(10);             
           TransferData(0x06,0);  
           delay(100);          
          }

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

***********************************************************************/
void     initina2(void)           //
          {
           delay(40);             /
           SB=1;                 /
           delay(1);              //
           RES=0;                
           delay(1);              
           delay(10);

           TransferData(0x36,0);  //Extended Function Set RE=1: extended instruction
           delay(100);            
           TransferData(0x36,0);  //Extended Function Set:RE=1: extended instruction set
           delay(37);            
           TransferData(0x3E,0);  //EXFUNCTION(DL=8BITS,RE=1,G=1)
           delay(100);            
           TransferData(0x01,0);  //CLEAR SCREEN
           delay(100);          
          }

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

***********************************************************************/
void    main(void)
     {
         while(1)
   {
 initina2();            //
  
          DisplayGraphic(pic2);  //
          delayms(200);  

          initinal();   //
          delay(100);            //?
          lcd_mesg(IC_DAT);      //
          delayms(240);
          delayms(240);
   
          initinal();   //
          delay(100);            //?
          lcd_mesg(IC_DAT2);     /
          delayms(240);
 delayms(240);
 initinal();  
        }
      }

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


***********************************************************************/
void   lcd_mesg(unsigned char code *adder1)
{
unsigned char i;
        TransferData(0x80,0);  //Set Graphic Display RAM Address
        delay(100);
for(i=0;i<32;i++)
{
  TransferData(*adder1,1);
  adder1++;
}

        TransferData(0x90,0);  //Set Graphic Display RAM Address
        delay(100);
for(i=32;i<64;i++)
{
  TransferData(*adder1,1);
  adder1++;
}
}

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

***********************************************************************/
void    TransferData(char data1,bit DI)  //??
          {
            WRD=0;
            RS=DI;
            delay(1);
            P2=Convert(data1);
            E=1;
            delay(1);
            E=0;
           }

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

***********************************************************************/
void    delayms(unsigned int n)            //
                   {
                      unsigned int i,j;
                      for(i=0;i<n;i++)
                         for(j=0;j<2000;j++);
                   }

/********************************************************************
*
***********************************************************************/
void    delay(unsigned int m)          
                   {
                      unsigned int i,j;
                      for(i=0;i<m;i++)
                         for(j=0;j<10;j++);
                   }


***********************************************************************/
void DisplayGraphic(unsigned char code *adder)
{

   int i,j;

   for(i=0;i<32;i++)              //
    { 
      TransferData((0x80 + i),0); 
      TransferData(0x80,0);       /
      for(j=0;j<16;j++)
       {
         TransferData(*adder,1);
         adder++;
       }
    }   

   for(i=0;i<32;i++)              //
    {
      TransferData((0x80 + i),0); //
      TransferData(0x88,0);       //
      for(j=0;j<16;j++;
       {
         TransferData(*adder,1);
         adder++;
       }
    }
}



unsigned char code pic2[]=
{
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0x78,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3C,0x1E,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xF0,0x07,0x80,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x03,0xC0,0x01,0xE0,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0x00,0x00,0x78,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x3C,0x00,0x00,0x1E,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0xF0,0x00,0x00,0x07,0x80,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x03,0xC0,0x00,0x00,0x01,0xC0,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x0F,0x00,0x00,0x00,0x00,0x70,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x3C,0x00,0x00,0x00,0x00,0x1C,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0xF0,0x00,0x00,0x00,0x00,0x1E,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x03,0xC0,0x00,0x00,0x00,0x00,0x7E,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x0F,0x00,0x00,0x00,0x00,0x01,0xE6,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x3C,0x00,0x00,0x00,0x00,0x07,0x82,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0xF0,0x00,0x00,0x00,0x00,0x1E,0x02,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x01,0xE0,0x00,0x00,0x00,0x00,0x78,0x03,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x01,0xE0,0x00,0x00,0x00,0x01,0xE0,0x03,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x01,0x78,0x00,0x00,0x00,0x07,0x80,0x01,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x03,0x1E,0x00,0x00,0x00,0x1E,0x00,0x07,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x03,0x07,0x80,0x00,0x00,0x78,0x00,0x1F,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x02,0x01,0xE0,0x00,0x01,0xE0,0x00,0x3F,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x06,0x00,0x78,0x1F,0x07,0x80,0x01,0xF1,0x80,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x0E,0x00,0x1E,0x3F,0x9E,0x00,0x03,0xF9,0x80,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x0E,0x00,0x07,0xB3,0x78,0x00,0x0F,0xF9,0x80,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x0F,0x80,0x01,0xFF,0xE0,0x00,0x79,0x98,0x80,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x0F,0xE0,0x00,0x7F,0x80,0x00,0xE0,0xD8,0x80,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x0F,0xF8,0x00,0x0C,0x00,0x07,0xE0,0xF8,0x80,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x0E,0x7E,0x00,0x0C,0x00,0x1F,0xF0,0xF8,0x80,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x0E,0x1F,0x80,0x0C,0x00,0x7E,0x70,0xDC,0x80,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x0F,0x07,0xE0,0x0C,0x01,0xE3,0x70,0x5C,0xC0,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x0F,0x81,0xF8,0x0C,0x07,0x83,0x70,0x5F,0xC0,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x0D,0xE0,0x7E,0x0C,0x1F,0xC1,0xF0,0x5F,0xC0,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x0F,0x78,0x3F,0x8C,0x7F,0xC1,0xB8,0x47,0xC0,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x0F,0x1E,0x0F,0xED,0xEC,0xE1,0xB8,0xC7,0xC0,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x1F,0x07,0x83,0xFF,0xC6,0xE1,0xB9,0xC7,0xC0,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x1F,0x07,0xE0,0xFF,0xE7,0xE1,0xBF,0x07,0xC0,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x1F,0x07,0xF8,0x3F,0xE7,0xE1,0xBF,0x07,0xC0,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x1F,0x07,0x9E,0x0C,0xE6,0xE1,0x8F,0x07,0xC0,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x1F,0x07,0x87,0x8C,0xE6,0xE3,0x8F,0x83,0xC0,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x1F,0x0F,0x81,0xED,0xE6,0xE7,0x0F,0x83,0xC0,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x1F,0x07,0x00,0x7F,0xE6,0xFE,0x0F,0x83,0x40,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x1F,0x00,0x00,0x1E,0x76,0xFE,0x0F,0x83,0x40,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x1E,0x00,0x00,0x00,0x72,0x1E,0x0F,0x83,0x40,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x1E,0x00,0x00,0x00,0x7E,0x1A,0x0F,0x83,0x40,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x1E,0x00,0x00,0x00,0x7C,0x1A,0x0F,0x83,0xC0,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x0C,0x00,0x00,0x00,0x78,0x1A,0x0F,0x83,0xC0,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x78,0x1A,0x07,0x83,0xC0,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7C,0x1E,0x07,0x80,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7C,0x1F,0x07,0x80,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7C,0x1F,0x07,0x80,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7C,0x1F,0x07,0x80,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7C,0x1F,0x07,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7C,0x1F,0x00,0x00,0x00,0x00,0x08,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7C,0x1F,0x00,0x00,0x00,0x00,0x10,0x00,0x40,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3C,0x1F,0x00,0x00,0x00,0x00,0xFF,0x08,0x20,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3C,0x1F,0x00,0x00,0x00,0x00,0x28,0x05,0xFC,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x34,0x0C,0x00,0x00,0x00,0x00,0x48,0x00,0x40,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x34,0x00,0x00,0x00,0x00,0x00,0xFF,0x08,0x88,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x34,0x00,0x00,0x00,0x00,0x00,0x08,0x05,0xFC,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3C,0x00,0x00,0x00,0x00,0x00,0x4A,0x00,0xA8,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3C,0x00,0x00,0x00,0x00,0x00,0x89,0x04,0xA8,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x00,0x00,0x00,0x00,0x01,0x08,0x88,0xA8,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x38,0x10,0xAA,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x01,0x2E,

};

正点原子逻辑分析仪DL16劲爆上市
回复

使用道具 举报

530

主题

11万

帖子

34

精华

管理员

Rank: 12Rank: 12Rank: 12

积分
165309
金钱
165309
注册时间
2010-12-1
在线时间
2108 小时
发表于 2014-4-28 10:39:57 | 显示全部楼层
同样的帖子,不要发N次!!
我是开源电子网www.openedv.com站长,有关站务问题请与我联系。
正点原子STM32开发板购买店铺http://openedv.taobao.com
正点原子官方微信公众平台,点击这里关注“正点原子”
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则



关闭

原子哥极力推荐上一条 /2 下一条

正点原子公众号

QQ|手机版|OpenEdv-开源电子网 ( 粤ICP备12000418号-1 )

GMT+8, 2024-11-22 22:50

Powered by OpenEdv-开源电子网

© 2001-2030 OpenEdv-开源电子网

快速回复 返回顶部 返回列表