广告

原创 点阵汉字显示proteus程序

2009-5-14 09:31 1581 0 1 分类: MCU/ 嵌入式

http://space.ednchina.com/Upload/2009/5/14/79bb7b9f-6ef6-491a-9cb3-dcdc0bf03c45.rar#include <reg51.h>


unsigned int adval;
unsigned char i,m,n,x,y;
code unsigned char tab[]={0xc0,0xf9,0xa4,0xb0,0x99,0x92,
                          0x82,0xf8,0x80,0x90,0xff}; //共阳数码管段码
code unsigned char tab1_H[]=
                        {0x01,0x02,0x04,0x08,0x10,0x20,0x40,
                        0x80};


 code unsigned char tab2_H[]=
                        {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
      0x01,0x02,0x04,0x08,0x10,0x20,0x40,
                        0x80};



  code unsigned char tab2 []= {0xFF,0xDD,0xFD,0xDD,0x5D,0xED,0x51,0xED,0x55,0xF5,0x05,0x00,0x51,0xBD,0x5C,0xDD,
0x5D,0xF9,0x01,0xF4,0x55,0xED,0x55,0xD5,0x51,0x99,0xDD,0x3D,0xFD,0xBD,0xFF,0xFF};/*"襄",0*/


  code unsigned char tab3 []= {0x7F,0xFD,0xB7,0xBD,0xD7,0xBD,0x00,0xDC,0xD7,0xDD,0xFD,0xED,0x53,0xF5,0xBB,0xF8,
0x55,0xF5,0xFF,0xED,0xB7,0xDD,0xD7,0x9D,0x00,0x3C,0xD7,0xBD,0xB7,0xFD,0xFF,0xFF};/*"樊",1*/


  code unsigned char tab4 []= {0xBF,0xFF,0xCF,0xFD,0xEF,0xFD,0xED,0xFD,0xA3,0xFD,0xAB,0xFD,0xAF,0xBD,0xAE,0x7D,
0xA1,0x80,0x2B,0xFD,0xAF,0xFD,0xE7,0xFD,0xA8,0xFD,0xCD,0xFD,0xEF,0xFD,0xFF,0xFF};/*"学",2*/


  code unsigned char tab5 []={0x01,0x00,0xFD,0xFF,0xCD,0xFD,0xB5,0xFB,0x79,0x7C,0xF3,0xBE,0xDB,0xCE,0xDB,0xF0,
0xDA,0xFE,0xD9,0xFE,0xDB,0x80,0xDB,0x7E,0xDB,0x7E,0xF3,0x7E,0xFB,0x0E,0xFF,0xFF};/*"院",3*/
 


  code unsigned char tab7 []=  {0xFF,0xFF,0xBF,0xFF,0x09,0x80,0xBB,0xED,0xBB,0xED,0x0B,0x80,0xBB,0x7F,0xF8,0xBE,
0x7B,0xDF,0x8B,0xE7,0xBB,0xF8,0xBB,0xF7,0xB9,0xCE,0x3F,0x9F,0xFF,0xDF,0xFF,0xFF};/*"嵌",4*/


  code unsigned char tab8 []= {0xFF,0xBF,0xFF,0xDF,0xFF,0xEF,0xFF,0xF7,0xFE,0xF9,0x7C,0xFE,0x89,0xFF,0xE7,0xFF,
0x9F,0xFF,0x7F,0xFF,0xFF,0xFC,0xFF,0xFB,0xFF,0xE7,0xFF,0xCF,0xFF,0xEF,0xFF,0xFF};/*"入",5*/


 


sbit SCLK_L= P3^0;
sbit DIN_L= P3^1;
sbit RCLK_L= P3^2;
sbit SCLK_H= P3^3;
sbit DIN_H= P3^4;
sbit RCLK_H= P3^5;


  //延时0.1ms个单位//


 void delay (unsigned char h)
  { while(h--);
  }
  //延时0.1ms个单位//


 //数据传输//
void sdata_L(void)
 {


  unsigned char c;
    
   for(c=0;c<8;c++)
    {
  SCLK_L=0;
    DIN_L=m &0x80;
     m <<=1;
     SCLK_L=1;
     }
 
 
   for(c=0;c<8;c++)
     { SCLK_L=0;
   DIN_L=n&0x80;
    n<<=1;
   SCLK_L=1;
     }

//数据输出//
void out_L(void)
 {RCLK_L=0;
  delay(40);
 RCLK_L=1;
 }
//数据输出// 
    
//数据传输//


   //数据传输//
void sdata_H(void)
 {


  unsigned char c;
    
   for(c=0;c<8;c++)
    {
  SCLK_H=0;
    DIN_H=x &0x80;
     x <<=1;
     SCLK_H=1;
     }
 
 
   for(c=0;c<8;c++)
     { SCLK_H=0;
   DIN_H=y&0x80;
    y<<=1;
   SCLK_H=1;
     }

//数据输出//
void out_H(void)
 {RCLK_H=0;
  delay(40);
  RCLK_H=1;
 }
//数据输出// 
    
//数据传输//


void main ()
{
  while (1)
    {
     for (i=0;i<16;i++)
   {
   if (i>=0 && i<8)   {x= tab1_H[i];y=0;}
    if (i>=8 && i<16)  {y= tab2_H[i];x=0;}
 
        sdata_H();
        out_H();
       m="tab5" [2*i]; 
       n="tab5" [2*i+1]; 
        sdata_L();
        out_L();
  delay (10);
 
  }
    }
}

广告

文章评论 1条评论)

登录后参与讨论

kao-yan-110_839246649 2009-7-23 18:39

dfsdafsd
相关推荐阅读
aas7502987 2012-04-07 11:48
51/STC最小系统板资料(更新中)
图片欣赏    淘宝网址:http://item.taobao.com/auction/item_detail.htm?item_num_id=9073446988  二   程...
aas7502987 2011-10-13 22:59
YL-3 资料
YL-3数码管模块资料:YL-3 串行数码管资料.zip...
aas7502987 2011-09-24 09:10
USB转TTL小板驱动
xp系统驱动:XP系统支持STC下载的PL-2303HX新版驱动.rar WIN7系统驱动:WIN7系统支持STC下载的PL2303HX驱动.rar...
aas7502987 2011-05-24 22:48
STM32F103RBT6最小系统原理图 PCB
STM32F103RBT6最小系统板原理图 PCB 附件:做好的成品板:淘宝链接网址:http://item.taobao.com/item.htm?id=8864376956...
aas7502987 2011-05-08 12:53
YL-16 STM32F103最小系统板资料(更新中)
二 数据手册:  USB协议中文版:attachment download  中文数据手册:attachment downloadSTM32选型手册:attachment downloadSTM32勘...
aas7502987 2011-03-20 13:27
DS18B20温度测量模块
DS18B20 数码管温度显示程序:...
我要评论
1
0
广告
关闭 热点推荐上一条 /2 下一条