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

📄 ss.c

📁 51 系列TIMER2应用,在STC51单片机上的应用,在测试板上应用过.
💻 C
📖 第 1 页 / 共 2 页
字号:
#include <reg51.h>
#include <math.h>
#include <absacc.h>
#include <string.h>
/* 直接访问方式地址定义,根据用户平台接口修改 */
#define  dwadd XBYTE[0x8000]  /* 写数据口地址 */
#define  dradd XBYTE[0x8200]  /* 读数据口地址 */
#define  cwadd XBYTE[0x8100]  /* 写指令口地址 */
#define  cradd XBYTE[0x8300]  /* 读状态口地址 */
/* 程序参数定义,根据用户选择的LCM型号修改 (根据T6963C的MD3,MD2定)*/
#define  PARA1  30;   // MGLS240128 */
#define  PARA2  128; //MGLS240128*/
#define  uchar unsigned char
#define  uint  unsigned int
#define ok  0xfb
#define sel 0xf7
#define up  0xef
#define up1 0xdf
//#define  KS 0x55
/* 定义调用函数 */  
CONVERT(); /* 汉字字模结构转换函数 */
PR2();/*    写数据函数    */
 PR1();/*    写指令函数    */
/* 定义标志位 */
sbit ACC_7=ACC^7;
code unsigned char CTAB[12][16]={   //code,用于指定存储于程序存储器中的数据。
/*8X16宋体: 0*/
0x00,0x00,0x7c,0xc6,0xc6,0xce,0xd6,0xd6,
0xe6,0xc6,0xc6,0x7c,0x00,0x00,0x00,0x00,
/*8X16宋体: 1*/
0x00,0x00,0x18,0x38,0x78,0x18,0x18,0x18,
0x18,0x18,0x18,0x7e,0x00,0x00,0x00,0x00,
/*8X16宋体: 2*/
0x00,0x00,0x7c,0xc6,0x06,0x0c,0x18,0x30,
0x60,0xc0,0xc6,0xfe,0x00,0x00,0x00,0x00,
/*8X16宋体: 3*/
0x00,0x00,0x7c,0xc6,0x06,0x06,0x3c,0x06,
0x06,0x06,0xc6,0x7c,0x00,0x00,0x00,0x00,
/*8X16宋体: 4*/
0x00,0x00,0x0c,0x1c,0x3c,0x6c,0xcc,0xfe,
0x0c,0x0c,0x0c,0x1e,0x00,0x00,0x00,0x00,
/*8X16宋体: 5*/
0x00,0x00,0xfe,0xc0,0xc0,0xc0,0xfc,0x0e,
0x06,0x06,0xc6,0x7c,0x00,0x00,0x00,0x00,
/*8X16宋体: 6*/
0x00,0x00,0x38,0x60,0xc0,0xc0,0xfc,0xc6,
0xc6,0xc6,0xc6,0x7c,0x00,0x00,0x00,0x00,
/*8X16宋体: 7*/
0x00,0x00,0xfe,0xc6,0x06,0x06,0x0c,0x18,
0x30,0x30,0x30,0x30,0x00,0x00,0x00,0x00,
/*8X16宋体: 8*/
0x00,0x00,0x7c,0xc6,0xc6,0xc6,0x7c,0xc6,
0xc6,0xc6,0xc6,0x7c,0x00,0x00,0x00,0x00,
/*8X16宋体: 9*/
0x00,0x00,0x7c,0xc6,0xc6,0xc6,0x7e,0x06,
0x06,0x06,0x0c,0x78,0x00,0x00,0x00,0x00,
/*8X16宋体: -*/
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xfe,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
/*8X16宋体: :*/
0x00,0x00,0x00,0x00,0x18,0x18,0x00,0x00,
0x00,0x18,0x18,0x00,0x00,0x00,0x00,0x00};	
/*-------------------------中文字符库------------------------*/
code unsigned char CCTAB[58][16]={

0x00,0x00,0x00,0x01,0x01,0x02,0x02,0x04,    // A0
0x04,0x07,0x0C,0x08,0x08,0x1C,0x00,0x00,
0x00,0x00,0x80,0xC0,0x40,0x60,0x60,0x30,
0x30,0xF0,0x38,0x18,0x18,0x3C,0x00,0x00,

0x00,0x00,0x1E,0x0C,0x0C,0x0C,0x0D,0x0F,    // K1
0x0D,0x0C,0x0C,0x0C,0x0C,0x1E,0x00,0x00,
0x00,0x00,0x7C,0x30,0x60,0xC0,0x80,0x80,
0xC0,0xE0,0x70,0x38,0x1C,0x1E,0x00,0x00,

0x00,0x00,0x03,0x06,0x0C,0x00,0x00,0x01,    // 32
0x00,0x00,0x00,0x0C,0x06,0x03,0x00,0x00,
0x00,0x00,0xC0,0x60,0x30,0x30,0x60,0xC0,
0x60,0x30,0x30,0x30,0x60,0xC0,0x00,0x00,

0x00,0x00,0x03,0x06,0x0C,0x0C,0x0D,0x0E,    // 63
0x0C,0x0C,0x0C,0x0C,0x06,0x03,0x00,0x00,
0x00,0x00,0xC0,0x60,0x30,0x00,0xC0,0x60,
0x30,0x30,0x30,0x30,0x60,0xC0,0x00,0x00,

0x00,0x00,0x03,0x06,0x0C,0x0C,0x0D,0x0E,    // 64
0x0C,0x0C,0x0C,0x0C,0x06,0x03,0x00,0x00,
0x00,0x00,0xC0,0x60,0x30,0x00,0xC0,0x60,
0x30,0x30,0x30,0x30,0x60,0xC0,0x00,0x00,


0x02,0x04,0x1F,0x11,0x15,0x11,0x1F,0x11,    // 奥5
0x15,0x11,0x01,0xFF,0x02,0x04,0x18,0xE0,
0x00,0x10,0xF8,0x10,0x50,0x10,0xF0,0x10,
0x50,0x10,0x04,0xFE,0x80,0x60,0x18,0x06,

0x04,0x0E,0xF8,0x08,0x08,0xFE,0x08,0x1C,    // 科6
0x1A,0x29,0x28,0x48,0x88,0x08,0x08,0x08,
0x10,0x10,0x90,0x50,0x10,0x90,0x50,0x10,
0x1E,0xF0,0x10,0x10,0x10,0x10,0x10,0x10,

0x1F,0x41,0x7F,0x81,0x3D,0x01,0x3D,0x01,    // 电7
0x3F,0x21,0x3F,0x21,0x3F,0x01,0x01,0x01,
0xF0,0x04,0xFE,0x02,0x74,0x00,0x70,0x00,
0xF8,0x08,0xF8,0x08,0xF8,0x02,0x02,0xFE,

0x10,0x10,0x1F,0x20,0x2F,0x40,0xBF,0x04,    // 气8
0x24,0x15,0x7F,0x04,0x15,0x24,0x44,0x04,
0x00,0x08,0xFC,0x00,0xF0,0x00,0xE0,0x20,
0xA0,0x20,0xE0,0x20,0x22,0x92,0x4A,0x04,

0x00,0x40,0x30,0x10,0x87,0x64,0x24,0x0C,    // 油9
0x14,0x27,0xE4,0x24,0x24,0x24,0x27,0x24,
0x40,0x40,0x40,0x44,0xFE,0x44,0x44,0x44,
0x44,0xFC,0x44,0x44,0x44,0x44,0xFC,0x04,

0x00,0xFE,0x28,0x28,0xFF,0xAA,0xAA,0xAB,    // 酸10
0xAE,0xC2,0x83,0xFE,0x82,0xFE,0x82,0x01,
0x20,0x20,0x48,0x84,0xFE,0x48,0x86,0x42,
0x78,0x88,0x48,0x50,0x20,0x50,0x8E,0x04,

0x08,0x08,0x0F,0x10,0x10,0x33,0x52,0x93,    // 值11
0x12,0x13,0x12,0x13,0x12,0x12,0x1F,0x10,
0x40,0x44,0xFE,0x40,0x40,0xF8,0x08,0xF8,
0x08,0xF8,0x08,0xF8,0x08,0x08,0xFE,0x00,

0x01,0x02,0x04,0x1F,0x10,0x10,0x10,0x1F,    // 自12
0x10,0x10,0x1F,0x10,0x10,0x10,0x1F,0x10,
0x00,0x00,0x10,0xF8,0x10,0x10,0x10,0xF0,
0x10,0x10,0xF0,0x10,0x10,0x10,0xF0,0x10,

0x07,0x7C,0x08,0xFF,0x08,0x7F,0x49,0x7F,    // 动13
0x49,0x7F,0x08,0x7F,0x08,0x0E,0x79,0x22,
0x20,0x20,0x20,0x24,0xFE,0x24,0x24,0x24,
0x24,0x24,0x44,0x44,0x44,0x84,0x28,0x10,

0x00,0x40,0x37,0x14,0x84,0x67,0x24,0x0C,    // 测14
0x17,0x14,0x64,0x27,0x22,0x24,0x28,0x20,
0x04,0x04,0xC4,0x54,0x54,0xD4,0x54,0x54,
0xD4,0x54,0x54,0xC4,0x84,0x44,0x14,0x08,

0x00,0x20,0x10,0x10,0x03,0xFC,0x00,0x7B,    // 试15
0x01,0x79,0x01,0x79,0x49,0x4F,0x7A,0x40,
0x20,0x28,0x24,0x20,0xFE,0x20,0x20,0xE0,
0x20,0x20,0x20,0x10,0xD2,0x0A,0x0A,0x04,

0x08,0x08,0x0B,0x10,0x13,0x30,0x57,0x90,    // 仪16
0x13,0x10,0x17,0x10,0x11,0x12,0x14,0x11,
0x88,0x50,0xFC,0x40,0xFC,0x40,0xFE,0xD4,
0x92,0x90,0xFE,0x90,0x94,0x88,0x9A,0xA6,

0x01,0x21,0x11,0x11,0x01,0x02,0xF4,0x13,    // 设17
0x11,0x11,0x10,0x10,0x14,0x18,0x13,0x0C,
0xF0,0x10,0x10,0x10,0x10,0x0E,0x00,0xF8,
0x08,0x10,0x90,0xA0,0x40,0xB0,0x0E,0x04,

0x3F,0x24,0x3F,0x01,0x7F,0x01,0x1F,0x10,    // 置18
0x1F,0x10,0x1F,0x10,0x1F,0x10,0xFF,0x00,
0xF8,0x48,0xF8,0x00,0xFC,0x00,0xF0,0x10,
0xF0,0x10,0xF0,0x10,0xF0,0x14,0xFE,0x00,

0x00,0x7F,0x08,0x08,0x08,0x08,0x08,0xFF,    // 开19
0x08,0x08,0x08,0x08,0x10,0x10,0x20,0x40,
0x08,0xFC,0x20,0x20,0x20,0x20,0x24,0xFE,
0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,

0x10,0x10,0x10,0x10,0xFC,0x25,0x27,0x24,    // 始20
0x24,0x49,0x29,0x11,0x29,0x45,0x85,0x01,
0x40,0x40,0x40,0x80,0x88,0x04,0xFE,0x02,
0x04,0xFE,0x04,0x04,0x04,0x04,0xFC,0x04,

0x00,0x1F,0x10,0x10,0x1F,0x10,0x10,0x1F,    // 显21
0x14,0x44,0x34,0x14,0x04,0x04,0xFF,0x00,
0x10,0xF8,0x10,0x10,0xF0,0x10,0x10,0xF0,
0x50,0x44,0x4C,0x50,0x40,0x44,0xFE,0x00,

0x00,0x3F,0x00,0x00,0x00,0x00,0xFF,0x01,    // 示22
0x01,0x09,0x19,0x21,0x41,0x01,0x05,0x02,
0x10,0xF8,0x00,0x00,0x00,0x04,0xFE,0x00,
0x00,0x20,0x18,0x0C,0x04,0x00,0x00,0x00,

0x10,0x10,0x10,0x13,0xFC,0x10,0x14,0x18,    // 打23
0x30,0xD0,0x10,0x10,0x10,0x10,0x50,0x20,
0x00,0x00,0x04,0xFE,0x20,0x20,0x20,0x20,
0x20,0x20,0x20,0x20,0x20,0x20,0xA0,0x40,

0x06,0x78,0x40,0x40,0x40,0x44,0x7E,0x40,    // 印24
0x40,0x40,0x40,0x4E,0x70,0x00,0x00,0x00,
0x04,0xFE,0x84,0x84,0x84,0x84,0x84,0x84,
0x84,0x84,0x84,0xA8,0x90,0x80,0x80,0x80,

0x00,0x1F,0x10,0x10,0x10,0x10,0x10,0x1F,    // 日25
0x10,0x10,0x10,0x10,0x10,0x1F,0x10,0x00,
0x10,0xF8,0x10,0x10,0x10,0x10,0x10,0xF0,
0x10,0x10,0x10,0x10,0x10,0xF0,0x10,0x00,

0x22,0x22,0x22,0x7F,0x22,0x3E,0x22,0x3E,    // 期26
0x22,0x22,0xFF,0x00,0x24,0x22,0x41,0x82,
0x04,0x7E,0x44,0x44,0x44,0x7C,0x44,0x44,
0x44,0x7C,0xC4,0x44,0x44,0x84,0x14,0x08};

unsigned int com,dat,O_X,O_Y,code_1,q_f,cod_e;
uchar  KS;
/****************************/
/*   初始化(图形方式)函数   */
/****************************/
INT_2()
   {
    unsigned int i,j;
     i=PARA1;
     j=PARA2;
     com=0x00; /* 方式设置 */
     PR1();    /* 调指令写入函数 */
     dat=0x32; /* 开显示,主方式,图形方式 */
     PR2();    /* 调数据写入函数 */
     com=0x01; /* 字符体设置 */
     PR1();    /* 调指令写入函数 */
     dat=0x77; /* 字符体为8×8点阵 */
     PR2();    /* 调数据写入函数 */
     com=0x02; /* 显示域宽度设置*/
     PR1();    /* 调指令写入函数 */
     dat=0x1D;//i-1; /* 一行占显示存储器40个字节 */
     PR2();    /* 调数据写入函数 */
     com=0x03; /* 帧信号设置 */
     PR1();    /* 调指令写入函数 */
     dat=0x7F;//j-1; /* 64行扫描行 */
     PR2();    /* 调数据写入函数 */
     com=0x08; /* 显示起始地址设置 */
     PR1();    /* 调指令写入函数 */
     dat=0x00; /* 低字节为0x00 */
     PR2();    /* 调数据写入函数 */
     com=0x08; /* 显示起始地址设置 */
     PR1();    /* 调指令写入函数 */
     dat=0x00; /* 高字节为0x00 */
     PR2();    /* 调数据写入函数 */

   }
/********************************/

/*       清屏函数        */
/*************************/
 CLEAR()
   {
    unsigned int i;
     com=0x0a; /* 设置光标指针地址 */
     PR1();    /* 调指令写入函数 */
     dat=0x00; /* 低字节为0x00 */
     PR2();    /* 调数据写入函数 */
     com=0x0b; /* 设置光标指针地址 */
     PR1();    /* 调指令写入函数 */
     dat=0x00; /* 高字节为0x00 */
     PR2();    /* 调数据写入函数 */
     com=0x0c; /* 数据写操作 */
     PR1();    /* 调指令写入函数 */
    for(i=0;i<8192;i++) /* 清显示存储器容量8K字节 */
      {
        dat=0x00; /* 写入数据0x00 */
        PR2(); /* 调数据写入函数 */
      }
   }
/*************************************/
/* 16×16点阵汉字写入函数CCW_PR      */
/* 函数调用入口:CCW_PR()             */
/* 连接字库:CCTAB                    */
/* 内部调用函数:PR1(),PR2()          */
/* 函数输入变量:PARA1,O_X,O_Y,code_1 */
/*0_x,0_y,code_1,q_f依次为XY地址字符代码是否取反*/
/*************************************/
CCW_PR(O_X,O_Y,code_1,q_f)
  {
   signed char i,count;
   unsigned int j;
    i=PARA1;    /* 显示屏每行显示的字节数 */
       j=i*O_Y+O_X;

⌨️ 快捷键说明

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