这些小活动你都参加了吗?快来围观一下吧!>>
电子产品世界 » 论坛首页 » DIY与开源设计 » 电子DIY » 点阵程序

共2条 1/1 1 跳转至

点阵程序

助工
2011-11-22 11:15:22     打赏

/*--------------------------------------------------------------*/
//列扫描,低电平有效

#include <reg52.h>


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


/*--------------------------------------------------------------*/
//代码库
#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 code table[]= {
/*--  宽度x高度=200x8  --*/
0x00,0x00,0x00,0x00,
0x00,0x00,0x42,0x7E,0x42,0x00,0x00,0x00,//I
0x7E,0x40,0x40,0x00,0x7E,0x42,0x7E,0x00,//LO
0x3E,0x40,0x3E,0x00,0x7E,0x52,0x52,0x00,//VE
0x00,0x00,0x0E,0x70,0x0E,0x00,0x7E,0x42,//YO
0x7E,0x00,0x7E,0x40,0x7E,0x00,0x00,0x00,// U
0x42,0x7E,0x40,0x00,0x52,0x52,0x7E,0x00,//1 3
0x42,0x7E,0x40,0x18,0x14,0x7E,0x10,0x00,//1 4
0x1C,0x22,0x44,0x22,0x1C,0x00,0x00,0x3C,//H A
0x42,0x4A,0x62,0x4A,0x42,0x3C,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x7E,0x10,0x7E,0x00,0x7C,0x12,0x7C,0x00,
0x7E,0x0A,0x0E,0x00,0x7E,0x0A,0x0E,0x00,//P P
0x0E,0x70,0x0E,0x00,//Y
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,0x00,
0x72,0x52,0x5E,0x00,//2
0x7E,0x42,0x7E,0x00,//0
0x42,0x7E,0x40,0x00,//1
0x42,0x7E,0x40,0x00,//1
0x08,0x08,0x08,0x00,//-
0x7E,0x42,0x7E,0x00,//0
0x7E,0x4A,0x7A,0x00,//6

0x08,0x08,0x08,0x00,//-

0x7E,0x42,0x7E,0x00,//0
0x72,0x52,0x5E,0x00,//2
0x00,0x00,0x42,0x7E,0x40,0x00,0x52,0x52,
0x7E,0x00,0x24,0x00,0x18,0x14,0x7E,0x10,0x00,0x5E,0x52,0x7E,0x00,0x00,0x00,0x0C,
0x02,0x4C,0x40,0x4C,0x02,0x0C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
};
/*--------------------------------------------------------------*/
//延时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;

 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;                     //循环显示
 }
}




关键词: 点阵     程序    

院士
2011-11-22 11:20:58     打赏
2楼
LZ最好改下帖子主题,请符合要求

共2条 1/1 1 跳转至

回复

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