各位前辈好!(新人向大家问好)我现在手上有一个板子,有个OLED,用51单片机控制,用DS18B20测温的。要求上电屏幕显示85度。电流显示0.84A。。。几秒延时过后,应该测得实际温度,电流在‘DS18B20设置的最低温度’以下时显示电流是0.00A。
但是我的在‘DS18B20设置的最低温度’以下时显示电流不是0.00A,我只要一按设置键,进入设置界面退出来后显示就是0.00A。程序不知道哪里有点小问题。哪位大神指点指点啊。程序付上:
/**********************程序如下*************************/
//=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
#include <reg52.h>
#include <stdlib.h>
#include "intrins.h"
#include <stdio.h>
#define uchar unsigned char
#define uint unsigned int
//ISP/IAP 特殊功能寄存器
sfr IAP_DATA = 0xC2;
sfr IAP_ADDRH = 0xC3;
sfr IAP_ADDRL = 0xC4;
sfr IAP_CMD = 0xC5;
sfr IAP_TRIG = 0xC6;
sfr IAP_CONTR = 0xC7;
//定义Flash 操作等待时间及允许IAP/ISP/EEPROM 操作的常数
//#define ENABLE_ISP 0x80 //系统工作时钟<30MHz 时,对IAP_CONTR 寄存器设置此值
//#define ENABLE_ISP 0x81 //系统工作时钟<24MHz 时,对IAP_CONTR 寄存器设置此值
#define ENABLE_ISP 0x82 //系统工作时钟<20MHz 时,对IAP_CONTR 寄存器设置此值
//#define ENABLE_ISP 0x83 //系统工作时钟<12MHz 时,对IAP_CONTR 寄存器设置此值
//#define ENABLE_ISP 0x84 //系统工作时钟<6MHz 时,对IAP_CONTR 寄存器设置此值
//#define ENABLE_ISP 0x85 //系统工作时钟<3MHz 时,对IAP_CONTR 寄存器设置此值
//#define ENABLE_ISP 0x86 //系统工作时钟<2MHz 时,对IAP_CONTR 寄存器设置此值
//#define ENABLE_ISP 0x87 //系统工作时钟<1MHz 时,对IAP_CONTR 寄存器设置此值
//#define DEBUG_DATA 0x5A //本测试程序最终存储在 EEPROM 单元的数值
#define DATA_FLASH_START_ADDRESS 0x00 //STC5Axx 系列 EEPROM 测试起始地址
union union_temp16
{
unsigned int un_temp16;
unsigned char un_temp8[2];
}my_unTemp16; // BS1=1; BS2=1
// OLED
sbit RES=P0^3; //使能端
sbit CS=P0^4; //
sbit DC=P0^5;
sbit SCLK=P0^ 7;
sbit SDIN=P0^6; // "℃"
sbit DQ=P3^2; //温度输入口
// 继电器
sbit EN=P2^3; // 低电平有效,大的LT1374使能端
sbit M1=P2^4; // 最大档控制继电器 J11
sbit M2=P2^5; // 第二档控制继电器 J12
sbit M3=P2^6; // 第三档控制继电器 J13
sbit M4=P2^7; // 最小档控制继电器 J14
//按键
sbit key0=P3^3;
sbit key1=P3^4;
sbit key2=P3^5;
sbit key3=P3^6;
sbit key4=P3^7;
uint count;
uint temp,add;
uint Low=10,High=35; //默认初始工作范围在20~45°之间
bit HI_Alarm=0; // 报警标志位
bit flag=0; // 工作模式选择标志位,为0时为自动工作模式,为1时为网络工作模式,
bit query_wendu=0;
bit query_dianliu=0;
bit shut=0;
char Alarm_Temp=35; // 报警温度
uchar temp11=0;
int temp10=0;
unsigned int b;
uchar data temp_data[2]={0x00,0x00};
uchar shi,ge,xiao,temp1,temp2,temp3,temp4,cankaozhi; //显示单元数据,共4个数据和一个运算暂用
uchar code df_Table[]={0,1,1,2,3,3,4,4,5,6,6,7,8,8,9,9}; //温度小数位对照表
//uchar flg1=0,flg2=0,flg3=0,flg4=0,flg5=0;
uchar rec[6]={0};
unsigned char code *a1,*a2,*a3,*a4,*b1,*b2,*aemp1,*c1,*c2,*c3,*c4,*c5;
signed char m1,m2,m3,m4,n1,n2,p1,p2,p3,p4,p5,d1,d2,t1,t2,bao1,bao2;
bit flag0=0,flag1=0,flag2=0,flag3=0,flag4=0,flag5=0,flag6=0,DIS_flag;//按键标志位
unsigned char i=0;
void scan(); // 函数声明
/*****************11us延时函数*************************/
//
void _delay1(uchar z)
{
uchar x,y,c;
for(c=z;c>0;c--)
for(x=50;x>0;x--)
for(y=91;y>0;y--);
}
/*****************串口初始化*************************/
void init_serial()
{
TMOD=0x21; //定时器/计数器工作方式设置,只能是字节传送,不能位寻址;这里用到2个定时器。
//GATE C/’T M1 M0(定时器1) GATE C/’T M1 M0(定时器0)
//0 0 1 0 工作方式2 0001 工作方式1 (用于定时)
//在串行口进行串行通信时,作波特率发生器使用
TH1=0xfd; // 串口工作模式1或3的波特率=T1的溢出率*2smod/32
TL1=0xfd; // =2smod/32*fosc/(12*(256-TH1)=>TH1=256--12M/(9600*12*32/2)=253=oxfd;
TR0=1;
ET0=1; //允许定时器/计数器0中断
TH0=0xff;
TL0=0xf6;
TR1=1; // TR1,TR0分别是定时器/计数器T1,T0的运行控制位,通过软件置1后,定时器/计数器才开始工作,在系统复位时被清0;
SM0=0;
SM1=1; //串口工作方式1
REN=1; //允许串行接收
EA=1; //中断总控制位,
// ES=0; //串行口中断控制位,为1时设置;
ES=1;
EN=1;
M1=1; //用于继电器调试
M2=1 ; //一上电时,工作在最大档进行抽风,测(风温)下面的72机箱温度,否则所测的不是风温是机器的温度很低,风扇会一直不转
M3=1;
M4=1;
SBUF=0xaa;while(!TI);TI=0;
}
/****************DS18B20复位函数************************/
/***********根据DS18B20中文PDF来写初始化程序***********/
ow_reset(void)
{
char presence=1;
while(presence)
{
while(presence)
{
DQ=1;
_nop_();_nop_(); //稍作延时,要尽可能短
DQ=0; count=0; //从高拉到低
do{}while(count<23); //低电平保持550 us(总线控制器拉低总线并保持 480us以上,发出(TX)一个复位脉冲,然后释放总线,进入接受状态(RX))
DQ=1;count=0; // 释放总线,即拉高了总线
do{}while(count<3); //66 us 此处延时有足够确保能让DS18B20发出存在脉冲。
presence=DQ; //presence=0 复位成功,继续下一步 ?
}
count=0;
do{}while(count<20); //延时500 us,通过定时器0中断1来 延时 interrupt 1
presence=~DQ;
}
DQ=1; //拉高电平
}
//
/****************DS18B20写命令函数************************/
//向1-WIRE 总线上写1个字节
void write_byte(uchar val)
{
uchar i;
for(i=8;i>0;i--) //一个字节有8位,一位一位的写
{
DQ=1;_nop_();_nop_();_nop_(); //从高拉到低
DQ=0;_nop_();_nop_();_nop_();_nop_();_nop_(); //5 us
DQ=val&0x01; //最低位移出 从字节的最低位开始传输
count=0;
do{}while(count<3); //66 us 因为15us后DS18B20会对总线采样。必须让写时序持续至少60us
val=val/2; //右移1位
}
DQ=1; //写完后,必须释放总线,将数据线拉高
}
//
/****************DS18B20读1字节函数************************/
//从总线上取1个字节 读数据时,数据以字节的最低有效位先从总线移出
uchar read_byte(void)
{
uchar i;
uchar value=0;
for(i=8;i>0;i--)
{
DQ=1;_nop_();_nop_();
value>>=1;
DQ=0;_nop_();_nop_();_nop_();_nop_(); //4 us
DQ=1;_nop_();_nop_();_nop_();_nop_(); ;_nop_(); //4 us
if(DQ) //控制器进行采样
{value|=0x80;} // 若总线为1,即DQ为1,那就把dat的最高位置1;若为0,则不进行处理,保持为0
count=0;
do{}while(count<3); //66 us
}
DQ=1;
return(value);
}
//
/****************读出温度函数************************/
//
void read_temp()
{
ow_reset();
do{}while(count<93); //_delay1(20);
write_byte(0xcc); //发命令:跳过读ROM指令
write_byte(0x44); //发温度转换命令
ow_reset(); //18B20总线复位
_delay1(1);
write_byte(0xcc); //发命令
write_byte(0xbe); //读暂存器和CRC字节
temp_data[0]=read_byte(); //读温度值的低字节
temp_data[1]=read_byte(); //读温度值的高字节
temp=temp_data[1]; //先把高八位有效数据赋于temp
temp<<=8; // 把以上8位数据从temp低八位移到高八位
temp=temp|temp_data[0]; // 两字节合成一个整型变量。
// SBUF=temp;
// return temp; //返回温度值
}
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
// Delay Time
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
void uDelay(unsigned char l)
{
while(l--);
}
void Delay(unsigned char n)
{
unsigned char i,j,k;
for(k=0;k<n;k++)
{
for(i=0;i<131;i++)
{
for(j=0;j<15;j++)
{
uDelay(203);
}
}
}
}
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
// Write_Command
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
void Write_Command(unsigned char Data) //屏写命令
{
unsigned char i;
CS=0;
DC=0; // datacommand#=00 数据/命令 控制字节 发命令
for (i=0; i<8; i++) // 先写入高位bit
{
SCLK=0;
SDIN=(Data&0x80)>>7; //第一次写入最高位,D7 送入SDIN
Data = Data << 1; // 左移一位
// uDelay(1);
SCLK=1;
// uDelay(1);
}
// SCLK=0;
DC=1; //关断"写命令"
CS=1;
}
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
// Write_Data
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
void Write_Data(unsigned char Data) //屏写数据
{
unsigned char i;
CS=0;
DC=1; // datacommand#=01 数据/命令 控制字节 写数据
for (i=0; i<8; i++)
{
SCLK=0;
SDIN=(Data&0x80)>>7;
Data = Data << 1;
// uDelay(1);
SCLK=1;
// uDelay(1);
}
// SCLK=0;
DC=1;
CS=1;
}
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
// Instruction Setting
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
void Set_Start_Column(unsigned char d) //列开始位置设置 :0x"xy"
{
Write_Command(0x00+d%16); // Set Lower Column Start Address for Page Addressing Mode = "y "
// Default => 0x00
Write_Command(0x10+d/16); // Set Higher Column Start Address for Page Addressing Mode ="x"
// Default => 0x10
}
void Set_Addressing_Mode(unsigned char d) //地址寻址模式选择
{
Write_Command(0x20); // Set Memory Addressing Mode
Write_Command(d); // Default => 0x02
// 0x00 => Horizontal Addressing Mode
// 0x01 => Vertical Addressing Mode 三种方式
// 0x02 => Page Addressing Mode
}
void Set_Column_Address(unsigned char a, unsigned char b)
{
Write_Command(0x21); // Set Column Address
Write_Command(a); // Default => 0x00 (Column Start Address)
Write_Command(b); // Default => 0x83 (Column End Address)
}
void Set_Page_Address(unsigned char a, unsigned char b)
{
Write_Command(0x22); // Set Page Address
Write_Command(a); // Default => 0x00 (Page Start Address)
Write_Command(b); // Default => 0x07 (Page End Address)
}
void Set_Start_Line(unsigned char d)
{
Write_Command(0x40|d); // Set Display Start Line
// Default => 0x40 (0x00)
}
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
// Set_Area_Brightness
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
void Set_Contrast_Control(unsigned char d)
{
Write_Command(0x81); // Set Contrast Control for Bank 0
Write_Command(d); // Default => 0x80
}
void Set_Area_Brightness(unsigned char d)
{
Write_Command(0x82); // Set Brightness for Area Color Banks
Write_Command(d); // Default => 0x80
}
void Set_Segment_Remap(unsigned char d)
{
Write_Command(0xA0|d); // Set Segment Re-Map
// Default => 0xA0
// 0xA0 (0x00) => Column Address 0 Mapped to SEG0
// 0xA1 (0x01) => Column Address 0 Mapped to SEG131
}
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
// xianshi
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
void Set_Entire_Display(unsigned char d)
{
Write_Command(0xA4|d); // Set Entire Display On / Off
// Default => 0xA4
// 0xA4 (0x00) => Normal Display
// 0xA5 (0x01) => Entire Display On
}
void Set_Inverse_Display(unsigned char d)
{
Write_Command(0xA6|d); // Set Inverse Display On/Off
// Default => 0xA6
// 0xA6 (0x00) => Normal Display
// 0xA7 (0x01) => Inverse Display On
}
void Set_Multiplex_Ratio(unsigned char d)
{
Write_Command(0xA8); // Set Multiplex Ratio
Write_Command(d); // Default => 0x3F (1/64 Duty)
}
void Set_Dim_Mode(unsigned char a, unsigned char b)
{
Write_Command(0xAB); // Set Dim Mode Configuration
Write_Command(0X00); // => (Dummy Write for First Parameter)
Write_Command(a); // Default => 0x80 (Contrast Control for Bank 0)
Write_Command(b); // Default => 0x80 (Brightness for Area Color Banks)
Write_Command(0xAC); // Set Display On in Dim Mode
}
void Set_Master_Config(unsigned char d)
{
Write_Command(0xAD); // Set Master Configuration
Write_Command(0x8E|d); // Default => 0x8E
// 0x8E (0x00) => Select External VCC Supply
// 0x8F (0x01) => Select Internal DC/DC Voltage Converter
}
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
// Set_Area_Brightness
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
void Set_Display_On_Off(unsigned char d)
{
Write_Command(0xAE|d); // Set Display On/Off
// Default => 0xAE
// 0xAE (0x00) => Display Off
// 0xAF (0x01) => Display On
}
void Set_Start_Page(unsigned char d)
{
Write_Command(0xB0|d); // Set Page Start Address for Page Addressing Mode
// Default => 0xB0 (0x00)
}
void Set_Common_Remap(unsigned char d)
{
Write_Command(0xC0|d); // Set COM Output Scan Direction
// Default => 0xC0
// 0xC0 (0x00) => Scan from COM0 to 63
// 0xC8 (0x08) => Scan from COM63 to 0
}
void Set_Display_Offset(unsigned char d)
{
Write_Command(0xD3); // Set Display Offset
Write_Command(d); // Default => 0x00
}
void Set_Display_Clock(unsigned char d)
{
Write_Command(0xD5); // Set Display Clock Divide Ratio / Oscillator Frequency
Write_Command(d); // Default => 0x70
// D[3:0] => Display Clock Divider
// D[7:4] => Oscillator Frequency
}
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
void Set_Precharge_Period(unsigned char d)
{
Write_Command(0xD9); // Set Pre-Charge Period
Write_Command(d); // Default => 0x22 (2 Display Clocks [Phase 2] / 2 Display Clocks [Phase 1])
// D[3:0] => Phase 1 Period in 1~15 Display Clocks
// D[7:4] => Phase 2 Period in 1~15 Display Clocks
}
void Set_Common_Config(unsigned char d)
{
Write_Command(0xDA); // Set COM Pins Hardware Configuration
Write_Command(0x02|d); // Default => 0x12 (0x10)
// Alternative COM Pin Configuration
// Disable COM Left/Right Re-Map
}
void Set_VCOMH(unsigned char d)
{
Write_Command(0xDB); // Set VCOMH Deselect Level
Write_Command(d); // Default => 0x34 (0.77*VCC)
}
void Set_Read_Modify_Write(unsigned char d)
{
Write_Command(0xE0|d); // Set Read Modify Write Mode
// Default => 0xE0
// 0xE0 (0x00) => Enter Read Modify Write
// 0xEE (0x0E) => Exit Read Modify Write
}
//=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
// Global Variables
//=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
#define XLevelL 0x04
#define XLevelH 0x10
#define XLevel ((XLevelH&0x0F)*16+XLevelL)
#define Max_Column 128
#define Max_Row 32
#define Brightness 0xcF
//=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
// Patterns
//=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
unsigned char code wendu_set[]= {
0x00,0x20,0x44,0x08,0x00,0xF8,0xA8,0xA8,0xA8,0xA8,0xFC,0x08,0x00,0x00,0x00,0x00,
0xF8,0x08,0x28,0x28,0xF8,0xAC,0xA8,0xF8,0x28,0x28,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x3E,0x21,0x3E,0x22,0x3E,0x22,
0x22,0x3E,0x22,0x3E,0x20,0x00,0x00,0x30,0x0F,0x20,0x20,0x22,0x16,0x0A,0x0A,0x16,
0x22,0x20,0x20,0x00,0x00,0x00,0x1B,0x1B,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}; // “温度”代码
unsigned char code dianliu_set[]={
0x00,0xE0,0x20,0x20,0x20,0xF8,0x20,0x20,0x20,0xE0,0x00,0x00,0x00,0x00,0x40,0x88,
0x10,0x00,0x90,0xD0,0xB0,0x98,0x90,0xD0,0x90,0x10,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0x09,0x09,0x09,0x3F,0x49,0x49,
0x49,0x4F,0x40,0x70,0x00,0x00,0x08,0x7C,0x42,0x20,0x10,0x0E,0x00,0x7E,0x00,0x3E,
0x41,0x78,0x00,0x00,0x00,0x36,0x36,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}; //“电流” 代码
unsigned char code fuhao_set[][32]={
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x1C,0x1C,0x1C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
// (.)! - 0x0021 Exclamation Mark
{0x00,0x70,0x50,0x70,0xC0,0x20,0x10,0x10,0x10,0x20,0x70,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x07,0x08,0x10,0x10,0x10,0x10,0x0C,0x00,0x00,0x00,0x00,0x00},
// (℃)! - 0x0021 Exclamation Mark
{0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x60,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x20,0x38,0x26,0x05,0x04,0x05,0x26,0x38,0x20,0x00,0x00,0x00,0x00},
// (A)! - 0x0021 Exclamation Mark
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
// ( )! - 0x0021 Exclamation Mark 空格
};
unsigned char code dian_set[]= {
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x38,0x38,0x38,0x00,0x00,0x00};
unsigned char code Ascii[][32]={
{0x00,0x00,0x00,0x00,0x00,0xE0,0x10,0x08,0x08,0x10,0xE0,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x0F,0x10,0x20,0x20,0x10,0x0F,0x00,0x00,0x00,0x00,0x00},
// (0)! - 0x0021 Exclamation Mark
{0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x10,0xF8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x20,0x3F,0x20,0x20,0x00,0x00,0x00,0x00,0x00},
// (1) ! - 0x0021 Exclamation Mark
{0x00,0x00,0x00,0x00,0x00,0x70,0x08,0x08,0x08,0x88,0x70,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x30,0x28,0x24,0x22,0x21,0x30,0x00,0x00,0x00,0x00,0x00},
// (2) " - 0x0022 Quotation Mark
{0x00,0x00,0x00,0x00,0x00,0x30,0x08,0x88,0x88,0x48,0x30,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x18,0x20,0x20,0x20,0x11,0x0E,0x00,0x00,0x00,0x00,0x00},
// (3) " - 0x0022 Quotation Mark
{0x00,0x00,0x00,0x00,0x00,0x00,0xC0,0x20,0x10,0xF8,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x07,0x04,0x24,0x24,0x3F,0x24,0x00,0x00,0x00,0x00,0x00},
// (4) " - 0x0022 Quotation Mark
{0x00,0x00,0x00,0x00,0x00,0xF8,0x08,0x88,0x88,0x08,0x08,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x19,0x21,0x20,0x20,0x11,0x0E,0x00,0x00,0x00,0x00,0x00},
// (5) " - 0x0022 Quotation Mark
{0x00,0x00,0x00,0x00,0x00,0xE0,0x10,0x88,0x88,0x18,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x0F,0x11,0x20,0x20,0x11,0x0E,0x00,0x00,0x00,0x00,0x00},
// (6) " - 0x0022 Quotation Mark
{0x00,0x00,0x00,0x00,0x00,0x38,0x08,0x08,0xC8,0x38,0x08,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
// (7) " - 0x0022 Quotation Mark
{0x00,0x00,0x00,0x00,0x00,0x70,0x88,0x08,0x08,0x88,0x70,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x1C,0x22,0x21,0x21,0x22,0x1C,0x00,0x00,0x00,0x00,0x00},
// (8) " - 0x0022 Quotation Mark
{0x00,0x00,0x00,0x00,0x00,0xE0,0x10,0x08,0x08,0x10,0xE0,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x31,0x22,0x22,0x11,0x0F,0x00,0x00,0x00,0x00,0x00},
// (9) " - 0x0022 Quotation Mark
};
unsigned char code one[]=
{0x00,0x10,0x10,0xF8,0x00,0x00,0x00,0x00,0x00,0x20,0x20,0x3F,0x20,0x20,0x00,0x00};
unsigned char code two[]=
{0x00,0x70,0x08,0x08,0x08,0x88,0x70,0x00,0x00,0x30,0x28,0x24,0x22,0x21,0x30,0x00};
unsigned char code three[]=
{0x00,0x30,0x08,0x88,0x88,0x48,0x30,0x00,0x00,0x18,0x20,0x20,0x20,0x11,0x0E,0x00};
unsigned char code four[]=
{0x00,0x00,0xC0,0x20,0x10,0xF8,0x00,0x00,0x00,0x07,0x04,0x24,0x24,0x3F,0x24,0x00};
unsigned char code five[]=
{0x00,0xF8,0x08,0x88,0x88,0x08,0x08,0x00,0x00,0x19,0x21,0x20,0x20,0x11,0x0E,0x00};
unsigned char code six[]=
{0x00,0xE0,0x10,0x88,0x88,0x18,0x00,0x00,0x00,0x0F,0x11,0x20,0x20,0x11,0x0E,0x00};
unsigned char code seven[]=
{0x00,0x38,0x08,0x08,0xC8,0x38,0x08,0x00,0x00,0x00,0x00,0x3F,0x00,0x00,0x00,0x00};
unsigned char code eight[]=
{0x00,0x70,0x88,0x08,0x08,0x88,0x70,0x00,0x00,0x1C,0x22,0x21,0x21,0x22,0x1C,0x00};
unsigned char code nine[]=
{0x00,0xE0,0x10,0x08,0x08,0x10,0xE0,0x00,0x00,0x00,0x31,0x22,0x22,0x11,0x0F,0x00};
unsigned char code zero[]=
{0x00,0xE0,0x10,0x08,0x08,0x10,0xE0,0x00,0x00,0x0F,0x10,0x20,0x20,0x10,0x0F,0x00};
unsigned char code one_box[]=
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x20,0xF0,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x1F,0x10,0x00,0x00,0x00,0x00,0x00};
unsigned char code two_box[]=
{0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x10,0x10,0x10,0xE0,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x14,0x12,0x11,0x10,0x00,0x00,0x00,0x00,0x00};
unsigned char code three_box[]=
{0x00,0x00,0x00,0x00,0x00,0x40,0x20,0x20,0x20,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x10,0x20,0x21,0x21,0x1E,0x00,0x00,0x00,0x00,0x00,0x00};
unsigned char code baojing[]=
{0x00,0x00,0x40,0x44,0xD8,0x00,0x40,0xA0,0x9C,0x84,0x84,0xBC,0xA0,0x20,0x00,0x40,
0x5C,0x54,0x54,0x5C,0xF4,0x54,0x5C,0x54,0x54,0x5C,0x40,0x00,0x20,0x20,0xFC,0x20,
0x20,0xFC,0x84,0x84,0xA4,0xA4,0x9C,0x00,0x00,0x28,0xF8,0xAC,0xE8,0x8C,0x78,0x08,
0xB0,0x4C,0x68,0x98,0x88,0x00,0x20,0x44,0x08,0x00,0xF8,0xA8,0xA8,0xA8,0xA8,0xFC,
0x08,0x00,0x00,0x00,0xF8,0x08,0x28,0x28,0xF8,0xAC,0xA8,0xF8,0x28,0x28,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x1F,0x08,0x24,0x11,0x0A,0x04,0x0A,0x11,0x20,0x20,0x00,0x20,
0x20,0x20,0x3F,0x29,0x2B,0x2D,0x29,0x3F,0x20,0x20,0x20,0x00,0x02,0x22,0x3F,0x01,
0x00,0x3F,0x10,0x0B,0x04,0x0A,0x11,0x20,0x00,0x02,0x02,0x3A,0x2A,0x2A,0x2A,0x2B,
0x2A,0x2A,0x3A,0x02,0x02,0x00,0x04,0x3E,0x21,0x3E,0x22,0x3E,0x22,0x22,0x3E,0x22,
0x3E,0x20,0x00,0x30,0x0F,0x20,0x20,0x22,0x16,0x0A,0x0A,0x16,0x22,0x20,0x20,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};
unsigned char code sdata[]=
{0x00,0x00,0x00,0x00,0x00,0x80,0x80,0x80,0xC0,0xE0,0xE0,0x00,0x00,0x00,0x00,0x00,
0x00,0x80,0xC0,0xE0,0x60,0x20,0x20,0x60,0xE0,0xE0,0xC0,0x80,0x00,0x00,0x80,0xC0,
0xE0,0x60,0x20,0x20,0x60,0xE0,0xC0,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0xC0,0xE0,0xE0,0xE0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,
0x00,0x07,0x07,0x07,0x06,0x80,0xC0,0xE0,0x78,0x3F,0x1F,0x07,0x00,0x00,0x03,0x03,
0x03,0x12,0x10,0x10,0x38,0x7F,0xEF,0xE7,0x80,0x00,0x80,0xC0,0xF0,0x38,0x1E,0x07,
0x03,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x20,0x20,0x20,0x3F,0x3F,0x3F,0x20,0x20,0x20,0x00,0x00,
0x30,0x38,0x3C,0x36,0x33,0x31,0x30,0x30,0x30,0x38,0x3E,0x3E,0x00,0x00,0x0E,0x1E,
0x3E,0x34,0x20,0x20,0x30,0x38,0x1F,0x1F,0x0F,0x00,0x01,0x01,0x01,0x01,0x21,0x21,
0x21,0x3F,0x3F,0x3F,0x21,0x21,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};
unsigned char code wendu2_set[]=
{0x00,0x00,0x40,0x44,0xD8,0x00,0x40,0xA0,0x9C,0x84,0x84,0xBC,0xA0,0x20,0x00,0x40,
0x5C,0x54,0x54,0x5C,0xF4,0x54,0x5C,0x54,0x54,0x5C,0x40,0x00,0x00,0x08,0x08,0x08,
0x08,0xF8,0x08,0x08,0x08,0x0C,0x08,0x00,0x00,0x80,0x40,0xF0,0x0C,0x40,0x20,0x1C,
0xF0,0x90,0x90,0x90,0x10,0x00,0x08,0x08,0x08,0xE8,0xA8,0xAC,0xA8,0xA8,0xE8,0x08,
0x08,0x08,0x00,0x20,0x44,0x08,0x00,0xF8,0xA8,0xA8,0xA8,0xA8,0xFC,0x08,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x1F,0x08,0x24,0x11,0x0A,0x04,0x0A,0x11,0x20,0x20,0x00,0x20,
0x20,0x20,0x3F,0x29,0x2B,0x2D,0x29,0x3F,0x20,0x20,0x20,0x00,0x10,0x10,0x10,0x10,
0x10,0x1F,0x10,0x10,0x10,0x10,0x18,0x10,0x00,0x00,0x00,0x3F,0x00,0x00,0x00,0x00,
0x3F,0x04,0x04,0x04,0x04,0x00,0x00,0x3F,0x01,0x01,0x1D,0x15,0x15,0x1D,0x01,0x21,
0x3F,0x00,0x00,0x04,0x3E,0x21,0x3E,0x22,0x3E,0x22,0x22,0x3E,0x22,0x3E,0x20,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};
unsigned char code du[]=
{0x00,0x00,0x38,0x28,0x38,0xC0,0x20,0x10,0x10,0x10,0x10,0x10,0x20,0xF0,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x0F,0x10,0x20,0x40,0x40,0x40,0x20,0x10,0x08,0x00,0x00};
unsigned char code ESC[]=
{0x00,0x00,0x00,0x00,0x00,0x08,0xF8,0x88,0x88,0xE8,0x08,0x10,0x00,0x00,0x70,0x88,
0x08,0x08,0x08,0x38,0x00,0xC0,0x30,0x08,0x08,0x08,0x08,0x38,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x20,0x3F,0x20,0x20,0x23,0x20,0x18,0x00,0x00,0x38,0x20,
0x21,0x21,0x22,0x1C,0x00,0x07,0x18,0x20,0x20,0x20,0x10,0x08,0x00,0x00,0x00,0x00};
unsigned char code wait[]=
{0x00,0x00,0x00,0x00,0x80,0x80,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xC0,0xC0,
0xC0,0x00,0x00,0x80,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x80,0xC0,0xC0,
0xC0,0x80,0x00,0x00,0x00,0xC0,0xC0,0xC0,0x00,0x80,0x80,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x80,0x80,0xC0,0xC0,
0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x20,0x20,0xF1,0xF3,0xF3,0x20,0x22,0xAA,0xAA,
0xAA,0x2A,0x3F,0x3F,0x2A,0xAA,0xAF,0xAF,0x3B,0x73,0x60,0x00,0x10,0x11,0x11,0xD1,
0xFF,0xFF,0xFF,0xD8,0x98,0x19,0xFF,0xF7,0x96,0x9F,0x9F,0x9F,0x9F,0xFF,0xF9,0x11,
0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0x23,0x23,0x21,0x21,0x21,0x21,0x21,0x21,
0x20,0x20,0x30,0x39,0x39,0x30,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0xFF,0x7F,
0x38,0x0C,0xFF,0xFF,0xFF,0x15,0x15,0x95,0x95,0x95,0xFF,0xFF,0x01,0x00,0x00,0x00,
0x10,0x1C,0x0F,0x07,0xFF,0xFF,0xFF,0x01,0x01,0x00,0xFF,0xFF,0x08,0x08,0x88,0x88,
0x88,0xFF,0xFF,0x00,0x00,0x00,0x00,0x80,0xE0,0x7F,0x3F,0x0F,0x00,0xFF,0xFF,0x41,
0x41,0x41,0x41,0x41,0x41,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x60,0x60,0x60,
0x60,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x60,0x60,0x60,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x60,0x60,0x60,0x60,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x01,0x00,0x00,0x00,0x00,0x01,0x01,0x01,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x01,0x00,0x00,0x00,0x01,0x01,
0x00,0x00,0x00,0x00,0x01,0x01,0x01,0x00,0x00,0x00,0x01,0x01,0x01,0x00,0x00,0x00,
0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};
unsigned char code wendu1_set[]= {
0x00,0x00,0x40,0x44,0xD8,0x00,0x40,0xA0,0x9C,0x84,0x84,0xBC,0xA0,0x20,0x00,0x40,
0x5C,0x54,0x54,0x5C,0xF4,0x54,0x5C,0x54,0x54,0x5C,0x40,0x00,0x00,0x08,0x08,0x08,
0x08,0xF8,0x08,0x08,0x08,0x0C,0x08,0x00,0x00,0x80,0x40,0xF0,0x0C,0x40,0x20,0x1C,
0xF0,0x90,0x90,0x90,0x10,0x00,0x80,0x40,0xF0,0x0C,0xF0,0x90,0x90,0xF0,0x88,0x8C,
0x88,0x80,0x00,0x20,0x44,0x08,0x00,0xF8,0xA8,0xA8,0xA8,0xA8,0xFC,0x08,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x1F,0x08,0x24,0x11,0x0A,0x04,0x0A,0x11,0x20,0x20,0x00,0x20,
0x20,0x20,0x3F,0x29,0x2B,0x2D,0x29,0x3F,0x20,0x20,0x20,0x00,0x10,0x10,0x10,0x10,
0x10,0x1F,0x10,0x10,0x10,0x10,0x18,0x10,0x00,0x00,0x00,0x3F,0x00,0x00,0x00,0x00,
0x3F,0x04,0x04,0x04,0x04,0x00,0x00,0x00,0x3F,0x00,0x1F,0x10,0x08,0x10,0x07,0x08,
0x10,0x38,0x00,0x02,0x3E,0x21,0x3E,0x22,0x3E,0x22,0x22,0x3E,0x22,0x3E,0x20,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
// Show Regular Pattern (Full Screen)
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
void Fill_RAM(unsigned char Data)
{
unsigned char i,j;
for(i=0;i<8;i++)
{
Set_Start_Page(i);
Set_Start_Column(0x00);
for(j=0;j<132;j++) //列数从4开始,4~132,正好128列
{
Write_Data(Data);
}
}
}
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
// Show Regular Pattern (Partial or Full Screen)
//
// a: Start Page
// b: End Page
// c: Start Column
// d: Total Columns
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
void Fill_Block(unsigned char Data, unsigned char a, unsigned char b, unsigned char c, unsigned char d)
{
unsigned char i,j;
for(i=a;i<(b+1);i++)
{
Set_Start_Page(i);
Set_Start_Column(c);
for(j=0;j<d;j++)
{
Write_Data(Data);
}
}
}
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
// SShow_Pattern 显示汉字与数字
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
void Show_Pattern(unsigned char *Data_Pointer, unsigned char a, unsigned char b, unsigned char c, unsigned char d,unsigned char np)
{
unsigned char *Src_Pointer;
unsigned char i,j;
Src_Pointer=Data_Pointer; // Show_Pattern(&UniV,0x00,0x03,XLevel+0x28,0x30);
for(i=a;i<(b+1);i++)
{
Set_Start_Page(i);
Set_Start_Column(c);
for(j=0;j<d;j++)
{ if(np==0)
{
Write_Data(*Src_Pointer); //显示数字 ,比如是黑字黄底
}
Src_Pointer++;
if(np==1)
{
Write_Data(~*Src_Pointer); // 光标移走后,数字为黄字黑底,即取反
}
}
}
}
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
// Fade In (Full Screen)
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
void Fade_In()
{
unsigned int i;
Set_Display_On_Off(0x01);
for(i=0;i<(Brightness+1);i++)
{
Set_Contrast_Control(i);
uDelay(200);
uDelay(200);
uDelay(200);
}
}
//-=-=-=-=-=-=-=-=-=
一周热门 更多>