⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 dsplcd.c

📁 自己编写的DSP 键盘扫描程序
💻 C
字号:
#include "DSP28_Deceive.h"
#define uchar unsigned char
#define uint  unsigned int
 const uchar time_num  = 10;  //有十个显示的数0到9
 const uchat time_data = 6;   // 时间显示个数,时,分,秒
 const uchar time_line = 16;
 const uchar time_row  = 1;
 const uint  start_row = 50;
 const uchar start_line= 50;
 const uchar white     = 0xFE;
 const uchar blue      = 0x02;
 const uchar yellow    = 0xFA; 
 const uchar time_buf[time_data] = {1,2,3,4,0,0}                               
 const uchar times[time_num][time_line*time_row]={
 /*--  文字:  0  --*/
/*--  宋体12;  此字体下对应的点阵为:宽x高=8x16   --*/
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xBC,0x65,0xED,0x00,0xBC,0x65,0xED,0x00},
/*--  文字:  1  --*/
/*--  宋体12;  此字体下对应的点阵为:宽x高=8x16   --*/
{0x00,0x00,0x00,0x10,0x70,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x7C,0x00,0x00}, 
/*--  文字:  2  --*/
/*--  宋体12;  此字体下对应的点阵为:宽x高=8x16   --*/
{0x00,0x00,0x00,0x3C,0x42,0x42,0x42,0x04,0x04,0x08,0x10,0x20,0x42,0x7E,0x00,0x00}, 
/*--  文字:  3  --*/
/*--  宋体12;  此字体下对应的点阵为:宽x高=8x16   --*/
{0x00,0x00,0x00,0x3C,0x42,0x42,0x04,0x18,0x04,0x02,0x02,0x42,0x44,0x38,0x00,0x00}, 
/*--  文字:  4  --*/
/*--  宋体12;  此字体下对应的点阵为:宽x高=8x16   --*/
{0x00,0x00,0x00,0x04,0x0C,0x14,0x24,0x24,0x44,0x44,0x7E,0x04,0x04,0x1E,0x00,0x00}, 
/*--  文字:  5  --*/
/*--  宋体12;  此字体下对应的点阵为:宽x高=8x16   --*/
{0x00,0x00,0x00,0x7E,0x40,0x40,0x40,0x58,0x64,0x02,0x02,0x42,0x44,0x38,0x00,0x00}, 
/*--  文字:  6  --*/
/*--  宋体12;  此字体下对应的点阵为:宽x高=8x16   --*/
{0x00,0x00,0x00,0x1C,0x24,0x40,0x40,0x58,0x64,0x42,0x42,0x42,0x24,0x18,0x00,0x00},
/*--  文字:  7  --*/
/*--  宋体12;  此字体下对应的点阵为:宽x高=8x16   --*/
{0x00,0x00,0x00,0x7E,0x44,0x44,0x08,0x08,0x10,0x10,0x10,0x10,0x10,0x10,0x00,0x00},
/*--  文字:  8  --*/
/*--  宋体12;  此字体下对应的点阵为:宽x高=8x16   --*/
{0x00,0x00,0x00,0x3C,0x42,0x42,0x42,0x24,0x18,0x24,0x42,0x42,0x42,0x3C,0x00,0x00},
/*--  文字:  9  --*/
/*--  宋体12;  此字体下对应的点阵为:宽x高=8x16   --*/
{0x00,0x00,0x00,0x18,0x24,0x42,0x42,0x42,0x26,0x1A,0x02,0x02,0x24,0x38,0x00,0x00},
 };
 const baseData time_all[time_data] = {
 {blue,white,start_row,start_line,time_row,time_line,&time_buf[time_data-1]},
 {blue,white,start_row+time_row,start_line,time_row,time_line,&time_buf[time_data-2]},
 {blue,white,start_row+2*time_row,start_line,time_row,time_line,&time_buf[time_data-3]},
 {blue,white,start_row+3*time_row,start_line,time_row,time_line,&time_buf[time_data-4]},
 {blue,white,start_row+4*time_row,start_line,time_row,time_line,&time_buf[time_data-5]},
 {blue,white,start_row+5*time_row,start_line,time_row,time_line,&time_buf[time_data-6]},
 };
 void time_display(baseData *point)
 {
  uchar i = 0;
  uchar x_clum = 0;
  uchar y_line = 0;
  uchar *p = &times[*(point->point_time)][0];
  time_clear(point);
  for(i = 0;i<time_data;++i,++point)
    {
     CMD_CS();
     *CMD = 0X04;
     DAT_CS();
     *DAT = point->background_color; 
     CMD_CS();
     *CMD = 0X02;
     DAT_CS();
     *DAT = point->foreground_color;
     CMD_CS();
	 *CMD = 0x01; 
     for(y_line = 0;y_line < point->lengh;++y_line)
       {
        X_ADDR_CS();
        *X_ADDR = (point->x_cdinate/256);
        *X_ADDR = (point->x_cdinate%256);
        Y_ADDR_CS();
        *Y_ADDR = point->y_cdinate + y_line;
        for(x_clum = 0;x_clum < point->wide;++x_clum,++p)
          {
           DAT_CS();
           *DAT = *p;
          }
       }
     } 
 }
  void time_clear(baseData *point_clear)
  {
   uchar x_clum = 0;
   uchar y_line = 0;
   CMD_CS();
   *CMD = 0X04;
   DAT_CS();
   *DAT = point_clear->background_color; 
   CMD_CS();
   *CMD = 0x00;
   for(y_line = 0;y_line < time_line;++y_line)
  	 {
  	  X_ADDR_CS();
  	  *X_ADDR = (point_clear->x_cdinate/256);
  	  *X_ADDR = (point_clear->x_cdinate%256);
  	  Y_ADDR_CS();
  	  *Y_ADDR = point_clear->y_cdinate;
  	  DAT_CS(); 
  	  for(x_clum = 0;x_clum < time_row;++x_clum) 
  	      {
  	         *DAT = white;
  	      }   
  	 }  
  }

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -