我写了这个代码,但是不知道为什么日期无法正常显示,其他全是正常的代码如下
#define MAIN_Fosc 11059200L //定义主时钟
#include "STC8.H"
#include "OLED.h"
#include "PCF8563.h"
void main()
{
P2M1 |= 0x30; P2M0 |= 0x30; //设置P2.4和P2.5为开漏输出
OLED_Init(); //对OLED屏初始化
OLED_Fill(0x00); //清屏
delay_ms(1000);
LCD_P8x16Str(0,0," 2000-00-00 0 ");
LCD_P8x16Str(0,2," 12:00:00 ");
delay_ms(10);//等待初始化完成
I2C_init(); //IIC初始化
EA = 1; //打开总中断
WriteRTC();
delay_ms(20);
while(1)
{ ReadRTC(); //读PCF8563时钟值,即读出时、分、秒
OLED_ShowChar(5*8,0,year/10+'0');
OLED_ShowChar(6*8,0,year%10+'0');
OLED_ShowChar(8*8,0,month/10+'0');
OLED_ShowChar(9*8,0,month%10+'0');
OLED_ShowChar(11*8,0,date/10+'0');
OLED_ShowChar(12*8,0,date%10+'0');
OLED_ShowChar(14*8,0,week+'0');
OLED_ShowChar(4*8,2,hour/10+'0');
OLED_ShowChar(5*8,2,hour%10+'0');
OLED_ShowChar(7*8,2,minute/10+'0');
OLED_ShowChar(8*8,2,minute%10+'0');
OLED_ShowChar(10*8,2,second/10+'0');
OLED_ShowChar(11*8,2,second%10+'0');
delay_ms(50); //刷新
}
}
#ifndef __PCF8563_H_
#define __PCF8563_H_
#include "delay.h"
#include "i2c.h"
uchar year,month,date,week,hour,minute,second; //RTC变量,时,分,秒
/**********************
引脚别名定义
***********************/
sbit SDA = P1^4; //定义SDA
sbit SCL = P1^5; //定义SCL
#define DIS_DOT 0x20
#define DIS_BLACK 0x10
#define DIS_ 0x11
#define SLAW 0xA2
#define SLAR 0xA3
uchar tmp[7];
uchar timedate[7]={21,7,20,2,18,31,0};//年,月,日,星期,时,分,秒
/*******************************************************************
功能描述:读RTC函数
入口参数:无
返回值:无
********************************************************************/
void ReadRTC(void)
{
P_SW2 |= 0x80; //将EAXFR位置1,以访问PWM在扩展RAM区的特殊功能寄存器
I2C_Start();
I2C_SendData(0xA2);
I2C_RecvACK();
I2C_SendData(0x02);
I2C_RecvACK();
I2C_Start();
I2C_SendData(0xA3);
I2C_RecvACK();
tmp[6] =I2C_RecvData();
second = ((tmp[6] >> 4) & 0x07) * 10 + (tmp[6] & 0x0f);//秒
I2C_SendACK();
tmp[5] =I2C_RecvData();
minute = ((tmp[5] >> 4) & 0x07) * 10 + (tmp[5] & 0x0f);
I2C_SendACK();
tmp[4] =I2C_RecvData();
hour = ((tmp[4] >> 4) & 0x03) * 10 + (tmp[4] & 0x0f);
I2C_SendACK();
tmp[3] =I2C_RecvData();
week = tmp[3];
I2C_SendACK();
tmp[2] =I2C_RecvData();
date = ((tmp[2] >> 4) & 0x03) * 10 + (tmp[2] & 0x0f);
I2C_SendACK();
tmp[1] =I2C_RecvData();
month = ((tmp[1] >> 4) & 0x03) * 10 + (tmp[1] & 0x0f);
I2C_SendACK();
tmp[0] =I2C_RecvData();
year = ((tmp[0] >> 4) & 0x03) * 10 + (tmp[0] & 0x0f);
I2C_SendNAK();
I2C_Stop();
P_SW2 &= 0x7F; //将EAXSFR位置0,恢复访问XRAM
}
/***************************************************************************************
功能描述:写RTC函数
入口参数:无
返回值:无
***************************************************************************************/
void WriteRTC(void)
{
tmp[0] = ((timedate[0] / 10) << 4) + (timedate[0] % 10);//年
tmp[1] = ((timedate[1] / 10) << 4) + (timedate[1] % 10);//月
tmp[2] = ((timedate[2] / 10) << 4) + (timedate[2] % 10);//日
tmp[3] = timedate[3]; //星期
tmp[4] = ((timedate[4] / 10) << 4) + (timedate[4] % 10);//小时
tmp[5] = ((timedate[5] / 10) << 4) + (timedate[5] % 10);//分钟
tmp[6] = ((timedate[6] / 10) << 4) + (timedate[6] % 10);//秒
P_SW2 |= 0x80; //将EAXFR位置1,以访问PWM在扩展RAM区的特殊功能寄存器
I2C_Start();
I2C_SendData(SLAW); //发送设备地址+写命令
I2C_RecvACK();
I2C_SendData(0x02); //发送存储地址
I2C_RecvACK();
I2C_SendData(tmp[6]); //设置秒值
I2C_RecvACK();
I2C_SendData(tmp[5]); //设置分钟值
I2C_RecvACK();
I2C_SendData(tmp[4]); //设置小时值
I2C_RecvACK();
I2C_SendData(tmp[3]); //设置星期值
I2C_RecvACK();
I2C_SendData(tmp[2]); //设置日期值
I2C_RecvACK();
I2C_SendData(tmp[1]); //设置月值
I2C_RecvACK();
I2C_SendData(tmp[0]); //设置年值
I2C_RecvACK();
I2C_Stop();
P_SW2 &= 0x7F; //将EAXSFR位置0,恢复访问XRAM
}
#endif
#ifndef OLED_H
#define OLED_H
#include "OLEDFONT.h"
#include "delay.h"
#define uchar unsigned char
#define uint unsigned int
#define OLED_WR_CMD 0
#define OLED_WR_DAT 1
#define SIZE 16
/**********************
引脚别名定义
***********************/
sbit RES=P5^5;
sbit DC=P4^0;
sbit CS=P3^5;
#define LCD_DC DC //OLED命令/数据选择 H=命令 L=数据
#define LCD_CS CS //OLED片选
#define XLevelL 0x00
#define XLevelH 0x10
#define XLevel ((XLevelH&0x0F)*16+XLevelL)
#define Max_Column 128
#define Max_Row 64
#define Brightness 0xCF
#define X_WIDTH 128
#define Y_WIDTH 64
#define SPIF 0x80 //SPSTAT.7
#define WCOL 0x40 //SPSTAT.6
#define SSIG 0x80 //SPCTL.7
#define SPEN 0x40 //SPCTL.6
#define DORD 0x20 //SPCTL.5
#define MSTR 0x10 //SPCTL.4
#define CPOL 0x08 //SPCTL.3
#define CPHA 0x04 //SPCTL.2
#define SPDHH 0x00 //CPU_CLK/4
#define SPDH 0x01 //CPU_CLK/8
#define SPDL 0x02 //CPU_CLK/16
#define SPDLL 0x03 //CPU_CLK/32
/**************************************************************************************
* 描 述 : 硬件SPI初始化
* 入 参 : 无
* 返回值 : 无
**************************************************************************************/
void Init_SPI()
{
P_SW1 |=0X0C; //将 SPI 调整到 P3.2 P3.3 P3.4 P3.5
SPDAT = 0; //初始化将SPI数据寄存器清空
SPSTAT = SPIF | WCOL; //清除SPI状态位
SPCTL = SPEN | MSTR | SSIG; //主机模式
}
/**************************************************************************************
* 描 述 : 硬件SPI写入一个字节,并返回一个值
* 入 参 : uchar date uchar mode
* 返回值 : 无
**************************************************************************************/
uchar OLED_WrByte(uchar dat,uchar mode)
{
if(mode == OLED_WR_CMD)LCD_DC = 0;
else LCD_DC = 1;
SPDAT = dat; //触发SPI发送数据
while (!(SPSTAT & SPIF)); //等待发送完成
SPSTAT = SPIF | WCOL; //清除SPI状态位
return SPDAT; //返回SPI数据
}
/******************************************************************************
* 描 述 : 设置坐标
* 入 参 : x:x坐标;y:y坐标
* 返回值 : 无
******************************************************************************/
void OLED_Set_Pos(uchar x, uchar y)
{
OLED_WrByte((0xb0+y),OLED_WR_CMD);
OLED_WrByte(((x&0xf0)>>4)|0x10,OLED_WR_CMD);
OLED_WrByte((x&0x0f)|0x01,OLED_WR_CMD);
}
/******************************************************************************
* 描 述 : LCD初始化
* 入 参 : 无
* 返回值 : 无
******************************************************************************/
void OLED_Fill(uchar dat)
{
uchar y,x;
for(y=0;y<8;y++)
{
OLED_WrByte(0xb0+y,OLED_WR_CMD); //设置页地址(0~7)
OLED_WrByte(0x02,OLED_WR_CMD); //设置显示位置—列低地址
OLED_WrByte(0x10,OLED_WR_CMD); //设置显示位置—列高地址
for(x=0; x<X_WIDTH; x++)
OLED_WrByte(dat,OLED_WR_DAT);
}
}
/******************************************************************************
* 描 述 : 指定位置显示一个字符
* 入 参 : x:列0~127;y:页地址0~7;
* 返回值 : 无
******************************************************************************/
void OLED_ShowChar(uchar x,uchar y,uchar chr)
{
uchar c=0,i=0;
c = chr-' '; //得到偏移后的值
if(x > Max_Column-1)
{
x = 0;
y = y+2;
}
OLED_Set_Pos(x,y);
for(i=0; i<8; i++)OLED_WrByte(F8X16[c*16+i],OLED_WR_DAT);
OLED_Set_Pos(x,y+1);
for(i=0;i<8;i++)OLED_WrByte(F8X16[c*16+i+8],OLED_WR_DAT);
}
/******************************************************************************
* 描 述 : 显示8*16一组标准ASCII字符串
* 入 参 : x:列0~127;y:页地址0~7;
* 返回值 : 无
******************************************************************************/
void LCD_P8x16Str(uchar x, uchar y,uchar ch[])
{
uchar c=0,i=0,j=0;
while (ch[j] != '\0')
{
c = ch[j]-32;
if(x>120){x=0;y++;}
OLED_Set_Pos(x,y);
for(i=0; i<8; i++)OLED_WrByte(F8X16[c*16+i],OLED_WR_DAT);
OLED_Set_Pos(x,y+1);
for(i=0;i<8;i++) OLED_WrByte(F8X16[c*16+i+8],OLED_WR_DAT);
x += 8;
j++;
}
}
/******************************************************************************
* 描 述 : 显示汉字
* 入 参 : x:列0~127;y:页地址0~7;
* 返回值 : 无
******************************************************************************/
void LCD_P16x16Ch(uchar x, uchar y, uchar N)
{
uchar wm=0;
unsigned int adder=32*N;
OLED_Set_Pos(x , y);
for(wm = 0;wm < 16;wm++)
{
OLED_WrByte(F16x16[adder],OLED_WR_DAT);
adder += 1;
}
OLED_Set_Pos(x,y + 1);
for(wm = 0;wm < 16;wm++)
{
OLED_WrByte(F16x16[adder],OLED_WR_DAT);
adder += 1;
}
}
/******************************************************************************
* 描 述 : LCD初始化
* 入 参 : 无
* 返回值 : 无
******************************************************************************/
void OLED_Init(void)
{
Init_SPI(); //SPI初始化
delay_ms(10);
LCD_CS=1;
delay_ms(10);
LCD_CS=0;
delay_ms(200);
OLED_WrByte(0xae,OLED_WR_CMD);//--turn off oled panel
OLED_WrByte(0x00,OLED_WR_CMD);//---set low column address
OLED_WrByte(0x10,OLED_WR_CMD);//---set high column address
OLED_WrByte(0x40,OLED_WR_CMD);//--set start line address Set Mapping RAM Display Start Line (0x00~0x3F)
OLED_WrByte(0x81,OLED_WR_CMD);//--set contrast control register
OLED_WrByte(0xcf,OLED_WR_CMD); // Set SEG Output Current Brightness
OLED_WrByte(0xa1,OLED_WR_CMD);//--Set SEG/Column Mapping 0xa0左右反置 0xa1正常
OLED_WrByte(0xc8,OLED_WR_CMD);//Set COM/Row Scan Direction 0xc0上下反置 0xc8正常
OLED_WrByte(0xa6,OLED_WR_CMD);//--set normal display
OLED_WrByte(0xa8,OLED_WR_CMD);//--set multiplex ratio(1 to 64)
OLED_WrByte(0x3f,OLED_WR_CMD);//--1/64 duty
OLED_WrByte(0xd3,OLED_WR_CMD);//-set display offset Shift Mapping RAM Counter (0x00~0x3F)
OLED_WrByte(0x00,OLED_WR_CMD);//-not offset
OLED_WrByte(0xd5,OLED_WR_CMD);//--set display clock divide ratio/oscillator frequency
OLED_WrByte(0x80,OLED_WR_CMD);//--set divide ratio, Set Clock as 100 Frames/Sec
OLED_WrByte(0xd9,OLED_WR_CMD);//--set pre-charge period
OLED_WrByte(0xf1,OLED_WR_CMD);//Set Pre-Charge as 15 Clocks & Discharge as 1 Clock
//OLED_WrByte(0x22,OLED_WR_CMD);
OLED_WrByte(0xda,OLED_WR_CMD);//--set com pins hardware configuration
OLED_WrByte(0x12,OLED_WR_CMD);
OLED_WrByte(0xdb,OLED_WR_CMD);//--set vcomh
OLED_WrByte(0x40,OLED_WR_CMD);//Set VCOM Deselect Level
OLED_WrByte(0x20,OLED_WR_CMD);//-Set Page Addressing Mode (0x00/0x01/0x02)
OLED_WrByte(0x02,OLED_WR_CMD);//
OLED_WrByte(0x8d,OLED_WR_CMD);//--set Charge Pump enable/disable
OLED_WrByte(0x14,OLED_WR_CMD);//--set(0x10) disable
OLED_WrByte(0xa4,OLED_WR_CMD);// Disable Entire Display On (0xa4/0xa5)
OLED_WrByte(0xa6,OLED_WR_CMD);// Disable Inverse Display On (0xa6/a7)
OLED_WrByte(0xaf,OLED_WR_CMD);//--turn on oled panel
OLED_Fill(0xff); //初始清屏
OLED_Set_Pos(0,0);
}
#endif
#ifndef __I2C_H
#define __I2C_H
#include "delay.h"
/******************************************************************************
引脚别名定义
*******************************************************************************/
//sbit SDA = P2^4; //定义SDA
//sbit SCL = P2^5; //定义SCL
/****************************/
void I2C_Wait(void)
{
while(!(I2CMSST&0x40)); //等待IIC主机状态寄存器的中断标志位为1
I2CMSST&=0xBF; //MSIF=0,软件清零IIC主机状态寄存器的中断标志位
}
/****************************/
void I2C_Start(void)
{
I2CMSCR=0x01;
I2C_Wait();
}
/****************************/
void I2C_SendData(uchar dat)
{
I2CTXD=dat; //写数据到数据缓冲区
I2CMSCR=0x02; //发送SEND命令
I2C_Wait();
}
/****************************/
void I2C_RecvACK(void)
{
I2CMSCR=0x03; //发送读ACK命令
I2C_Wait();
}
/****************************/
uchar I2C_RecvData(void)
{
I2CMSCR=0x04; //发送RECV命令
I2C_Wait();
return I2CRXD;
}
/****************************/
void I2C_SendACK(void)
{
I2CMSST=0x00; //设置ACK信号
I2CMSCR=0x05; //发送ACK命令
I2C_Wait();
}
/****************************/
void I2C_SendNAK(void)
{
I2CMSST=0x01; //设置NAK信号
I2CMSCR=0x05; //发送ACK命令
I2C_Wait();
}
/****************************/
void I2C_Stop(void)
{
I2CMSCR=0x06; //发送STOP命令
I2C_Wait();
}
/****************************/
void I2C_init(void)
{
P_SW2 |= 0x80; //将EAXFR位置1,以访问PWM在扩展RAM区的特殊功能寄存器
P_SW2 &= 0xCF; //将I2C_S[1:0]置01,以选择I2C硬件功能脚为P2.4 P2.5
P_SW2 |= 0x10; //将I2C_S[1:0]置01,以选择I2C硬件功能脚为P2.4 P2.5
I2CCFG=0xFF; //使能I2C主机模式
I2CMSST=0x00;
P_SW2 &= 0x7F; //将EAXSFR位置0,恢复访问XRAM
}
#endif
#ifndef OLEDFONT_H
#define OLEDFONT_H
unsigned char code F8X16[]=
{
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,// 0
0x00,0x00,0x00,0xF8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x33,0x30,0x00,0x00,0x00,//! 1
0x00,0x10,0x0C,0x06,0x10,0x0C,0x06,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//" 2
0x40,0xC0,0x78,0x40,0xC0,0x78,0x40,0x00,0x04,0x3F,0x04,0x04,0x3F,0x04,0x04,0x00,//# 3
0x00,0x70,0x88,0xFC,0x08,0x30,0x00,0x00,0x00,0x18,0x20,0xFF,0x21,0x1E,0x00,0x00,//$ 4
0xF0,0x08,0xF0,0x00,0xE0,0x18,0x00,0x00,0x00,0x21,0x1C,0x03,0x1E,0x21,0x1E,0x00,//% 5
0x00,0xF0,0x08,0x88,0x70,0x00,0x00,0x00,0x1E,0x21,0x23,0x24,0x19,0x27,0x21,0x10,//& 6
0x10,0x16,0x0E,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//' 7
0x00,0x00,0x00,0xE0,0x18,0x04,0x02,0x00,0x00,0x00,0x00,0x07,0x18,0x20,0x40,0x00,//( 8
0x00,0x02,0x04,0x18,0xE0,0x00,0x00,0x00,0x00,0x40,0x20,0x18,0x07,0x00,0x00,0x00,//) 9
0x40,0x40,0x80,0xF0,0x80,0x40,0x40,0x00,0x02,0x02,0x01,0x0F,0x01,0x02,0x02,0x00,//* 10
0x00,0x00,0x00,0xF0,0x00,0x00,0x00,0x00,0x01,0x01,0x01,0x1F,0x01,0x01,0x01,0x00,//+ 11
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xB0,0x70,0x00,0x00,0x00,0x00,0x00,//, 12
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x01,0x01,0x01,0x01,0x01,//- 13
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x30,0x00,0x00,0x00,0x00,0x00,//. 14
0x00,0x00,0x00,0x00,0x80,0x60,0x18,0x04,0x00,0x60,0x18,0x06,0x01,0x00,0x00,0x00,/// 15
0x00,0xE0,0x10,0x08,0x08,0x10,0xE0,0x00,0x00,0x0F,0x10,0x20,0x20,0x10,0x0F,0x00,//0 16
0x00,0x10,0x10,0xF8,0x00,0x00,0x00,0x00,0x00,0x20,0x20,0x3F,0x20,0x20,0x00,0x00,//1 17
0x00,0x70,0x08,0x08,0x08,0x88,0x70,0x00,0x00,0x30,0x28,0x24,0x22,0x21,0x30,0x00,//2 18
0x00,0x30,0x08,0x88,0x88,0x48,0x30,0x00,0x00,0x18,0x20,0x20,0x20,0x11,0x0E,0x00,//3 19
0x00,0x00,0xC0,0x20,0x10,0xF8,0x00,0x00,0x00,0x07,0x04,0x24,0x24,0x3F,0x24,0x00,//4 20
0x00,0xF8,0x08,0x88,0x88,0x08,0x08,0x00,0x00,0x19,0x21,0x20,0x20,0x11,0x0E,0x00,//5 21
0x00,0xE0,0x10,0x88,0x88,0x18,0x00,0x00,0x00,0x0F,0x11,0x20,0x20,0x11,0x0E,0x00,//6 22
0x00,0x38,0x08,0x08,0xC8,0x38,0x08,0x00,0x00,0x00,0x00,0x3F,0x00,0x00,0x00,0x00,//7 23
0x00,0x70,0x88,0x08,0x08,0x88,0x70,0x00,0x00,0x1C,0x22,0x21,0x21,0x22,0x1C,0x00,//8 24
0x00,0xE0,0x10,0x08,0x08,0x10,0xE0,0x00,0x00,0x00,0x31,0x22,0x22,0x11,0x0F,0x00,//9 25
0x00,0x00,0x00,0xC0,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x30,0x00,0x00,0x00,//: 26
0x00,0x00,0x00,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x60,0x00,0x00,0x00,0x00,//; 27
0x00,0x00,0x80,0x40,0x20,0x10,0x08,0x00,0x00,0x01,0x02,0x04,0x08,0x10,0x20,0x00,//< 28
0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x00,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x00,//= 29
0x00,0x08,0x10,0x20,0x40,0x80,0x00,0x00,0x00,0x20,0x10,0x08,0x04,0x02,0x01,0x00,//> 30
0x00,0x70,0x48,0x08,0x08,0x08,0xF0,0x00,0x00,0x00,0x00,0x30,0x36,0x01,0x00,0x00,//? 31
0xC0,0x30,0xC8,0x28,0xE8,0x10,0xE0,0x00,0x07,0x18,0x27,0x24,0x23,0x14,0x0B,0x00,//@ 32
0x00,0x00,0xC0,0x38,0xE0,0x00,0x00,0x00,0x20,0x3C,0x23,0x02,0x02,0x27,0x38,0x20,//A 33
0x08,0xF8,0x88,0x88,0x88,0x70,0x00,0x00,0x20,0x3F,0x20,0x20,0x20,0x11,0x0E,0x00,//B 34
0xC0,0x30,0x08,0x08,0x08,0x08,0x38,0x00,0x07,0x18,0x20,0x20,0x20,0x10,0x08,0x00,//C 35
0x08,0xF8,0x08,0x08,0x08,0x10,0xE0,0x00,0x20,0x3F,0x20,0x20,0x20,0x10,0x0F,0x00,//D 36
0x08,0xF8,0x88,0x88,0xE8,0x08,0x10,0x00,0x20,0x3F,0x20,0x20,0x23,0x20,0x18,0x00,//E 37
0x08,0xF8,0x88,0x88,0xE8,0x08,0x10,0x00,0x20,0x3F,0x20,0x00,0x03,0x00,0x00,0x00,//F 38
0xC0,0x30,0x08,0x08,0x08,0x38,0x00,0x00,0x07,0x18,0x20,0x20,0x22,0x1E,0x02,0x00,//G 39
0x08,0xF8,0x08,0x00,0x00,0x08,0xF8,0x08,0x20,0x3F,0x21,0x01,0x01,0x21,0x3F,0x20,//H 40
0x00,0x08,0x08,0xF8,0x08,0x08,0x00,0x00,0x00,0x20,0x20,0x3F,0x20,0x20,0x00,0x00,//I 41
0x00,0x00,0x08,0x08,0xF8,0x08,0x08,0x00,0xC0,0x80,0x80,0x80,0x7F,0x00,0x00,0x00,//J 42
0x08,0xF8,0x88,0xC0,0x28,0x18,0x08,0x00,0x20,0x3F,0x20,0x01,0x26,0x38,0x20,0x00,//K 43
0x08,0xF8,0x08,0x00,0x00,0x00,0x00,0x00,0x20,0x3F,0x20,0x20,0x20,0x20,0x30,0x00,//L 44
0x08,0xF8,0xF8,0x00,0xF8,0xF8,0x08,0x00,0x20,0x3F,0x00,0x3F,0x00,0x3F,0x20,0x00,//M 45
0x08,0xF8,0x30,0xC0,0x00,0x08,0xF8,0x08,0x20,0x3F,0x20,0x00,0x07,0x18,0x3F,0x00,//N 46
0xE0,0x10,0x08,0x08,0x08,0x10,0xE0,0x00,0x0F,0x10,0x20,0x20,0x20,0x10,0x0F,0x00,//O 47
0x08,0xF8,0x08,0x08,0x08,0x08,0xF0,0x00,0x20,0x3F,0x21,0x01,0x01,0x01,0x00,0x00,//P 48
0xE0,0x10,0x08,0x08,0x08,0x10,0xE0,0x00,0x0F,0x18,0x24,0x24,0x38,0x50,0x4F,0x00,//Q 49
0x08,0xF8,0x88,0x88,0x88,0x88,0x70,0x00,0x20,0x3F,0x20,0x00,0x03,0x0C,0x30,0x20,//R 50
0x00,0x70,0x88,0x08,0x08,0x08,0x38,0x00,0x00,0x38,0x20,0x21,0x21,0x22,0x1C,0x00,//S 51
0x18,0x08,0x08,0xF8,0x08,0x08,0x18,0x00,0x00,0x00,0x20,0x3F,0x20,0x00,0x00,0x00,//T 52
0x08,0xF8,0x08,0x00,0x00,0x08,0xF8,0x08,0x00,0x1F,0x20,0x20,0x20,0x20,0x1F,0x00,//U 53
0x08,0x78,0x88,0x00,0x00,0xC8,0x38,0x08,0x00,0x00,0x07,0x38,0x0E,0x01,0x00,0x00,//V 54
0xF8,0x08,0x00,0xF8,0x00,0x08,0xF8,0x00,0x03,0x3C,0x07,0x00,0x07,0x3C,0x03,0x00,//W 55
0x08,0x18,0x68,0x80,0x80,0x68,0x18,0x08,0x20,0x30,0x2C,0x03,0x03,0x2C,0x30,0x20,//X 56
0x08,0x38,0xC8,0x00,0xC8,0x38,0x08,0x00,0x00,0x00,0x20,0x3F,0x20,0x00,0x00,0x00,//Y 57
0x10,0x08,0x08,0x08,0xC8,0x38,0x08,0x00,0x20,0x38,0x26,0x21,0x20,0x20,0x18,0x00,//Z 58
0x00,0x00,0x00,0xFE,0x02,0x02,0x02,0x00,0x00,0x00,0x00,0x7F,0x40,0x40,0x40,0x00,//[ 59
0x00,0x0C,0x30,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x06,0x38,0xC0,0x00,//\ 60
0x00,0x02,0x02,0x02,0xFE,0x00,0x00,0x00,0x00,0x40,0x40,0x40,0x7F,0x00,0x00,0x00,//] 61
0x00,0x00,0x04,0x02,0x02,0x02,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//^ 62
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,//_ 63
0x00,0x02,0x02,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//` 64
0x00,0x00,0x80,0x80,0x80,0x80,0x00,0x00,0x00,0x19,0x24,0x22,0x22,0x22,0x3F,0x20,//a 65
0x08,0xF8,0x00,0x80,0x80,0x00,0x00,0x00,0x00,0x3F,0x11,0x20,0x20,0x11,0x0E,0x00,//b 66
0x00,0x00,0x00,0x80,0x80,0x80,0x00,0x00,0x00,0x0E,0x11,0x20,0x20,0x20,0x11,0x00,//c 67
0x00,0x00,0x00,0x80,0x80,0x88,0xF8,0x00,0x00,0x0E,0x11,0x20,0x20,0x10,0x3F,0x20,//d 68
0x00,0x00,0x80,0x80,0x80,0x80,0x00,0x00,0x00,0x1F,0x22,0x22,0x22,0x22,0x13,0x00,//e 69
0x00,0x80,0x80,0xF0,0x88,0x88,0x88,0x18,0x00,0x20,0x20,0x3F,0x20,0x20,0x00,0x00,//f 70
0x00,0x00,0x80,0x80,0x80,0x80,0x80,0x00,0x00,0x6B,0x94,0x94,0x94,0x93,0x60,0x00,//g 71
0x08,0xF8,0x00,0x80,0x80,0x80,0x00,0x00,0x20,0x3F,0x21,0x00,0x00,0x20,0x3F,0x20,//h 72
0x00,0x80,0x98,0x98,0x00,0x00,0x00,0x00,0x00,0x20,0x20,0x3F,0x20,0x20,0x00,0x00,//i 73
0x00,0x00,0x00,0x80,0x98,0x98,0x00,0x00,0x00,0xC0,0x80,0x80,0x80,0x7F,0x00,0x00,//j 74
0x08,0xF8,0x00,0x00,0x80,0x80,0x80,0x00,0x20,0x3F,0x24,0x02,0x2D,0x30,0x20,0x00,//k 75
0x00,0x08,0x08,0xF8,0x00,0x00,0x00,0x00,0x00,0x20,0x20,0x3F,0x20,0x20,0x00,0x00,//l 76
0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x00,0x20,0x3F,0x20,0x00,0x3F,0x20,0x00,0x3F,//m 77
0x80,0x80,0x00,0x80,0x80,0x80,0x00,0x00,0x20,0x3F,0x21,0x00,0x00,0x20,0x3F,0x20,//n 78
0x00,0x00,0x80,0x80,0x80,0x80,0x00,0x00,0x00,0x1F,0x20,0x20,0x20,0x20,0x1F,0x00,//o 79
0x80,0x80,0x00,0x80,0x80,0x00,0x00,0x00,0x80,0xFF,0xA1,0x20,0x20,0x11,0x0E,0x00,//p 80
0x00,0x00,0x00,0x80,0x80,0x80,0x80,0x00,0x00,0x0E,0x11,0x20,0x20,0xA0,0xFF,0x80,//q 81
0x80,0x80,0x80,0x00,0x80,0x80,0x80,0x00,0x20,0x20,0x3F,0x21,0x20,0x00,0x01,0x00,//r 82
0x00,0x00,0x80,0x80,0x80,0x80,0x80,0x00,0x00,0x33,0x24,0x24,0x24,0x24,0x19,0x00,//s 83
0x00,0x80,0x80,0xE0,0x80,0x80,0x00,0x00,0x00,0x00,0x00,0x1F,0x20,0x20,0x00,0x00,//t 84
0x80,0x80,0x00,0x00,0x00,0x80,0x80,0x00,0x00,0x1F,0x20,0x20,0x20,0x10,0x3F,0x20,//u 85
0x80,0x80,0x80,0x00,0x00,0x80,0x80,0x80,0x00,0x01,0x0E,0x30,0x08,0x06,0x01,0x00,//v 86
0x80,0x80,0x00,0x80,0x00,0x80,0x80,0x80,0x0F,0x30,0x0C,0x03,0x0C,0x30,0x0F,0x00,//w 87
0x00,0x80,0x80,0x00,0x80,0x80,0x80,0x00,0x00,0x20,0x31,0x2E,0x0E,0x31,0x20,0x00,//x 88
0x80,0x80,0x80,0x00,0x00,0x80,0x80,0x80,0x80,0x81,0x8E,0x70,0x18,0x06,0x01,0x00,//y 89
0x00,0x80,0x80,0x80,0x80,0x80,0x80,0x00,0x00,0x21,0x30,0x2C,0x22,0x21,0x30,0x00,//z 90
0x00,0x00,0x00,0x00,0x80,0x7C,0x02,0x02,0x00,0x00,0x00,0x00,0x00,0x3F,0x40,0x40,//{ 91
0x00,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,//| 92
0x00,0x02,0x02,0x7C,0x80,0x00,0x00,0x00,0x00,0x40,0x40,0x3F,0x00,0x00,0x00,0x00,//} 93
0x00,0x06,0x01,0x01,0x02,0x02,0x04,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//~ 94
};
unsigned char code F16x16[] =
{
/*-- ??: ? --*/
/*-- ??12; ??????????:?x?=16x16 --*/
0x10,0x10,0xD0,0xFF,0x90,0x10,0x00,0x10,0x10,0xD0,0xFF,0xD0,0x10,0x10,0x10,0x00,
0x04,0x03,0x00,0xFF,0x00,0x11,0x08,0x04,0x03,0x00,0xFF,0x00,0x03,0x04,0x08,0x00,
/*-- ??: ? --*/
/*-- ??12; ??????????:?x?=16x16 --*/
0x10,0x10,0x92,0x92,0x92,0xFE,0x92,0x92,0x92,0x92,0x92,0x92,0xFE,0x10,0x10,0x00,
0x40,0x20,0x10,0x0C,0xFF,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0xFC,0x00,0x00,0x00,
};
#endif
#ifndef DELAY_H
#define DELAY_H
#include "intrins.h"
#define uchar unsigned char
#define uint unsigned int
/**************************************
* 描 述 : 延时函数
* 入 参 : 1ms的整数倍
* 返回值 : 无
***************************************/
void delay_ms(uint x)
{
uint j,i;
for(j=0;j<x;j++)
{
for(i=0;i<1580;i++);
}
}
#endif
希望大佬不吝赐教求求啦,显示出的效果如下
|