您的位置:首页 > 其它

【BLE】CC2541之OLED

2015-10-03 15:23 246 查看
[b]本篇博文最后修改时间:2017年01月06日,11:06。
[/b]



一、简介

本文介绍如何使用OLED(SSD1306)。

二、实验平台

协议栈版本:BLE-CC254x-1.4.0

编译软件:IAR 8.20.2

硬件平台:Smart RF开发板(主芯片CC2541)

版权声明

博主:甜甜的大香瓜

声明:喝水不忘挖井人,转载请注明出处。

原文地址:http://blog.csdn.NET/feilusia

联系方式:897503845@qq.com

香瓜BLE之CC2541群:127442605

香瓜BLE之CC2640群:557278427

香瓜BLE之Android群:541462902

香瓜单片机之STM8/STM32群:164311667

甜甜的大香瓜的小店(淘宝店):https://shop217632629.taobao.com/?spm=2013.1.1000126.d21.hd2o8i

四、实验前提
1、在进行本文步骤前,请先阅读以下博文:
暂无

2、在进行本文步骤前,请先实现以下博文:

暂无

五、基础知识

暂无

六、实验步骤

1、IAR设置中的添加宏

HAL_LCD=TRUE

2、替换LCD驱动(hal_lcd.c)

/*
CC254x test demo [电装科技]
by AMO
20130106
*/

/*
说明:
oled 128x64的显示屏, 驱动实现代码
*/

/**************************************************************************************************
*                                           INCLUDES
**************************************************************************************************/
#if (HAL_LCD == TRUE)
#include "hal_types.h"
#include "hal_lcd.h"
#include "OSAL.h"
#include "OnBoard.h"
#include "hal_assert.h"

#if defined (ZTOOL_P1) || defined (ZTOOL_P2)
#include "DebugTrace.h"
#endif

#else

#include "ioCC2540.h"
#endif

#ifdef LCD_TO_UART
#include "npi.h"
#endif

#include "stdio.h"
#include "Hal_lcd.h"

#define LCD_SCL P1_5       //SCLK  时钟 D0(SCLK)
#define LCD_SDA P1_6       //SDA   D1(MOSI) 数据
#define LCD_RST P1_7       //_RES  hardware reset   复位
#define LCD_DC  P1_2       //A0  H/L 命令数据选通端,H:数据,L:命令

#define X_WIDTH        128
#define Y_WIDTH        64

/* LCD lines */
#define LCD_MAX_LINE_COUNT              8
#define LCD_MAX_LINE_LENGTH             21
#define LCD_MAX_BUF                     25

static uint8 *Lcd_Line1;

#ifdef LCD_SUPPORT
/***************************16*16的点阵字体取模方式:共阴——列行式——逆向输出*********/
const unsigned char F16x16[] =
{
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,0xFF,0xFF,0x33,0xFF,0xFF,0x00,0xFF,0xFF,0xC3,0xDB,0xDB,0xDF,0xCF,0x00,0x00,
0x20,0x7F,0x1F,0x63,0x7F,0x3F,0x00,0x7F,0x7F,0x20,0x37,0x18,0x3F,0x73,0x20,0x00,

/*--  文字:  务  --*/
0x80,0x80,0x90,0x98,0xCC,0xDF,0x77,0x66,0x66,0xF6,0xDE,0x8E,0x80,0x80,0x80,0x00,
0x00,0x61,0x61,0x67,0x36,0x3E,0x1F,0x07,0x06,0x66,0x7E,0x3F,0x01,0x01,0x00,0x00,

/*--  文字:  创  --*/
0x20,0x30,0xF8,0xEC,0x67,0x6F,0xFC,0xF8,0x10,0xF8,0xF8,0x00,0xFE,0xFE,0x00,0x00,
0x00,0x00,0x3F,0x7F,0x60,0x66,0x67,0x73,0x30,0x0F,0x0F,0x60,0x7F,0x3F,0x00,0x00,

/*--  文字:  新  --*/
0x00,0x66,0x7E,0x7E,0xE7,0xFF,0x7E,0x66,0x00,0xFE,0xFE,0x66,0xE6,0xE7,0x63,0x00,
0x00,0x33,0x1B,0x63,0x7F,0x3F,0x0B,0x5B,0x70,0x3F,0x0F,0x00,0x7F,0x7F,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,

/*--  文字:  深  --*/
/*--  宋体12;  此字体下对应的点阵为:宽x高=16x16   --*/
0x10,0x61,0x06,0xE0,0x00,0x26,0x22,0x1A,0x02,0xC2,0x0A,0x12,0x32,0x06,0x02,0x00,
0x04,0xFC,0x03,0x20,0x20,0x11,0x11,0x09,0x05,0xFF,0x05,0x09,0x19,0x31,0x10,0x00,

/*--  文字:  圳  --*/
/*--  宋体12;  此字体下对应的点阵为:宽x高=16x16   --*/
0x10,0x10,0x10,0xFE,0x10,0x10,0xFE,0x00,0x00,0xFC,0x00,0x00,0x00,0xFE,0x00,0x00,
0x08,0x08,0x04,0x47,0x24,0x18,0x07,0x00,0x00,0x1F,0x00,0x00,0x00,0x7F,0x00,0x00,

/*--  文字:  市  --*/
/*--  宋体12;  此字体下对应的点阵为:宽x高=16x16   --*/
0x04,0x04,0x04,0xE4,0x24,0x24,0x25,0xFE,0x24,0x24,0x24,0x24,0xE4,0x04,0x04,0x00,
0x00,0x00,0x00,0x3F,0x00,0x00,0x00,0xFF,0x00,0x00,0x10,0x20,0x1F,0x00,0x00,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,0x42,0x2C,0x24,0x10,0xFF,0x04,0x64,0xA4,0x24,0x3F,0x24,0x24,0x24,0x04,0x00,
0x20,0x21,0x11,0x11,0xF9,0x45,0x23,0x03,0x05,0x09,0x11,0x29,0x45,0xC1,0x41,0x00,

/*--  文字:  科  --*/
/*--  宋体12;  此字体下对应的点阵为:宽x高=16x16   --*/
0x10,0x12,0x92,0x72,0xFE,0x51,0x91,0x00,0x22,0xCC,0x00,0x00,0xFF,0x00,0x00,0x00,
0x04,0x02,0x01,0x00,0xFF,0x00,0x04,0x04,0x04,0x02,0x02,0x02,0xFF,0x01,0x01,0x00,

/*--  文字:  技  --*/
/*--  宋体12;  此字体下对应的点阵为:宽x高=16x16   --*/
0x08,0x08,0x88,0xFF,0x48,0x28,0x00,0xC8,0x48,0x48,0x7F,0x48,0xC8,0x48,0x08,0x00,
0x01,0x41,0x80,0x7F,0x00,0x40,0x40,0x20,0x13,0x0C,0x0C,0x12,0x21,0x60,0x20,0x00,

/*--  文字:  专  --*/
/*--  宋体12;  此字体下对应的点阵为:宽x高=16x16   --*/
0x20,0x20,0x24,0x24,0xA4,0x64,0x3C,0x27,0x24,0x24,0xA4,0x24,0x24,0x20,0x20,0x00,
0x00,0x00,0x00,0x00,0x01,0x01,0x09,0x11,0x29,0x45,0x03,0x01,0x00,0x00,0x00,0x00,

/*--  文字:  业  --*/
/*--  宋体12;  此字体下对应的点阵为:宽x高=16x16   --*/
0x00,0x10,0x60,0x80,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x80,0x60,0x38,0x10,0x00,
0x20,0x20,0x20,0x23,0x21,0x3F,0x20,0x20,0x20,0x3F,0x22,0x21,0x20,0x30,0x20,0x00,

/*--  文字:  专  --*/
/*--  宋体12;  此字体下对应的点阵为:宽x高=16x16   --*/
0x20,0x20,0x24,0x24,0xA4,0x64,0x3C,0x27,0x24,0x24,0xA4,0x24,0x24,0x20,0x20,0x00,
0x00,0x00,0x00,0x00,0x01,0x01,0x09,0x11,0x29,0x45,0x03,0x01,0x00,0x00,0x00,0x00,

/*--  文字:  注  --*/
/*--  宋体12;  此字体下对应的点阵为:宽x高=16x16   --*/
0x10,0x60,0x01,0x86,0x60,0x08,0x08,0x08,0x09,0xFE,0x08,0x08,0x08,0x08,0x08,0x00,
0x04,0x04,0xFE,0x01,0x40,0x40,0x41,0x41,0x41,0x7F,0x41,0x41,0x41,0x41,0x40,0x00,

/*--  文字:  无  --*/
/*--  宋体12;  此字体下对应的点阵为:宽x高=16x16   --*/
0x00,0x40,0x42,0x42,0x42,0x42,0x42,0xFE,0xC2,0x42,0x42,0x42,0x42,0x42,0x40,0x00,
0x40,0x40,0x20,0x10,0x08,0x04,0x03,0x00,0x3F,0x40,0x40,0x40,0x40,0x40,0x70,0x00,

/*--  文字:  线  --*/
/*--  宋体12;  此字体下对应的点阵为:宽x高=16x16   --*/
0x40,0x60,0x58,0xC7,0x62,0x00,0x90,0x90,0x90,0xFF,0x90,0x92,0x9C,0x94,0x80,0x00,
0x20,0x22,0x23,0x12,0x12,0x12,0x20,0x20,0x10,0x13,0x0C,0x14,0x22,0x40,0xF8,0x00,

/*--  文字:  通  --*/
/*--  宋体12;  此字体下对应的点阵为:宽x高=16x16   --*/
0x40,0x41,0xC6,0x00,0x00,0xF2,0x52,0x52,0x56,0xFA,0x5A,0x56,0xF2,0x00,0x00,0x00,
0x40,0x20,0x1F,0x20,0x40,0x5F,0x42,0x42,0x42,0x5F,0x4A,0x52,0x4F,0x40,0x40,0x00,

/*--  文字:  讯  --*/
/*--  宋体12;  此字体下对应的点阵为:宽x高=16x16   --*/
0x20,0x21,0x2E,0xE4,0x00,0x42,0x42,0xFE,0x42,0x42,0x42,0x02,0xFE,0x00,0x00,0x00,
0x00,0x00,0x00,0x7F,0x20,0x10,0x00,0x7F,0x00,0x00,0x00,0x00,0x3F,0x40,0x38,0x00,

/*--  文字:  十  --*/
/*--  宋体12;  此字体下对应的点阵为:宽x高=16x16   --*/
0x40,0x40,0x40,0x40,0x40,0x40,0x40,0xFF,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,

/*--  文字:  年  --*/
/*--  宋体12;  此字体下对应的点阵为:宽x高=16x16   --*/
0x40,0x20,0x10,0x0C,0xE3,0x22,0x22,0x22,0xFE,0x22,0x22,0x22,0x22,0x02,0x00,0x00,
0x04,0x04,0x04,0x04,0x07,0x04,0x04,0x04,0xFF,0x04,0x04,0x04,0x04,0x04,0x04,0x00,

/*--  文字:  经  --*/
/*--  宋体12;  此字体下对应的点阵为:宽x高=16x16   --*/
0x20,0x30,0xAC,0x63,0x10,0x00,0x40,0x42,0x22,0x22,0x12,0x1A,0x26,0x42,0xC0,0x00,
0x22,0x23,0x22,0x12,0x12,0x00,0x20,0x21,0x21,0x21,0x3F,0x21,0x21,0x21,0x20,0x00,

/*--  文字:  验  --*/
/*--  宋体12;  此字体下对应的点阵为:宽x高=16x16   --*/
0x02,0xFA,0x82,0x82,0xFE,0x80,0x40,0x60,0x58,0x46,0x48,0x50,0x20,0x20,0x20,0x00,
0x08,0x08,0x04,0x24,0x40,0x3F,0x22,0x2C,0x21,0x2E,0x20,0x30,0x2C,0x23,0x20,0x00,

/*--  文字:  开  --*/
/*--  宋体12;  此字体下对应的点阵为:宽x高=16x16   --*/
0x40,0x42,0x42,0x42,0x42,0xFE,0x42,0x42,0x42,0x42,0xFE,0x42,0x42,0x42,0x42,0x00,
0x00,0x40,0x20,0x10,0x0C,0x03,0x00,0x00,0x00,0x00,0x7F,0x00,0x00,0x00,0x00,0x00,

/*--  文字:  拓  --*/
/*--  宋体12;  此字体下对应的点阵为:宽x高=16x16   --*/
0x08,0x08,0x08,0xFF,0x48,0x28,0x0A,0x02,0xE2,0x9E,0x82,0x82,0x82,0x82,0x02,0x00,
0x02,0x42,0x81,0x7F,0x00,0x08,0x04,0x03,0x7F,0x20,0x20,0x20,0x20,0x7F,0x00,0x00,

/*--  文字:  创  --*/
/*--  宋体12;  此字体下对应的点阵为:宽x高=16x16   --*/
0x40,0x20,0xD0,0x4C,0x43,0x44,0x48,0xD8,0x30,0x10,0x00,0xFC,0x00,0x00,0xFF,0x00,
0x00,0x00,0x3F,0x40,0x40,0x42,0x44,0x43,0x78,0x00,0x00,0x07,0x20,0x40,0x3F,0x00,

/*--  文字:  新  --*/
/*--  宋体12;  此字体下对应的点阵为:宽x高=16x16   --*/
0x20,0x24,0x2C,0x35,0xE6,0x34,0x2C,0x24,0x00,0xFC,0x24,0x24,0xE2,0x22,0x22,0x00,
0x21,0x11,0x4D,0x81,0x7F,0x05,0x59,0x21,0x18,0x07,0x00,0x00,0xFF,0x00,0x00,0x00,

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

};

/****************************************8*16的点阵************************************/
static const unsigned char 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
};
#endif

/************************************6*8的点阵************************************/
static const unsigned char F6x8[92][6] =
{
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,// sp
0x00, 0x00, 0x00, 0x2f, 0x00, 0x00,// !
0x00, 0x00, 0x07, 0x00, 0x07, 0x00,// "
0x00, 0x14, 0x7f, 0x14, 0x7f, 0x14,// #
0x00, 0x24, 0x2a, 0x7f, 0x2a, 0x12,// $
0x00, 0x62, 0x64, 0x08, 0x13, 0x23,// %
0x00, 0x36, 0x49, 0x55, 0x22, 0x50,// &
0x00, 0x00, 0x05, 0x03, 0x00, 0x00,// '
0x00, 0x00, 0x1c, 0x22, 0x41, 0x00,// (
0x00, 0x00, 0x41, 0x22, 0x1c, 0x00,// )
0x00, 0x14, 0x08, 0x3E, 0x08, 0x14,// *
0x00, 0x08, 0x08, 0x3E, 0x08, 0x08,// +
0x00, 0x00, 0x00, 0xA0, 0x60, 0x00,// ,
0x00, 0x08, 0x08, 0x08, 0x08, 0x08,// -
0x00, 0x00, 0x60, 0x60, 0x00, 0x00,// .
0x00, 0x20, 0x10, 0x08, 0x04, 0x02,// /
0x00, 0x3E, 0x51, 0x49, 0x45, 0x3E,// 0
0x00, 0x00, 0x42, 0x7F, 0x40, 0x00,// 1
0x00, 0x42, 0x61, 0x51, 0x49, 0x46,// 2
0x00, 0x21, 0x41, 0x45, 0x4B, 0x31,// 3
0x00, 0x18, 0x14, 0x12, 0x7F, 0x10,// 4
0x00, 0x27, 0x45, 0x45, 0x45, 0x39,// 5
0x00, 0x3C, 0x4A, 0x49, 0x49, 0x30,// 6
0x00, 0x01, 0x71, 0x09, 0x05, 0x03,// 7
0x00, 0x36, 0x49, 0x49, 0x49, 0x36,// 8
0x00, 0x06, 0x49, 0x49, 0x29, 0x1E,// 9
0x00, 0x00, 0x36, 0x36, 0x00, 0x00,// :
0x00, 0x00, 0x56, 0x36, 0x00, 0x00,// ;
0x00, 0x08, 0x14, 0x22, 0x41, 0x00,// <
0x00, 0x14, 0x14, 0x14, 0x14, 0x14,// =
0x00, 0x00, 0x41, 0x22, 0x14, 0x08,// >
0x00, 0x02, 0x01, 0x51, 0x09, 0x06,// ?
0x00, 0x32, 0x49, 0x59, 0x51, 0x3E,// @
0x00, 0x7C, 0x12, 0x11, 0x12, 0x7C,// A
0x00, 0x7F, 0x49, 0x49, 0x49, 0x36,// B
0x00, 0x3E, 0x41, 0x41, 0x41, 0x22,// C
0x00, 0x7F, 0x41, 0x41, 0x22, 0x1C,// D
0x00, 0x7F, 0x49, 0x49, 0x49, 0x41,// E
0x00, 0x7F, 0x09, 0x09, 0x09, 0x01,// F
0x00, 0x3E, 0x41, 0x49, 0x49, 0x7A,// G
0x00, 0x7F, 0x08, 0x08, 0x08, 0x7F,// H
0x00, 0x00, 0x41, 0x7F, 0x41, 0x00,// I
0x00, 0x20, 0x40, 0x41, 0x3F, 0x01,// J
0x00, 0x7F, 0x08, 0x14, 0x22, 0x41,// K
0x00, 0x7F, 0x40, 0x40, 0x40, 0x40,// L
0x00, 0x7F, 0x02, 0x0C, 0x02, 0x7F,// M
0x00, 0x7F, 0x04, 0x08, 0x10, 0x7F,// N
0x00, 0x3E, 0x41, 0x41, 0x41, 0x3E,// O
0x00, 0x7F, 0x09, 0x09, 0x09, 0x06,// P
0x00, 0x3E, 0x41, 0x51, 0x21, 0x5E,// Q
0x00, 0x7F, 0x09, 0x19, 0x29, 0x46,// R
0x00, 0x46, 0x49, 0x49, 0x49, 0x31,// S
0x00, 0x01, 0x01, 0x7F, 0x01, 0x01,// T
0x00, 0x3F, 0x40, 0x40, 0x40, 0x3F,// U
0x00, 0x1F, 0x20, 0x40, 0x20, 0x1F,// V
0x00, 0x3F, 0x40, 0x38, 0x40, 0x3F,// W
0x00, 0x63, 0x14, 0x08, 0x14, 0x63,// X
0x00, 0x07, 0x08, 0x70, 0x08, 0x07,// Y
0x00, 0x61, 0x51, 0x49, 0x45, 0x43,// Z
0x00, 0x00, 0x7F, 0x41, 0x41, 0x00,// [
0x00, 0x55, 0x2A, 0x55, 0x2A, 0x55,// 55
0x00, 0x00, 0x41, 0x41, 0x7F, 0x00,// ]
0x00, 0x04, 0x02, 0x01, 0x02, 0x04,// ^
0x00, 0x40, 0x40, 0x40, 0x40, 0x40,// _
0x00, 0x00, 0x01, 0x02, 0x04, 0x00,// '
0x00, 0x20, 0x54, 0x54, 0x54, 0x78,// a
0x00, 0x7F, 0x48, 0x44, 0x44, 0x38,// b
0x00, 0x38, 0x44, 0x44, 0x44, 0x20,// c
0x00, 0x38, 0x44, 0x44, 0x48, 0x7F,// d
0x00, 0x38, 0x54, 0x54, 0x54, 0x18,// e
0x00, 0x08, 0x7E, 0x09, 0x01, 0x02,// f
0x00, 0x18, 0xA4, 0xA4, 0xA4, 0x7C,// g
0x00, 0x7F, 0x08, 0x04, 0x04, 0x78,// h
0x00, 0x00, 0x44, 0x7D, 0x40, 0x00,// i
0x00, 0x40, 0x80, 0x84, 0x7D, 0x00,// j
0x00, 0x7F, 0x10, 0x28, 0x44, 0x00,// k
0x00, 0x00, 0x41, 0x7F, 0x40, 0x00,// l
0x00, 0x7C, 0x04, 0x18, 0x04, 0x78,// m
0x00, 0x7C, 0x08, 0x04, 0x04, 0x78,// n
0x00, 0x38, 0x44, 0x44, 0x44, 0x38,// o
0x00, 0xFC, 0x24, 0x24, 0x24, 0x18,// p
0x00, 0x18, 0x24, 0x24, 0x18, 0xFC,// q
0x00, 0x7C, 0x08, 0x04, 0x04, 0x08,// r
0x00, 0x48, 0x54, 0x54, 0x54, 0x20,// s
0x00, 0x04, 0x3F, 0x44, 0x40, 0x20,// t
0x00, 0x3C, 0x40, 0x40, 0x20, 0x7C,// u
0x00, 0x1C, 0x20, 0x40, 0x20, 0x1C,// v
0x00, 0x3C, 0x40, 0x30, 0x40, 0x3C,// w
0x00, 0x44, 0x28, 0x10, 0x28, 0x44,// x
0x00, 0x1C, 0xA0, 0xA0, 0xA0, 0x7C,// y
0x00, 0x44, 0x64, 0x54, 0x4C, 0x44,// z
0x14, 0x14, 0x14, 0x14, 0x14, 0x14,// horiz lines
};

/*--  宽度x高度=128x64  D:\mdcg.bmp--*/
#if 0
unsigned char BMP[] =
{
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,0xFC,0xFC,0x70,0xE0,0xFF,0x8C,0xF0,0xE0,0xC0,0xC0,0xC0,0xE0,
0xE0,0xF0,0xF0,0xF0,0xF8,0x98,0x1C,0x0C,0x2C,0x24,0x04,0x1C,0xF8,0x00,0x00,0xFE,
0xFF,0x4C,0x4C,0xF8,0xF8,0x60,0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x80,0x80,0xC0,0xC0,0xC0,0xC0,0xC0,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,
0x60,0x60,0xF8,0xF8,0xFF,0xBF,0xFE,0xFF,0xFF,0xFF,0x87,0x83,0xBF,0xBF,0xFF,0xFF,
0xFD,0xE1,0xF1,0xFF,0xFF,0xFF,0xFC,0x61,0x62,0x32,0x13,0x1D,0x0F,0x00,0x00,0x03,
0xEF,0x7A,0x7E,0xCF,0x9D,0x1B,0x06,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xC0,0x60,
0x18,0x0C,0xC6,0xE2,0x79,0x7D,0xB7,0xF2,0x71,0x39,0x19,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,0x0E,0x0E,0x0E,0xCE,0x0E,0x0E,0x0E,0x0E,0x0E,0xFE,0x00,0x00,0x00,0x00,
0x0E,0x0E,0x0E,0xCE,0x3E,0xCE,0x0E,0x0E,0x0E,0xC0,0x00,0x00,0x00,0xFE,0x00,0x00,
0x00,0x09,0x97,0xDE,0x6D,0xB7,0xFF,0x7F,0xFF,0xFF,0x9F,0x1F,0x4F,0x87,0xC7,0xE7,
0x17,0x9F,0x9D,0xF1,0xE1,0xC0,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x0F,
0x83,0xE0,0x60,0x1D,0xFF,0xFE,0x06,0x0E,0x1C,0x18,0x00,0x00,0xF0,0x87,0xC1,0xE0,
0x70,0x38,0x1F,0x1E,0x1F,0x1D,0x07,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xFE,0xC0,0xCE,0xF0,0xF0,0xC0,0x00,
0x30,0x30,0x30,0xF0,0x30,0x30,0x00,0x00,0x00,0xFE,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0xF0,0xCF,0xC0,0xC0,0xC0,0xC0,0xFE,0xC1,0xC0,0xC0,0x00,0x00,
0x30,0x3E,0x3E,0x31,0xF0,0x31,0x3E,0x3E,0x30,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,
0x00,0x00,0x00,0x03,0x0D,0x3E,0xDB,0x6B,0x37,0x1F,0x7C,0xFC,0xC5,0xC7,0x3F,0x07,
0x03,0x86,0x8C,0xC0,0xC0,0xC1,0xE3,0x6F,0xEE,0xFC,0x38,0x30,0x30,0x90,0x90,0x7B,
0xE9,0xEC,0x7C,0xFC,0xFF,0xFE,0xFE,0xF7,0xEF,0x3F,0x3F,0xBD,0xF7,0xDF,0x7E,0xF8,
0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0xFF,0xFF,0xC1,0xC1,0xC1,0x01,0x01,0xFF,0x01,0x01,0xF1,0xF1,0x01,0x00,
0x00,0x00,0x00,0xFF,0x00,0x00,0x0E,0x0E,0x0E,0xFF,0x0E,0x0E,0x0E,0xFE,0x00,0x00,
0x00,0x38,0x38,0x38,0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x01,0xFF,0xFF,0x00,0x00,
0x38,0x38,0x38,0x38,0xFF,0x38,0x38,0x38,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,
0x00,0x00,0x00,0x08,0xFC,0xFC,0x1E,0x3E,0xFE,0xFE,0xE7,0xE7,0xE3,0xC7,0xCF,0xD9,
0xF1,0xF0,0xF9,0x0C,0x60,0xFF,0xFF,0xDB,0x9B,0x08,0x01,0xFF,0xFF,0xCC,0xEC,0xEE,
0xEE,0xC3,0xFF,0x2D,0x6C,0x76,0x37,0x33,0x13,0xFF,0x7C,0x96,0xD6,0xEB,0x6B,0xE9,
0xFF,0xFF,0xF8,0xF0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0xFF,0xFF,0xC1,0x01,0xFF,0x00,0x00,0x07,0xF8,0x06,0x01,0x01,0xC0,0x00,
0xC0,0xC0,0xC0,0x3F,0x38,0x38,0x00,0x00,0xF8,0x07,0x00,0x00,0x00,0xFF,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x38,0x38,0x38,0x07,0x07,0x00,0x00,
0x38,0x38,0x38,0x38,0x07,0x06,0x06,0x06,0x06,0x01,0x38,0x38,0x38,0x3F,0x00,0x00,
0x00,0x00,0x00,0x00,0x7F,0xFF,0x00,0x00,0x7F,0xFF,0x00,0x00,0x00,0x00,0x00,0x81,
0xC1,0x7D,0x1F,0x03,0x87,0x66,0x7C,0x1C,0x1E,0x1F,0x3F,0x3B,0x33,0x37,0x37,0x7E,
0x7C,0x37,0x34,0x37,0x3F,0x1B,0x1B,0x78,0x7F,0x87,0x84,0xFE,0xFE,0x03,0x07,0x07,
0x18,0x38,0x60,0xC0,0x0F,0x3C,0xE0,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x38,0x07,0x07,0x01,0x06,0x01,0x38,0x38,0x06,0x01,0x06,0x38,0x38,0x3F,0x00,
0x01,0x01,0x01,0x00,0x38,0x38,0x06,0x06,0x01,0x38,0x38,0x38,0x38,0x07,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,0x3F,0x3F,0x3F,0x3F,0x3F,0xB0,0x80,0x70,0xB8,0x7F,0x7F,
0x1B,0x0C,0x06,0x03,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x80,0x80,0x40,
0x40,0x60,0xA0,0xB0,0x98,0x48,0x48,0x64,0x34,0x1F,0x1B,0x0F,0x07,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x07,0x06,0x19,0x3F,0x7C,0xF8,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,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,0xC0,0xF0,0xF8,0xCC,0xE6,0x1F,0x0D,0x03,0x01,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x78,0x3F,0x3F,0x3F,0x3F,0x06,
0x02,0x03,0x03,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFC,0xFF,0xFF,0xFF,0xFF,0x0E,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,
};
#endif

/*********************LCD 延时1ms************************************/
void LCD_DLY_ms(unsigned int ms)
{
unsigned int a;
while(ms)
{
a=1800;
while(a--);
ms--;
}
return;
}

/*********************LCD写数据************************************/
void LCD_WrDat(unsigned char dat)
{
unsigned char i=8, temp=0;
LCD_DC=1;
for(i=0;i<8;i++) //发送一个八位数据
{
LCD_SCL=0;

temp = dat&0x80;
if (temp == 0)
{
LCD_SDA = 0;
}
else
{
LCD_SDA = 1;
}
LCD_SCL=1;
dat<<=1;
}
}
/*********************LCD写命令************************************/
void LCD_WrCmd(unsigned char cmd)
{
unsigned char i=8, temp=0;
LCD_DC=0;
for(i=0;i<8;i++) //发送一个八位数据
{
LCD_SCL=0;

temp = cmd&0x80;
if (temp == 0)
{
LCD_SDA = 0;
}
else
{
LCD_SDA = 1;
}
LCD_SCL=1;
cmd<<=1;;
}
}
/*********************LCD 设置坐标************************************/
void LCD_Set_Pos(unsigned char x, unsigned char y)
{
LCD_WrCmd(0xb0+y);
LCD_WrCmd(((x&0xf0)>>4)|0x10);
LCD_WrCmd((x&0x0f)|0x01);
}
/*********************LCD全屏************************************/
void LCD_Fill(unsigned char bmp_dat)
{
unsigned char y,x;
for(y=0;y<8;y++)
{
LCD_WrCmd(0xb0+y);
LCD_WrCmd(0x01);
LCD_WrCmd(0x10);
for(x=0;x<X_WIDTH;x++)
LCD_WrDat(bmp_dat);
}
}

/***************功能描述:行填充, y为页范围0~7****************/
void LCD_FillLine(unsigned char y,unsigned char ch)
{
unsigned char x;
LCD_WrCmd(0xb0+y);
LCD_WrCmd(0x01);
LCD_WrCmd(0x10);
for(x=0;x<X_WIDTH;x++)
LCD_WrDat(ch);
}

/*********************LCD复位************************************/
void LCD_CLS(void)
{
unsigned char y,x;
for(y=0;y<8;y++)
{
LCD_WrCmd(0xb0+y);
LCD_WrCmd(0x01);
LCD_WrCmd(0x10);
for(x=0;x<X_WIDTH;x++)
LCD_WrDat(0);
}
}
/*********************LCD初始化************************************/
void HalLcd_HW_Init(void)
{
P1SEL &= 0x1b; //让 P1.2 P1.5 P1.6 P1.7为普通IO口           00011011
P1DIR |= 0xe4; //把 P1.2 P1.3 1.7设置为输出                 11100100

LCD_SCL=1;
LCD_RST=0;
LCD_DLY_ms(50);
LCD_RST=1;      //从上电到下面开始初始化要有足够的时间,即等待RC复位完毕
LCD_WrCmd(0xae);//--turn off oled panel
LCD_WrCmd(0x00);//---set low column address
LCD_WrCmd(0x10);//---set high column address
LCD_WrCmd(0x40);//--set start line address  Set Mapping RAM Display Start Line (0x00~0x3F)
LCD_WrCmd(0x81);//--set contrast control register
LCD_WrCmd(0xcf); // Set SEG Output Current Brightness
LCD_WrCmd(0xa1);//--Set SEG/Column Mapping     0xa0左右反置 0xa1正常
LCD_WrCmd(0xc8);//Set COM/Row Scan Direction   0xc0上下反置 0xc8正常
LCD_WrCmd(0xa6);//--set normal display
LCD_WrCmd(0xa8);//--set multiplex ratio(1 to 64)
LCD_WrCmd(0x3f);//--1/64 duty
LCD_WrCmd(0xd3);//-set display offset    Shift Mapping RAM Counter (0x00~0x3F)
LCD_WrCmd(0x00);//-not offset
LCD_WrCmd(0xd5);//--set display clock divide ratio/oscillator frequency
LCD_WrCmd(0x80);//--set divide ratio, Set Clock as 100 Frames/Sec
LCD_WrCmd(0xd9);//--set pre-charge period
LCD_WrCmd(0xf1);//Set Pre-Charge as 15 Clocks & Discharge as 1 Clock
LCD_WrCmd(0xda);//--set com pins hardware configuration
LCD_WrCmd(0x12);
LCD_WrCmd(0xdb);//--set vcomh
LCD_WrCmd(0x40);//Set VCOM Deselect Level
LCD_WrCmd(0x20);//-Set Page Addressing Mode (0x00/0x01/0x02)
LCD_WrCmd(0x02);//
LCD_WrCmd(0x8d);//--set Charge Pump enable/disable
LCD_WrCmd(0x14);//--set(0x10) disable
LCD_WrCmd(0xa4);// Disable Entire Display On (0xa4/0xa5)
LCD_WrCmd(0xa6);// Disable Inverse Display On (0xa6/a7)
LCD_WrCmd(0xaf);//--turn on oled panel
LCD_Fill(0x00); //初始成黑屏
LCD_Set_Pos(0,0);

}
/***************功能描述:显示6*8一组标准ASCII字符串    显示的坐标(x,y),y为页范围0~7****************/
void LCD_P6x8Str(unsigned char x, unsigned char y,unsigned char ch[])
{
unsigned char c=0,i=0,j=0;
while (ch[j]!='\0')
{
c =ch[j]-32;
if(x>126){x=0;y++;}
LCD_Set_Pos(x,y);
if(c > 0 && c < 92)
{
for(i=0;i<6;i++)
LCD_WrDat(F6x8[c][i]);
}
x+=6;
j++;
}
}

/***********功能描述:显示一行ascii 码?无显示的点阵显示黑色,     y为页的范围0~7*****************/
void HalLcd_HW_WriteLine(unsigned char line, const char *pText)
{
LCD_FillLine(line-1, 0);                            //先把这一行显示成黑色
LCD_P6x8Str(0, line-1, (unsigned char *)pText);
}

#ifdef LCD_SUPPORT
/*******************功能描述:显示8*16一组标准ASCII字符串     显示的坐标(x,y),y为页范围0~7****************/
void LCD_P8x16Str(unsigned char x, unsigned char y,unsigned char ch[])
{
unsigned char c=0,i=0,j=0;
while (ch[j]!='\0')
{
c =ch[j]-32;
if(x>120){x=0;y++;}
LCD_Set_Pos(x,y);
for(i=0;i<8;i++)
LCD_WrDat(F8X16[c*16+i]);
LCD_Set_Pos(x,y+1);
for(i=0;i<8;i++)
LCD_WrDat(F8X16[c*16+i+8]);
x+=8;
j++;
}
}
/*****************功能描述:显示16*16点阵  显示的坐标(x,y),y为页范围0~7****************************/
void LCD_P16x16Ch(unsigned char x, unsigned char y, unsigned char N)
{
unsigned char wm=0;
unsigned int adder=32*N;  //
LCD_Set_Pos(x , y);
for(wm = 0;wm < 16;wm++)  //
{
LCD_WrDat(F16x16[adder]);
adder += 1;
}
LCD_Set_Pos(x,y + 1);
for(wm = 0;wm < 16;wm++) //
{
LCD_WrDat(F16x16[adder]);
adder += 1;
}
}

/***********功能描述:显示显示BMP图片128×64起始点坐标(x,y),x的范围0~127,y为页的范围0~7*****************/
void Draw_BMP(unsigned char x0, unsigned char y0,unsigned char x1, unsigned char y1,unsigned char BMP[])
{
unsigned int j=0;
unsigned char x,y;

if(y1%8==0) y=y1/8;
else y=y1/8+1;
for(y=y0;y<y1;y++)
{
LCD_Set_Pos(x0,y);
for(x=x0;x<x1;x++)
{
LCD_WrDat(BMP[j++]);
}
}
}
#endif

/**************************************************************************************************
z-stack代码,未修改
**************************************************************************************************/
void HalLcdInit(void)
{
#if (HAL_LCD == TRUE)
HalLcd_HW_Init();
#endif
}

/*************************************************************************************************
*                    LCD EMULATION FUNCTIONS
*
* Some evaluation boards are equipped with Liquid Crystal Displays
* (LCD) which may be used to display diagnostic information. These
* functions provide LCD emulation, sending the diagnostic strings
* to Z-Tool via the RS232 serial port. These functions are enabled
* when the "LCD_SUPPORTED" compiler flag is placed in the makefile.
*
* Most applications update both lines (1 and 2) of the LCD whenever
* text is posted to the device. This emulator assumes that line 1 is
* updated first (saved locally) and the formatting and send operation
* is triggered by receipt of line 2. Nothing will be transmitted if
* only line 1 is updated.
*
*************************************************************************************************/

/**************************************************************************************************
z-stack代码,未修改
**************************************************************************************************/
void HalLcdWriteString ( char *str, uint8 option)
{

#ifdef LCD_TO_UART
NPI_WriteTransport ( (uint8*)str,osal_strlen(str));
NPI_WriteTransport ("\r\n",2);
#endif

#if (HAL_LCD == TRUE)

uint8 strLen = 0;
uint8 totalLen = 0;
uint8 *buf;
uint8 tmpLen;

if ( Lcd_Line1 == NULL )
{
Lcd_Line1 = osal_mem_alloc( HAL_LCD_MAX_CHARS+1 );
HalLcdWriteString( "TexasInstruments", 1 );
}

strLen = (uint8)osal_strlen( (char*)str );

/* Check boundries */
if ( strLen > HAL_LCD_MAX_CHARS )
strLen = HAL_LCD_MAX_CHARS;

if ( option == HAL_LCD_LINE_1 )
{
/* Line 1 gets saved for later */
osal_memcpy( Lcd_Line1, str, strLen );
Lcd_Line1[strLen] = '\0';
}
else
{
/* Line 2 triggers action */
tmpLen = (uint8)osal_strlen( (char*)Lcd_Line1 );
totalLen =  tmpLen + 1 + strLen + 1;
buf = osal_mem_alloc( totalLen );
if ( buf != NULL )
{
/* Concatenate strings */
osal_memcpy( buf, Lcd_Line1, tmpLen );
buf[tmpLen++] = ' ';
osal_memcpy( &buf[tmpLen], str, strLen );
buf[tmpLen+strLen] = '\0';

/* Send it out */
#if defined (ZTOOL_P1) || defined (ZTOOL_P2)

#if defined(SERIAL_DEBUG_SUPPORTED)
debug_str( (uint8*)buf );
#endif //LCD_SUPPORTED

#endif //ZTOOL_P1

/* Free mem */
osal_mem_free( buf );
}
}

/* Display the string */
HalLcd_HW_WriteLine (option, str);

#endif //HAL_LCD

}

/**************************************************************************************************
* @fn      HalLcdWriteValue
*
* @brief   Write a value to the LCD,
向lcd指定行写入一个32位的值
*
* @param   value  - value that will be displayed,
需要显示的32位数
*          radix  - 8, 10, 16,
进制,8进制显示 10进制显示,16进制显示
*          option - display options,
指定行显示
*
* @return  None
**************************************************************************************************/
void HalLcdWriteValue ( uint32 value, const uint8 radix, uint8 option)
{
#if (HAL_LCD == TRUE)
uint8 buf[LCD_MAX_BUF];

_ltoa( value, &buf[0], radix );
HalLcdWriteString( (char*)buf, option );
#endif
}

/**************************************************************************************************
z-stack代码,未修改
**************************************************************************************************/
void HalLcdWriteScreen( char *line1, char *line2 )
{
#if (HAL_LCD == TRUE)
HalLcdWriteString( line1, 1 );
HalLcdWriteString( line2, 2 );
#endif
}

/**************************************************************************************************
z-stack代码,未修改
**************************************************************************************************/
void HalLcdWriteStringValue( char *title, uint16 value, uint8 format, uint8 line )
{
#if (HAL_LCD == TRUE)
uint8 tmpLen;
uint8 buf[LCD_MAX_BUF];
uint32 err;

tmpLen = (uint8)osal_strlen( (char*)title );
osal_memcpy( buf, title, tmpLen );
buf[tmpLen] = ' ';
err = (uint32)(value);
_ltoa( err, &buf[tmpLen+1], format );
HalLcdWriteString( (char*)buf, line );
#endif
}

/**************************************************************************************************
z-stack代码,未修改
**************************************************************************************************/
void HalLcdWriteStringValueValue( char *title, uint16 value1, uint8 format1,
uint16 value2, uint8 format2, uint8 line )
{

#if (HAL_LCD == TRUE)

uint8 tmpLen;
uint8 buf[LCD_MAX_BUF];
uint32 err;

tmpLen = (uint8)osal_strlen( (char*)title );
if ( tmpLen )
{
osal_memcpy( buf, title, tmpLen );
buf[tmpLen++] = ' ';
}

err = (uint32)(value1);
_ltoa( err, &buf[tmpLen], format1 );
tmpLen = (uint8)osal_strlen( (char*)buf );

buf[tmpLen++] = ',';
buf[tmpLen++] = ' ';
err = (uint32)(value2);
_ltoa( err, &buf[tmpLen], format2 );

HalLcdWriteString( (char *)buf, line );

#endif
}

/**************************************************************************************************
z-stack代码,未修改
**************************************************************************************************/
void HalLcdDisplayPercentBar( char *title, uint8 value )
{
#if (HAL_LCD == TRUE)

uint8 percent;
uint8 leftOver;
uint8 buf[17];
uint32 err;
uint8 x;

/* Write the title: */
HalLcdWriteString( title, HAL_LCD_LINE_1 );

if ( value > 100 )
value = 100;

/* convert to blocks */
percent = (uint8)(value / 10);
leftOver = (uint8)(value % 10);

/* Make window */
osal_memcpy( buf, "[          ]  ", 15 );

for ( x = 0; x < percent; x ++ )
{
buf[1+x] = '>';
}

if ( leftOver >= 5 )
buf[1+x] = '+';

err = (uint32)value;
_ltoa( err, (uint8*)&buf[13], 10 );

HalLcdWriteString( (char*)buf, HAL_LCD_LINE_2 );

#endif

}

/*int 转 字符串函数*/
/*
unsigned char* IntToStr(unsigned char* buf, int m)
{
unsigned char tmp[16];
unsigned long isNegtive = 0;
unsigned long index;

if(m < 0)
{
isNegtive = 1;
m = - m;
}

tmp[15] = '\0';
index = 14;
do
{
tmp[index--] = m % 10 + '0';
m /= 10;
} while (m > 0);

if(isNegtive)
tmp[index--] = '-';

strcpy((char *)buf, (char *)(tmp + index + 1));

return buf;
}
*/

#ifdef LCD_SUPPORT
int main()
{
unsigned char i=0;

HalLcd_HW_Init();                //oled 初始化
LCD_Fill(0xff);                  //屏全亮

while(1)
{
for(i=0; i<8; i++)
{
LCD_P16x16Ch(i*16,0,i);  //点阵显示
LCD_P16x16Ch(i*16,2,i+8);
LCD_P16x16Ch(i*16,4,i+16);
LCD_P16x16Ch(i*16,6,i+24);
}
HalHW_WaitMS(1000);
LCD_CLS();
LCD_P8x16Str(44,0,"saler");
LCD_P8x16Str(20,2,"OLED DISPLAY");

LCD_P8x16Str(8,4,"TEL:18588220515");
LCD_P6x8Str(20,6,"mzy202@126.com");
LCD_P6x8Str(20,7,"2013-10-6 18:18");
HalHW_WaitMS(1000);

//LCD_CLS();
//Draw_BMP(0,0,128,8,BMP);     //图片显示
//DelayMS(1000);
}
}
#endif
使用amo的驱动。

3、添加测试代码(SimpleBLECentral_Init.c中)

// 分别在第一行和第二行显示字符串
HalLcdWriteScreen("AmoMcu1", "AmoMcu2");

//显示字符串在某一行
HalLcdWriteString( "SimpleBLETest 08", HAL_LCD_LINE_3 );

//显示数据在某一行
HalLcdWriteValue(100, 10, HAL_LCD_LINE_4);

//显示字符串+数据在某一行
HalLcdWriteStringValue("line5", 101, 10, HAL_LCD_LINE_5);

//显示字符串+数据在某一行
HalLcdWriteStringValue("line6", 102, 10, HAL_LCD_LINE_6);

//显示(字符串+数据)+(字符串+数据)在某一行
HalLcdWriteStringValueValue("line7", 103, 10, 0x89, 16,HAL_LCD_LINE_7);
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: