码迷,mamicode.com
首页 > 其他好文 > 详细

智能车学习(六)——OLED屏幕使用

时间:2015-10-26 20:46:44      阅读:3848      评论:0      收藏:2      [点我收藏+]

标签:

一、代码展示

1、头文件:

#ifndef OLED_H_
#define OLED_H_


extern unsigned char Draw[];
extern const unsigned char Font_8x16[];
extern const unsigned char HanZi[][32];
extern const unsigned char Map[];


/*--------------------*OLED写数据*--------------------*/
void OLED_Write_Data(unsigned char Data);


/*--------------------*OLED写命令*--------------------*/
void OLED_Write_Command(unsigned char Cmd);


/*-------------------*设置位置*-------------------*/
void OLED_Set_Pos(unsigned char x,unsigned char y);


/*-------------------*填充*-------------------*/
void OLED_Fill(unsigned char Bmp_data);

/*---------------------*OLED局域清屏*---------------------*/
void OLEDPartClear(unsigned char x,unsigned char y,unsigned char xlen,unsigned char ylen);


/*---------------------*OLED清屏*---------------------*/
void OLED_Clear(void);


/*--------------------*OLED初始化*--------------------*/
void OLED_Init(void);   


/*-------------------*整型转字符串*-------------------*/
signed int Int_To_String(signed long Int_Num,signed char String[]);


/*------------------*浮点型转字符串*------------------*/
signed int Float_To_String(float Float_Num,signed char String[]);


/*-----------------*OLED写一个字符串*-----------------*/      
void OLED_Write_String(unsigned char x,unsigned char y,signed char String[]);


/*-----------------*OLED写一个字符*-------------------*/      
void OLED_Write_Char  (unsigned char x,unsigned char y,signed char Asc); 


/*-----------------*OLED写一个字符*-------------------*/      
void OLED_Write_Draw  (unsigned char x,unsigned char y,signed char Asc); 
void OLED_Write_Map(unsigned char x,unsigned char y,signed char Asc);


/*----------------*OLED写一个整型数据*----------------*/      
void OLED_Write_Int   (unsigned char x,unsigned char y,signed int Number);


/*---------------*OLED写一个浮点型数据*---------------*/
void OLED_Write_Float (unsigned char x,unsigned char y,float Number);


/*-----------------*OLED写一个汉字*--------------------*/
void OLED_Write_HanZi(unsigned char x,unsigned char y,unsigned char NO);


/*------------------*OLED写汉字数据专用*---------------*/
void OLED_Write_HZ_Data(unsigned char Data);
void OLED_Draw_Clover(unsigned char y,unsigned char num);
void OLED_Draw_style(void);


#endif

 

2、源文件:

#include "common.h"
#include "gpio.h"


#define OLED_SCL    PTB8_OUT    //K60&kl25引脚
#define OLED_SDA    PTB9_OUT
#define OLED_RST    PTB10_OUT
#define OLED_DC     PTB11_OUT
#define Dot_Size 2                  // 小数点后数位


unsigned char Draw[]=
{
  0xfc,0x04,0x07,0x01,0x01,0x07,0x04,0xfc,0xff,0x80,0x80,0x80,0x80,0x80,0x80,0xff,//没电 0
  0xfc,0x04,0x07,0x01,0x01,0x07,0x04,0xfc,0xff,0x80,0xa0,0xa0,0xa0,0xa0,0x80,0xff,//一格 1
  0xfc,0x04,0x07,0x01,0x01,0x07,0x04,0xfc,0xff,0x80,0xb0,0xb0,0xb0,0xb0,0x80,0xff,//两格
  0xfc,0x04,0x07,0x01,0x01,0x07,0x04,0xfc,0xff,0x80,0xb8,0xb8,0xb8,0xb8,0x80,0xff,//三格
  0xfc,0x04,0x07,0x01,0x01,0x07,0x04,0xfc,0xff,0x80,0xbc,0xbc,0xbc,0xbc,0x80,0xff,//四格
  0xfc,0x04,0x07,0x01,0x01,0x07,0x04,0xfc,0xff,0x80,0xbe,0xbe,0xbe,0xbe,0x80,0xff,//五格
  0xfc,0x04,0x07,0x01,0x01,0x07,0x04,0xfc,0xff,0x80,0xbf,0xbf,0xbf,0xbf,0x80,0xff,//六格
  0xfc,0x04,0x87,0x81,0x81,0x87,0x04,0xfc,0xff,0x80,0xbf,0xbf,0xbf,0xbf,0x80,0xff,//七格
  0xfc,0x04,0xc7,0xc1,0xc1,0xc7,0x04,0xfc,0xff,0x80,0xbf,0xbf,0xbf,0xbf,0x80,0xff,//八格
  0xfc,0x04,0xe7,0xe1,0xe1,0xe7,0x04,0xfc,0xff,0x80,0xbf,0xbf,0xbf,0xbf,0x80,0xff,//九格
  0xfc,0x04,0xf7,0xf1,0xf1,0xf7,0x04,0xfc,0xff,0x80,0xbf,0xbf,0xbf,0xbf,0x80,0xff,//十格
  
  0x00,0xFC,0xF8,0xF0,0xE0,0xC0,0x80,0x00,0x00,0x0F,0x07,0x07,0x1F,0x3F,0x19,0x01,//箭头11
  0x00,0xF8,0x04,0x04,0x04,0x04,0x38,0x00,0x00,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x00,//开锁12
  0x00,0xE0,0x10,0x10,0x10,0x10,0xE0,0x00,0x00,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x00,//闭锁13
  0x00,0x00,0x00,0xFC,0xFC,0x18,0x18,0x00,0x00,0x3C,0x7E,0x67,0x67,0x7E,0x3C,0x00,//钥匙14
  0xc0,0x60,0x30,0x18,0x18,0x30,0x60,0xc0,0x01,0x01,0x1f,0x10,0x10,0x1f,0x01,0x01,//上档15
  0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,//黑块16
  0xff,0x01,0x01,0x01,0x01,0x01,0x01,0xff,0xff,0x80,0x80,0x80,0x80,0x80,0x80,0xff,//方框17
  0x00,0x80,0xC0,0xE0,0xE0,0xC0,0x80,0x00,0x07,0x03,0x01,0x00,0x00,0x01,0x03,0x07,//单箭头18
  0xC0,0x60,0x30,0x18,0x18,0x30,0x60,0xC0,0x18,0x0C,0x06,0x03,0x03,0x06,0x0C,0x18,//双箭头19
  
};


const unsigned char Font_8x16[1520]=
{
  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
};


const unsigned char Map[]=
{
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xC0,0xE0,0xF8,0xF8,0xF8,0xF8,0xF8,
  0xF8,0xF0,0xE0,0xE0,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xC0,0xE0,0xF0,0xF0,
  0xF0,0xF0,0xF0,0xF0,0xE0,0xC0,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  0x00,0x00,0xF8,0xFC,0xFE,0xFE,0xFF,0xFE,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
  0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x00,0x00,0xE0,0xFC,0xFF,0xFF,0xFF,0xFF,0xFF,
  0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xF8,0xF8,0xF8,0xF0,0xE0,0xE0,0x00,0x00,0x00,
  0x00,0x00,0x01,0x07,0x07,0x0F,0x0F,0x1F,0x1F,0x1F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,
  0x3F,0x3F,0x3F,0x3F,0x3F,0x07,0x01,0x00,0x00,0x3F,0x3F,0x7F,0x7F,0x7F,0xFF,0xFF,
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,0xFF,0xFF,0xFF,0xFF,0xF1,0xE0,
  0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x01,0x01,0x01,0x00,0xE0,0xF0,0xFC,0xFE,0xFF,
  0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFC,
  0xF1,0xE3,0x03,0x07,0x07,0x0F,0x0F,0x1F,0x1F,0x1F,0x1F,0x1F,0x0F,0x07,0x03,0x00,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x07,0x1F,0x3F,0x7F,
  0xFF,0xFF,0xFF,0xFF,0x7F,0x3F,0x3F,0x7F,0x7F,0xFF,0xFF,0xFF,0xFF,0xFF,0x7F,0x3F,
  0x0F,0x07,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
};


const unsigned char style[]={
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xC0,0xF0,0xF8,
  0x7C,0x3C,0x1E,0x1E,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0E,0x0E,0x1E,
  0x1E,0x1E,0x3C,0x3C,0xF8,0xF0,0xE0,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,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,0xF0,0xFE,0xFF,0x3F,0x03,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  0x00,0x00,0x00,0x01,0x1F,0xFF,0xFE,0xE0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFC,0xFC,0xF8,0x80,0xC0,0xC0,0xC0,0x00,0x00,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xE0,0xE0,0xC0,0x00,0x00,
  0x00,0xF0,0xFC,0xF8,0x70,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x00,0xC0,0xF0,0xF0,0xE0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0xE0,0xFC,0xFF,0xBF,0x3F,0x78,0x70,0x70,0x60,0xE0,0xE0,0xC0,
  0xC0,0xC0,0xC0,0xC0,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,
  0x80,0xC0,0xC0,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  0x00,0x06,0x8E,0x8E,0xFF,0xFF,0xFF,0xFF,0x73,0x71,0x39,0x38,0x18,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xE0,0xFC,0xFF,0xFF,0x1F,0x0F,0xE0,0xFC,0xFF,
  0xFF,0x39,0x9C,0xCE,0xFF,0x3F,0x3F,0x1E,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xC0,
  0xF0,0xFC,0xFF,0x3F,0x0F,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  0x00,0x00,0x00,0x01,0x03,0x07,0x1F,0xFE,0xFE,0xFC,0xEC,0xCC,0xDC,0x99,0xB9,0xB1,
  0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0xB3,0xF3,0xF3,0xF3,0xBB,0x9B,0xD9,0xDD,
  0xDF,0xCF,0xC7,0xC3,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x0C,0x1C,0x1E,0x0F,0xE7,
  0xF7,0xF3,0xE3,0xFF,0xFF,0xFF,0x1C,0x1E,0x1F,0x07,0x03,0x00,0x00,0x00,0x00,0x00,
  0x00,0x00,0x00,0x07,0x07,0x07,0xFF,0xFF,0xFE,0x00,0xC0,0xF1,0xFB,0x3B,0x03,0xFF,
  0xFF,0xFF,0x08,0x78,0xF8,0xF0,0xE0,0x00,0x00,0x00,0x00,0x80,0xCE,0xDF,0x9F,0x07,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x0F,0x1F,0xFF,0xF9,0xF3,0xE7,0x6F,0x6D,0x3D,0x39,0x00,0x00,
  0x00,0x00,0x00,0x00,0x80,0xF1,0xFD,0xFD,0xDD,0xDD,0x9D,0x1D,0x0E,0x0E,0x0F,0x0F,
  0x07,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x9C,0x9F,0x8F,0x07,0x01,
  0x00,0x81,0x83,0x87,0x8F,0x1F,0x1E,0x3E,0x3C,0xBC,0xB8,0x38,0x38,0x38,0x30,0x80,
  0x80,0x80,0x00,0x00,0x3F,0x3F,0x3F,0x00,0x83,0x81,0x8E,0x1E,0x3C,0x3F,0xBF,0x8F,
  0x80,0x80,0x00,0x01,0x00,0x80,0x80,0x00,0x00,0x03,0x07,0x07,0x03,0x00,0x80,0x80,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xE0,
  0xF8,0xFC,0xBE,0x9F,0x9F,0xBF,0xF3,0xF3,0xE3,0x63,0x67,0x76,0x7E,0x7C,0x3C,0x3E,
  0xFF,0xF3,0xF3,0xB1,0x99,0xDB,0xFF,0xFF,0x7F,0x3F,0x00,0x00,0x00,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x61,0x50,0x50,0x48,0x47,0x00,0x3F,0x61,
  0x40,0x40,0x61,0x3F,0x00,0x00,0x41,0x40,0x7F,0x40,0x40,0x00,0x21,0x44,0x44,0x44,
  0x3B,0x00,0x04,0x04,0x44,0x61,0x50,0x50,0x48,0x47,0x00,0x3F,0x61,0x40,0x40,0x61,
  0x3F,0x00,0x41,0x40,0x7F,0x40,0x40,0x00,0x10,0x18,0x16,0x13,0x11,0x7F,0x10,0x00,
  0x00,0x00,0x00,0x00,
};


const unsigned char Labi[]=
{
  
  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,
  0x02,0x07,0x07,0x03,0x01,0x00,0x07,0x07,0x07,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x00,0x1F,0x3F,0x0F,0x00,0x00,0x3F,0x3F,0x1F,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x00,0x03,0x3F,0x3F,0x3F,0x07,0xFF,0xFF,0xFF,0x07,0x00,0x00,
  0x1F,0xFF,0xF9,0xF1,0xFF,0x1F,0xDF,0xFF,0xFF,0xFF,0xFF,0x7F,0x00,0x00,0x00,0x00,
  0x04,0x0F,0x0F,0x1F,0x3F,0xFF,0xFF,0xFF,0x6F,0x1F,0xFF,0xFF,0xFF,0xF0,0xF0,0x00,
  0x00,0x01,0x03,0x07,0x07,0xCF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFB,0xFB,0x79,0x78,0x78,
  0xFF,0xFF,0xFF,0xFF,0xFE,0xFF,0xFF,0xFF,0xFB,0xFB,0xE3,0x07,0x1F,0xFF,0xFF,0x00,
  0x00,0x00,0xC0,0xFF,0xFF,0xFF,0xFF,0xDE,0x7F,0xFB,0xED,0xFF,0xFF,0x3C,0x3E,0x1F,
  0x07,0xE0,0xE0,0xE0,0xC0,0xF8,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFD,0x00,0x00,
  0x80,0xE0,0xE0,0xE0,0x00,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x00,0x00,
  0x00,0x00,0x00,0x80,0x80,0xF8,0xF8,0x00,0x80,0xE0,0xF8,0xFC,0xF8,0x00,0x00,0x80,
  0x80,0x00,0x00,0x00,0x7C,0x3E,0xBE,0xF8,0xC0,0x80,0x80,0xD8,0xFC,0xFE,0x7E,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
};


const unsigned char HanZi[][32]=
{
  
  0X00,0X00,0XFF,0XA0,0XA0,0XAF,0XBA,0XAA,0XAA,0XAA,0XAA,0XAA,0XAF,0XA0,0XA0,0X00,
  0X02,0X0C,0XF0,0X01,0X05,0XE9,0XBD,0XAA,0XAA,0XAA,0XAD,0XA9,0XE1,0X01,0X01,0X00, //厦 0
  
  0X04,0X04,0X04,0X04,0X04,0X04,0X05,0XFE,0X05,0X04,0X04,0X04,0X04,0X0C,0X04,0X00,
  0X00,0X02,0X02,0X04,0X08,0X30,0XC0,0X00,0X80,0X60,0X10,0X08,0X04,0X06,0X04,0X00, //大 1
  
  0X00,0X00,0X00,0X1F,0X12,0X32,0X52,0X92,0X12,0X12,0X12,0X3F,0X10,0X00,0X00,0X00,
  0X00,0X00,0X00,0XFF,0X22,0X22,0X22,0X22,0X22,0X22,0X22,0XFF,0X00,0X00,0X00,0X00, //自 2
  
  0X04,0X24,0X24,0X27,0X64,0X2C,0X04,0X08,0X08,0XFF,0X08,0X08,0X08,0X1F,0X08,0X00,
  0X10,0X28,0XD0,0X10,0X10,0X51,0X32,0X0C,0X30,0XC0,0X02,0X01,0X02,0XFC,0X00,0X00, //动 3
  
  0X01,0X02,0X04,0X1F,0XE0,0X00,0X00,0X00,0XFF,0X02,0X04,0X08,0X18,0X00,0X00,0X00,
  0X00,0X00,0X00,0XFF,0X00,0X20,0X40,0X80,0XFC,0X02,0X02,0X02,0X02,0X02,0X0E,0X00, //化 4
  
  0X04,0X14,0XE4,0X27,0X3C,0X25,0X64,0X24,0X04,0X3F,0X21,0X21,0X21,0X7F,0X20,0X00,
  0X20,0X40,0X80,0X3F,0X2A,0X2A,0XEA,0X2A,0X2A,0XAA,0X2A,0X7E,0X20,0X80,0X00,0X00, //智 5
  
  0X08,0X1B,0X2A,0XCA,0X0A,0X3B,0X0C,0X00,0XFE,0X09,0X11,0X21,0X61,0X07,0X00,0X00,
  0X00,0XFF,0X90,0X92,0X91,0XFE,0X00,0X00,0X7E,0X09,0X11,0X21,0X61,0X01,0X07,0X00, //能 6
  
  0X00,0X20,0X23,0X25,0X29,0X31,0XE1,0X2F,0X21,0X21,0X23,0X21,0X60,0X20,0X00,0X00,
  0X20,0X20,0X20,0X20,0X20,0X20,0X20,0XFF,0X20,0X20,0X20,0X20,0X20,0X60,0X20,0X00, //车 7
  
  0X08,0X44,0X26,0X30,0X02,0X02,0X3F,0X04,0X04,0XFF,0X08,0X08,0X1F,0X08,0X00,0X00,
  0X20,0X20,0X7F,0X80,0X00,0X00,0XFC,0X02,0X02,0XFA,0X22,0X12,0XE2,0X02,0X0E,0X00, //池 8
  
  0X00,0X00,0X20,0X20,0XFF,0X24,0X24,0X24,0X24,0X24,0XFF,0X20,0X20,0X00,0X00,0X00,
  0X10,0X10,0X11,0X12,0XF6,0X90,0X90,0X90,0X90,0X90,0XF4,0X12,0X13,0X30,0X10,0X00, //其 9
  
  0X08,0X08,0X49,0X49,0X49,0X7F,0X49,0X49,0X49,0X49,0X49,0XFF,0X48,0X18,0X08,0X00,
  0X02,0X04,0X08,0X30,0XFF,0X22,0X22,0X22,0X22,0X22,0X22,0X22,0X7F,0X20,0X00,0X00, //君 10
  
  0X08,0X08,0X08,0XB0,0XFF,0X09,0X08,0X00,0X08,0X0B,0XFF,0X09,0X08,0X18,0X08,0X00,
  0X10,0X20,0XC0,0X00,0XFF,0X00,0X90,0X20,0XC0,0X00,0XFF,0X00,0XC0,0X60,0X40,0X00, //林 11
  
  0X00,0X44,0X54,0X54,0X54,0X54,0X54,0X57,0X54,0X54,0X54,0X54,0XFE,0X40,0X00,0X00,
  0X01,0X01,0X82,0X42,0X64,0X08,0X30,0XC0,0X30,0X08,0X24,0X44,0XC2,0X03,0X02,0X00, //灵 12
  
  0X10,0X10,0X10,0X11,0X12,0X14,0X18,0XFF,0X18,0X14,0X12,0X11,0X10,0X30,0X10,0X00,
  0X40,0X41,0X8E,0X00,0X00,0X08,0X06,0XE0,0X08,0X06,0X00,0X08,0X84,0XC3,0X80,0X00, //杰 13
  
  0X00,0X1F,0X12,0X12,0X12,0X12,0XFF,0X12,0X12,0X12,0X12,0X3F,0X10,0X00,0X00,0X00,
  0X00,0XE0,0X40,0X40,0X40,0X40,0XFC,0X42,0X42,0X42,0X42,0XE2,0X02,0X0E,0X00,0X00, //电 14
  
  0X08,0X08,0X0B,0XFF,0X09,0X08,0X00,0X3F,0X20,0X20,0X20,0X7F,0X20,0X00,0X00,0X00,
  0X20,0XC0,0X00,0XFF,0X01,0X82,0X04,0XF8,0X00,0X00,0X00,0XFC,0X02,0X02,0X0E,0X00, //机 15
  
  0X01,0X01,0X3F,0X69,0XA5,0X3F,0X04,0X18,0X13,0X90,0X50,0X10,0X11,0X14,0X18,0X00,
  0X02,0X04,0XF8,0X42,0X21,0XFE,0X00,0X00,0XFC,0X22,0X42,0X82,0X02,0X0E,0X00,0X00, //舵 16
  
  0X04,0X04,0X04,0X14,0X15,0X36,0XDC,0X14,0X15,0X56,0X35,0X14,0X04,0X0C,0X04,0X00,
  0X20,0X21,0X41,0X81,0X52,0X52,0X92,0XA4,0X24,0X48,0X08,0X90,0X40,0X60,0X40,0X00, //参 17
  
  0X08,0X49,0X2A,0X0C,0XFF,0X0A,0X29,0X4C,0X1B,0XE8,0X08,0X08,0X0F,0X18,0X08,0X00,
  0X40,0X41,0X72,0XCC,0X44,0X4A,0X71,0X02,0XC4,0X28,0X10,0X68,0X86,0X03,0X02,0X00, //数 18
  
  0X02,0X3C,0X08,0XFF,0X09,0X05,0X08,0XF8,0X0F,0X08,0X0F,0X08,0X08,0X1F,0X08,0X00,
  0X40,0X40,0X80,0XFF,0X00,0X08,0X30,0XC2,0X0C,0X70,0X82,0X01,0X02,0XFC,0X00,0X00, //物 19
};


#define X_WIDTH 128
#define Y_WIDTH 64
/*--------------------*OLED写数据*--------------------*/
void OLED_Write_Data(unsigned char Data)
{
  unsigned char Temp_i=8;
  OLED_DC=1;;
  OLED_SCL=0; 
  while(Temp_i--)
  { 
    if(Data&0x80){OLED_SDA=1;}
    else{OLED_SDA=0;}
    OLED_SCL=1; 
    asm("nop");;
    asm("nop");;
    asm("nop");;
    OLED_SCL=0;;
    Data<<=1;
  }
}


/*--------------------*OLED写命令*--------------------*/
void OLED_Write_Command(unsigned char Cmd)
{
  unsigned char Temp_i=8;    
  OLED_DC=0;;
  OLED_SCL=0;;
  while(Temp_i--)
  {
    if(Cmd&0x80){OLED_SDA=1;}
    else{OLED_SDA=0;;}
    OLED_SCL=1;;
    
    asm("nop");;
    
    asm("nop");;
    
    asm("nop");;
    
    OLED_SCL=0;;
    Cmd<<=1;;   
  }     
}


/*-------------------*整型转字符串*-------------------*/
void OLED_Set_Pos(unsigned char x,unsigned char y)
{ 
  OLED_Write_Command(0xb0+y);
  OLED_Write_Command(((x&0xf0)>>4)|0x10);
  OLED_Write_Command(x&0x0f);
} 


/*-------------------*整型转字符串*-------------------*/
void OLED_Fill(unsigned char Bmp_data)
{
  unsigned char y,x;
  
  for(y=0;y<8;y++)
  {
    OLED_Write_Command(0xb0+y);
    OLED_Write_Command(0x01);
    OLED_Write_Command(0x10);
    for(x=0;x<X_WIDTH;x++)
      OLED_Write_Data(Bmp_data);
  }
}


/*----------*OLED清除某一局部,参数为左上角坐标加上x,y轴要清楚的长度*----------*/
void OLEDPartClear(unsigned char x,unsigned char y,unsigned char xlen,unsigned char ylen)
{
  unsigned char temp1=0,temp2=0;
  for(temp1=0;temp1<xlen;temp1++)
  {
    OLED_Write_Command(0xb0+x+temp1);
    OLED_Write_Command(0x01);
    OLED_Write_Command(0x10);
    for(temp2=y;temp2<y+ylen;temp2++)
      OLED_Write_Data(0X00);
  }
}


/*---------------------*OLED清屏*---------------------*/
void OLED_Clear(void)
{
  OLED_Fill(0x00);
}


/*--------------------*OLED初始化*--------------------*/
void OLED_Init(void)
{
  unsigned int Temp_Count;
  
  gpio_init(PTB8,GPO,0);  //OLED用IO口初始化为输出
  gpio_init(PTB9,GPO,0);
  gpio_init(PTB10,GPO,0);
  gpio_init(PTB11,GPO,0);
  
  OLED_SCL=1;
  OLED_RST=0;
  for(Temp_Count=0;Temp_Count<50000;Temp_Count++);
  
  OLED_RST=1;
  //从上电到下面开始初始化要有足够的时间,即等待RC复位完毕
  OLED_Write_Command(0xAE|0x00);                            // Display Off (0x00/0x01)
  OLED_Write_Command(0xD5);OLED_Write_Command(0x80);    // Set Clock as 100 Frames/Sec
  OLED_Write_Command(0xA8);OLED_Write_Command(0x3F);    // 1/64 Duty (0x0F~0x3F)
  OLED_Write_Command(0xD3);OLED_Write_Command(0x00);    // Shift Mapping RAM Counter (0x00~0x3F)
  OLED_Write_Command(0x40|0x00);                            // Set Mapping RAM Display Start Line (0x00~0x3F)
  OLED_Write_Command(0x8D);OLED_Write_Command(0x10|0x04);        // Enable Embedded DC/DC Converter (0x00/0x04)
  OLED_Write_Command(0x20);OLED_Write_Command(0x02);              // Set Page Addressing Mode (0x00/0x01/0x02)
  OLED_Write_Command(0xA0|0x01);                      // Set SEG/Column Mapping     0x00左右反置 0x01正常
  OLED_Write_Command(0xC0|0x08);                            // Set COM/Row Scan Direction 0x00上下反置 0x08正常
  OLED_Write_Command(0xDA);OLED_Write_Command(0x02|0x10);        // Set Sequential Configuration (0x00/0x10)
  OLED_Write_Command(0x81);OLED_Write_Command(0xCF);      // Set SEG Output Current
  OLED_Write_Command(0xD9);OLED_Write_Command(0xF1);            // Set Pre-Charge as 15 Clocks & Discharge as 1 Clock
  OLED_Write_Command(0xDB);OLED_Write_Command(0x40);                // Set VCOM Deselect Level
  OLED_Write_Command(0xA4|0x00);                          // Disable Entire Display On (0x00/0x01)
  OLED_Write_Command(0xA6|0x00);                          // Disable Inverse Display On (0x00/0x01)  
  OLED_Write_Command(0xAE|0x01);                          // Display On (0x00/0x01)
  OLED_Clear();                                       // 初始清屏
  OLED_Set_Pos(0,0); 
} 


/*-------------------*整型转字符串*-------------------*/
signed int Int_To_String(signed long Int_Num,signed char String[])
// 返回字符串长度
{
  signed int Num_Length=0;
  signed char Negative_Flag=0;
  signed char *Point_p=String;                //做换向时用的指针
  signed char *Point_s=String;
  if(Int_Num<0)
  {
    Negative_Flag=1;
    Int_Num=0-Int_Num;
  }
  if(Int_Num==0)
    String[Num_Length++]=0;
  while(Int_Num>0)
  {
    String[Num_Length++]=Int_Num%10+0;
    Int_Num=Int_Num/10;
  }
  if(Negative_Flag)
    String[Num_Length++]=-;
  String[Num_Length]=\0;
  Point_p=String+Num_Length-1;                //将P指针指向字符串结束标志之前
  
  for(;Point_p-Point_s>0;Point_p--,Point_s++) //将字符串中存储的数调头   
  {   
    *Point_s^=*Point_p;   
    *Point_p^=*Point_s;   
    *Point_s^=*Point_p;   
  }   
  return(Num_Length);
}


/*------------------*浮点型转字符串*------------------*/
signed int Float_To_String(float Float_Num,signed char String[])
// Dot_Size为小数点后边保留位数
// 返回字符串长度
{
  signed int Num_Length=0;
  signed int Temp_i=0;
  signed char *Point_p=String;                //做换向时用的指针
  signed char *Point_s=String;
  signed char Negative_Flag=0;
  signed long Predot_Num;
  signed long Afterdot_Num;
  float Afterdot_Float;
  
  if(Float_Num<0)
  {
    Negative_Flag=1;
    Float_Num=0-Float_Num;
  }
  
  Predot_Num=(signed long)Float_Num;          //将小数点之前的数变为整数
  Afterdot_Float=Float_Num-Predot_Num;        //单独取出小数点之后的数
  for(Temp_i=Dot_Size;Temp_i>0;Temp_i--)
  {
    Afterdot_Float=Afterdot_Float*10;
  }
  Afterdot_Num=(signed long)Afterdot_Float;
  
  Temp_i=Dot_Size;
  
  while(Afterdot_Num>0|Temp_i>0)
  {
    Temp_i--;
    String[Num_Length++]=Afterdot_Num%10+0;
    Afterdot_Num=Afterdot_Num/10;
  }
  String[Num_Length++]=.;
  
  if(Predot_Num==0)                           //处理小数点前为0的情况
    String[Num_Length++]=0;
  
  while(Predot_Num>0)
  {
    String[Num_Length++]=Predot_Num%10+0;
    Predot_Num=Predot_Num/10;
  }
  
  if(Negative_Flag==1)
    String[Num_Length++]=-;
  String[Num_Length]=\0;                    //加上字符串结束标志
  
  Point_p=String+Num_Length-1;                //将P指针指向字符串结束标志之前
  
  for(;Point_p-Point_s>0;Point_p--,Point_s++) //将字符串中存储的数调头   
  {   
    *Point_s^=*Point_p;   
    *Point_p^=*Point_s;   
    *Point_s^=*Point_p;   
  }   
  
  return(Num_Length);
}


/*-----------------*OLED写一个字符串*-----------------*/      
void OLED_Write_String(unsigned char x,unsigned char y,signed char String[])
{
  unsigned char Temp_Char=0,Temp_i=0,Temp_j=0;
  if(x>7) return;   
  while(String[Temp_j]!=\0)
  {    
    Temp_Char=String[Temp_j]-32;
    if(y>120){y=0;x++;}
    OLED_Set_Pos(y,x);    
    for(Temp_i=0;Temp_i<8;Temp_i++) 
      OLED_Write_Data(Font_8x16[Temp_Char*16+Temp_i]);
    OLED_Set_Pos(y,x+1);    
    for(Temp_i=0;Temp_i<8;Temp_i++)     
      OLED_Write_Data(Font_8x16[Temp_Char*16+Temp_i+8]);  
    y+=8;
    Temp_j++;
  }
}


/*-----------------*OLED写一个字符*-------------------*/      
void OLED_Write_Char(unsigned char x,unsigned char y,signed char Asc) 
{
  signed char Temp_String[2];
  y=y*8;        
  Temp_String[0]=Asc;    
  Temp_String[1]=\0;                              //字母占一个字节
  OLED_Write_String(x,y,Temp_String);            //显示字母
}


/*-----------------*OLED写一个字符*-------------------*/      
void OLED_Write_Draw(unsigned char x,unsigned char y,signed char Asc) 
{
  unsigned char Temp_i;
  unsigned char Temp_Char;
  y=y*8;
  if(y>120) return;
  if(x>7) return;
  Temp_Char=Asc;
  
  OLED_Set_Pos(y,x);    
  for(Temp_i=0;Temp_i<8;Temp_i++)     
    OLED_Write_Data(Draw[Temp_Char*16+Temp_i]);
  OLED_Set_Pos(y,x+1);    
  for(Temp_i=0;Temp_i<8;Temp_i++)     
    OLED_Write_Data(Draw[Temp_Char*16+Temp_i+8]);  
}


void OLED_Write_Map(unsigned char x,unsigned char y,signed char Asc) 
{
  unsigned char Temp_i;
  unsigned char Temp_Char;
  y=y*8;
  
  Temp_Char=Asc;
  
  OLED_Set_Pos(y,x);    
  for(Temp_i=0;Temp_i<8;Temp_i++)     
    OLED_Write_Data(Map[Temp_Char*16+Temp_i]);
  OLED_Set_Pos(y,x+1);    
  for(Temp_i=0;Temp_i<8;Temp_i++)     
    OLED_Write_Data(Map[Temp_Char*16+Temp_i+8]);  
}


/*----------------*OLED写一个整型数据*----------------*/      
void OLED_Write_Int(unsigned char x,unsigned char y,signed int Number)
{
  if(x>7) return;
  signed char Temp_Buf[17];
  (void)Int_To_String(Number,Temp_Buf);
  OLED_Write_String(x,y,Temp_Buf);   
}


/*---------------*OLED写一个浮点型数据*---------------*/
void OLED_Write_Float(unsigned char x,unsigned char y,float Number)
{
  signed char Temp_Buf[17];
  (void)Float_To_String(Number,Temp_Buf);
  OLED_Write_String(x,y,Temp_Buf);   
}


/*--------------------*OLED写汉字数据专用*--------------------*/
void OLED_Write_HZ_Data(unsigned char Data)
{
  unsigned char Temp_i=8;
  OLED_DC=1;;
  OLED_SCL=0;
  while(Temp_i--)
  {
    if(Data&0x01){OLED_SDA=1;}
    else{OLED_SDA=0;}
    OLED_SCL=1;
    asm("nop");;
    asm("nop");;
    asm

 

二、使用方法:

     初始化之后就可以直接调用头文件的方法即可

智能车学习(六)——OLED屏幕使用

标签:

原文地址:http://www.cnblogs.com/BlueMountain-HaggenDazs/p/4912171.html

(0)
(2)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!