RK3568笔记四十二:OLED 屏幕驱动(模拟I2C)

若该文为原创文章,转载请注明原文出处。

本篇记录使用GPIO模拟I2C驱动OLED屏幕,显示界面效果如下。

主要流程是,修改设备树,使用普通IO口,驱动模拟I2C方式,应用程直接传输数据控制。

1、修改设备

2、编写I2C驱动

3、编写应用程序

一、OLED介绍

SSD1306是一款带控制器的用于OLED点阵图形显示系统的单片CMOS OLED/PLED驱动器。

手上的屏幕使用的是I2C方式驱动,I2C总线包含从机地址位 SA0,由数据信号线(SDA)和时钟信号线(SCL)组成。SDA和SCL线都必须接上拉电阻。

写入时序
IIC写入时序如下所示:

1、主机先发起开始(START)信号,然后发送1byte首字节,包括从机地址(7位)和读写数据位(1位,最低位,0为写模式),驱动器识别从机地址为本机地址之后,将会发出 应答信号(ACK) 。(首字节组成如下图所示)
2、主机收到从机(驱动器)的应答信号之后,随后传输1byte控制字节。一个控制字节主要由
CO 和 D/C# 位后面再加上六个0组成的。(控制字节组成如下图所示)
如果Co为0,后面传输的信息就只包含数据字节。
D/C# 位决定了下个数据字节是作为命令还是数据。D/C# 为0时,下一个数据被视为命令;DC# 为1时,下一个数据被视为显示数据,存储到GDDRAM中。
3、收到控制字节ACK信号之后,传输要写入的数据字节。
4、传输完毕之后主机发出结束(STOP)信号。

二、原理图

SCL: GPIO3_PC4

SDA: GPIO3_PC5

三、创建设备节点

1、设备树节点

修改/home/alientek/rk3568_linux_sdk/kernel/arch/arm64/boot/dts/rockchip/目录下的rk3568-atk-evb1-ddr4-v10.dtsi文件,添加gpios节点,并在gpios下创建两个子节点sda和scl.

gpios {
  compatible = "gpio-i2c-test";
  pinctrl-names = "default";
  status = "okay";
  sda {
    compatible = "sda-test";
    pinctrl-0 = <&pinctrl_sda>;
    gpios-sda = <&gpio3 RK_PC5 GPIO_ACTIVE_HIGH>;
    status = "okay";
  };
  
  scl {
    compatible = "scl-test";
    pinctrl-0 = <&pinctrl_scl>;
    gpios-scl = <&gpio3 RK_PC4 GPIO_ACTIVE_HIGH>;
    status = "okay";
  };
};

2、创建设备的 pinctrl 节点

修改/home/alientek/rk3568_linux_sdk/kernel/arch/arm64/boot/dts/rockchip/目录下的rk3568-pinctrl.dtsi文件,在最后面增加节点

sda-gpio {
    pinctrl_sda: sda-gpio-ctrl {
        rockchip,pins = <3 RK_PC5 RK_FUNC_GPIO &pcfg_pull_none>;
    };
};
 
scl-gpio {
    pinctrl_scl: scl-gpio-ctrl {
        rockchip,pins = <3 RK_PC4 RK_FUNC_GPIO &pcfg_pull_none>;
    };

四、驱动编写

1、drv_oled.c

/*
gpios {
  compatible = "gpio-i2c-test";
  pinctrl-names = "default";
  status = "okay";
  sda {
    compatible = "sda-test";
    pinctrl-0 = <&pinctrl_sda>;
    gpios-sda = <&gpio3 RK_PC5 GPIO_ACTIVE_HIGH>;
    status = "okay";
  };
  
  scl {
    compatible = "scl-test";
    pinctrl-0 = <&pinctrl_scl>;
    gpios-scl = <&gpio3 RK_PC4 GPIO_ACTIVE_HIGH>;
    status = "okay";
  };
};

sda-gpio {
    pinctrl_sda: sda-gpio-ctrl {
        rockchip,pins = <3 RK_PC5 RK_FUNC_GPIO &pcfg_pull_none>;
    };
};
 
scl-gpio {
    pinctrl_scl: scl-gpio-ctrl {
        rockchip,pins = <3 RK_PC4 RK_FUNC_GPIO &pcfg_pull_none>;
    };
};

*/


#include <linux/types.h>
#include <linux/kernel.h>
#include <linux/delay.h>
#include <linux/ide.h>
#include <linux/init.h>
#include <linux/module.h>
#include <linux/errno.h>
#include <linux/gpio.h>
#include <linux/cdev.h>
#include <linux/device.h>
#include <linux/of_gpio.h>
#include <linux/semaphore.h>
#include <linux/timer.h>
#include <linux/irq.h>
#include <linux/wait.h>
#include <linux/poll.h>
#include <linux/fs.h>
#include <linux/fcntl.h>
#include <linux/platform_device.h>
//#include <asm/mach/map.h>
#include <asm/uaccess.h>
#include <asm/io.h>
 
#define GPIOOLED_CNT         2             /* 设备号个数 */
#define GPIOOLED_NAME       "oledtest"      /* 名字 */
 
 
/* gpioled 设备结构体 */
struct gpiooled_dev{
    dev_t devid; /* 设备号 */
    struct cdev cdev; /* cdev */
    struct class *class; /* 类 */
    struct device *device; /* 设备 */
    int major; /* 主设备号 */
    int minor; /* 次设备号 */
    struct device_node *nd[GPIOOLED_CNT]; /* 设备节点 */
    int gpios[GPIOOLED_CNT]; /* oled 所使用的 GPIO 编号 */
};
 
struct gpiooled_dev gpiooled; /* oled 设备 */
                    
//IIC返回的两种状态
typedef enum
{
  NACK = 0x00,    //无响应
  ACK  = 0x01     //有响应
}IIC_ACK;


// 输入方向
void IIC_SDA_IN(void)
{
   gpio_direction_input(gpiooled.gpios[1]);
}

// 输出方向
void IIC_SDA_OUT(void)
{
    gpio_direction_output(gpiooled.gpios[1], 1);
}


// SDA 置1
void IIC_SDA_H(void)
{
    gpio_set_value(gpiooled.gpios[1], 1);
}

// SDA 置0
void IIC_SDA_L(void)
{
    gpio_set_value(gpiooled.gpios[1], 0);
}

// SCL 置1
void IIC_SCL_H(void)
{
    gpio_set_value(gpiooled.gpios[0], 1);
}

// SCL 置0
void IIC_SCL_L(void)
{
    gpio_set_value(gpiooled.gpios[0], 0);
}


/**
 * 功能:发起IIC开始信号
 * 参数:None
 * 返回值:None
 */
void startIIC(void)
{
  IIC_SDA_OUT();          //设置SDA引脚为开漏输出

  IIC_SCL_H();            //拉高SCL
  IIC_SDA_H();            //拉高SDA
  udelay(1);              //延时一段时间
  IIC_SDA_L();            //拉低SDA,在SCK高电平器件产生下降沿
  udelay(1);;             //延时一段时间
  IIC_SCL_L();            //拉低时钟,完成一个时钟周期
}
 
/**
 * 功能:发起IIC停止信号
 * 参数:None
 * 返回值:None
 */
void stopIIC(void)
{
  IIC_SDA_OUT();

  IIC_SDA_L();
  IIC_SCL_H();
  udelay(1);
  IIC_SDA_H();            //SCL高电平期间,产生SDA下降沿
  udelay(1);
  IIC_SCL_L();
}


/**
 * 功能:发起一个字节数据
 * 参数:byte:待发送数据
 * 返回值:None
 */
void sendIICByte(unsigned char byte)
{
  unsigned char i;

  IIC_SDA_OUT();

  for(i=0;i<8;++i)
  {
    if(byte & 0x80)
    {
      IIC_SDA_H();
    }
    else 
    {
      IIC_SDA_L();
    }
    byte <<= 1;

    IIC_SCL_H();
    udelay(1);
    IIC_SCL_L();
    udelay(1);
  }
}
 
/**
 * 功能:等待从机ACK信号
 * 参数:None
 * 返回值:None
 */
IIC_ACK waitAck(void)
{
  unsigned char  i = 0;

  IIC_SDA_IN();
  IIC_SCL_H();
  while(gpio_get_value(gpiooled.gpios[1]))
  {
    if(++i>50)
    {
      IIC_SCL_L();
      return  NACK;
    }
    udelay(1);
  }

  IIC_SCL_L();
  return ACK;
}
 
/*
 * @description : 打开设备
 * @param – inode : 传递给驱动的 inode
 * @param – filp : 设备文件,file 结构体有个叫做 private_data 的成员变量
 * 一般在 open 的时候将 private_data 指向设备结构体。
 * @return : 0 成功;其他 失败
 */
static int oled_open(struct inode *inode, struct file *filp)
{
  int minor = MINOR(inode->i_rdev);
    filp->private_data = &gpiooled; /* 设置私有数据 */
    printk("open minor is %d\r\n",minor);
 
    return 0;
}
 
 
/*
 * @description : 从设备读取数据
 * @param – filp : 要打开的设备文件(文件描述符)
 * @param - buf : 返回给用户空间的数据缓冲区
 * @param - cnt : 要读取的数据长度
 * @param – offt : 相对于文件首地址的偏移
 * @return : 读取的字节数,如果为负值,表示读取失败
 */
static ssize_t oled_read(struct file *filp, char __user *buf,
        size_t cnt, loff_t *offt)
{
    return 0;
}
 
/*
 * @description : 向设备写数据
 * @param - filp : 设备文件,表示打开的文件描述符
 * @param - buf : 要写给设备写入的数据
 * @param - cnt : 要写入的数据长度
 * @param – offt : 相对于文件首地址的偏移
 * @return : 写入的字节数,如果为负值,表示写入失败
 */
static ssize_t oled_write(struct file *filp, const char __user *buf,
        size_t cnt, loff_t *offt)
{
 
    int retvalue;
    unsigned char databuf[4];
    unsigned char stat;
    unsigned char cmddata;
    //struct gpiooled_dev *dev = filp->private_data;
 
 
    retvalue = copy_from_user(databuf, buf, cnt);
    if(retvalue < 0){
        printk("kernel write failed!\r\n");
        return -EFAULT;
    }
 
    stat = databuf[0];     /* 获取状态值 */
    cmddata = databuf[1];  // 参数
    printk("==> stat: 0x%x\n", stat);
    printk("==> stat: 0x%x\n", cmddata);
    
    /* 模拟I2C */
    if(stat == 0)   // 写入命令给OLED
    {
        startIIC();
        sendIICByte(0x78); //发送从机地址及写指令位('0')       
        waitAck(); 
        sendIICByte(0x00); //写入控制字节
        waitAck(); 
        sendIICByte(cmddata); 
        waitAck(); 
        stopIIC();
    }
    else   // 写入数据给OLED
    {
        startIIC();
        sendIICByte(0x78); //发送从机地址及写指令位('0')
        waitAck(); 
        sendIICByte(0x40); //写入控制字节
        waitAck(); 
        sendIICByte(cmddata);
        waitAck(); 
        stopIIC();
    }
 
    return 0;
}
 
/*
 * @description : 关闭/释放设备
 * @param – filp : 要关闭的设备文件(文件描述符)
 * @return : 0 成功;其他 失败
 */
static int oled_release(struct inode *inode, struct file *filp)
{
    return 0;
}
 
/* 设备操作函数 */
static struct file_operations gpiooled_fops = {
    .owner = THIS_MODULE,
    .open = oled_open,
    .read = oled_read,
    .write = oled_write,
    .release = oled_release,
};
 
/*
 * @description : 驱动入口函数
 * @param : 无
 * @return : 无
 */
static int __init oled_init(void)
{
    int ret = 0;
    struct property *proper;
    /* 设置 LED 所使用的 GPIO */
    /* 1、获取设备节点:gpioled */
    gpiooled.nd[0] = of_find_node_by_path("/gpios/scl");
    if(gpiooled.nd[0] == NULL) {
        printk("gpioled node cant not found!\r\n");
        return -EINVAL;
    } else {
        printk("gpioled node has been found!\r\n");
    }
 
    /* 2、 获取设备树中的 gpio 属性,得到 LED 所使用的 LED 编号 */
    gpiooled.gpios[0] = of_get_named_gpio(gpiooled.nd[0], "gpios-scl", 0);
    if(gpiooled.gpios[0] < 0) {
        printk("can't get led-gpio!\r\n");
        return -EINVAL;
    }
    printk("oled-gpio num = %d\r\n", gpiooled.gpios[0]);
 
    /* 3、设置 GPIO1_IO03 为输出,并且输出高电平,默认关闭 LED 灯 */
    ret = gpio_direction_output(gpiooled.gpios[0], 1);
    if(ret < 0) {
        printk("can't set le-gpio!\r\n");
    }
    /*获取字节点的compatible属性*/
    proper = of_find_property(gpiooled.nd[0], "compatible", NULL);
    if(proper == NULL) {
        printk("compatible property find failed\r\n");
    } else {
        printk("led compatible = %s\r\n", (char*)proper->value);
    }
 
 
    /*  设置 BEEP 所使用的 GPIO */
      /* 1、获取设备节点:gpioled */
    gpiooled.nd[1] = of_find_node_by_path("/gpios/sda");
    if(gpiooled.nd[1] == NULL) {
        printk("gpiobeep node cant not found!\r\n");
        return -EINVAL;
    } else {
        printk("gpiobeep node has been found!\r\n");
    }
 
    /* 2、 获取设备树中的 gpio 属性,得到 LED 所使用的 LED 编号 */
    gpiooled.gpios[1] = of_get_named_gpio(gpiooled.nd[1], "gpios-sda", 0);
    if(gpiooled.gpios[1] < 0) {
        printk("can't get beep-gpio!\r\n");
        return -EINVAL;
    }
    printk("sda-gpio num = %d\r\n", gpiooled.gpios[1]);
 
    /* 3、设置 GPIO1_IO03 为输出,并且输出高电平,默认关闭 LED 灯 */
    ret = gpio_direction_output(gpiooled.gpios[1], 1);
    if(ret < 0) {
        printk("can't set beep-gpio!\r\n");
    }
    /*获取字节点的compatible属性*/
    proper = of_find_property(gpiooled.nd[0], "compatible", NULL);
    if(proper == NULL) {
        printk("sda compatible property find failed\r\n");
    } else {
        printk("sda compatible = %s\r\n", (char*)proper->value);
    }
 
 
    /*符设备驱动 */
    /* 1、创建设备号 */
    if (gpiooled.major) { /* 定义了设备号 */
        gpiooled.devid = MKDEV(gpiooled.major, 0);
        register_chrdev_region(gpiooled.devid, GPIOOLED_CNT,
                GPIOOLED_NAME);
    } else { /* 没有定义设备号 */
        alloc_chrdev_region(&gpiooled.devid, 0, GPIOOLED_CNT,
                GPIOOLED_NAME); /* 申请设备号 */
        gpiooled.major = MAJOR(gpiooled.devid); /* 获取分配号的主设备号 */
        gpiooled.minor = MINOR(gpiooled.devid); /* 获取分配号的次设备号 */
    }
    printk("gpiooled major=%d,minor=%d\r\n",gpiooled.major,
            gpiooled.minor);
 
    /* 2、初始化 cdev */
    gpiooled.cdev.owner = THIS_MODULE;
    cdev_init(&gpiooled.cdev, &gpiooled_fops);
 
    /* 3、添加一个 cdev */
    ret = cdev_add(&gpiooled.cdev, gpiooled.devid, GPIOOLED_CNT);
    if(ret)
    {
        printk("cdev_add erro!\r\n");
        goto cdevadd_erro;
    }
    
    printk("cdev_add ok!\r\n");
    /* 4、创建类 */
    gpiooled.class = class_create(THIS_MODULE, "my-oled");
    if (IS_ERR(gpiooled.class)) {
      printk("class_create erro!\r\n");
        ret=PTR_ERR(gpiooled.class);
      goto class_create_erro;
 
    }
 
    /* 5、创建设备 */
    gpiooled.device = device_create(gpiooled.class, NULL,
            MKDEV(gpiooled.major,0), NULL, "oled");
    if (IS_ERR(gpiooled.device)) 
    {
      goto device_create1_erro;
    }
 
   
 
    printk("oled_init ok\n");
    return 0;
device_create1_erro:
     class_destroy(gpiooled.class);
class_create_erro:
   cdev_del(&gpiooled.cdev); /* 删除 cdev */
cdevadd_erro:
     unregister_chrdev_region(gpiooled.devid, GPIOOLED_CNT); 
   return ret;
 }
 
 /*
    189 * @description : 驱动出口函数
  * @param : 无
  * @return : 无
  */
 static void __exit oled_exit(void)
 {
     /* 注销字符设备驱动 */
     cdev_del(&gpiooled.cdev); /* 删除 cdev */
     unregister_chrdev_region(gpiooled.devid, GPIOOLED_CNT); /* 注销 */
 
     device_destroy(gpiooled.class, MKDEV(gpiooled.major,0));
     device_destroy(gpiooled.class, MKDEV(gpiooled.major,1));
     class_destroy(gpiooled.class);
 }
 
 module_init(oled_init);
 module_exit(oled_exit);
 MODULE_LICENSE("GPL");
 MODULE_AUTHOR("yifeng");


程序主要是写函数

通过用户空间传过来的值模拟写数据或写命令操作操作,启动I2C使用模拟方式。

2、makefile

KERNELDIR := /home/alientek/rk3568_linux_sdk/kernel
ARCH=arm64
CROSS_COMPILE=/opt/atk-dlrk356x-toolchain/usr/bin/aarch64-buildroot-linux-gnu-

export  ARCH  CROSS_COMPILE

CURRENT_PATH := $(shell pwd)
obj-m := drv_oled.o

build: kernel_modules

kernel_modules:
	$(MAKE) -C $(KERNELDIR) M=$(CURRENT_PATH) modules
clean:
	$(MAKE) -C $(KERNELDIR) M=$(CURRENT_PATH) clean

编译生成ko文件,拷贝到开发板上。

五、应用程序

应用程序有4个文件,font.h(字库),main.c(主程序),oled.c(oled驱动),oled.h(头文件)

程序仅供参考:

1、main.c

#include "stdio.h"
#include "unistd.h"
#include "sys/types.h"
#include "sys/stat.h"
#include "fcntl.h"
#include "stdlib.h"
#include "string.h"


#include "oled.h"


int oled_i2c_open(char *dev)
{
  int fd = -1;

  if (dev == NULL)
  {
    return fd;
  }

  fd = open(dev, O_RDWR);

  if (fd < 0)
  {
    printf("can't open oled drv\n");
    return fd;
  }

  return fd;
}



int main(int argc, char *argv[])
{
  int fd;
  int i = 0;
  char cmd[32];
  
  fd = oled_i2c_open("/dev/oled");
  SetOledFd(fd);

  initOLED();
  
  formatScreen(0x00);//清屏

  OLED_ShowString(0, 0, "hello world", 16);

  while(1)
  {
    memset(cmd, 0, 32);
    i++;
    sprintf(cmd, "%04d", i);
    OLED_ShowString(0, 2, cmd, 16);
    
    sleep(1);
  }

  close(fd);
  
  return 0;
}

功能是显示 “hello world",每秒累加1.

2、oled.c

/******************************************************************
 * 文件:OLED.c
 * 功能:实现OLED驱动函数
 * 日期:
 * 作者:
 * 版本:Ver.1.0 | 最初版本
 * 
 * Copyright (C) 2018 zx. All rights reserved.
*******************************************************************/
#include "stdio.h"
#include "string.h"
#include "oled.h"
#include "font.h"    

#include "stdio.h"
#include "unistd.h"
#include "sys/types.h"
#include "sys/stat.h"
#include "fcntl.h"
#include "stdlib.h"
#include "string.h"


static int fd = -1;


void SetOledFd(int fdd)
{
  fd = fdd;
}


/**********************************静态功能函数**************************************/
/**
 * 功能:根据指定坐标值生效坐标设置
 * 参数:
 *   x:x轴坐标
 *   y:y轴坐标
 * 返回值:None
 */
void setPos(unsigned char x, unsigned char y) 
{ 
  writeCommand(0xb0+y);
  writeCommand(((x&0xf0)>>4)|0x10);
  writeCommand(x&0x0f); 
} 



/**
 * 功能:写入命令给OLED
 * 参数:
 *   cmd:命令
 * 返回值:None
 */
void writeCommand(unsigned char cmd)
{
  unsigned char databuf[2]; 
  int retvalue;
  
  databuf[0] = 0x00;
  databuf[1] = cmd;
  
  retvalue = write(fd, databuf, sizeof(databuf));
  if(retvalue < 0){
    printf("oled Control Failed!\r\n");
    close(fd);
  }
}

/**
 * 功能:写入数据给OLED
 * 参数:
 *   data:数据
 * 返回值:None
 */
void writeData(unsigned char data)
{
  unsigned char databuf[2]; 
  int retvalue;
  
  databuf[0] = 0x01;
  databuf[1] = data;
  
  retvalue = write(fd, databuf, sizeof(databuf));
  if(retvalue < 0){
    printf("oled Control Failed!\r\n");
    close(fd);
  }
}
/**********************************屏幕设置函数**************************************/
/**
 * 功能:设置屏幕反色  
 * 参数:
 *   set:设置参数   SCREEN_NORMAL,SCREEN_REVERSE可选
 * 返回值:None
 */
void setScreenReverse(SCREEN_SHOW set)
{
  if(set==SCREEN_REVERSE)  //屏幕反色
  {
    writeCommand(0xA7);
  }
  else       //屏幕常色
  {
    writeCommand(0xA6);
  }
}

/**
 * 功能:设置屏幕显示方向,类似于手机屏幕翻转  
 * 参数:
 *   set:设置参数   SCREEN_UP,SCREEN_DOWN可选
 * 返回值:None
 */
void setScreenDir(SCREEN_DIR set)
{
  if(set==SCREEN_UP)   //屏幕正向
  {
    writeCommand(0xA1);
    writeCommand(0xC8);
  }
  else       //屏幕倒向
  {
    writeCommand(0xA0);
    writeCommand(0xC0);
  }
}

/**
 * 功能:设置屏幕是否开启,类似于手机息屏和唤醒
 * 参数:
 *   set:设置参数   SCREEN_ON,SCREEN_OFF可选
 * 返回值:None
 */
void setScreenSwtich(SCREEN_SWITCH set)
{
  if(set==SCREEN_ON)
  {
    writeCommand(0xAF);
  }
  else 
  {
    writeCommand(0xAE);
  }
}

/**********************************显示屏驱动函数**************************************/
/**
 * 功能:初始化OLED
 * 参数:None
 * 返回值:None
 */
void initOLED(void)
{   
  writeCommand(0x81);  //设置亮度
  writeCommand(0xFF);  //亮度值最大 复位默认0x7F
  writeCommand(0xA1);  //设置段映射方式即设置是否水平翻转 A0表示翻转 通常和C0一起使用
  writeCommand(0xC8);  //设置COM扫描模式即设置是否垂直翻转 C0表示翻转 通常和A0一起使用 
  writeCommand(0x8D);  //电荷泵使能
  writeCommand(0x14);
  
  writeCommand(0xAF);  //开屏幕,默认是关闭的就和没上电一样,所以要手动开启
} 

/**
 * 功能:格式化屏幕,常使用0x00或者0xFF清屏,使用不同数据可以产生不同的条纹
 * 参数:
 *   format_data:格式化内容,一般清屏会用到0x00或者0xFF
 * 返回值:None
 */
void formatScreen(unsigned char format_data)  
{  
  unsigned char x,y;      
  for(y=0;y<8;++y)  
  {  
    writeCommand(0xb0+y);    //设置页地址(0~7)
    writeCommand(0x00);      //设置显示位置—列低地址
    writeCommand(0x10);      //设置显示位置—列高地址   
    for(x=0;x<128;++x)
    {
      writeData(format_data); 
    } 
  } 
}

/**
 * 功能:显示一个字符到OLED
 * 参数:
 *   x:x轴坐标 0-127
 *   y:y轴坐标 0-7
 *   ch:待显示字符 ASCII字符集
 *   f_size:字体大小 FONT_8_EN(0608) FONT_16_EN(0816)
 * 返回值:None
 */
void showChar(unsigned char x,unsigned char y,unsigned char ch,FONT_SIZE f_size)
{       
  unsigned char index = ch-' '; 
  unsigned char i;
  
  if(x > 127 || y > 7)    //参数异常处理
  {
    x = 0;
    y = 0;
  }
  if(f_size == FONT_16_EN)  //如果是16*8点阵
  {
    setPos(x,y); 
    for(i=0;i<8;++i)   //由于是8*16的点阵,因此占用两页,要分成写入,此时写入第一页
    {
      writeData(ANSIC0816[index][i]);
    }
    setPos(x,y+1);    //人为指定下一页地址
    for(i=8;i<16;++i)   //由于是8*16的点阵,因此占用两页,要分成写入,此时写入第二页
    {
      writeData(ANSIC0816[index][i]);
    }
  }
  else if(f_size == FONT_8_EN) //6*8点阵
  { 
    setPos(x,y);
    for(i=0;i<6;i++)   //6*8点阵,写入一页即可
    {
      writeData(ANSIC0608[index][i]);  
    } 
  }
  else 
  {
   /*其他字体敬请期待:)*/
  }
}

/**
 * 功能:显示字符串到OLED
 * 参数:
 *   x:x轴坐标 0-127
 *   y:y轴坐标 0-7
 *   str:待显示字符串
 *   f_size:字体大小 FONT_8_EN(0608) FONT_16_EN(0816)
 * 返回值:None
 */  
void showString(unsigned char x,unsigned char y,unsigned char* str,FONT_SIZE f_size)
{
  while(*str)
  {
    showChar(x,y,*str++,f_size); 
    x += f_size;  //增加横坐标,移到下一个汉字位置
  }
}




//显示汉字
void OLED_ShowCHinese(unsigned char x,unsigned char y,unsigned char no)
{      			    
	unsigned char t,adder=0;
	setPos(x,y);	
    for(t=0;t<16;t++)
		{
				writeData(Hzk[2*no][t]);
				adder+=1;
     }	
		setPos(x,y+1);	
    for(t=0;t<16;t++)
			{	
				writeData(Hzk[2*no+1][t]);
				adder+=1;
      }					
}

void OLED_ShowChar(unsigned char x,unsigned char y,unsigned char chr,unsigned char Char_Size)
{      	
	unsigned char c=0,i=0;	
		c=chr-' ';//得到偏移后的值			
		if(x>128-1){x=0;y=y+2;}
		if(Char_Size ==16)
			{
			setPos(x,y);	
			for(i=0;i<8;i++)
			writeData(F8X16[c*16+i]);
			setPos(x,y+1);
			for(i=0;i<8;i++)
			writeData(F8X16[c*16+i+8]);
			}
			else {	
				setPos(x,y);
				for(i=0;i<6;i++)
				writeData(F6x8[c][i]);
				
			}
}
//显示一个字符号串
void OLED_ShowString(unsigned char x,unsigned char y,unsigned char *chr,unsigned char Char_Size)
{
	unsigned char j=0;
	while (chr[j]!='\0')
	{		
		OLED_ShowChar(x,y,chr[j],Char_Size);
			x+=8;
		if(x>120){x=0;y+=2;}
			j++;
	}
}

3、oled.h

#ifndef _OLED_H
#define _OLED_H



typedef enum
{
  SCREEN_UP = 0,
  SCREEN_DOWN = 1
}SCREEN_DIR;

typedef enum
{
  SCREEN_NORMAL = 0,
  SCREEN_REVERSE = 1
}SCREEN_SHOW;


typedef enum
{
  SCREEN_ON = 0,
  SCREEN_OFF = 1
}SCREEN_SWITCH;


typedef enum
{
  FONT_8_EN  = 6,
  FONT_16_EN = 8,
  FONT_16_CN = 16
}FONT_SIZE;


typedef enum 
{
  OCT = 8,
  DEC = 10,
  HEX = 16
}RADIX;


typedef enum
{
  FM_LOGO_ENUM = 0,
  DIRECT_LOGO_ENUM = 1,
  BRIGHTNESS_LOGO_ENUM = 2,
  REVERSAL_LOGO_ENUM = 3
}IMAGE_INDEX;

void SetOledFd(int fdd);

void initOLED(void);

void writeCommand(unsigned char cmd);
void writeData(unsigned char data);

void formatScreen(unsigned char format_data);

void showChar(unsigned char x,unsigned char y,unsigned char ch,FONT_SIZE f_size);  
void showString(unsigned char x,unsigned char y,unsigned char* str,FONT_SIZE f_size);

void showImage(unsigned char xpos, unsigned char ypos,unsigned char x_len, unsigned char y_len,IMAGE_INDEX  image_index);

void setScreenReverse(SCREEN_SHOW set);
void setScreenDir(SCREEN_DIR set);
void setScreenSwtich(SCREEN_SWITCH set);				  

void OLED_ShowCHinese(unsigned char x,unsigned char y,unsigned char no);
void OLED_ShowString(unsigned char x,unsigned char y,unsigned char *chr,unsigned char Char_Size);


#endif


4、font.h

/******************************************************************
 * 文件:FONT.h
 * 功能:定义OLED屏幕显示字体资源库
 * 日期:2018-03-05
 * 作者:zx
 * 版本:Ver.1.0 | 最初版本
 * 标注:ASICII显示字符,方便取模
 *      'SPACE'!"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~
 * Copyright (C) 2018 zx. All rights reserved.
*******************************************************************/
#ifndef __OLEDFONT_H
#define __OLEDFONT_H 	   

/***************************************6*8 ANSIC点阵**************************************/
/*****************************************检索信息******************************************
 SPACE(0) !(1) "(2) #(3) $(4) %(5) &(6) '(7) ((8) )(9) *(10) +(11) ,(12) -(13) .(14) /(15)
 0(16) 1(17) 2(18) 3(19) 4(20) 5(21) 6(22) 7(23) 8(24) 9(25) :(26) ;(27) <(28) =(29) >(30) ?(31)
 @(32) A(33) B(34) C(35) D(36) E(37) F(38) G(39) H(40) I(41) J(42) K(43) L(44) M(45) N(46) O(47)
 P(48) Q(49) R(50) S(51) T(52) U(53) V(54) W(55) X(56) Y(57) Z(58) [(59) \(60) ](61) ^(62) _(63)
 `(64) a(65) b(66) c(67) d(68) e(69) f(70) g(71) h(72) i(73) j(74) k(75) l(76) m(77) n(78) o(79)
 p(80) q(81) r(82) s(83) t(84) u(85) v(86) w(87) x(88) y(89) z(90) {(91) |(92) }(93) ~(94)
*******************************************************************************************/
const unsigned char ANSIC0608[95][6] =		
{
    {0x00,0x00,0x00,0x00,0x00,0x00},/*" ",0*/

    {0x00,0x00,0x4C,0x40,0x00,0x00},/*"!",1*/

    {0x00,0x02,0x02,0x02,0x00,0x00},/*""",2*/

    {0x20,0x7C,0x28,0x28,0x3E,0x20},/*"#",3*/

    {0x00,0x6C,0x4A,0x74,0x24,0x00},/*"$",4*/

    {0x0C,0x52,0x3C,0x7C,0x52,0x70},/*"%",5*/

    {0x30,0x4C,0x7A,0x6C,0x50,0x40},/*"&",6*/

    {0x00,0x02,0x00,0x00,0x00,0x00},/*"'",7*/

    {0x00,0x00,0x00,0x7C,0x82,0x00},/*"(",8*/

    {0x00,0x42,0x3C,0x00,0x00,0x00},/*")",9*/

    {0x00,0x18,0x38,0x10,0x18,0x00},/*"*",10*/

    {0x00,0x00,0x10,0x18,0x10,0x00},/*"+",11*/

    {0x00,0xC0,0x00,0x00,0x00,0x00},/*",",12*/

    {0x08,0x08,0x08,0x08,0x08,0x08},/*"-",13*/

    {0x00,0x40,0x00,0x00,0x00,0x00},/*".",14*/

    {0x00,0x40,0x30,0x08,0x06,0x00},/*"/",15*/

    {0x00,0x7C,0x42,0x42,0x7C,0x00},/*"0",16*/

    {0x00,0x00,0x44,0x7C,0x00,0x00},/*"1",17*/

    {0x00,0x64,0x62,0x52,0x4C,0x00},/*"2",18*/

    {0x00,0x64,0x42,0x4A,0x7C,0x00},/*"3",19*/

    {0x00,0x10,0x28,0x7C,0x20,0x00},/*"4",20*/

    {0x00,0x6C,0x4C,0x4C,0x70,0x00},/*"5",21*/

    {0x00,0x7C,0x4A,0x4A,0x74,0x00},/*"6",22*/

    {0x00,0x04,0x64,0x1C,0x04,0x00},/*"7",23*/

    {0x00,0x7C,0x4A,0x52,0x7C,0x00},/*"8",24*/

    {0x00,0x5C,0x52,0x52,0x3C,0x00},/*"9",25*/

    {0x00,0x00,0x48,0x48,0x00,0x00},/*":",26*/

    {0x00,0x00,0xC8,0x00,0x00,0x00},/*";",27*/

    {0x00,0x18,0x28,0x24,0x42,0x00},/*"<",28*/

    {0x00,0x18,0x18,0x18,0x18,0x00},/*"=",29*/

    {0x00,0x42,0x24,0x28,0x18,0x00},/*">",30*/

    {0x00,0x04,0x62,0x52,0x0C,0x00},/*"?",31*/

    {0x18,0x64,0x7A,0x56,0x6C,0x18},/*"@",32*/

    {0x40,0x30,0x1C,0x1C,0x70,0x00},/*"A",33*/

    {0x00,0x7C,0x54,0x54,0x5C,0x20},/*"B",34*/

    {0x18,0x64,0x42,0x42,0x42,0x24},/*"C",35*/

    {0x00,0x7C,0x44,0x44,0x24,0x18},/*"D",36*/

    {0x00,0x7C,0x54,0x54,0x44,0x00},/*"E",37*/

    {0x00,0x7C,0x14,0x14,0x1C,0x04},/*"F",38*/

    {0x38,0x44,0x42,0x42,0x64,0x00},/*"G",39*/

    {0x00,0x7C,0x10,0x10,0x7C,0x00},/*"H",40*/

    {0x00,0x00,0x7C,0x44,0x00,0x00},/*"I",41*/

    {0x80,0x80,0x80,0xFC,0x04,0x00},/*"J",42*/

    {0x00,0x7C,0x08,0x34,0x40,0x00},/*"K",43*/

    {0x00,0x7C,0x40,0x40,0x40,0x00},/*"L",44*/

    {0x70,0x4C,0x70,0x10,0x7C,0x00},/*"M",45*/

    {0x00,0x7C,0x08,0x10,0x3C,0x00},/*"N",46*/

    {0x18,0x64,0x42,0x42,0x44,0x38},/*"O",47*/

    {0x00,0x7C,0x14,0x14,0x0C,0x04},/*"P",48*/

    {0x38,0x44,0x62,0x42,0xC4,0x38},/*"Q",49*/

    {0x00,0x7C,0x14,0x14,0x6C,0x00},/*"R",50*/

    {0x00,0x4C,0x4A,0x52,0x74,0x00},/*"S",51*/

    {0x04,0x04,0x7C,0x04,0x04,0x04},/*"T",52*/

    {0x00,0x7C,0x40,0x40,0x7C,0x00},/*"U",53*/

    {0x00,0x0C,0x30,0x30,0x0C,0x00},/*"V",54*/

    {0x00,0x3C,0x14,0x3C,0x1C,0x04},/*"W",55*/

    {0x00,0x44,0x28,0x38,0x44,0x00},/*"X",56*/

    {0x00,0x04,0x78,0x08,0x04,0x00},/*"Y",57*/

    {0x00,0x64,0x54,0x4C,0x44,0x00},/*"Z",58*/

    {0x00,0x00,0xFE,0x82,0x80,0x00},/*"[",59*/

    {0x00,0x06,0x08,0x30,0x40,0x00},/*"\",60*/

    {0x00,0x80,0x82,0xFE,0x00,0x00},/*"]",61*/

    {0x00,0x01,0x01,0x01,0x01,0x00},/*"^",62*/

    {0x80,0x80,0x80,0x80,0x80,0x80},/*"_",63*/

    {0x00,0x01,0x01,0x00,0x00,0x00},/*"`",64*/

    {0x00,0x60,0x58,0x58,0x70,0x40},/*"a",65*/

    {0x00,0x7E,0x48,0x48,0x70,0x00},/*"b",66*/

    {0x00,0x70,0x48,0x48,0x40,0x00},/*"c",67*/

    {0x00,0x70,0x48,0x48,0x7E,0x40},/*"d",68*/

    {0x00,0x70,0x68,0x68,0x50,0x00},/*"e",69*/

    {0x00,0x08,0x7C,0x0C,0x0C,0x00},/*"f",70*/

    {0x00,0xF0,0xE8,0xE8,0xD8,0x08},/*"g",71*/

    {0x00,0x7E,0x08,0x08,0x70,0x00},/*"h",72*/

    {0x00,0x08,0x78,0x40,0x00,0x00},/*"i",73*/

    {0x00,0x80,0x80,0x88,0x7A,0x00},/*"j",74*/

    {0x00,0x7E,0x10,0x38,0x48,0x00},/*"k",75*/

    {0x00,0x00,0x7E,0x40,0x00,0x00},/*"l",76*/

    {0x78,0x48,0x48,0x70,0x48,0x70},/*"m",77*/

    {0x08,0x78,0x08,0x08,0x70,0x00},/*"n",78*/

    {0x00,0x70,0x48,0x48,0x70,0x00},/*"o",79*/

    {0x08,0xF8,0x48,0x48,0x70,0x00},/*"p",80*/

    {0x00,0x70,0x48,0x48,0xF0,0x00},/*"q",81*/

    {0x08,0x48,0x70,0x08,0x08,0x00},/*"r",82*/

    {0x00,0x50,0x58,0x68,0x68,0x00},/*"s",83*/

    {0x00,0x08,0x7C,0x48,0x48,0x00},/*"t",84*/

    {0x08,0x78,0x40,0x40,0x78,0x40},/*"u",85*/

    {0x08,0x18,0x20,0x20,0x18,0x00},/*"v",86*/

    {0x08,0x38,0x28,0x38,0x38,0x08},/*"w",87*/

    {0x00,0x48,0x38,0x38,0x48,0x00},/*"x",88*/

    {0x00,0x98,0xA0,0x60,0x18,0x08},/*"y",89*/

    {0x00,0x48,0x68,0x58,0x48,0x00},/*"z",90*/

    {0x00,0x00,0x00,0x7E,0x80,0x00},/*"{",91*/

    {0x00,0x00,0x00,0xFF,0x00,0x00},/*"|",92*/

    {0x00,0x80,0x7E,0x00,0x00,0x00},/*"}",93*/

    {0x00,0x01,0x01,0x02,0x02,0x00} /*"~",94*/
};

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
};

const unsigned char F6x8[][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
};

/************************************~END~************************************/


/****************************************8*16 ANSIC点阵************************************/
/*****************************************检索信息******************************************
 SPACE(0) !(1) "(2) #(3) $(4) %(5) &(6) '(7) ((8) )(9) *(10) +(11) ,(12) -(13) .(14) /(15)
 0(16) 1(17) 2(18) 3(19) 4(20) 5(21) 6(22) 7(23) 8(24) 9(25) :(26) ;(27) <(28) =(29) >(30) ?(31)
 @(32) A(33) B(34) C(35) D(36) E(37) F(38) G(39) H(40) I(41) J(42) K(43) L(44) M(45) N(46) O(47)
 P(48) Q(49) R(50) S(51) T(52) U(53) V(54) W(55) X(56) Y(57) Z(58) [(59) \(60) ](61) ^(62) _(63)
 `(64) a(65) b(66) c(67) d(68) e(69) f(70) g(71) h(72) i(73) j(74) k(75) l(76) m(77) n(78) o(79)
 p(80) q(81) r(82) s(83) t(84) u(85) v(86) w(87) x(88) y(89) z(90) {(91) |(92) }(93) ~(94)
*******************************************************************************************/
const unsigned char ANSIC0816[95][16] =	  
{
    {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,0x00,0x00,0x00,0x00},/*"!",1*/

    {0x00,0x10,0x0C,0x02,0x10,0x0C,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},/*""",2*/

    {0x00,0x40,0xC0,0x78,0x40,0xC0,0x78,0x00,0x00,0x04,0x3F,0x04,0x04,0x3F,0x04,0x00},/*"#",3*/

    {0x00,0x70,0x88,0x88,0xFC,0x08,0x30,0x00,0x00,0x18,0x20,0x20,0xFF,0x21,0x1E,0x00},/*"$",4*/

    {0xF0,0x08,0xF0,0x80,0x60,0x18,0x00,0x00,0x00,0x31,0x0C,0x03,0x1E,0x21,0x1E,0x00},/*"%",5*/

    {0x00,0xF0,0x08,0x88,0x70,0x00,0x00,0x00,0x1E,0x21,0x23,0x2C,0x19,0x27,0x21,0x10},/*"&",6*/

    {0x00,0x12,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,0x00,0xE0,0x00,0x00,0x00,0x00,0x01,0x01,0x01,0x0F,0x01,0x01,0x01},/*"+",11*/

    {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x90,0x70,0x00,0x00,0x00,0x00,0x00},/*",",12*/

    {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x01,0x01,0x01,0x01,0x00},/*"-",13*/

    {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x30,0x00,0x00,0x00,0x00,0x00},/*".",14*/

    {0x00,0x00,0x00,0x00,0xC0,0x38,0x04,0x00,0x00,0x60,0x18,0x07,0x00,0x00,0x00,0x00},/*"/",15*/

    {0x00,0xE0,0x10,0x08,0x08,0x10,0xE0,0x00,0x00,0x0F,0x10,0x20,0x20,0x10,0x0F,0x00},/*"0",16*/

    {0x00,0x00,0x10,0x10,0xF8,0x00,0x00,0x00,0x00,0x00,0x20,0x20,0x3F,0x20,0x20,0x00},/*"1",17*/

    {0x00,0x70,0x08,0x08,0x08,0x08,0xF0,0x00,0x00,0x30,0x28,0x24,0x22,0x21,0x30,0x00},/*"2",18*/

    {0x00,0x30,0x08,0x08,0x08,0x88,0x70,0x00,0x00,0x18,0x20,0x21,0x21,0x22,0x1C,0x00},/*"3",19*/

    {0x00,0x00,0x80,0x40,0x30,0xF8,0x00,0x00,0x00,0x06,0x05,0x24,0x24,0x3F,0x24,0x24},/*"4",20*/

    {0x00,0xF8,0x88,0x88,0x88,0x08,0x08,0x00,0x00,0x19,0x20,0x20,0x20,0x11,0x0E,0x00},/*"5",21*/

    {0x00,0xE0,0x10,0x88,0x88,0x90,0x00,0x00,0x00,0x0F,0x11,0x20,0x20,0x20,0x1F,0x00},/*"6",22*/

    {0x00,0x18,0x08,0x08,0x88,0x68,0x18,0x00,0x00,0x00,0x00,0x3E,0x01,0x00,0x00,0x00},/*"7",23*/

    {0x00,0x70,0x88,0x08,0x08,0x88,0x70,0x00,0x00,0x1C,0x22,0x21,0x21,0x22,0x1C,0x00},/*"8",24*/

    {0x00,0xF0,0x08,0x08,0x08,0x10,0xE0,0x00,0x00,0x01,0x12,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,0x00,0xE0,0x00,0x00,0x00,0x00},/*";",27*/

    {0x00,0x00,0x80,0x40,0x20,0x10,0x08,0x00,0x00,0x01,0x02,0x04,0x08,0x10,0x20,0x00},/*"<",28*/

    {0x00,0x40,0x40,0x40,0x40,0x40,0x40,0x00,0x00,0x02,0x02,0x02,0x02,0x02,0x02,0x00},/*"=",29*/

    {0x00,0x08,0x10,0x20,0x40,0x80,0x00,0x00,0x00,0x20,0x10,0x08,0x04,0x02,0x01,0x00},/*">",30*/

    {0x00,0x70,0x48,0x08,0x08,0x88,0x70,0x00,0x00,0x00,0x00,0x30,0x37,0x00,0x00,0x00},/*"?",31*/

    {0xC0,0x30,0xC8,0x28,0xE8,0x10,0xE0,0x00,0x07,0x18,0x27,0x28,0x2F,0x28,0x17,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,0x01,0x3E,0x01,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,0x10,0x28,0x28,0x30,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*/

    {0x08,0xF8,0x00,0xF8,0x00,0xF8,0x08,0x00,0x00,0x03,0x3E,0x01,0x3E,0x03,0x00,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,0x04,0x38,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,0x04,0x00,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,0x00,0x00,0x00,0x00,0x19,0x24,0x24,0x12,0x3F,0x20,0x00},/*"a",65*/

    {0x10,0xF0,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,0x80,0x80,0x80,0x90,0xF0,0x00,0x00,0x1F,0x20,0x20,0x20,0x10,0x3F,0x20},/*"d",68*/

    {0x00,0x00,0x80,0x80,0x80,0x80,0x00,0x00,0x00,0x1F,0x24,0x24,0x24,0x24,0x17,0x00},/*"e",69*/

    {0x00,0x80,0x80,0xE0,0x90,0x90,0x20,0x00,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*/

    {0x10,0xF0,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*/

    {0x10,0xF0,0x00,0x00,0x80,0x80,0x80,0x00,0x20,0x3F,0x24,0x06,0x29,0x30,0x20,0x00},/*"k",75*/

    {0x00,0x10,0x10,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,0x91,0x20,0x20,0x11,0x0E,0x00},/*"p",80*/

    {0x00,0x00,0x00,0x80,0x80,0x00,0x80,0x00,0x00,0x0E,0x11,0x20,0x20,0x91,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,0x10,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,0x80,0x80,0x80,0x00,0x00,0x03,0x0C,0x30,0x0C,0x03,0x00,0x00},/*"v",86*/

    {0x80,0x80,0x00,0x80,0x80,0x00,0x80,0x80,0x01,0x0E,0x30,0x0C,0x07,0x38,0x06,0x01},/*"w",87*/

    {0x00,0x80,0x80,0x80,0x00,0x80,0x80,0x00,0x00,0x20,0x31,0x0E,0x2E,0x31,0x20,0x00},/*"x",88*/

    {0x80,0x80,0x80,0x00,0x00,0x80,0x80,0x80,0x00,0x81,0x86,0x78,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,0x00,0xFC,0x02,0x02,0x00,0x00,0x00,0x00,0x01,0x3E,0x40,0x40},/*"{",91*/

    {0x00,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0x00,0x00,0x00},/*"|",92*/

    {0x02,0x02,0xFC,0x00,0x00,0x00,0x00,0x00,0x40,0x40,0x3E,0x01,0x00,0x00,0x00,0x00},/*"}",93*/

    {0x00,0x02,0x01,0x02,0x02,0x04,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00} /*"~",94*/
};
/************************************~END~************************************/

/************************************16*16 汉字************************************/
const unsigned char CN1616[4][32] = 
{
{0x20,0x30,0xAC,0x63,0x30,0x00,0x80,0x92,0x92,0x92,0x92,0x92,0xFE,0x80,0x80,0x00,
0x22,0x67,0x22,0x12,0x12,0x00,0x22,0x14,0x48,0x84,0x7F,0x04,0x08,0x14,0x22,0x00},/*"绿",0*/

{0x00,0x00,0xFE,0x02,0x02,0xF2,0x92,0x9A,0x96,0x92,0x92,0xF2,0x02,0x02,0x02,0x00,
0x80,0x60,0x1F,0x40,0x20,0x17,0x44,0x84,0x7C,0x04,0x04,0x17,0x20,0x40,0x00,0x00},/*"原",1*/

{0x20,0x18,0x08,0x08,0x08,0xC8,0x38,0xCF,0x08,0x08,0x08,0x08,0xA8,0x18,0x00,0x00,
0x10,0x08,0x04,0x02,0xFF,0x40,0x20,0x00,0x03,0x04,0x0A,0x11,0x20,0x40,0x40,0x00},/*"农",2*/

{0x00,0x00,0xF8,0x08,0x08,0x08,0x08,0x09,0xEE,0x08,0x08,0x08,0x08,0x08,0x00,0x00,
0x80,0x60,0x1F,0x40,0x41,0x41,0x41,0x41,0x7F,0x41,0x41,0x41,0x41,0x41,0x40,0x00}/*"庄",3*/

};

unsigned char CN1616_Index[] = "绿原农庄"; //16*16中文字库索引表

char Hzk[][32]={
{0x08,0x24,0x23,0x6A,0xAA,0x2A,0xAA,0x6A,0x2A,0x2A,0x2A,0xEA,0x02,0x02,0x00,0x00},
{0x10,0x11,0x15,0x15,0x15,0xFF,0x15,0x15,0x15,0x11,0x10,0x0F,0x30,0x40,0xF8,0x00},/*"氧",0*/

{0x20,0x10,0x4C,0x47,0x54,0x54,0x54,0x54,0x54,0x54,0x54,0xD4,0x04,0x04,0x00,0x00},
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0x30,0x40,0xF0,0x00},/*"气",1*/

{0x00,0x00,0xFE,0x02,0x12,0x22,0xC2,0x02,0xC2,0x32,0x02,0xFE,0x00,0x00,0x00,0x00},
{0x80,0x60,0x1F,0x00,0x20,0x10,0x0C,0x03,0x0C,0x30,0x00,0x0F,0x30,0x40,0xF8,0x00},/*"风",2*/

{0x00,0x00,0xFC,0x24,0x24,0x24,0x25,0x26,0x24,0x24,0x24,0x24,0x24,0x3C,0x00,0x00},
{0x40,0x30,0x0F,0x21,0x15,0x49,0x81,0x7F,0x00,0x21,0x15,0x49,0x81,0x7F,0x00,0x00},/*"扇",3*/

{0x80,0x82,0x82,0x82,0xFE,0x82,0x82,0x82,0x82,0x82,0xFE,0x82,0x82,0x82,0x80,0x00},
{0x00,0x80,0x40,0x30,0x0F,0x00,0x00,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0x00,0x00},/*"开",4*/

{0x00,0x00,0x10,0x11,0x16,0x10,0x10,0xF0,0x10,0x10,0x14,0x13,0x10,0x00,0x00,0x00},
{0x81,0x81,0x41,0x41,0x21,0x11,0x0D,0x03,0x0D,0x11,0x21,0x41,0x41,0x81,0x81,0x00},/*"关",5*/

{0x10,0x10,0x10,0xFF,0x10,0x10,0xF0,0x00,0x00,0xF8,0x08,0x08,0x08,0xF8,0x00,0x00},
{0x80,0x40,0x30,0x0F,0x40,0x80,0x7F,0x00,0x00,0x7F,0x20,0x20,0x20,0x7F,0x00,0x00},/*"加",6*/

{0x20,0x10,0x4C,0x47,0x54,0x54,0x54,0x54,0x54,0x54,0x54,0xD4,0x04,0x04,0x00,0x00},
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0x30,0x40,0xF0,0x00},/*"气",7*/

{0x40,0x40,0x42,0xCC,0x00,0x40,0xA0,0x9E,0x82,0x82,0x82,0x9E,0xA0,0x20,0x20,0x00},
{0x00,0x00,0x00,0x3F,0x90,0x88,0x40,0x43,0x2C,0x10,0x28,0x46,0x41,0x80,0x80,0x00},/*"设",8*/

{0x00,0x17,0x15,0xD5,0x55,0x57,0x55,0x7D,0x55,0x57,0x55,0xD5,0x15,0x17,0x00,0x00},
{0x40,0x40,0x40,0x7F,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x7F,0x40,0x40,0x40,0x00},/*"置",9*/

{0x04,0x04,0x04,0x04,0xF4,0x94,0x95,0x96,0x94,0x94,0xF4,0x04,0x04,0x04,0x04,0x00},
{0x00,0xFE,0x02,0x02,0x7A,0x4A,0x4A,0x4A,0x4A,0x4A,0x7A,0x02,0x82,0xFE,0x00,0x00},/*"高",10*/

{0x00,0x80,0x60,0xF8,0x07,0x00,0xFC,0x84,0x84,0x84,0xFE,0x82,0x83,0x82,0x80,0x00},
{0x01,0x00,0x00,0xFF,0x00,0x00,0xFF,0x40,0x20,0x00,0x41,0x8E,0x30,0x40,0xF8,0x00},/*"低",11*/
};
/************************************~END~************************************/
#endif



编译:

/opt/atk-dlrk356x-toolchain/bin/aarch64-buildroot-linux-gnu-gcc main.c oled.c -o oledApp

自行测试,驱动也可以显示汉字,需要取模软件取模。

使用函数OLED_ShowCHinese()显示。

如有侵权,或需要完整代码,请及时联系博主。

  • 19
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

殷忆枫

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值