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

共1条 1/1 1 跳转至

补交之点阵

菜鸟
2012-01-12 23:05:37     打赏

//编的有点粗心,但是我确实有干活的,版主,手下留情,不要让我进黑名单啦、、、、、//
#include <reg52.H>
#include<intrins.h>
//心形显示
//unsigned char code tabP0[]={0x30,0x48,0x44,0x22,0x44,0x48,0x30,0x00};
//unsigned char code tabP2[]={0xBF,0x0DF,0x0EF,0x0F7,0x0FB,0x0FD,0x0FE,0x7F};
//自定义 "江"
//unsigned char code tabP0[]={0x85,0x4A,0x20,0x44,0x44,0x7C,0x44,0x44,0x00};
unsigned char code tabP2[]={0xFE,0xFD,0xFB,0xF7,0xEF,0xDF,0xBF,0x7F,0xFF};
//'0'
//unsigned char code tabP0[]={0x00,0xff,0x81,0x81,0x81,0xff,0x00,0x00,0x00};
//'1'
//unsigned char code tabP0[]={0x00,0x00,0x84,0xfe,0xff,0x80,0x00,0x00,0x00};
//'2'
//unsigned char code tabP0[]={0x00,0xf1,0x91,0x91,0x91,0x9f,0x00,0x00,0x00};
//'3'
//unsigned char code tabP0[]={0x00,0x91,0x91,0x91,0x91,0xff,0x00,0x00,0x00};
//'4'
//unsigned char code tabP0[]={0x00,0x1f,0x10,0x10,0x10,0xff,0x00,0x00,0x00};
//'5'
//unsigned char code tabP0[]={0x00,0x8f,0x89,0x89,0x89,0xf9,0x00,0x00,0x00};
//'6'
//unsigned char code tabP0[]={0x00,0xff,0x91,0x91,0x91,0xf1,0x00,0x00,0x00};
//'7'
//unsigned char code tabP0[]={0x00,0x01,0x01,0x01,0x01,0xff,0x00,0x00,0x00};
//'8'
//unsigned char code tabP0[]={0x00,0xff,0x89,0x89,0x89,0xff,0x00,0x00,0x00};
//'9'
//unsigned char code tabP0[]={0x00,0x9f,0x91,0x91,0x91,0xff,0x00,0x00,0x00};
unsigned char code tabP0[]={0x00,0xff,0x81,0x81,0x81,0xff,0x00,0x00,0x00,0x00,0x00,0x84,0xfe,0xff,0x80,0x00,0x00,0x00,
         0x00,0xf1,0x91,0x91,0x91,0x9f,0x00,0x00,0x00,0x00,0x91,0x91,0x91,0x91,0xff,0x00,0x00,0x00,
         0x00,0x1f,0x10,0x10,0x10,0xff,0x00,0x00,0x00,0x00,0x8f,0x89,0x89,0x89,0xf9,0x00,0x00,0x00,
         0x00,0xff,0x91,0x91,0x91,0xf1,0x00,0x00,0x00,0x00,0x01,0x01,0x01,0x01,0xff,0x00,0x00,0x00,
         0x00,0xff,0x89,0x89,0x89,0xff,0x00,0x00,0x00,0x00,0x9f,0x91,0x91,0x91,0xff,0x00,0x00,0x00};
sbit beep = P1^0;
//unsigned char code tabP0[]={0x85,0x4A,0x20,0x51,0x6A,0xFD,0x6B,0x51,0x00};
//unsigned char code tabP2[]={0xFE,0xFD,0xFB,0xF7,0xEF,0xDF,0xBF,0x7F,0xFF};
unsigned int i,j,m;
unsigned char Count;
//圆形显示
//unsigned char code tabP0[]={0x00,0x3c,0x42,0x42,0x42,0x42,0x3c,0x00};
//unsigned char code tabP2[]={0x7F,0xBF,0x0DF,0x0EF,0x0F7,0x0FB,0x0FD,0x0FE};

//菱形显示
//unsigned char code tabP0[]={0x00,0x08,0x14,0x22,0x41,0x22,0x14,0x08};
//unsigned char code tabP2[]={0x7F,0xBF,0x0DF,0x0EF,0x0F7,0x0FB,0x0FD,0x0FE};

//叉形显示
//unsigned char code tabP0[]={0x00,0x41,0x22,0x14,0x08,0x14,0x22,0x41};
//unsigned char code tabP2[]={0x7F,0xBF,0x0DF,0x0EF,0x0F7,0x0FB,0x0FD,0x0FE};

//中字显示
//unsigned char code tabP0[]={0x00,0x1e,0x12,0x12,0x7f,0x12,0x12,0x1e};
//unsigned char code tabP2[]={0x7F,0xBF,0x0DF,0x0EF,0x0F7,0x0FB,0x0FD,0x0FE};
/********************************************************************
* 名称 : Time0_Init()
* 功能 : 定时器的初始化,11.0592MZ晶振,50ms
* 输入 : 无
* 输出 : 无
***********************************************************************/
void Time0_Init(void)
{
 IE =0x82;
 TMOD = 0x01;
 TH0  = 0xB1;
 TL0  = 0xDF; 
 TR0 = 1;  
}
//***********************************************************************
void Time0_Int() interrupt 1
{
 TH0 = 0xB1;
 TL0 = 0xDF;
 Count++;   //长度加1
 if(Count==50)
 {
  m++;
  if(m==90){m=0;}
  Count=0;
 }
}

/********************************************************************
/********************************************************************
* 名称 : Main()
* 功能 : 主函数
* 输入 : 无
* 输出 : 无
***********************************************************************/
void main()
{
 Time0_Init();
 beep = 0;
 while(1)
 {
  for(i=0;i<9;i++)
  {
   P0=0;
   P2=tabP2[i];
   _nop_();
   _nop_();
   _nop_();
//   if((j+m)==90) P0=tabP0[(j+m)-90];
   P0=tabP0[j+m];
   _nop_();
   _nop_();
   _nop_();
   j++;
   if(j==9)j=0;
  } 
 }
}




关键词: 补交     点阵     unsigned     tabP0    

共1条 1/1 1 跳转至

回复

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