首 页文档资料下载资料维修视频包年699元
请登录  |  免费注册
当前位置:精通维修下载 > 文档资料 > 家电技术 > 单元电路介绍 > 其它电路
STC12C5410AD AD的测试LCD12864显示程序
来源:本站整理  作者:佚名  2011-08-04 10:13:49



STC12C5410AD AD的测试LCD12864显示程序 
#include <STC12C5410AD.H>   
#include "stdio.h" 
#include "stdlib.h" 
#include "math.h" 
#include "absaCC.h" 
#include "intrins.h" 
#include "string.h"     
 
#define Rssp_On 0x3f
#define Rssp_Off 0x3e
#define Col_Add 0x40
#define Page_Add 0xb8
#define Start_Line 0xc0

sbit Rs = P1^7; //Data or Instrument Select
sbit RW = P1^5; //Write or Read
sbit Ce = P1^6; //6800 mode Enable single
#define Lcd_Bus P2
sbit Cs1 = P1^3; //Master Chip enable
sbit Cs2 = P1^4; //Slave chip enable

unsigned char adbuf;

unsigned char code han[]=
{
/*--  文字:  值  --*/
/*--  宋体12;  此字体下对应的点阵为:宽x高=16x16   --*/
0x80,0x40,0xF0,0x2F,0x02,0x04,0xE4,0xA4,0xB4,0xAF,0xA6,0xA4,0xE4,0x04,0x00,0x00,
0x00,0x00,0xFF,0x00,0x40,0x40,0x7F,0x4A,0x4A,0x4A,0x4A,0x4A,0x7F,0x40,0x40,0x00,
/*--  文字:  电  --*/
/*--  宋体12;  此字体下对应的点阵为:宽x高=16x16   --*/
0x00,0x00,0xF8,0x48,0x48,0x48,0x48,0xFF,0x48,0x48,0x48,0x48,0xF8,0x00,0x00,0x00,
0x00,0x00,0x0F,0x04,0x04,0x04,0x04,0x3F,0x44,0x44,0x44,0x44,0x4F,0x40,0x70,0x00,

/*--  文字:  压  --*/
/*--  宋体12;  此字体下对应的点阵为:宽x高=16x16   --*/
0x00,0x00,0xFE,0x02,0x42,0x42,0x42,0x42,0xFA,0x42,0x42,0x42,0x62,0x42,0x02,0x00,
0x20,0x18,0x27,0x20,0x20,0x20,0x20,0x20,0x3F,0x20,0x21,0x2E,0x24,0x20,0x20,0x00,

/*--  文字:  专  --*/
/*--  宋体-方正超大字符集11;  此字体下对应的点阵为:宽x高=16x16   --*/
0x00,0x00,0x80,0x90,0x90,0xF0,0x9C,0x90,0x90,0x90,0x90,0x88,0x40,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x03,0x02,0x12,0x22,0x72,0x0A,0x06,0x02,0x00,0x00,0x00,0x00,

/*--  文字:  注  --*/
/*--  宋体-方正超大字符集11;  此字体下对应的点阵为:宽x高=16x16   --*/
0x20,0x40,0x84,0xE8,0x20,0x20,0x20,0x22,0x24,0xE8,0x20,0x20,0x20,0x00,0x00,0x00,
0x00,0x38,0x46,0x01,0x00,0x42,0x42,0x42,0x42,0x7F,0x42,0x42,0x42,0x42,0x00,0x00,

/*--  文字:  于  --*/
/*--  宋体-方正超大字符集11;  此字体下对应的点阵为:宽x高=16x16   --*/
0x00,0x80,0x84,0x84,0x84,0x84,0x84,0xFC,0x84,0x84,0x84,0x84,0x84,0x80,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x40,0x40,0x7F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,

/*--  文字:  消  --*/
/*--  宋体-方正超大字符集11;  此字体下对应的点阵为:宽x高=16x16   --*/
0x00,0x20,0x40,0x84,0x60,0x00,0xC8,0x30,0x40,0x3E,0x40,0x30,0x48,0xC0,0x00,0x00,
0x00,0x00,0x7C,0x03,0x00,0x00,0x7F,0x09,0x09,0x09,0x09,0x89,0x89,0x7F,0x00,0x00,

/*--  文字:  费  --*/
/*--  宋体-方正超大字符集11;  此字体下对应的点阵为:宽x高=16x16   --*/
0x00,0x00,0xE8,0xA8,0xA8,0xE8,0x9C,0xA8,0xA8,0xFC,0xA8,0xA8,0xB8,0x80,0x00,0x00,
0x00,0x80,0x84,0x9E,0x85,0x44,0x24,0x1C,0x24,0x25,0x24,0x5E,0x42,0x01,0x00,0x00,

/*--  文字:  类  --*/
/*--  宋体-方正超大字符集11;  此字体下对应的点阵为:宽x高=16x16   --*/
0x00,0x20,0x20,0x20,0xA8,0x50,0x20,0xFC,0x20,0x50,0xAC,0xA0,0x20,0x00,0x00,0x00,
0x80,0x82,0x8A,0x49,0x48,0x28,0x19,0x06,0x18,0x28,0x28,0x48,0x49,0x84,0x00,0x00,

/*--  文字:  控  --*/
/*--  宋体-方正超大字符集11;  此字体下对应的点阵为:宽x高=16x16   --*/
0x00,0x20,0x20,0xFC,0x20,0x20,0x30,0x90,0x54,0x1C,0x10,0x50,0xB0,0x10,0x00,0x00,
0x00,0x44,0x82,0x7F,0x01,0x01,0x81,0x84,0x84,0x7C,0x84,0x84,0x84,0x41,0x00,0x00,

/*--  文字:  制  --*/
/*--  宋体-方正超大字符集11;  此字体下对应的点阵为:宽x高=16x16   --*/
0x00,0x60,0x9C,0x90,0x90,0xFC,0x90,0x90,0x50,0x80,0xF8,0x00,0x00,0xFC,0x00,0x00,
0x00,0x00,0x3E,0x02,0x02,0x7F,0x22,0x3E,0x02,0x00,0x0F,0x40,0x40,0x3F,0x00,0x00,
};

unsigned char code shuzi[]={
/*--  文字:  0  --*/
/*--  宋体12;  此字体下对应的点阵为:宽x高=8x16   --*/
0x00,0xE0,0x10,0x08,0x08,0x10,0xE0,0x00,0x00,0x0F,0x10,0x20,0x20,0x10,0x0F,0x00, //0

/*--  文字:  1  --*/
/*--  宋体12;  此字体下对应的点阵为:宽x高=8x16   --*/
0x00,0x10,0x10,0xF8,0x00,0x00,0x00,0x00,0x00,0x20,0x20,0x3F,0x20,0x20,0x00,0x00,   //1

/*--  文字:  2  --*/
/*--  宋体12;  此字体下对应的点阵为:宽x高=8x16   --*/
0x00,0x70,0x08,0x08,0x08,0x88,0x70,0x00,0x00,0x30,0x28,0x24,0x22,0x21,0x30,0x00,  //2

/*--  文字:  3  --*/
/*--  宋体12;  此字体下对应的点阵为:宽x高=8x16   --*/
0x00,0x30,0x08,0x88,0x88,0x48,0x30,0x00,0x00,0x18,0x20,0x20,0x20,0x11,0x0E,0x00, //3

/*--  文字:  4  --*/
/*--  宋体12;  此字体下对应的点阵为:宽x高=8x16   --*/
0x00,0x00,0xC0,0x20,0x10,0xF8,0x00,0x00,0x00,0x07,0x04,0x24,0x24,0x3F,0x24,0x00,

/*--  文字:  5  --*/
/*--  宋体12;  此字体下对应的点阵为:宽x高=8x16   --*/
0x00,0xF8,0x08,0x88,0x88,0x08,0x08,0x00,0x00,0x19,0x21,0x20,0x20,0x11,0x0E,0x00,

/*--  文字:  6  --*/
/*--  宋体12;  此字体下对应的点阵为:宽x高=8x16   --*/
0x00,0xE0,0x10,0x88,0x88,0x18,0x00,0x00,0x00,0x0F,0x11,0x20,0x20,0x11,0x0E,0x00,

/*--  文字:  7  --*/
/*--  宋体12;  此字体下对应的点阵为:宽x高=8x16   --*/
0x00,0x38,0x08,0x08,0xC8,0x38,0x08,0x00,0x00,0x00,0x00,0x3F,0x00,0x00,0x00,0x00,

/*--  文字:  8  --*/
/*--  宋体12;  此字体下对应的点阵为:宽x高=8x16   --*/
0x00,0x70,0x88,0x08,0x08,0x88,0x70,0x00,0x00,0x1C,0x22,0x21,0x21,0x22,0x1C,0x00,

/*--  文字:  9  --*/
/*--  宋体12;  此字体下对应的点阵为:宽x高=8x16   --*/
0x00,0xE0,0x10,0x08,0x08,0x10,0xE0,0x00,0x00,0x00,0x31,0x22,0x22,0x11,0x0F,0x00,

/*--  文字:  a  --10*/
/*--  宋体12;  此字体下对应的点阵为:宽x高=8x16   --*/
0x00,0x00,0x80,0x80,0x80,0x80,0x00,0x00,0x00,0x19,0x24,0x22,0x22,0x22,0x3F,0x20, //10

/*--  文字:  b  --11*/
/*--  宋体12;  此字体下对应的点阵为:宽x高=8x16   --*/
0x08,0xF8,0x00,0x80,0x80,0x00,0x00,0x00,0x00,0x3F,0x11,0x20,0x20,0x11,0x0E,0x00,  //11

/*--  文字:  c  --12*/
/*--  宋体12;  此字体下对应的点阵为:宽x高=8x16   --*/
0x00,0x00,0x00,0x80,0x80,0x80,0x00,0x00,0x00,0x0E,0x11,0x20,0x20,0x20,0x11,0x00, //12

/*--  文字:  d  --13*/
/*--  宋体12;  此字体下对应的点阵为:宽x高=8x16   --*/
0x00,0x00,0x00,0x80,0x80,0x88,0xF8,0x00,0x00,0x0E,0x11,0x20,0x20,0x10,0x3F,0x20, //13

/*--  文字:  e  --*/
/*--  宋体12;  此字体下对应的点阵为:宽x高=8x16   --*/
0x00,0x00,0x80,0x80,0x80,0x80,0x00,0x00,0x00,0x1F,0x22,0x22,0x22,0x22,0x13,0x00, //14

/*--  文字:  f  --*/
/*--  宋体12;  此字体下对应的点阵为:宽x高=8x16   --*/
0x00,0x80,0x80,0xF0,0x88,0x88,0x88,0x18,0x00,0x20,0x20,0x3F,0x20,0x20,0x00,0x00,  //15

/*--  文字:  g  --16*/
/*--  宋体12;  此字体下对应的点阵为:宽x高=8x16   --*/
0x00,0x00,0x80,0x80,0x80,0x80,0x80,0x00,0x00,0x6B,0x94,0x94,0x94,0x93,0x60,0x00, //16

/*--  文字:  h  --*/
/*--  宋体12;  此字体下对应的点阵为:宽x高=8x16   --*/
0x08,0xF8,0x00,0x80,0x80,0x80,0x00,0x00,0x20,0x3F,0x21,0x00,0x00,0x20,0x3F,0x20,   //17

/*--  文字:  i  --*/
/*--  宋体12;  此字体下对应的点阵为:宽x高=8x16   --*/
0x00,0x80,0x98,0x98,0x00,0x00,0x00,0x00,0x00,0x20,0x20,0x3F,0x20,0x20,0x00,0x00,   //18

/*--  文字:  j  --19*/
/*--  宋体12;  此字体下对应的点阵为:宽x高=8x16   --*/
0x00,0x00,0x00,0x80,0x98,0x98,0x00,0x00,0x00,0xC0,0x80,0x80,0x80,0x7F,0x00,0x00,   //19

/*--  文字:  k  --*/
/*--  宋体12;  此字体下对应的点阵为:宽x高=8x16   --*/
0x08,0xF8,0x00,0x00,0x80,0x80,0x80,0x00,0x20,0x3F,0x24,0x02,0x2D,0x30,0x20,0x00,   //20

/*--  文字:  l  --*/
/*--  宋体12;  此字体下对应的点阵为:宽x高=8x16   --*/
0x00,0x08,0x08,0xF8,0x00,0x00,0x00,0x00,0x00,0x20,0x20,0x3F,0x20,0x20,0x00,0x00,   //21

/*--  文字:  m  --22*/
/*--  宋体12;  此字体下对应的点阵为:宽x高=8x16   --*/
0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x00,0x20,0x3F,0x20,0x00,0x3F,0x20,0x00,0x3F,   //22

/*--  文字:  n  --23*/
/*--  宋体12;  此字体下对应的点阵为:宽x高=8x16   --*/
0x80,0x80,0x00,0x80,0x80,0x80,0x00,0x00,0x20,0x3F,0x21,0x00,0x00,0x20,0x3F,0x20, //23

/*--  文字:  o  --24*/
/*--  宋体12;  此字体下对应的点阵为:宽x高=8x16   --*/
0x00,0x00,0x80,0x80,0x80,0x80,0x00,0x00,0x00,0x1F,0x20,0x20,0x20,0x20,0x1F,0x00,   //24

/*--  文字:  p  --*/
/*--  宋体12;  此字体下对应的点阵为:宽x高=8x16   --*/
0x80,0x80,0x00,0x80,0x80,0x00,0x00,0x00,0x80,0xFF,0xA1,0x20,0x20,0x11,0x0E,0x00,   //25

/*--  文字:  q  --*/
/*--  宋体12;  此字体下对应的点阵为:宽x高=8x16   --*/
0x00,0x00,0x00,0x80,0x80,0x80,0x80,0x00,0x00,0x0E,0x11,0x20,0x20,0xA0,0xFF,0x80,  //26

/*--  文字:  r  --*/
/*--  宋体12;  此字体下对应的点阵为:宽x高=8x16   --*/
0x80,0x80,0x80,0x00,0x80,0x80,0x80,0x00,0x20,0x20,0x3F,0x21,0x20,0x00,0x01,0x00,   //27
                      
/*--  文字:  s  --*/
/*--  宋体12;  此字体下对应的点阵为:宽x高=8x16   --*/
0x00,0x00,0x80,0x80,0x80,0x80,0x80,0x00,0x00,0x33,0x24,0x24,0x24,0x24,0x19,0x00, //28

/*--  文字:  t  --*/
/*--  宋体12;  此字体下对应的点阵为:宽x高=8x16   --*/
0x00,0x80,0x80,0xE0,0x80,0x80,0x00,0x00,0x00,0x00,0x00,0x1F,0x20,0x20,0x00,0x00, //29

/*--  文字:  u  --30*/
/*--  宋体12;  此字体下对应的点阵为:宽x高=8x16   --*/
0x80,0x80,0x00,0x00,0x00,0x80,0x80,0x00,0x00,0x1F,0x20,0x20,0x20,0x10,0x3F,0x20, //30

/*--  文字:  v  --*/
/*--  宋体12;  此字体下对应的点阵为:宽x高=8x16   --*/
0x80,0x80,0x80,0x00,0x00,0x80,0x80,0x80,0x00,0x01,0x0E,0x30,0x08,0x06,0x01,0x00,   //31

/*--  文字:  w  --*/
/*--  宋体12;  此字体下对应的点阵为:宽x高=8x16   --*/
0x80,0x80,0x00,0x80,0x00,0x80,0x80,0x80,0x0F,0x30,0x0C,0x03,0x0C,0x30,0x0F,0x00, //32

/*--  文字:  x  --*/
/*--  宋体12;  此字体下对应的点阵为:宽x高=8x16   --*/
0x00,0x80,0x80,0x00,0x80,0x80,0x80,0x00,0x00,0x20,0x31,0x2E,0x0E,0x31,0x20,0x00, //33

/*--  文字:  y  --*/
/*--  宋体12;  此字体下对应的点阵为:宽x高=8x16   --*/
0x80,0x80,0x80,0x00,0x00,0x80,0x80,0x80,0x80,0x81,0x8E,0x70,0x18,0x06,0x01,0x00, //34

/*--  文字:  z  --35*/
/*--  宋体12;  此字体下对应的点阵为:宽x高=8x16   --*/
0x00,0x80,0x80,0x80,0x80,0x80,0x80,0x00,0x00,0x21,0x30,0x2C,0x22,0x21,0x30,0x00, //35

/*--  文字:  -  --*/
/*--  宋体12;  此字体下对应的点阵为:宽x高=8x16   --*/
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x01,0x01,0x01,0x01,0x01, //36

/*--  文字:  =  --*/
/*--  宋体12;  此字体下对应的点阵为:宽x高=8x16   --*/
0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x00,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x00, //37

/*--  文字:  \  --*/
/*--  宋体12;  此字体下对应的点阵为:宽x高=8x16   --*/
0x00,0x0C,0x30,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x06,0x38,0xC0,0x00,  //38

/*--  文字:     --39*/
/*--  宋体12;  此字体下对应的点阵为:宽x高=8x16   --*/
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, //39

/*--  文字:  [  --*/
/*--  宋体12;  此字体下对应的点阵为:宽x高=8x16   --*/
0x00,0x00,0x00,0xFE,0x02,0x02,0x02,0x00,0x00,0x00,0x00,0x7F,0x40,0x40,0x40,0x00,  //40

/*--  文字:  ]  --*/
/*--  宋体12;  此字体下对应的点阵为:宽x高=8x16   --*/
0x00,0x02,0x02,0x02,0xFE,0x00,0x00,0x00,0x00,0x40,0x40,0x40,0x7F,0x00,0x00,0x00,  //41

/*--  文字:  ;  --*/
/*--  宋体12;  此字体下对应的点阵为:宽x高=8x16   --*/
0x00,0x00,0x00,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x60,0x00,0x00,0x00,0x00, //42

/*--  文字:  ’  --*/
/*--  宋体12;  此字体下对应的点阵为:宽x高=8x16   --*/
0x10,0x16,0x0E,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,  //43

/*--  文字:  ,  --*/
/*--  宋体12;  此字体下对应的点阵为:宽x高=8x16   --*/
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xB0,0x70,0x00,0x00,0x00,0x00,0x00, //44

/*--  文字:  .  --45*/
/*--  宋体12;  此字体下对应的点阵为:宽x高=8x16   --*/
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x30,0x00,0x00,0x00,0x00,0x00, //45

/*--  文字:  /  --*/
/*--  宋体12;  此字体下对应的点阵为:宽x高=8x16   --*/
0x00,0x00,0x00,0x00,0x80,0x60,0x18,0x04,0x00,0x60,0x18,0x06,0x01,0x00,0x00,0x00, //46

/*--  文字:  :  --*/
/*--  宋体12;  此字体下对应的点阵为:宽x高=8x16   --*/
0x00,0x00,0x00,0xC0,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x30,0x00,0x00,0x00, //47


/*--  文字:  Q  --*/
/*--  宋体12;  此字体下对应的点阵为:宽x高=8x16   --*/
0x07,0x08,0x10,0x10,0x10,0x08,0x07,0x00,0xF0,0x18,0x24,0x24,0x1C,0x0A,0xF2,0x00  //48
};
//---------------------------------------
//名称: 延时函数    
//----------------------------------------- 
void delay(unsigned int t)
{
 unsigned int i,j;
 for(i=0;i<t;i++)
 {
  for(j=0;j<10;j++);  
 }
}
//---------------------------------------
//名称: 写一个命令字节到LCD函数    
//----------------------------------------- 
void write_com(unsigned char cmdcode)
{

 Rs=0;
 RW=0;
 Lcd_Bus=cmdcode;
 delay(0);
 Ce=1;
 delay(0);
 Ce=0;
}
//---------------------------------------
//名称: 写一个数据字节到LCD函数   
//----------------------------------------- 
void write_data(unsigned char Rsspdata)
{

 Rs=1;
 RW=0;
 Lcd_Bus=Rsspdata;
 delay(0);
 Ce=1;
 delay(0);
 Ce=0;

//---------------------------------------
//名称: 清屏函数    
//----------------------------------------- 
void Clr_Scr(void)
{
 unsigned char j,k;
 Cs1=1;
 Cs2=1;
 write_com(Page_Add+0);
 write_com(Col_Add+0);

 for(k=0;k<8;k++)
 {
  write_com(Page_Add+k);
  for(j=0;j<64;j++)write_data(0x00);
 }

//---------------------------------------
//名称: 写入地址函数   
//----------------------------------------- 
void werite_x_y(unsigned char x,unsigned char y)
{
 y=y&0x7f;
 x=x&0x07;
 if(y<64)
 {
  Cs1=1;
  Cs2=0;
  write_com(Col_Add+y);
 }
 else
 {
  Cs1=0;
  Cs2=1;
  y&=0x3f;
  write_com(Col_Add+y); 
 }
 write_com(Page_Add+x); 
}
//---------------------------------------
//名称: 指定位置写16*16汉字函数     

//----------------------------------------- 

void write_chinese(unsigned char x,unsigned char y, unsigned char Hz)
{
 unsigned char j=0,i=0; 
 for(j=0;j<2;j++)
 {
  werite_x_y(x+j,y);
  for(i=0;i<16;i++) write_data(han[hz*32+16*j+i]);
 }
}

 
//---------------------------------------
//名称: 写一个字符到LCD函数(8*16点阵)
//参数:x,y:写入字符的地址 c: 写入字符在shuzi表格中的位置 
//----------------------------------------- 
 void write_zifu(unsigned char x,unsigned char y, unsigned char zi)
{
 unsigned char j=0,i=0; 
 for(j=0;j<2;j++)
 {
  werite_x_y(x+j,y);
  for(i=0;i<8;i++) write_data(shuzi[zi*16+8*j+i]);   //   
 }
}
//---------------------------------------
//名称: 初始化12864函数   
//----------------------------------------- 
void init_lcd(void)
{    

 Cs1=1;
 Cs2=1; 
 delay(250);
 write_com(Rssp_Off);
 write_com(Page_Add+0);
 write_com(Start_Line+0);
 write_com(Col_Add+0);
 write_com(Rssp_On);
}  
//---------------------------------------
//名称: 延时约1毫秒函数 
//----------------------------------------- 
void delay1ms()
{
  unsigned int k;
 for(k=0;k<12000;k++);
}
//---------------------------------------
//名称: 模数转换函数(8位)   
//----------------------------------------- 
void adpro()
{
  ADC_DATA = 0;               //清A/D转换结果寄存器 
 adbuf=0;     
 ADC_CONTR = ADC_CONTR|0x08; //0000,1000ADCS = 1,启动转换
 delay1ms();
 do{ ; }    
    while((ADC_CONTR&0x10)==0);   //0001,0000等待A/D转换结束
 ADC_CONTR = ADC_CONTR&0xE7; //1110,0111清ADC_FLAG位,停止A/D转换
 adbuf = ADC_DATA;  
}
//---------------------------------------
//名称: 初始化函数函数 
//----------------------------------------- 
void init()
{
  P1M0=0x01;     //设置P1.0为高阻输入,以准备AD
 P1M1=0x00;
    ADC_CONTR = ADC_CONTR|0x80; //1000,0000打开A/D转换电源     
 delay1ms();
 delay1ms();
 ADC_CONTR = ADC_CONTR&0xe0; //1110,0000 清ADC_FLAG,ADC_START位和低3位

//---------------------------------------
//名称: AD值转电压值函数 
//----------------------------------------- 
unsigned int dianya_zhuanhuan()
{
 unsigned int k;
 float i_val, f_val; 
 i_val=(float)adbuf;
 i_val=i_val/255;
 i_val=i_val*500;
 f_val = modf(i_val, &i_val);
 if(i_val>999) i_val=999;
 k=(int)i_val;
 return k;    
}
//---------------------------------------
//名称: 主函数   
//作者:huangjianxin
//邮箱:hjx5548@163.com
//日期:2009-12-9 
//----------------------------------------- 
void main()
{
 unsigned int dianyabuf;
 init();
 init_lcd();       //初始化液晶
   Clr_Scr();

 while(1)
 {
  adpro();
  write_zifu(0,0,10); //A  
  write_zifu(0,8,13); //D  
  write_chinese(0,16,0); //值
  write_zifu(0,32,47); //:    
  
  write_zifu(0,40,((adbuf%1000)/100)); //
     write_zifu(0,48,((adbuf%100)/10)); //
     write_zifu(0,56,(adbuf%10)); //

  dianyabuf=dianya_zhuanhuan();
  write_chinese(2,0,1); //电  
  write_chinese(2,16,2); //压     
  write_zifu(2,32,47); //: 
 
  write_zifu(2,40,dianyabuf/100);    
  write_zifu(2,48,45);    
  write_zifu(2,56,(dianyabuf%100)/10);
     write_zifu(2,64,dianyabuf%10); 
     write_zifu(2,72,31); 

  write_chinese(4,0,3);   // 专
  write_chinese(4,16,4);  //  注
  write_chinese(4,32,5);   // 于
  write_chinese(4,48,6);  //  消
  write_chinese(4,64,7);  // 费
  write_chinese(4,80,8);   // 类
  write_chinese(4,96,9);   // 控
  write_chinese(4,112,10);  // 制

  write_zifu(6,0,26);   //q
  write_zifu(6,8,26);   //q
  write_zifu(6,16,47);  //:
  write_zifu(6,24,2);   //2 
  write_zifu(6,32,7);   //7 
   write_zifu(6,40,9);   //9 
  write_zifu(6,48,0);   //0 
  write_zifu(6,56,6);      //6 
  write_zifu(6,64,8);   //8

  write_zifu(6,72,0);   //0 
  write_zifu(6,80,7);      //7 
  write_zifu(6,88,9);      //9 
 }
}

关键词:

文章评论评论内容只代表网友观点,与本站立场无关!

   评论摘要(共 0 条,得分 0 分,平均 0 分)
Copyright © 2007-2017 down.gzweix.Com. All Rights Reserved .
页面执行时间:10,625.00000 毫秒