OpenVINOTM,给你看得见的未来!>>
电子产品世界 » 论坛首页 » DIY与开源设计 » 电子DIY » 双色点阵滚动显示英文字母

共2条 1/1 1 跳转至

双色点阵滚动显示英文字母

助工
2012-01-04 15:14:46    评分



关键词: 双色     点阵     滚动     显示     英文     字母    

助工
2012-01-04 15:17:39    评分
2楼

     /*--------------------------------------------------------------*/
//列扫描,低电平有效
#include <reg51.h>

/*--------------------------------------------------------------*/
//接口定义
#define L P2 //列
#define R P0 //行

/*--------------------------------------------------------------*/
//代码库
#define  num  sizeof(table) //代码长度
/*unsigned char code table[]= {
--  宽度x高度=200x8  -
0x00,0x00,0x00,0x00,
0x7F,0x49,0x49,0x3e,//B
0x00,0x42,0x7E,0x42,//I
0x00,0x7E,0x1A,0x6E,//R
0x00,0x02,0x7E,0x02,//T
0X00,0X7E,0X10,0X7E,//H
0x00,0x7E,0x42,0x24,0x18,0x00,//D
0x7C,0x12,0x7C,0x00,//A
0x0E,0x70,0x0E,0x00,//Y
0x00,0x00,0x00,0x00,0x00,0x00,0x00};
-*/
  unsigned char table[]={
                         0x00,0x1e,0x20,0x40,0x3e,0x40,0x20,0x1e,//W
                         0x00,0x00,0x7e,0x08,0x08,0x70,0x00,0x00,//H
           0x00,0x3c,0x4a,0x4a,0x4a,0x6c,0x00,0x00,//E
          0X00,0X00,0X7E,0X04,0X02,0X02,0X7C,0X00,//N
       
                0X00,0X04,0X4E,0X90,0x90,0x7e,0x00,0x00,//Y
           0x00,0x3c,0x42,0x42,0x42,0x3c,0x00,0x00,//O
           0x00,0x3e,0x40,0x40,0x40,0x3e,0x40,0x00,//U

          0X00,0x10,0xfc,0x12,0x12,0x16,0x10,0x00,//F
                         0x00,0x3c,0x4a,0x4a,0x4a,0x6c,0x00,0x00,//E
                         0x00,0x3c,0x4a,0x4a,0x4a,0x6c,0x00,0x00,//E
           0X00,0X00,0X00,0X7E,0X40,0X00,0X00,0X00,//L

          0x04,0x02,0x12,0x24,0x24,0x12,0x02,0x04 //笑脸 };
/*--------------------------------------------------------------*/
//延时5000+0us 函数定义
void delay1(void)
{
    unsigned char i, j;
    for(i = 185; i > 0; i--)
    for(j = 6; j > 0; j--);
}


/*--------------------------------------------------------------*/
//主函数
void main (void)
{
 unsigned char  i;
 unsigned int m, n;
 // L= ~(0x01 << i);                           //开始列扫描
 // R= table[i + n];                              //查表取出数据
  while(1)  
  {   L= ~(0x01 << i);                           //开始列扫描
             R= table[i + n]; 
   delay1();                                         //延迟时间
   i++; if(i == 8) i = 0;                        //循环扫描
   m++; if(m ==1000) {m = 0; n++;}     //滚动速度控制1
   if(n == num-7) n = 0;                     //循环显示
  }
}

 


共2条 1/1 1 跳转至

回复

匿名不能发帖!请先 [ 登陆 注册 ]