前言
本篇文章将之前所有的文章进行整合,是之前几篇文章的综合版。
MQ-2烟雾传感器模块功能实现(STM32)
MQ-7一氧化碳传感器模块功能实现(STM32)
dht11温湿度模块功能实现(STM32)
0.96寸 4针OLED屏模块功能实现(STM32)
按键修改阈值功能、报警功能、空气质量功能实现(STM32)
ESP8266与手机App通信(STM32)
需求分析
需求概述
根据实际需求,本系统主要功能三种:首先,32单片机的各个模块能够正常工作,能够正确地监测厨房内的空气质量、烟雾浓度、CO浓度、温度和湿度等参数,并将这些环境参数传送至OLED屏幕进行显示。其次,这个系统需要能够根据环境参数的变化触发报警机制,例如当空气质量等级较差时触发报警,当温度超过设定阈值时触发报警。最后,这个系统需要能够通过按键调整设定的高低温度,并可以通过手机APP设置环境参数阈值;也需要能够通过Wi-Fi将环境数据发送到手机APP上,并可以通过APP远程监控厨房内的环境变化,以及设置环境参数阈值。
整体操作流程
第一,采集环境参数数据,包括烟雾浓度、CO浓度、温度和湿度,然后根据这些参数评判空气质量;第二,将数据传输到OLED屏幕上进行显示,以及触发相应的报警机制;第三,通过按键调整设定的高低温度,并设置环境参数阈值;第四,将环境数据通过Wi-Fi发送到手机APP上进行远程监控,并可以通过APP设置环境参数阈值。整体操作流程示意图如图所示:
功能需求
环境参数采集:系统需要能够正确采集烟雾浓度、CO浓度、温度和湿度等参数数据,并对空气质量做出正确评判。
数据显示:系统需要能够将监测到的环境数据通过OLED屏幕进行显示。
报警机制:系统需要能够根据环境参数的变化触发报警机制,例如当空气质量等级较差时触发报警,当温度超过设定阈值时触发报警。
按键调整设置:系统需要能够通过按键调整设置的高低温度,并可以通过手机APP设置环境参数阈值。
远程监控:系统需要能够通过Wi-Fi将环境数据发送到手机APP上,并可以通过APP远程监控厨房内的环境变化,以及设置环境参数阈值。
系统可靠性:系统需要保证在长时间运行的情况下能够稳定工作,并且具有一定的抗干扰能力。
用户友好性:系统需要简单易用,并且提供清晰明了的操作界面,使得用户能够方便地操作和设置系统。
非功能需求
性能需求:系统需要具有足够的性能,以便能够在实时监测环境参数的同时,快速进行数据处理和显示。
可靠性需求:系统需要保证高可靠性,以便在长时间运行的情况下不会出现故障。
可维护性需求:系统需要能够方便地进行维护和修复,以便及时解决故障或升级系统。
易用性需求:系统需要提供简单易用的操作界面,以便用户能够方便地设置和操作系统。
可扩展性需求:系统需要具有一定的可扩展性,以便能够在未来根据需要增加新的监测参数或功能。
耗电量需求:系统需要保证较低的耗电量,以便节省能源并延长系统的使用寿命。
响应时间需求:系统需要保证在监测到异常情况时能够及时触发报警机制,以便及时采取相应的措施。
功能实现
烟雾传感器功能实现
所选的烟雾传感器MQ-2型烟雾传感器属于二氧化锡半导体气敏材料,属于表面离子式N型半导体。当处于200~300摄氏度时,二氧化锡吸附空气中的氧,形成氧的负离子吸附,使半导体中的电子密度减少,从而使其电阻值增加。当与烟雾接触时,如果晶粒间界处的势垒收到烟雾的调至而变化,就会引起表面导电率的变化。利用这一点就可以获得这种烟雾存在的信息,烟雾的浓度越大,导电率越大,输出电阻越低,则输出的模拟信号就越大。
本课题使用MQ-2传感器监测CH4的浓度。32单片机可以通过ADC(模数转换器)读取MQ-2传感器输出的模拟电压信号。首先可以先获取ADC在一定时间内的平均值,其次,可以利用公式将ADC的平均值转化为MQ-2的输出电压值,接着根据这个电压信号和传感器特性曲线(即上图中的带黄色三角形的折线)计算出CH4的浓度。例如,定义Smog_Get_Vol()函数用于读取MQ-2传感器的电压值。它使用了STM32的ADC模块来获取模拟信号,并将其转换为数字值。接着,函数将模拟电压值转换为数字值,并将其除以4096.0,以获得0到3.3V范围内的电压值。最后,函数返回电压值,该值与CH4的浓度成正比。然后再定义Smog_GetPPM()函数用于计算MQ-2传感器检测到的CH4浓度。在这个函数里先通过调用Smog_Get_Vol()函数来获取MQ-2传感器的电压值。然后,计算MQ-2传感器的电阻值(RS),该值基于传感器的电压值和电路中的电阻值。在这里,电路中的电阻值(RL)和空气中的CH4浓度下MQ-2传感器的电阻值(R0)是预先确定的常量。最后,该函数计算CH4的浓度(ppm),并返回该值。
MQ2.c
#include "mq2.h"
#define CAL_PPM 10 // 校准环境中PPM值
#define RL 10 // RL阻值
#define R0 26 // R0阻值
void MQ2_Init(void)
{
GPIO_InitTypeDef GPIO_InitStructure;
ADC_CommonInitTypeDef ADC_CommonInitStructure;
ADC_InitTypeDef ADC_InitStructure;
/* 引脚和ADC的时钟使能 */
RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOA, ENABLE);
RCC_APB2PeriphClockCmd(RCC_APB2Periph_ADC1, ENABLE);
/* 配置引脚为模拟功能模式 */
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_4;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AN; //模拟功能模式
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL ;
GPIO_Init(GPIOA, &GPIO_InitStructure);
/* ADC的常规配置 */
ADC_CommonInitStructure.ADC_Mode = ADC_Mode_Independent; //独立模式
ADC_CommonInitStructure.ADC_Prescaler = ADC_Prescaler_Div2; //84MHz/2 = 42MHz
ADC_CommonInitStructure.ADC_DMAAccessMode = ADC_DMAAccessMode_Disabled; //禁止MDA
ADC_CommonInitStructure.ADC_TwoSamplingDelay = ADC_TwoSamplingDelay_5Cycles; //ADC通道采用间隔
ADC_CommonInit(&ADC_CommonInitStructure);
/* ADC1 初始化 ****************************************************************/
ADC_InitStructure.ADC_Resolution = ADC_Resolution_12b; //分辨率
ADC_InitStructure.ADC_ScanConvMode = DISABLE; //禁止扫描
ADC_InitStructure.ADC_ContinuousConvMode = ENABLE; //连续转换模式
ADC_InitStructure.ADC_ExternalTrigConvEdge = ADC_ExternalTrigConvEdge_None;//不需要外部触发
ADC_InitStructure.ADC_DataAlign = ADC_DataAlign_Right; //数据右对齐
ADC_InitStructure.ADC_NbrOfConversion = 1; //一次转换
ADC_Init(ADC1, &ADC_InitStructure);
//ADC1的采样通道4放入规则通道1中
ADC_RegularChannelConfig(ADC1, ADC_Channel_4, 1, ADC_SampleTime_3Cycles);
/* 使能 ADC1 */
ADC_Cmd(ADC1, ENABLE);
}
uint32_t MQ2_ADC_Read(void)
{
/* 启动软件触发检测 */
ADC_SoftwareStartConv(ADC1);
//等待转换结束
while( ADC_GetFlagStatus(ADC1, ADC_FLAG_EOC) == RESET);
return ADC_GetConversionValue(ADC1);
}
//计算平均值
u16 ADC1_Average_Data(u8 ADC_Channel)
{
u16 temp_val=0;
u8 t;
for(t=0;t<SMOG_READ_TIMES;t++) //#define SMOG_READ_TIMES 10 定义烟雾传感器读取次数,读这么多次,然后取平均值
{
temp_val+=MQ2_ADC_Read(); //读取ADC值
delay_ms(5);
}
temp_val/=SMOG_READ_TIMES;//得到平均值
return (u16)temp_val;//返回算出的ADC平均值
}
//读取MQ7传感器的电压值
float Smog_Get_Vol(void)
{
u16 adc_value = 0;//这是从MQ-7传感器模块电压输出的ADC转换中获得的原始数字值,该值的范围为0到4095,将模拟电压表示为数字值
float voltage = 0;//MQ-7传感器模块的电压输出,与一氧化碳的浓度成正比
adc_value = ADC1_Average_Data(ADC_Channel_4);//#define SMOG_ADC_CHX ADC_Channel_4 定义烟雾传感器所在的ADC通道编号
delay_ms(5);
voltage = (3.3/4096.0)*(adc_value);
return voltage;
}
/*********************
// 传感器校准函数,根据当前环境PPM值与测得的RS电压值,反推出R0值,在空气中运行过后测出R0为26
float MQ7_PPM_Calibration()
{
float RS = 0;
float R0 = 0;
RS = (3.3f - Smog_Get_Vol()) / Smog_Get_Vol() * RL;//RL 10 // RL阻值
R0 = RS / pow(CAL_PPM / 98.322, 1 / -1.458f);//CAL_PPM 10 // 校准环境中PPM值
return R0;
}
**********************/
// 计算Smog_ppm
float Smog_GetPPM()
{
float RS = (3.3f - Smog_Get_Vol()) / Smog_Get_Vol() * RL;
float ppm = 98.322f * pow(RS/R0, -1.458f);
return ppm;
}
mq2.h
#ifndef _MQ2_H
#define _MQ2_H
//C文件中需要的其他的头文件
#include <stm32f4xx.h>
#include "sys.h"
#include "delay.h"
#include "math.h"
#define SMOG_READ_TIMES 10 //定义烟雾传感器读取次数,读这么多次,然后取平均值
//C文件中定义的函数的声明
void MQ2_Init(void);
float Smog_Get_Vol(void); //读取MQ7传感器的电压值
//float MQ7_PPM_Calibration(void);
float Smog_GetPPM(void);
#endif
CO传感器模块功能实现
所选的CO传感器MQ-7也是一种基于半导体的烟雾传感器,由微型AL2O3陶瓷管、二氧化锡(SnO2)敏感层、测量电极和加热器组成,其工作原理与上述MQ-2传感器一致,是基于化学反应和电学信号转换。
MQ-7烟雾传感器内部有一块小小的加热器,通过电流加热,使得传感器的工作环境温度升高,同时加速气体分子的运动。当空气中存在烟雾、煤气等有机化合物时,这些化合物会在加热器上发生化学反应,释放出一些气体,如二氧化碳、一氧化碳等。这些气体会进入传感器内部的敏感元件,与氧气发生化学反应,导致敏感元件的电阻发生变化,当空气中的CO浓度增加时,电阻减小,从而输出一个模拟信号。而32单片机通过模数转换器(ADC)读取传感器输出的模拟电压信号,并根据传感器特性曲线函数将电压值转换为一氧化碳浓度值。具体步骤为:首先获取ADC在一定时间内的平均值,其次,可以利用公式将ADC的平均值转化为MQ-7的输出电压值,接着根据这个电压信号和传感器特性曲线计算出CO的浓度。由于MQ-7的原理与上述的MQ-2类似,此处不做详细说明。
MQ7.c
#include "mq7.h"
#define CAL_PPM 10 // 校准环境中PPM值
#define RL 10 // RL阻值
#define R0 16 // R0阻值
u16 MQ7_Buffer[4];
void CO_Init(void)
{
GPIO_InitTypeDef GPIO_InitStructure;
RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOA,ENABLE);//使能PA的时钟
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_6; //PA6 模拟输入引脚
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AN; //输入模式
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL; //上下拉电阻:无上下拉电阻
GPIO_Init(GPIOA, &GPIO_InitStructure);
adc_Init();
}
//计算平均值
u16 ADC2_Average_Data(u8 ADC_Channel)
{
u16 temp_val=0;
u8 t;
for(t=0;t<CO_READ_TIMES;t++) //#define CO_READ_TIMES 10 定义烟雾传感器读取次数,读这么多次,然后取平均值
{
temp_val+=ADC_Read(); //读取ADC值
delay_ms(5);
}
temp_val/=CO_READ_TIMES;//得到平均值
return (u16)temp_val;//返回算出的ADC平均值
}
//float voltage = adc_value * (3.3 / 4096.0); 将ADC值转换为电压
/***********************************
计算Rs的两种公式
float Rs = (3.3 * RL) / voltage - RL; 计算传感器的电阻 RL:负载电阻阻值
float RS = (3.3f - voltage) / voltage * RL;
************************************/
//float co_ppm = a * pow(Rs/R0, b); 使用校准曲线计算一氧化碳浓度
//a, b是MQ-7传感器模块校准曲线的系数.其值来源于MQ7的手册资料,a = 98.322, b = -1.458
//R0是器件在洁净空气中的电阻值,来自于MQ-7灵敏度特性曲线,R0 = RS / pow(CAL_PPM / 98.322, 1 / -1.458f);
//读取MQ7传感器的电压值
float CO_Get_Vol()
{
u16 adc_value = 0;//这是从MQ-7传感器模块电压输出的ADC转换中获得的原始数字值,该值的范围为0到4095,将模拟电压表示为数字值
float voltage = 0;//MQ-7传感器模块的电压输出,与一氧化碳的浓度成正比
adc_value = ADC2_Average_Data(ADC_Channel_6);
delay_ms(5);
voltage = (3.3/4096.0)*(adc_value);
return voltage;
}
/*********************
// 传感器校准函数,根据当前环境PPM值与测得的RS电压值,反推出R0值,在空气中运行过后测出R0为16
float MQ7_PPM_Calibration()
{
float RS = 0;
float R0 = 0;
RS = (3.3f - Smog_Get_Vol()) / Smog_Get_Vol() * RL;//RL 10 // RL阻值
R0 = RS / pow(CAL_PPM / 98.322, 1 / -1.458f);//CAL_PPM 10 // 校准环境中PPM值
return R0;
}
**********************/
// 计算CO_ppm
float MQ7_GetPPM()
{
float RS = (3.3f - CO_Get_Vol()) / CO_Get_Vol() * RL;
float ppm = 98.322f * pow(RS/R0, -1.458f);
return ppm;
}
adc.c
#include "adc.h"
void adc_Init()
{
GPIO_InitTypeDef GPIO_InitStructure;
ADC_CommonInitTypeDef ADC_CommonInitStructure;
ADC_InitTypeDef ADC_InitStructure;
// 使能 ADC 引脚的 GPIO 时钟
RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOA, ENABLE);
// 将 ADC 引脚配置为模拟输入
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_6;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AN;
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL ;
GPIO_Init(GPIOA, &GPIO_InitStructure);
// 使能 ADC2 时钟
RCC_APB2PeriphClockCmd(RCC_APB2Periph_ADC2, ENABLE);
/* ADC的常规配置 */
ADC_CommonInitStructure.ADC_Mode = ADC_Mode_Independent; //独立模式
ADC_CommonInitStructure.ADC_Prescaler = ADC_Prescaler_Div2; //84MHZ/2 = 42MHZ
ADC_CommonInitStructure.ADC_DMAAccessMode = ADC_DMAAccessMode_Disabled; //禁止MDA
ADC_CommonInitStructure.ADC_TwoSamplingDelay = ADC_TwoSamplingDelay_5Cycles; //ADC通道采用间隔
ADC_CommonInit(&ADC_CommonInitStructure);
// ADC初始化
ADC_InitStructure.ADC_Resolution = ADC_Resolution_12b;//分辨率
ADC_InitStructure.ADC_ScanConvMode = DISABLE;//禁止扫描
ADC_InitStructure.ADC_ContinuousConvMode = ENABLE;//连续转换模式
ADC_InitStructure.ADC_ExternalTrigConvEdge = ADC_ExternalTrigConvEdge_None;//不需要外部触发
ADC_InitStructure.ADC_DataAlign = ADC_DataAlign_Right;//数据右对齐
ADC_InitStructure.ADC_NbrOfConversion = 1;//一次转换
ADC_Init(ADC2, &ADC_InitStructure);
//ADC2的采样通道6放入规则通道1中
ADC_RegularChannelConfig(ADC2, ADC_Channel_6, 1, ADC_SampleTime_3Cycles);
// 使能 ADC2
ADC_Cmd(ADC2, ENABLE);
// 初始化 ADC2
ADC_SoftwareStartConv(ADC2);
}
//获得 ADC 值
uint16_t ADC_Read(void)
{
// 开始转换
ADC_SoftwareStartConv(ADC2);
// 等到转换完成
while (ADC_GetFlagStatus(ADC2, ADC_FLAG_EOC) == RESET);
// 获取转换结果
return ADC_GetConversionValue(ADC2);
}
mq7.h
#ifndef _MQ7_H
#define _MQ7_H
//C文件中需要的其他的头文件
#include <stm32f4xx.h>
#include "sys.h"
#include "delay.h"
#include "math.h"
#include "adc.h"
#define SMOG_PIN46_R 1000 //烟雾传感器管脚4、6接出到地的电阻值
#define CO_READ_TIMES 10 //定义CO传感器读取次数,读这么多次,然后取平均值
//C文件中定义的函数的声明
void CO_Init(void);
u16 ADC2_Average_Data(u8 ADC_Channel);
float CO_Get_Vol(void);
//float MQ7_PPM_Calibration();
float MQ7_GetPPM(void);
#endif
adc.h
#ifndef _ADC_H
#define _ADC_H
//C文件中需要的其他的头文件
#include <stm32f4xx.h>
#include "sys.h"
#include "delay.h"
//C文件中定义的函数的声明
void adc_Init(void);
uint16_t ADC_Read(void);
#endif
温湿度模块功能实现
DTH11内部集成了温湿度传感器模块和数字式信号处理电路,它可以将温度和湿度值转换为数字信号输出。数字信号输出格式为二进制数,包括40位数据,其中包含8位的湿度整数数据、8位的湿度小数数据、8位的温度整数数据、8位的温度小数数据以及8位校验和。STM32通过读取DTH11输出的数字信号,就可以得到温度和湿度的精确值,进而对环境进行控制。
STM32单片机通过引脚与dth11传感器进行连接,包括VCC、GND、DATA三个引脚。单片机向dth11传感器发送开始信号,即拉低DATA引脚,持续至少18ms,然后再将DATA引脚拉高,等待dth11传感器的响应。此时dth11传感器会发送一个80us的低电平响应信号,然后再发送一个80us的高电平信号,表示已经准备好发送数据。接着,dth11传感器开始向单片机发送40位二进制数据,包括湿度值、温度值、校验位等信息。每一位数据都有固定的发送方式,即:首先,dth11传感器会将DATA引脚拉低50us,表示开始发送一位数据;其次,dth11传感器会根据实际数值将DATA引脚拉高26~28us表示0,或者拉高70us表示1;最后,单片机需要在每一位数据发送完毕后,将DATA引脚拉高,等待下一位数据的发送。当单片机接收到40位数据后,需要对数据进行解析,获取温度和湿度数值,以及校验位信息。
在实际操作时,可以定义一个dht11_read_data()函数用于从DHT11传感器读取温度和湿度数据,该函数首先通过调用dht11_start()函数启动DHT11传感器,并等待其应答。如果DHT11传感器在100次内没有应答,则函数返回-1表示启动失败。接着,该函数通过调用dht11_readbyte()函数读取5个字节的数据,其中前两个字节是湿度数据,接下来两个字节是温度数据,最后一个字节是校验和。最后,该函数计算校验和,如果校验和不匹配,则函数返回-2表示数据读取失败。如果一切正常,则函数返回0,读取到的湿度和温度数据存储在输入的缓冲区(buf)中。
DHT11.c
#include "DHT11.h"
void dht11_outputmode(void)
{
GPIO_InitTypeDef GPIO_InitStructure;
//初始化DHT11对应的引脚 PG9 的时钟
RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOG, ENABLE);
//2、通过结构体初始化DHT11引脚
/* 配置PG9 引脚为输出模式 */
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_9; //配置的引脚
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT; //输出模式
GPIO_InitStructure.GPIO_OType = GPIO_OType_PP; //推挽模式
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_100MHz; //速度为100MHz
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL; //上下拉电阻:无上下拉电阻
GPIO_Init(GPIOG, &GPIO_InitStructure);
}
void dht11_inputmode(void)
{
GPIO_InitTypeDef GPIO_InitStructure;
//初始化DHT11对应的引脚 PG9 的时钟
RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOG, ENABLE);
//2、通过结构体初始化DHT11引脚
/* 配置PG9 引脚为输出模式 */
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_9; //配置的引脚
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN; //输入模式
GPIO_InitStructure.GPIO_OType = GPIO_OType_PP; //推挽模式
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_100MHz; //速度为100MHz
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL; //上下拉电阻:无上下拉电阻
GPIO_Init(GPIOG, &GPIO_InitStructure);
}
//发送开始信号和接收响应信号
uint32_t dht11_start(void)
{
uint32_t i;
/* 发送开始信号 */
//配置PG9位输出模式
dht11_outputmode();
//引脚输出低电平
PGout(9) = 0;
delay_ms(20);
//引脚输出高电平
PGout(9) = 1;
delay_us(30);
/* 接收响应信号 */
//配置PG9位输入模式
dht11_inputmode();
//检测低电平,最多持续100us
i=0;
while(i<100)
{
//检测到低电平跳出循环
if(PGin(9) == 0)
break;
i++;
delay_us(1);
}
if(i>=100) //上面的循环是超时跳出,对方无响应
return 1;
//检测高电平,最多持续100us
i=0;
while(i<100)
{
//检测到高电平跳出循环
if(PGin(9))
break;
i++;
delay_us(1);
}
if(i>=100) //上面的循环是超时跳出,对方无响应
return 2;
return 0;
}
uint8_t dht11_readbyte(void)
{
int i;
uint8_t d=0;
//跳过前面的高电平
while(PGin(9));
for(i=0; i<8; i++)
{
//跳过前面50us低电平
while(PGin(9)==0);
delay_us(40);
if(PGin(9)) //引脚为高电平,说明数据为1
{
d |= 1<<(7-i);//保存数据
while(PGin(9)); //跳过剩余的高电平时间
}
}
return d;
}
int dht11_read_data(uint8_t *buf)
{
//让DHT11启动
int i=0;
while(i<100)
{
//启动成功,跳出循环
if(dht11_start() == 0)
break;
i++;
delay_us(1);
}
if(i>=100)//上面循环是由于超时退出,DHT11没有启动
return -1;
//读取5字节数据
for(i=0; i<5; i++)
{
buf[i] = dht11_readbyte();
}
//计算检验和
if(buf[4] != buf[0]+buf[1]+buf[2]+buf[3])
return -2;
return 0;
}
DHT11.h
#ifndef _DHT11_H
#define _DHT11_H
//C文件中需要的其他的头文件
#include <stm32f4xx.h>
#include "sys.h"
#include "delay.h"
//C文件中定义的函数的声明
int dht11_read_data(uint8_t *buf);
#endif
OLED模块功能实现
在32单片机中使用0.96寸4针OLED屏模块时,需要将单片机的输出信号转化为OLED屏幕可识别的信号。因此,需要使用相应的OLED控制器,通过I2C总线进行通信,将单片机的输出信号转化为OLED屏幕可识别的信号。代码中应定义OLED屏模块的驱动函数,OLED屏模块的驱动程序主要包括以下几个部分:写入函数(用于向OLED发送命令或数据)、清屏函数(用于清除OLED上的所有内容)、显示函数(用于将缓冲区中的内容写入到OLED上)、点亮或熄灭像素点的函数、显示字符或字符串的函数等。最后初始化OLED屏模块,具体步骤为:首先开启GPIOB的时钟;然后设置GPIOB的8、9引脚为输出模式,推挽输出,100MHz速率,上拉;延时200ms,等待OLED屏幕启动;发送OLED的初始化命令序列;最后清空OLED屏幕。由于环境参数是变动的,所以可以考虑将环境参数变量和环境阈值转化为字符串形式再由OLED屏输出。
oled.c
#include "oled.h"
#include "stdlib.h"
#include "oledfont.h"
u8 OLED_GRAM[144][8];
void delay(u32 t)
{
while(t--);
}
//反显函数
void OLED_ColorTurn(u8 i)
{
if(i==0)
{
OLED_WR_Byte(0xA6,OLED_CMD);//正常显示
}
if(i==1)
{
OLED_WR_Byte(0xA7,OLED_CMD);//反色显示
}
}
//屏幕旋转180度
void OLED_DisplayTurn(u8 i)
{
if(i==0)
{
OLED_WR_Byte(0xC8,OLED_CMD);//正常显示
OLED_WR_Byte(0xA1,OLED_CMD);
}
if(i==1)
{
OLED_WR_Byte(0xC0,OLED_CMD);//反转显示
OLED_WR_Byte(0xA0,OLED_CMD);
}
}
//起始信号
void I2C_Start(void)
{
OLED_SDIN_Set();delay(1);
OLED_SCLK_Set();delay(1);
OLED_SDIN_Clr();delay(1);
OLED_SCLK_Clr();delay(1);
}
//结束信号
void I2C_Stop(void)
{
OLED_SCLK_Set();delay(1);
OLED_SDIN_Clr();delay(1);
OLED_SDIN_Set();delay(1);
}
//等待信号响应
void I2C_WaitAck(void) //测数据信号的电平
{
OLED_SCLK_Set();delay(1);
OLED_SCLK_Clr();delay(1);
}
//写入一个字节
void Send_Byte(u8 dat)
{
u8 i;
for(i=0;i<8;i++)
{
OLED_SCLK_Clr();//将时钟信号设置为低电平
delay(1);
if(dat&0x80)//将dat的8位从最高位依次写入
{
OLED_SDIN_Set();delay(1);
}
else
{
OLED_SDIN_Clr();delay(1);
}
OLED_SCLK_Set();//将时钟信号设置为高电平
delay(1);
OLED_SCLK_Clr();//将时钟信号设置为低电平
delay(1);
dat<<=1;
}
}
//发送一个字节
//向SSD1306写入一个字节。
//mode:数据/命令标志 0,表示命令;1,表示数据;
void OLED_WR_Byte(u8 dat,u8 mode)
{
I2C_Start();
Send_Byte(0x78);
I2C_WaitAck();
if(mode){Send_Byte(0x40);}
else{Send_Byte(0x00);}
I2C_WaitAck();
Send_Byte(dat);
I2C_WaitAck();
I2C_Stop();
}
//开启OLED显示
void OLED_DisPlay_On(void)
{
OLED_WR_Byte(0x8D,OLED_CMD);//电荷泵使能
OLED_WR_Byte(0x14,OLED_CMD);//开启电荷泵
OLED_WR_Byte(0xAF,OLED_CMD);//点亮屏幕
}
//关闭OLED显示
void OLED_DisPlay_Off(void)
{
OLED_WR_Byte(0x8D,OLED_CMD);//电荷泵使能
OLED_WR_Byte(0x10,OLED_CMD);//关闭电荷泵
OLED_WR_Byte(0xAF,OLED_CMD);//关闭屏幕
}
//更新显存到OLED
void OLED_Refresh(void)
{
u8 i,n;
for(i=0;i<8;i++)
{
OLED_WR_Byte(0xb0+i,OLED_CMD); //设置行起始地址
OLED_WR_Byte(0x00,OLED_CMD); //设置低列起始地址
OLED_WR_Byte(0x10,OLED_CMD); //设置高列起始地址
for(n=0;n<128;n++)
OLED_WR_Byte(OLED_GRAM[n][i],OLED_DATA);
}
}
//清屏函数
void OLED_Clear(void)
{
u8 i,n;
for(i=0;i<8;i++)
{
for(n=0;n<128;n++)
{
OLED_GRAM[n][i]=0;//清除所有数据
}
}
OLED_Refresh();//更新显示
}
//画点
//x:0~127
//y:0~63
void OLED_DrawPoint(u8 x,u8 y)
{
u8 i,m,n;
i=y/8;
m=y%8;
n=1<<m;
OLED_GRAM[x][i]|=n;
}
//清除一个点
//x:0~127
//y:0~63
void OLED_ClearPoint(u8 x,u8 y)
{
u8 i,m,n;
i=y/8;
m=y%8;
n=1<<m;
OLED_GRAM[x][i]=~OLED_GRAM[x][i];
OLED_GRAM[x][i]|=n;
OLED_GRAM[x][i]=~OLED_GRAM[x][i];
}
//画线
//x:0~128
//y:0~64
void OLED_DrawLine(u8 x1,u8 y1,u8 x2,u8 y2)
{
u8 i,k,k1,k2,y0;
if((x1<0)||(x2>128)||(y1<0)||(y2>64)||(x1>x2)||(y1>y2))return;
if(x1==x2) //画竖线
{
for(i=0;i<(y2-y1);i++)
{
OLED_DrawPoint(x1,y1+i);
}
}
else if(y1==y2) //画横线
{
for(i=0;i<(x2-x1);i++)
{
OLED_DrawPoint(x1+i,y1);
}
}
else //画斜线
{
k1=y2-y1;
k2=x2-x1;
k=k1*10/k2;
for(i=0;i<(x2-x1);i++)
{
OLED_DrawPoint(x1+i,y1+i*k/10);
}
}
}
//x,y:圆心坐标
//r:圆的半径
void OLED_DrawCircle(u8 x,u8 y,u8 r)
{
int a, b,num;
a = 0;
b = r;
while(2 * b * b >= r * r)
{
OLED_DrawPoint(x + a, y - b);
OLED_DrawPoint(x - a, y - b);
OLED_DrawPoint(x - a, y + b);
OLED_DrawPoint(x + a, y + b);
OLED_DrawPoint(x + b, y + a);
OLED_DrawPoint(x + b, y - a);
OLED_DrawPoint(x - b, y - a);
OLED_DrawPoint(x - b, y + a);
a++;
num = (a * a + b * b) - r*r;//计算画的点离圆心的距离
if(num > 0)
{
b--;
a--;
}
}
}
//在指定位置显示一个字符,包括部分字符
//x:0~127
//y:0~63
//size:选择字体 12/16/24
//取模方式 逐列式
void OLED_ShowChar(u8 x,u8 y,u8 chr,u8 size1)
{
u8 i,m,temp,size2,chr1;
u8 y0=y;
size2=(size1/8+((size1%8)?1:0))*(size1/2); //得到字体一个字符对应点阵集所占的字节数
chr1=chr-' '; //计算偏移后的值
for(i=0;i<size2;i++)
{
if(size1==12)
{temp=asc2_1206[chr1][i];} //调用1206字体
else if(size1==16)
{temp=asc2_1608[chr1][i];} //调用1608字体
else if(size1==24)
{temp=asc2_2412[chr1][i];} //调用2412字体
else return;
for(m=0;m<8;m++) //写入数据
{
if(temp&0x80)OLED_DrawPoint(x,y);
else OLED_ClearPoint(x,y);
temp<<=1;
y++;
if((y-y0)==size1)
{
y=y0;
x++;
break;
}
}
}
}
//显示字符串
//x,y:起点坐标
//size1:字体大小
//*chr:字符串起始地址
void OLED_ShowString(u8 x,u8 y,u8 *chr,u8 size1)
{
while((*chr>=' ')&&(*chr<='~'))//判断是不是非法字符!
{
OLED_ShowChar(x,y,*chr,size1);
x+=size1/2;
if(x>128-size1) //换行
{
x=0;
y+=2;
}
chr++;
}
}
//m^n
u32 OLED_Pow(u8 m,u8 n)
{
u32 result=1;
while(n--)
{
result*=m;
}
return result;
}
显示2个数字
x,y :起点坐标
len :数字的位数
size:字体大小
void OLED_ShowNum(u8 x,u8 y,u32 num,u8 len,u8 size1)
{
u8 t,temp;
for(t=0;t<len;t++)
{
temp=(num/OLED_Pow(10,len-t-1))%10;
if(temp==0)
{
OLED_ShowChar(x+(size1/2)*t,y,'0',size1);
}
else
{
OLED_ShowChar(x+(size1/2)*t,y,temp+'0',size1);
}
}
}
//显示汉字
//x,y:起点坐标
//num:汉字对应的序号
//取模方式 列行式
void OLED_ShowChinese(u8 x,u8 y,u8 num,u8 size1)
{
u8 i,m,n=0,temp,chr1;
u8 x0=x,y0=y;
u8 size3=size1/8;
while(size3--)
{
chr1=num*size1/8+n;
n++;
for(i=0;i<size1;i++)
{
if(size1==16)
{temp=Hzk1[chr1][i];}//调用16*16字体
else if(size1==24)
{temp=Hzk2[chr1][i];}//调用24*24字体
else if(size1==32)
{temp=Hzk3[chr1][i];}//调用32*32字体
else if(size1==64)
{temp=Hzk4[chr1][i];}//调用64*64字体
else return;
for(m=0;m<8;m++)
{
if(temp&0x01)OLED_DrawPoint(x,y);
else OLED_ClearPoint(x,y);
temp>>=1;
y++;
}
x++;
if((x-x0)==size1)
{x=x0;y0=y0+8;}
y=y0;
}
}
}
//显示汉字
//x,y:起点坐标
//num:汉字对应的序号
//取模方式 列行式
void OLED_ShowChinese2(u8 x,u8 y,u8 num,u8 size1)
{
u8 i,m,n=0,temp,chr1;
u8 x0=x,y0=y;
u8 size3=size1/8;
while(size3--)
{
chr1=num*size1/8+n;
n++;
for(i=0;i<size1;i++)
{
if(size1==16)
{temp=Hzk5[chr1][i];}//调用16*16字体
else if(size1==24)
{temp=Hzk2[chr1][i];}//调用24*24字体
else if(size1==32)
{temp=Hzk3[chr1][i];}//调用32*32字体
else if(size1==64)
{temp=Hzk4[chr1][i];}//调用64*64字体
else return;
for(m=0;m<8;m++)
{
if(temp&0x01)OLED_DrawPoint(x,y);
else OLED_ClearPoint(x,y);
temp>>=1;
y++;
}
x++;
if((x-x0)==size1)
{x=x0;y0=y0+8;}
y=y0;
}
}
}
//显示汉字
//x,y:起点坐标
//num:汉字对应的序号
//取模方式 列行式
void OLED_ShowChinese3(u8 x,u8 y,u8 num,u8 size1)
{
u8 i,m,n=0,temp,chr1;
u8 x0=x,y0=y;
u8 size3=size1/8;
while(size3--)
{
chr1=num*size1/8+n;
n++;
for(i=0;i<size1;i++)
{
if(size1==16)
{temp=Hzk6[chr1][i];}//调用16*16字体
else return;
for(m=0;m<8;m++)
{
if(temp&0x01)OLED_DrawPoint(x,y);
else OLED_ClearPoint(x,y);
temp>>=1;
y++;
}
x++;
if((x-x0)==size1)
{x=x0;y0=y0+8;}
y=y0;
}
}
}
//num 显示汉字的个数
//space 上一遍的尾和下一遍的头的间隔
void OLED_ScrollDisplay(u8 num,u8 space)
{
u8 i,n,t=0,m=0,r;
int c=161;
while(c)
{
if(m==0)
{
OLED_ShowChinese(128,0,t,16); //写入一个汉字保存在OLED_GRAM[][]数组中
OLED_ShowChinese(128,16,t,16); //写入一个汉字保存在OLED_GRAM[][]数组中
OLED_ShowChinese(128,32,t,16); //写入一个汉字保存在OLED_GRAM[][]数组中
OLED_ShowChinese(128,48,t,16); //写入一个汉字保存在OLED_GRAM[][]数组中
t++;
}
if(t==num)
{
for(r=0;r<16*space;r++) //显示间隔
{
for(i=0;i<144;i++)
{
for(n=0;n<8;n++)
{
OLED_GRAM[i-1][n]=OLED_GRAM[i][n];
}
}
OLED_Refresh();
}
t=0;
}
m++;
if(m==16){m=0;}
for(i=0;i<144;i++) //实现左移
{
for(n=0;n<8;n++)
{
OLED_GRAM[i-1][n]=OLED_GRAM[i][n];
}
}
OLED_Refresh();
c--;
if (c==0) break;
}
}
//配置写入数据的起始位置
void OLED_WR_BP(u8 x,u8 y)
{
OLED_WR_Byte(0xb0+y,OLED_CMD);//设置行起始地址
OLED_WR_Byte(((x&0xf0)>>4)|0x10,OLED_CMD);
OLED_WR_Byte((x&0x0f),OLED_CMD);
}
//x0,y0:起点坐标
//x1,y1:终点坐标
//BMP[]:要写入的图片数组
void OLED_ShowPicture(u8 x0,u8 y0,u8 x1,u8 y1,u8 BMP[])
{
u32 j=0;
u8 x=0,y=0;
if(y%8==0)y=0;
else y+=1;
for(y=y0;y<y1;y++)
{
OLED_WR_BP(x0,y);
for(x=x0;x<x1;x++)
{
OLED_WR_Byte(BMP[j],OLED_DATA);
j++;
}
}
}
//OLED的初始化
void OLED_Init(void)
{
GPIO_InitTypeDef GPIO_InitStructure;
RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOB,ENABLE);//使能PORTA~E,PORTG时钟
//GPIO初始化设置
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_8|GPIO_Pin_9;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT;//普通输出模式
GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;//推挽输出
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_100MHz;//100MHz
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_UP;//上拉
GPIO_Init(GPIOB, &GPIO_InitStructure);//初始化
delay_ms(200);
OLED_WR_Byte(0xAE,OLED_CMD);//--关闭OLED面板
OLED_WR_Byte(0x00,OLED_CMD);//---设置低列地址
OLED_WR_Byte(0x10,OLED_CMD);//---设置高列地址
OLED_WR_Byte(0x40,OLED_CMD);//--设置起始行地址 设置映射 RAM 显示起始行 (0x00~0x3F)
OLED_WR_Byte(0x81,OLED_CMD);//--设置对比度控制寄存器
OLED_WR_Byte(0xCF,OLED_CMD);// 设置 SEG 输出电流亮度
OLED_WR_Byte(0xA1,OLED_CMD);//--设置 SEG/列映射 0xa0左右反置 0xa1正常
OLED_WR_Byte(0xC8,OLED_CMD);//设置 COM/行扫描方向 0xc0上下反置 0xc8正常
OLED_WR_Byte(0xA6,OLED_CMD);//--设置正常显示
OLED_WR_Byte(0xA8,OLED_CMD);//--设置复用比(1 到 64)
OLED_WR_Byte(0x3f,OLED_CMD);//--1/64 duty
OLED_WR_Byte(0xD3,OLED_CMD);//-设置显示偏移量 移位映射 RAM 计数器 (0x00~0x3F)
OLED_WR_Byte(0x00,OLED_CMD);//-不抵消
OLED_WR_Byte(0xd5,OLED_CMD);//--设置显示时钟分频比/振荡器频率
OLED_WR_Byte(0x80,OLED_CMD);//--设置分频比,设置时钟为 100 帧/秒
OLED_WR_Byte(0xD9,OLED_CMD);//--设置预充电期
OLED_WR_Byte(0xF1,OLED_CMD);//将预充电设置为 15 个时钟,将放电设置为 1 个时钟
OLED_WR_Byte(0xDA,OLED_CMD);//--设置 com 引脚硬件配置
OLED_WR_Byte(0x12,OLED_CMD);
OLED_WR_Byte(0xDB,OLED_CMD);//--设置 vcomh
OLED_WR_Byte(0x40,OLED_CMD);//设置 VCOM 取消选择级别
OLED_WR_Byte(0x20,OLED_CMD);//-设置页面寻址模式(0x00/0x01/0x02)
OLED_WR_Byte(0x02,OLED_CMD);//
OLED_WR_Byte(0x8D,OLED_CMD);//--设置电荷泵启用/禁用
OLED_WR_Byte(0x14,OLED_CMD);//--设置(0x10)禁用
OLED_WR_Byte(0xA4,OLED_CMD);// 禁用整个显示 (0xa4/0xa5)
OLED_WR_Byte(0xA6,OLED_CMD);// 禁用反向显示 (0xa6/a7)
OLED_WR_Byte(0xAF,OLED_CMD);
OLED_Clear();
}
oled.h
#ifndef __OLED_H
#define __OLED_H
#include "sys.h"
#include "stdlib.h"
#include "delay.h"
//-----------------OLED端口定义----------------
#define OLED_SCLK_Clr() GPIO_ResetBits(GPIOB,GPIO_Pin_8)//SCL
#define OLED_SCLK_Set() GPIO_SetBits(GPIOB,GPIO_Pin_8)
#define OLED_SDIN_Clr() GPIO_ResetBits(GPIOB,GPIO_Pin_9)//DIN
#define OLED_SDIN_Set() GPIO_SetBits(GPIOB,GPIO_Pin_9)
#define OLED_CMD 0 //写命令
#define OLED_DATA 1 //写数据
#define u8 unsigned char
#define u32 unsigned int
void OLED_ClearPoint(u8 x,u8 y);
void OLED_ColorTurn(u8 i);
void OLED_DisplayTurn(u8 i);
void I2C_Start(void);
void I2C_Stop(void);
void I2C_WaitAck(void);
void Send_Byte(u8 dat);
void OLED_WR_Byte(u8 dat,u8 cmd);
void OLED_DisPlay_On(void);
void OLED_DisPlay_Off(void);
void OLED_Refresh(void);
void OLED_Clear(void);
void OLED_DrawPoint(u8 x,u8 y);
void OLED_DrawLine(u8 x1,u8 y1,u8 x2,u8 y2);
void OLED_DrawCircle(u8 x,u8 y,u8 r);
void OLED_ShowChar(u8 x,u8 y,u8 chr,u8 size1);
void OLED_ShowString(u8 x,u8 y,u8 *chr,u8 size1);
void OLED_ShowNum(u8 x,u8 y,u32 num,u8 len,u8 size1);
void OLED_ShowChinese(u8 x,u8 y,u8 num,u8 size1);
void OLED_ShowChinese2(u8 x,u8 y,u8 num,u8 size1);
void OLED_ShowChinese3(u8 x,u8 y,u8 num,u8 size1);
void OLED_ScrollDisplay(u8 num,u8 space);
void OLED_WR_BP(u8 x,u8 y);
void OLED_ShowPicture(u8 x0,u8 y0,u8 x1,u8 y1,u8 BMP[]);
void OLED_Init(void);
#endif
oledfont.h
#ifndef __OLEDFONT_H
#define __OLEDFONT_H
//常用ASCII表
//偏移量32
//ASCII字符集
//偏移量32
//大小:12*6
/************************************6*8的点阵************************************/
//12*12 ASCII字符集点阵
const unsigned char asc2_1206[95][12]={
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},/*" ",0*/
{0x00,0x00,0x00,0x00,0x3F,0x40,0x00,0x00,0x00,0x00,0x00,0x00},/*"!",1*/
{0x00,0x00,0x30,0x00,0x40,0x00,0x30,0x00,0x40,0x00,0x00,0x00},/*""",2*/
{0x09,0x00,0x0B,0xC0,0x3D,0x00,0x0B,0xC0,0x3D,0x00,0x09,0x00},/*"#",3*/
{0x18,0xC0,0x24,0x40,0x7F,0xE0,0x22,0x40,0x31,0x80,0x00,0x00},/*"$",4*/
{0x18,0x00,0x24,0xC0,0x1B,0x00,0x0D,0x80,0x32,0x40,0x01,0x80},/*"%",5*/
{0x03,0x80,0x1C,0x40,0x27,0x40,0x1C,0x80,0x07,0x40,0x00,0x40},/*"&",6*/
{0x10,0x00,0x60,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},/*"'",7*/
{0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0x80,0x20,0x40,0x40,0x20},/*"(",8*/
{0x00,0x00,0x40,0x20,0x20,0x40,0x1F,0x80,0x00,0x00,0x00,0x00},/*")",9*/
{0x09,0x00,0x06,0x00,0x1F,0x80,0x06,0x00,0x09,0x00,0x00,0x00},/*"*",10*/
{0x04,0x00,0x04,0x00,0x3F,0x80,0x04,0x00,0x04,0x00,0x00,0x00},/*"+",11*/
{0x00,0x10,0x00,0x60,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},/*",",12*/
{0x04,0x00,0x04,0x00,0x04,0x00,0x04,0x00,0x04,0x00,0x00,0x00},/*"-",13*/
{0x00,0x00,0x00,0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},/*".",14*/
{0x00,0x20,0x01,0xC0,0x06,0x00,0x38,0x00,0x40,0x00,0x00,0x00},/*"/",15*/
{0x1F,0x80,0x20,0x40,0x20,0x40,0x20,0x40,0x1F,0x80,0x00,0x00},/*"0",16*/
{0x00,0x00,0x10,0x40,0x3F,0xC0,0x00,0x40,0x00,0x00,0x00,0x00},/*"1",17*/
{0x18,0xC0,0x21,0x40,0x22,0x40,0x24,0x40,0x18,0x40,0x00,0x00},/*"2",18*/
{0x10,0x80,0x20,0x40,0x24,0x40,0x24,0x40,0x1B,0x80,0x00,0x00},/*"3",19*/
{0x02,0x00,0x0D,0x00,0x11,0x00,0x3F,0xC0,0x01,0x40,0x00,0x00},/*"4",20*/
{0x3C,0x80,0x24,0x40,0x24,0x40,0x24,0x40,0x23,0x80,0x00,0x00},/*"5",21*/
{0x1F,0x80,0x24,0x40,0x24,0x40,0x34,0x40,0x03,0x80,0x00,0x00},/*"6",22*/
{0x30,0x00,0x20,0x00,0x27,0xC0,0x38,0x00,0x20,0x00,0x00,0x00},/*"7",23*/
{0x1B,0x80,0x24,0x40,0x24,0x40,0x24,0x40,0x1B,0x80,0x00,0x00},/*"8",24*/
{0x1C,0x00,0x22,0xC0,0x22,0x40,0x22,0x40,0x1F,0x80,0x00,0x00},/*"9",25*/
{0x00,0x00,0x00,0x00,0x08,0x40,0x00,0x00,0x00,0x00,0x00,0x00},/*":",26*/
{0x00,0x00,0x00,0x00,0x04,0x60,0x00,0x00,0x00,0x00,0x00,0x00},/*";",27*/
{0x00,0x00,0x04,0x00,0x0A,0x00,0x11,0x00,0x20,0x80,0x40,0x40},/*"<",28*/
{0x09,0x00,0x09,0x00,0x09,0x00,0x09,0x00,0x09,0x00,0x00,0x00},/*"=",29*/
{0x00,0x00,0x40,0x40,0x20,0x80,0x11,0x00,0x0A,0x00,0x04,0x00},/*">",30*/
{0x18,0x00,0x20,0x00,0x23,0x40,0x24,0x00,0x18,0x00,0x00,0x00},/*"?",31*/
{0x1F,0x80,0x20,0x40,0x27,0x40,0x29,0x40,0x1F,0x40,0x00,0x00},/*"@",32*/
{0x00,0x40,0x07,0xC0,0x39,0x00,0x0F,0x00,0x01,0xC0,0x00,0x40},/*"A",33*/
{0x20,0x40,0x3F,0xC0,0x24,0x40,0x24,0x40,0x1B,0x80,0x00,0x00},/*"B",34*/
{0x1F,0x80,0x20,0x40,0x20,0x40,0x20,0x40,0x30,0x80,0x00,0x00},/*"C",35*/
{0x20,0x40,0x3F,0xC0,0x20,0x40,0x20,0x40,0x1F,0x80,0x00,0x00},/*"D",36*/
{0x20,0x40,0x3F,0xC0,0x24,0x40,0x2E,0x40,0x30,0xC0,0x00,0x00},/*"E",37*/
{0x20,0x40,0x3F,0xC0,0x24,0x40,0x2E,0x00,0x30,0x00,0x00,0x00},/*"F",38*/
{0x0F,0x00,0x10,0x80,0x20,0x40,0x22,0x40,0x33,0x80,0x02,0x00},/*"G",39*/
{0x20,0x40,0x3F,0xC0,0x04,0x00,0x04,0x00,0x3F,0xC0,0x20,0x40},/*"H",40*/
{0x20,0x40,0x20,0x40,0x3F,0xC0,0x20,0x40,0x20,0x40,0x00,0x00},/*"I",41*/
{0x00,0x60,0x20,0x20,0x20,0x20,0x3F,0xC0,0x20,0x00,0x20,0x00},/*"J",42*/
{0x20,0x40,0x3F,0xC0,0x24,0x40,0x0B,0x00,0x30,0xC0,0x20,0x40},/*"K",43*/
{0x20,0x40,0x3F,0xC0,0x20,0x40,0x00,0x40,0x00,0x40,0x00,0xC0},/*"L",44*/
{0x3F,0xC0,0x3C,0x00,0x03,0xC0,0x3C,0x00,0x3F,0xC0,0x00,0x00},/*"M",45*/
{0x20,0x40,0x3F,0xC0,0x0C,0x40,0x23,0x00,0x3F,0xC0,0x20,0x00},/*"N",46*/
{0x1F,0x80,0x20,0x40,0x20,0x40,0x20,0x40,0x1F,0x80,0x00,0x00},/*"O",47*/
{0x20,0x40,0x3F,0xC0,0x24,0x40,0x24,0x00,0x18,0x00,0x00,0x00},/*"P",48*/
{0x1F,0x80,0x21,0x40,0x21,0x40,0x20,0xE0,0x1F,0xA0,0x00,0x00},/*"Q",49*/
{0x20,0x40,0x3F,0xC0,0x24,0x40,0x26,0x00,0x19,0xC0,0x00,0x40},/*"R",50*/
{0x18,0xC0,0x24,0x40,0x24,0x40,0x22,0x40,0x31,0x80,0x00,0x00},/*"S",51*/
{0x30,0x00,0x20,0x40,0x3F,0xC0,0x20,0x40,0x30,0x00,0x00,0x00},/*"T",52*/
{0x20,0x00,0x3F,0x80,0x00,0x40,0x00,0x40,0x3F,0x80,0x20,0x00},/*"U",53*/
{0x20,0x00,0x3E,0x00,0x01,0xC0,0x07,0x00,0x38,0x00,0x20,0x00},/*"V",54*/
{0x38,0x00,0x07,0xC0,0x3C,0x00,0x07,0xC0,0x38,0x00,0x00,0x00},/*"W",55*/
{0x20,0x40,0x39,0xC0,0x06,0x00,0x39,0xC0,0x20,0x40,0x00,0x00},/*"X",56*/
{0x20,0x00,0x38,0x40,0x07,0xC0,0x38,0x40,0x20,0x00,0x00,0x00},/*"Y",57*/
{0x30,0x40,0x21,0xC0,0x26,0x40,0x38,0x40,0x20,0xC0,0x00,0x00},/*"Z",58*/
{0x00,0x00,0x00,0x00,0x7F,0xE0,0x40,0x20,0x40,0x20,0x00,0x00},/*"[",59*/
{0x00,0x00,0x70,0x00,0x0C,0x00,0x03,0x80,0x00,0x40,0x00,0x00},/*"\",60*/
{0x00,0x00,0x40,0x20,0x40,0x20,0x7F,0xE0,0x00,0x00,0x00,0x00},/*"]",61*/
{0x00,0x00,0x20,0x00,0x40,0x00,0x20,0x00,0x00,0x00,0x00,0x00},/*"^",62*/
{0x00,0x10,0x00,0x10,0x00,0x10,0x00,0x10,0x00,0x10,0x00,0x10},/*"_",63*/
{0x00,0x00,0x00,0x00,0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00},/*"`",64*/
{0x00,0x00,0x02,0x80,0x05,0x40,0x05,0x40,0x03,0xC0,0x00,0x40},/*"a",65*/
{0x20,0x00,0x3F,0xC0,0x04,0x40,0x04,0x40,0x03,0x80,0x00,0x00},/*"b",66*/
{0x00,0x00,0x03,0x80,0x04,0x40,0x04,0x40,0x06,0x40,0x00,0x00},/*"c",67*/
{0x00,0x00,0x03,0x80,0x04,0x40,0x24,0x40,0x3F,0xC0,0x00,0x40},/*"d",68*/
{0x00,0x00,0x03,0x80,0x05,0x40,0x05,0x40,0x03,0x40,0x00,0x00},/*"e",69*/
{0x00,0x00,0x04,0x40,0x1F,0xC0,0x24,0x40,0x24,0x40,0x20,0x00},/*"f",70*/
{0x00,0x00,0x02,0xE0,0x05,0x50,0x05,0x50,0x06,0x50,0x04,0x20},/*"g",71*/
{0x20,0x40,0x3F,0xC0,0x04,0x40,0x04,0x00,0x03,0xC0,0x00,0x40},/*"h",72*/
{0x00,0x00,0x04,0x40,0x27,0xC0,0x00,0x40,0x00,0x00,0x00,0x00},/*"i",73*/
{0x00,0x10,0x00,0x10,0x04,0x10,0x27,0xE0,0x00,0x00,0x00,0x00},/*"j",74*/
{0x20,0x40,0x3F,0xC0,0x01,0x40,0x07,0x00,0x04,0xC0,0x04,0x40},/*"k",75*/
{0x20,0x40,0x20,0x40,0x3F,0xC0,0x00,0x40,0x00,0x40,0x00,0x00},/*"l",76*/
{0x07,0xC0,0x04,0x00,0x07,0xC0,0x04,0x00,0x03,0xC0,0x00,0x00},/*"m",77*/
{0x04,0x40,0x07,0xC0,0x04,0x40,0x04,0x00,0x03,0xC0,0x00,0x40},/*"n",78*/
{0x00,0x00,0x03,0x80,0x04,0x40,0x04,0x40,0x03,0x80,0x00,0x00},/*"o",79*/
{0x04,0x10,0x07,0xF0,0x04,0x50,0x04,0x40,0x03,0x80,0x00,0x00},/*"p",80*/
{0x00,0x00,0x03,0x80,0x04,0x40,0x04,0x50,0x07,0xF0,0x00,0x10},/*"q",81*/
{0x04,0x40,0x07,0xC0,0x02,0x40,0x04,0x00,0x04,0x00,0x00,0x00},/*"r",82*/
{0x00,0x00,0x06,0x40,0x05,0x40,0x05,0x40,0x04,0xC0,0x00,0x00},/*"s",83*/
{0x00,0x00,0x04,0x00,0x1F,0x80,0x04,0x40,0x00,0x40,0x00,0x00},/*"t",84*/
{0x04,0x00,0x07,0x80,0x00,0x40,0x04,0x40,0x07,0xC0,0x00,0x40},/*"u",85*/
{0x04,0x00,0x07,0x00,0x04,0xC0,0x01,0x80,0x06,0x00,0x04,0x00},/*"v",86*/
{0x06,0x00,0x01,0xC0,0x07,0x00,0x01,0xC0,0x06,0x00,0x00,0x00},/*"w",87*/
{0x04,0x40,0x06,0xC0,0x01,0x00,0x06,0xC0,0x04,0x40,0x00,0x00},/*"x",88*/
{0x04,0x10,0x07,0x10,0x04,0xE0,0x01,0x80,0x06,0x00,0x04,0x00},/*"y",89*/
{0x00,0x00,0x04,0x40,0x05,0xC0,0x06,0x40,0x04,0x40,0x00,0x00},/*"z",90*/
{0x00,0x00,0x00,0x00,0x04,0x00,0x7B,0xE0,0x40,0x20,0x00,0x00},/*"{",91*/
{0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xF0,0x00,0x00,0x00,0x00},/*"|",92*/
{0x00,0x00,0x40,0x20,0x7B,0xE0,0x04,0x00,0x00,0x00,0x00,0x00},/*"}",93*/
{0x40,0x00,0x80,0x00,0x40,0x00,0x20,0x00,0x20,0x00,0x40,0x00},/*"~",94*/
};
//16*16 ASCII字符集点阵
const unsigned char asc2_1608[95][16]={
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},/*" ",0*/
{0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0xCC,0x00,0x0C,0x00,0x00,0x00,0x00,0x00,0x00},/*"!",1*/
{0x00,0x00,0x08,0x00,0x30,0x00,0x60,0x00,0x08,0x00,0x30,0x00,0x60,0x00,0x00,0x00},/*""",2*/
{0x02,0x20,0x03,0xFC,0x1E,0x20,0x02,0x20,0x03,0xFC,0x1E,0x20,0x02,0x20,0x00,0x00},/*"#",3*/
{0x00,0x00,0x0E,0x18,0x11,0x04,0x3F,0xFF,0x10,0x84,0x0C,0x78,0x00,0x00,0x00,0x00},/*"$",4*/
{0x0F,0x00,0x10,0x84,0x0F,0x38,0x00,0xC0,0x07,0x78,0x18,0x84,0x00,0x78,0x00,0x00},/*"%",5*/
{0x00,0x78,0x0F,0x84,0x10,0xC4,0x11,0x24,0x0E,0x98,0x00,0xE4,0x00,0x84,0x00,0x08},/*"&",6*/
{0x08,0x00,0x68,0x00,0x70,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},/*"'",7*/
{0x00,0x00,0x00,0x00,0x00,0x00,0x07,0xE0,0x18,0x18,0x20,0x04,0x40,0x02,0x00,0x00},/*"(",8*/
{0x00,0x00,0x40,0x02,0x20,0x04,0x18,0x18,0x07,0xE0,0x00,0x00,0x00,0x00,0x00,0x00},/*")",9*/
{0x02,0x40,0x02,0x40,0x01,0x80,0x0F,0xF0,0x01,0x80,0x02,0x40,0x02,0x40,0x00,0x00},/*"*",10*/
{0x00,0x80,0x00,0x80,0x00,0x80,0x0F,0xF8,0x00,0x80,0x00,0x80,0x00,0x80,0x00,0x00},/*"+",11*/
{0x00,0x01,0x00,0x0D,0x00,0x0E,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},/*",",12*/
{0x00,0x00,0x00,0x80,0x00,0x80,0x00,0x80,0x00,0x80,0x00,0x80,0x00,0x80,0x00,0x80},/*"-",13*/
{0x00,0x00,0x00,0x0C,0x00,0x0C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},/*".",14*/
{0x00,0x00,0x00,0x06,0x00,0x18,0x00,0x60,0x01,0x80,0x06,0x00,0x18,0x00,0x20,0x00},/*"/",15*/
{0x00,0x00,0x07,0xF0,0x08,0x08,0x10,0x04,0x10,0x04,0x08,0x08,0x07,0xF0,0x00,0x00},/*"0",16*/
{0x00,0x00,0x08,0x04,0x08,0x04,0x1F,0xFC,0x00,0x04,0x00,0x04,0x00,0x00,0x00,0x00},/*"1",17*/
{0x00,0x00,0x0E,0x0C,0x10,0x14,0x10,0x24,0x10,0x44,0x11,0x84,0x0E,0x0C,0x00,0x00},/*"2",18*/
{0x00,0x00,0x0C,0x18,0x10,0x04,0x11,0x04,0x11,0x04,0x12,0x88,0x0C,0x70,0x00,0x00},/*"3",19*/
{0x00,0x00,0x00,0xE0,0x03,0x20,0x04,0x24,0x08,0x24,0x1F,0xFC,0x00,0x24,0x00,0x00},/*"4",20*/
{0x00,0x00,0x1F,0x98,0x10,0x84,0x11,0x04,0x11,0x04,0x10,0x88,0x10,0x70,0x00,0x00},/*"5",21*/
{0x00,0x00,0x07,0xF0,0x08,0x88,0x11,0x04,0x11,0x04,0x18,0x88,0x00,0x70,0x00,0x00},/*"6",22*/
{0x00,0x00,0x1C,0x00,0x10,0x00,0x10,0xFC,0x13,0x00,0x1C,0x00,0x10,0x00,0x00,0x00},/*"7",23*/
{0x00,0x00,0x0E,0x38,0x11,0x44,0x10,0x84,0x10,0x84,0x11,0x44,0x0E,0x38,0x00,0x00},/*"8",24*/
{0x00,0x00,0x07,0x00,0x08,0x8C,0x10,0x44,0x10,0x44,0x08,0x88,0x07,0xF0,0x00,0x00},/*"9",25*/
{0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x0C,0x03,0x0C,0x00,0x00,0x00,0x00,0x00,0x00},/*":",26*/
{0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x06,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},/*";",27*/
{0x00,0x00,0x00,0x80,0x01,0x40,0x02,0x20,0x04,0x10,0x08,0x08,0x10,0x04,0x00,0x00},/*"<",28*/
{0x02,0x20,0x02,0x20,0x02,0x20,0x02,0x20,0x02,0x20,0x02,0x20,0x02,0x20,0x00,0x00},/*"=",29*/
{0x00,0x00,0x10,0x04,0x08,0x08,0x04,0x10,0x02,0x20,0x01,0x40,0x00,0x80,0x00,0x00},/*">",30*/
{0x00,0x00,0x0E,0x00,0x12,0x00,0x10,0x0C,0x10,0x6C,0x10,0x80,0x0F,0x00,0x00,0x00},/*"?",31*/
{0x03,0xE0,0x0C,0x18,0x13,0xE4,0x14,0x24,0x17,0xC4,0x08,0x28,0x07,0xD0,0x00,0x00},/*"@",32*/
{0x00,0x04,0x00,0x3C,0x03,0xC4,0x1C,0x40,0x07,0x40,0x00,0xE4,0x00,0x1C,0x00,0x04},/*"A",33*/
{0x10,0x04,0x1F,0xFC,0x11,0x04,0x11,0x04,0x11,0x04,0x0E,0x88,0x00,0x70,0x00,0x00},/*"B",34*/
{0x03,0xE0,0x0C,0x18,0x10,0x04,0x10,0x04,0x10,0x04,0x10,0x08,0x1C,0x10,0x00,0x00},/*"C",35*/
{0x10,0x04,0x1F,0xFC,0x10,0x04,0x10,0x04,0x10,0x04,0x08,0x08,0x07,0xF0,0x00,0x00},/*"D",36*/
{0x10,0x04,0x1F,0xFC,0x11,0x04,0x11,0x04,0x17,0xC4,0x10,0x04,0x08,0x18,0x00,0x00},/*"E",37*/
{0x10,0x04,0x1F,0xFC,0x11,0x04,0x11,0x00,0x17,0xC0,0x10,0x00,0x08,0x00,0x00,0x00},/*"F",38*/
{0x03,0xE0,0x0C,0x18,0x10,0x04,0x10,0x04,0x10,0x44,0x1C,0x78,0x00,0x40,0x00,0x00},/*"G",39*/
{0x10,0x04,0x1F,0xFC,0x10,0x84,0x00,0x80,0x00,0x80,0x10,0x84,0x1F,0xFC,0x10,0x04},/*"H",40*/
{0x00,0x00,0x10,0x04,0x10,0x04,0x1F,0xFC,0x10,0x04,0x10,0x04,0x00,0x00,0x00,0x00},/*"I",41*/
{0x00,0x03,0x00,0x01,0x10,0x01,0x10,0x01,0x1F,0xFE,0x10,0x00,0x10,0x00,0x00,0x00},/*"J",42*/
{0x10,0x04,0x1F,0xFC,0x11,0x04,0x03,0x80,0x14,0x64,0x18,0x1C,0x10,0x04,0x00,0x00},/*"K",43*/
{0x10,0x04,0x1F,0xFC,0x10,0x04,0x00,0x04,0x00,0x04,0x00,0x04,0x00,0x0C,0x00,0x00},/*"L",44*/
{0x10,0x04,0x1F,0xFC,0x1F,0x00,0x00,0xFC,0x1F,0x00,0x1F,0xFC,0x10,0x04,0x00,0x00},/*"M",45*/
{0x10,0x04,0x1F,0xFC,0x0C,0x04,0x03,0x00,0x00,0xE0,0x10,0x18,0x1F,0xFC,0x10,0x00},/*"N",46*/
{0x07,0xF0,0x08,0x08,0x10,0x04,0x10,0x04,0x10,0x04,0x08,0x08,0x07,0xF0,0x00,0x00},/*"O",47*/
{0x10,0x04,0x1F,0xFC,0x10,0x84,0x10,0x80,0x10,0x80,0x10,0x80,0x0F,0x00,0x00,0x00},/*"P",48*/
{0x07,0xF0,0x08,0x18,0x10,0x24,0x10,0x24,0x10,0x1C,0x08,0x0A,0x07,0xF2,0x00,0x00},/*"Q",49*/
{0x10,0x04,0x1F,0xFC,0x11,0x04,0x11,0x00,0x11,0xC0,0x11,0x30,0x0E,0x0C,0x00,0x04},/*"R",50*/
{0x00,0x00,0x0E,0x1C,0x11,0x04,0x10,0x84,0x10,0x84,0x10,0x44,0x1C,0x38,0x00,0x00},/*"S",51*/
{0x18,0x00,0x10,0x00,0x10,0x04,0x1F,0xFC,0x10,0x04,0x10,0x00,0x18,0x00,0x00,0x00},/*"T",52*/
{0x10,0x00,0x1F,0xF8,0x10,0x04,0x00,0x04,0x00,0x04,0x10,0x04,0x1F,0xF8,0x10,0x00},/*"U",53*/
{0x10,0x00,0x1E,0x00,0x11,0xE0,0x00,0x1C,0x00,0x70,0x13,0x80,0x1C,0x00,0x10,0x00},/*"V",54*/
{0x1F,0xC0,0x10,0x3C,0x00,0xE0,0x1F,0x00,0x00,0xE0,0x10,0x3C,0x1F,0xC0,0x00,0x00},/*"W",55*/
{0x10,0x04,0x18,0x0C,0x16,0x34,0x01,0xC0,0x01,0xC0,0x16,0x34,0x18,0x0C,0x10,0x04},/*"X",56*/
{0x10,0x00,0x1C,0x00,0x13,0x04,0x00,0xFC,0x13,0x04,0x1C,0x00,0x10,0x00,0x00,0x00},/*"Y",57*/
{0x08,0x04,0x10,0x1C,0x10,0x64,0x10,0x84,0x13,0x04,0x1C,0x04,0x10,0x18,0x00,0x00},/*"Z",58*/
{0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0xFE,0x40,0x02,0x40,0x02,0x40,0x02,0x00,0x00},/*"[",59*/
{0x00,0x00,0x30,0x00,0x0C,0x00,0x03,0x80,0x00,0x60,0x00,0x1C,0x00,0x03,0x00,0x00},/*"\",60*/
{0x00,0x00,0x40,0x02,0x40,0x02,0x40,0x02,0x7F,0xFE,0x00,0x00,0x00,0x00,0x00,0x00},/*"]",61*/
{0x00,0x00,0x00,0x00,0x20,0x00,0x40,0x00,0x40,0x00,0x40,0x00,0x20,0x00,0x00,0x00},/*"^",62*/
{0x00,0x01,0x00,0x01,0x00,0x01,0x00,0x01,0x00,0x01,0x00,0x01,0x00,0x01,0x00,0x01},/*"_",63*/
{0x00,0x00,0x40,0x00,0x40,0x00,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},/*"`",64*/
{0x00,0x00,0x00,0x98,0x01,0x24,0x01,0x44,0x01,0x44,0x01,0x44,0x00,0xFC,0x00,0x04},/*"a",65*/
{0x10,0x00,0x1F,0xFC,0x00,0x88,0x01,0x04,0x01,0x04,0x00,0x88,0x00,0x70,0x00,0x00},/*"b",66*/
{0x00,0x00,0x00,0x70,0x00,0x88,0x01,0x04,0x01,0x04,0x01,0x04,0x00,0x88,0x00,0x00},/*"c",67*/
{0x00,0x00,0x00,0x70,0x00,0x88,0x01,0x04,0x01,0x04,0x11,0x08,0x1F,0xFC,0x00,0x04},/*"d",68*/
{0x00,0x00,0x00,0xF8,0x01,0x44,0x01,0x44,0x01,0x44,0x01,0x44,0x00,0xC8,0x00,0x00},/*"e",69*/
{0x00,0x00,0x01,0x04,0x01,0x04,0x0F,0xFC,0x11,0x04,0x11,0x04,0x11,0x00,0x18,0x00},/*"f",70*/
{0x00,0x00,0x00,0xD6,0x01,0x29,0x01,0x29,0x01,0x29,0x01,0xC9,0x01,0x06,0x00,0x00},/*"g",71*/
{0x10,0x04,0x1F,0xFC,0x00,0x84,0x01,0x00,0x01,0x00,0x01,0x04,0x00,0xFC,0x00,0x04},/*"h",72*/
{0x00,0x00,0x01,0x04,0x19,0x04,0x19,0xFC,0x00,0x04,0x00,0x04,0x00,0x00,0x00,0x00},/*"i",73*/
{0x00,0x00,0x00,0x03,0x00,0x01,0x01,0x01,0x19,0x01,0x19,0xFE,0x00,0x00,0x00,0x00},/*"j",74*/
{0x10,0x04,0x1F,0xFC,0x00,0x24,0x00,0x40,0x01,0xB4,0x01,0x0C,0x01,0x04,0x00,0x00},/*"k",75*/
{0x00,0x00,0x10,0x04,0x10,0x04,0x1F,0xFC,0x00,0x04,0x00,0x04,0x00,0x00,0x00,0x00},/*"l",76*/
{0x01,0x04,0x01,0xFC,0x01,0x04,0x01,0x00,0x01,0xFC,0x01,0x04,0x01,0x00,0x00,0xFC},/*"m",77*/
{0x01,0x04,0x01,0xFC,0x00,0x84,0x01,0x00,0x01,0x00,0x01,0x04,0x00,0xFC,0x00,0x04},/*"n",78*/
{0x00,0x00,0x00,0xF8,0x01,0x04,0x01,0x04,0x01,0x04,0x01,0x04,0x00,0xF8,0x00,0x00},/*"o",79*/
{0x01,0x01,0x01,0xFF,0x00,0x85,0x01,0x04,0x01,0x04,0x00,0x88,0x00,0x70,0x00,0x00},/*"p",80*/
{0x00,0x00,0x00,0x70,0x00,0x88,0x01,0x04,0x01,0x04,0x01,0x05,0x01,0xFF,0x00,0x01},/*"q",81*/
{0x01,0x04,0x01,0x04,0x01,0xFC,0x00,0x84,0x01,0x04,0x01,0x00,0x01,0x80,0x00,0x00},/*"r",82*/
{0x00,0x00,0x00,0xCC,0x01,0x24,0x01,0x24,0x01,0x24,0x01,0x24,0x01,0x98,0x00,0x00},/*"s",83*/
{0x00,0x00,0x01,0x00,0x01,0x00,0x07,0xF8,0x01,0x04,0x01,0x04,0x00,0x00,0x00,0x00},/*"t",84*/
{0x01,0x00,0x01,0xF8,0x00,0x04,0x00,0x04,0x00,0x04,0x01,0x08,0x01,0xFC,0x00,0x04},/*"u",85*/
{0x01,0x00,0x01,0x80,0x01,0x70,0x00,0x0C,0x00,0x10,0x01,0x60,0x01,0x80,0x01,0x00},/*"v",86*/
{0x01,0xF0,0x01,0x0C,0x00,0x30,0x01,0xC0,0x00,0x30,0x01,0x0C,0x01,0xF0,0x01,0x00},/*"w",87*/
{0x00,0x00,0x01,0x04,0x01,0x8C,0x00,0x74,0x01,0x70,0x01,0x8C,0x01,0x04,0x00,0x00},/*"x",88*/
{0x01,0x01,0x01,0x81,0x01,0x71,0x00,0x0E,0x00,0x18,0x01,0x60,0x01,0x80,0x01,0x00},/*"y",89*/
{0x00,0x00,0x01,0x84,0x01,0x0C,0x01,0x34,0x01,0x44,0x01,0x84,0x01,0x0C,0x00,0x00},/*"z",90*/
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x3E,0xFC,0x40,0x02,0x40,0x02},/*"{",91*/
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00},/*"|",92*/
{0x00,0x00,0x40,0x02,0x40,0x02,0x3E,0xFC,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00},/*"}",93*/
{0x00,0x00,0x60,0x00,0x80,0x00,0x80,0x00,0x40,0x00,0x40,0x00,0x20,0x00,0x20,0x00},/*"~",94*/
};
//24*24 ASICII字符集点阵
const unsigned char asc2_2412[95][36]={
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},/*" ",0*/
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0x80,0x38,0x0F,0xFE,0x38,0x0F,0x80,0x38,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},/*"!",1*/
{0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x06,0x00,0x00,0x0C,0x00,0x00,0x38,0x00,0x00,0x31,0x00,0x00,0x06,0x00,0x00,0x0C,0x00,0x00,0x38,0x00,0x00,0x30,0x00,0x00,0x00,0x00,0x00},/*""",2*/
{0x00,0x00,0x00,0x00,0x61,0x80,0x00,0x67,0xF8,0x07,0xF9,0x80,0x00,0x61,0x80,0x00,0x61,0x80,0x00,0x61,0x80,0x00,0x61,0x80,0x00,0x67,0xF8,0x07,0xF9,0x80,0x00,0x61,0x80,0x00,0x00,0x00},/*"#",3*/
{0x00,0x00,0x00,0x00,0x00,0x00,0x01,0xC0,0xE0,0x03,0xE0,0xF0,0x06,0x30,0x08,0x04,0x18,0x08,0x1F,0xFF,0xFE,0x04,0x0E,0x08,0x07,0x87,0xF0,0x03,0x81,0xE0,0x00,0x00,0x00,0x00,0x00,0x00},/*"$",4*/
{0x01,0xF0,0x00,0x06,0x0C,0x00,0x04,0x04,0x08,0x06,0x0C,0x70,0x01,0xF9,0xC0,0x00,0x0E,0x00,0x00,0x3B,0xE0,0x00,0xEC,0x18,0x07,0x08,0x08,0x04,0x0C,0x18,0x00,0x03,0xE0,0x00,0x00,0x00},/*"%",5*/
{0x00,0x01,0xE0,0x00,0x07,0xF0,0x03,0xF8,0x18,0x04,0x1C,0x08,0x04,0x17,0x08,0x07,0xE1,0xD0,0x03,0xC0,0xE0,0x00,0x23,0xB0,0x00,0x3C,0x08,0x00,0x20,0x08,0x00,0x00,0x10,0x00,0x00,0x00},/*"&",6*/
{0x00,0x00,0x00,0x01,0x00,0x00,0x31,0x00,0x00,0x32,0x00,0x00,0x1C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},/*"'",7*/
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0x00,0x01,0xFF,0xC0,0x07,0x80,0xF0,0x0C,0x00,0x18,0x10,0x00,0x04,0x20,0x00,0x02,0x00,0x00,0x00},/*"(",8*/
{0x00,0x00,0x00,0x20,0x00,0x02,0x10,0x00,0x04,0x0C,0x00,0x18,0x07,0x80,0xF0,0x01,0xFF,0xC0,0x00,0x7F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},/*")",9*/
{0x00,0x00,0x00,0x00,0x42,0x00,0x00,0x66,0x00,0x00,0x66,0x00,0x00,0x3C,0x00,0x00,0x18,0x00,0x03,0xFF,0xC0,0x00,0x18,0x00,0x00,0x3C,0x00,0x00,0x66,0x00,0x00,0x66,0x00,0x00,0x42,0x00},/*"*",10*/
{0x00,0x00,0x00,0x00,0x08,0x00,0x00,0x08,0x00,0x00,0x08,0x00,0x00,0x08,0x00,0x00,0x08,0x00,0x01,0xFF,0xC0,0x00,0x08,0x00,0x00,0x08,0x00,0x00,0x08,0x00,0x00,0x08,0x00,0x00,0x08,0x00},/*"+",11*/
{0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x31,0x00,0x00,0x32,0x00,0x00,0x1C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},/*",",12*/
{0x00,0x00,0x00,0x00,0x08,0x00,0x00,0x08,0x00,0x00,0x08,0x00,0x00,0x08,0x00,0x00,0x08,0x00,0x00,0x08,0x00,0x00,0x08,0x00,0x00,0x08,0x00,0x00,0x08,0x00,0x00,0x08,0x00,0x00,0x00,0x00},/*"-",13*/
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x38,0x00,0x00,0x38,0x00,0x00,0x38,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},/*".",14*/
{0x00,0x00,0x00,0x00,0x00,0x06,0x00,0x00,0x1C,0x00,0x00,0x70,0x00,0x01,0x80,0x00,0x0E,0x00,0x00,0x38,0x00,0x00,0xC0,0x00,0x07,0x00,0x00,0x1C,0x00,0x00,0x30,0x00,0x00,0x00,0x00,0x00},/*"/",15*/
{0x00,0x00,0x00,0x00,0x7F,0x80,0x01,0xFF,0xE0,0x03,0x80,0x70,0x06,0x00,0x18,0x04,0x00,0x08,0x04,0x00,0x08,0x06,0x00,0x18,0x03,0x80,0x70,0x01,0xFF,0xE0,0x00,0x7F,0x80,0x00,0x00,0x00},/*"0",16*/
{0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x08,0x01,0x00,0x08,0x01,0x00,0x08,0x03,0xFF,0xF8,0x07,0xFF,0xF8,0x00,0x00,0x08,0x00,0x00,0x08,0x00,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00},/*"1",17*/
{0x00,0x00,0x00,0x01,0xC0,0x38,0x02,0xC0,0x58,0x04,0x00,0x98,0x04,0x01,0x18,0x04,0x02,0x18,0x04,0x04,0x18,0x06,0x1C,0x18,0x03,0xF8,0x18,0x01,0xE0,0xF8,0x00,0x00,0x00,0x00,0x00,0x00},/*"2",18*/
{0x00,0x00,0x00,0x01,0xC0,0xE0,0x03,0xC0,0xF0,0x04,0x00,0x08,0x04,0x08,0x08,0x04,0x08,0x08,0x06,0x18,0x08,0x03,0xF4,0x18,0x01,0xE7,0xF0,0x00,0x01,0xE0,0x00,0x00,0x00,0x00,0x00,0x00},/*"3",19*/
{0x00,0x00,0x00,0x00,0x03,0x00,0x00,0x0D,0x00,0x00,0x11,0x00,0x00,0x61,0x00,0x00,0x81,0x08,0x03,0x01,0x08,0x07,0xFF,0xF8,0x0F,0xFF,0xF8,0x00,0x01,0x08,0x00,0x01,0x08,0x00,0x00,0x00},/*"4",20*/
{0x00,0x00,0x00,0x00,0x00,0xE0,0x07,0xFC,0xD0,0x06,0x08,0x08,0x06,0x10,0x08,0x06,0x10,0x08,0x06,0x10,0x08,0x06,0x18,0x38,0x06,0x0F,0xF0,0x06,0x07,0xC0,0x00,0x00,0x00,0x00,0x00,0x00},/*"5",21*/
{0x00,0x00,0x00,0x00,0x3F,0x80,0x01,0xFF,0xE0,0x03,0x84,0x30,0x02,0x08,0x18,0x04,0x10,0x08,0x04,0x10,0x08,0x04,0x10,0x08,0x07,0x18,0x10,0x03,0x0F,0xF0,0x00,0x07,0xC0,0x00,0x00,0x00},/*"6",22*/
{0x00,0x00,0x00,0x00,0x00,0x00,0x03,0xC0,0x00,0x07,0x00,0x00,0x06,0x00,0x00,0x06,0x00,0xF8,0x06,0x07,0xF8,0x06,0x18,0x00,0x06,0xE0,0x00,0x07,0x00,0x00,0x06,0x00,0x00,0x00,0x00,0x00},/*"7",23*/
{0x00,0x00,0x00,0x01,0xE1,0xE0,0x03,0xF7,0xF0,0x06,0x34,0x10,0x04,0x18,0x08,0x04,0x18,0x08,0x04,0x0C,0x08,0x04,0x0C,0x08,0x06,0x16,0x18,0x03,0xF3,0xF0,0x01,0xC1,0xE0,0x00,0x00,0x00},/*"8",24*/
{0x00,0x00,0x00,0x00,0xF8,0x00,0x03,0xFC,0x30,0x03,0x06,0x38,0x04,0x02,0x08,0x04,0x02,0x08,0x04,0x02,0x08,0x04,0x04,0x10,0x03,0x08,0xF0,0x01,0xFF,0xC0,0x00,0x7F,0x00,0x00,0x00,0x00},/*"9",25*/
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x70,0x38,0x00,0x70,0x38,0x00,0x70,0x38,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},/*":",26*/
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x1A,0x00,0x30,0x1C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},/*";",27*/
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x00,0x00,0x14,0x00,0x00,0x22,0x00,0x00,0x41,0x00,0x00,0x80,0x80,0x01,0x00,0x40,0x02,0x00,0x20,0x04,0x00,0x10,0x08,0x00,0x08,0x00,0x00,0x00},/*"<",28*/
{0x00,0x00,0x00,0x00,0x21,0x00,0x00,0x21,0x00,0x00,0x21,0x00,0x00,0x21,0x00,0x00,0x21,0x00,0x00,0x21,0x00,0x00,0x21,0x00,0x00,0x21,0x00,0x00,0x21,0x00,0x00,0x21,0x00,0x00,0x00,0x00},/*"=",29*/
{0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x00,0x08,0x04,0x00,0x10,0x02,0x00,0x20,0x01,0x00,0x40,0x00,0x80,0x80,0x00,0x41,0x00,0x00,0x22,0x00,0x00,0x14,0x00,0x00,0x08,0x00,0x00,0x00,0x00},/*">",30*/
{0x00,0x00,0x00,0x03,0xC0,0x00,0x04,0xC0,0x00,0x04,0x00,0x00,0x08,0x00,0x38,0x08,0x0F,0x38,0x08,0x08,0x38,0x08,0x10,0x00,0x0C,0x30,0x00,0x07,0xE0,0x00,0x03,0xC0,0x00,0x00,0x00,0x00},/*"?",31*/
{0x00,0x00,0x00,0x00,0x3F,0x80,0x00,0xFF,0xE0,0x03,0x80,0x70,0x02,0x0F,0x10,0x06,0x70,0x88,0x04,0xC0,0x88,0x04,0x83,0x08,0x04,0x7F,0x88,0x02,0xC0,0x90,0x03,0x01,0x20,0x00,0xFE,0x40},/*"@",32*/
{0x00,0x00,0x08,0x00,0x00,0x18,0x00,0x01,0xF8,0x00,0x3E,0x08,0x01,0xC2,0x00,0x07,0x02,0x00,0x07,0xE2,0x00,0x00,0xFE,0x00,0x00,0x1F,0xC8,0x00,0x01,0xF8,0x00,0x00,0x38,0x00,0x00,0x08},/*"A",33*/
{0x04,0x00,0x08,0x07,0xFF,0xF8,0x07,0xFF,0xF8,0x04,0x08,0x08,0x04,0x08,0x08,0x04,0x08,0x08,0x04,0x08,0x08,0x06,0x18,0x08,0x03,0xF4,0x18,0x01,0xE7,0xF0,0x00,0x01,0xE0,0x00,0x00,0x00},/*"B",34*/
{0x00,0x00,0x00,0x00,0x3F,0x80,0x01,0xFF,0xE0,0x03,0x80,0x70,0x02,0x00,0x18,0x04,0x00,0x08,0x04,0x00,0x08,0x04,0x00,0x08,0x04,0x00,0x10,0x06,0x00,0x20,0x07,0x80,0xC0,0x00,0x00,0x00},/*"C",35*/
{0x04,0x00,0x08,0x07,0xFF,0xF8,0x07,0xFF,0xF8,0x04,0x00,0x08,0x04,0x00,0x08,0x04,0x00,0x08,0x04,0x00,0x18,0x02,0x00,0x10,0x03,0x80,0x70,0x01,0xFF,0xE0,0x00,0x7F,0x80,0x00,0x00,0x00},/*"D",36*/
{0x04,0x00,0x08,0x07,0xFF,0xF8,0x07,0xFF,0xF8,0x04,0x08,0x08,0x04,0x08,0x08,0x04,0x08,0x08,0x04,0x08,0x08,0x04,0x3E,0x08,0x04,0x00,0x08,0x06,0x00,0x18,0x01,0x00,0x60,0x00,0x00,0x00},/*"E",37*/
{0x04,0x00,0x08,0x07,0xFF,0xF8,0x07,0xFF,0xF8,0x04,0x08,0x08,0x04,0x08,0x00,0x04,0x08,0x00,0x04,0x08,0x00,0x04,0x3E,0x00,0x06,0x00,0x00,0x06,0x00,0x00,0x01,0x80,0x00,0x00,0x00,0x00},/*"F",38*/
{0x00,0x00,0x00,0x00,0x3F,0x80,0x01,0xFF,0xE0,0x03,0x80,0x70,0x06,0x00,0x18,0x04,0x00,0x08,0x04,0x02,0x08,0x04,0x02,0x08,0x02,0x03,0xF0,0x07,0x83,0xF0,0x00,0x02,0x00,0x00,0x02,0x00},/*"G",39*/
{0x04,0x00,0x08,0x07,0xFF,0xF8,0x07,0xFF,0xF8,0x04,0x08,0x08,0x00,0x08,0x00,0x00,0x08,0x00,0x00,0x08,0x00,0x00,0x08,0x00,0x04,0x08,0x08,0x07,0xFF,0xF8,0x07,0xFF,0xF8,0x04,0x00,0x08},/*"H",40*/
{0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x08,0x04,0x00,0x08,0x04,0x00,0x08,0x07,0xFF,0xF8,0x07,0xFF,0xF8,0x04,0x00,0x08,0x04,0x00,0x08,0x04,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00},/*"I",41*/
{0x00,0x00,0x00,0x00,0x00,0x06,0x00,0x00,0x07,0x00,0x00,0x01,0x04,0x00,0x01,0x04,0x00,0x01,0x04,0x00,0x03,0x07,0xFF,0xFE,0x07,0xFF,0xFC,0x04,0x00,0x00,0x04,0x00,0x00,0x04,0x00,0x00},/*"J",42*/
{0x04,0x00,0x08,0x07,0xFF,0xF8,0x07,0xFF,0xF8,0x04,0x0C,0x08,0x00,0x18,0x00,0x00,0x3E,0x00,0x04,0xC7,0x80,0x05,0x03,0xC8,0x06,0x00,0xF8,0x04,0x00,0x38,0x04,0x00,0x18,0x00,0x00,0x08},/*"K",43*/
{0x04,0x00,0x08,0x07,0xFF,0xF8,0x07,0xFF,0xF8,0x04,0x00,0x08,0x00,0x00,0x08,0x00,0x00,0x08,0x00,0x00,0x08,0x00,0x00,0x08,0x00,0x00,0x08,0x00,0x00,0x18,0x00,0x00,0x60,0x00,0x00,0x00},/*"L",44*/
{0x04,0x00,0x08,0x07,0xFF,0xF8,0x07,0x80,0x08,0x07,0xFC,0x00,0x00,0x7F,0xC0,0x00,0x03,0xF8,0x00,0x07,0xC0,0x00,0x78,0x00,0x07,0x80,0x08,0x07,0xFF,0xF8,0x07,0xFF,0xF8,0x04,0x00,0x08},/*"M",45*/
{0x04,0x00,0x08,0x07,0xFF,0xF8,0x07,0x00,0x08,0x03,0xC0,0x00,0x00,0xE0,0x00,0x00,0x38,0x00,0x00,0x1E,0x00,0x00,0x07,0x00,0x00,0x01,0xC0,0x04,0x00,0xF0,0x07,0xFF,0xF8,0x04,0x00,0x00},/*"N",46*/
{0x00,0x00,0x00,0x00,0x7F,0x80,0x01,0xFF,0xE0,0x03,0x80,0x70,0x06,0x00,0x18,0x04,0x00,0x08,0x04,0x00,0x08,0x06,0x00,0x18,0x03,0x00,0x30,0x01,0xFF,0xE0,0x00,0x7F,0x80,0x00,0x00,0x00},/*"O",47*/
{0x04,0x00,0x08,0x07,0xFF,0xF8,0x07,0xFF,0xF8,0x04,0x04,0x08,0x04,0x04,0x00,0x04,0x04,0x00,0x04,0x04,0x00,0x04,0x04,0x00,0x06,0x0C,0x00,0x03,0xF8,0x00,0x01,0xF0,0x00,0x00,0x00,0x00},/*"P",48*/
{0x00,0x00,0x00,0x00,0x7F,0x80,0x01,0xFF,0xE0,0x03,0x80,0x70,0x06,0x00,0x88,0x04,0x00,0x88,0x04,0x00,0xC8,0x06,0x00,0x3C,0x03,0x00,0x3E,0x01,0xFF,0xE6,0x00,0x7F,0x84,0x00,0x00,0x00},/*"Q",49*/
{0x04,0x00,0x08,0x07,0xFF,0xF8,0x07,0xFF,0xF8,0x04,0x08,0x08,0x04,0x08,0x00,0x04,0x0C,0x00,0x04,0x0F,0x00,0x04,0x0B,0xC0,0x06,0x10,0xF0,0x03,0xF0,0x38,0x01,0xE0,0x08,0x00,0x00,0x08},/*"R",50*/
{0x00,0x00,0x00,0x01,0xE0,0xF8,0x03,0xF0,0x30,0x06,0x30,0x10,0x04,0x18,0x08,0x04,0x18,0x08,0x04,0x0C,0x08,0x04,0x0C,0x08,0x02,0x06,0x18,0x02,0x07,0xF0,0x07,0x81,0xE0,0x00,0x00,0x00},/*"S",51*/
{0x01,0x80,0x00,0x06,0x00,0x00,0x04,0x00,0x00,0x04,0x00,0x00,0x04,0x00,0x08,0x07,0xFF,0xF8,0x07,0xFF,0xF8,0x04,0x00,0x08,0x04,0x00,0x00,0x04,0x00,0x00,0x06,0x00,0x00,0x01,0x80,0x00},/*"T",52*/
{0x04,0x00,0x00,0x07,0xFF,0xE0,0x07,0xFF,0xF0,0x04,0x00,0x18,0x00,0x00,0x08,0x00,0x00,0x08,0x00,0x00,0x08,0x00,0x00,0x08,0x00,0x00,0x08,0x04,0x00,0x10,0x07,0xFF,0xE0,0x04,0x00,0x00},/*"U",53*/
{0x04,0x00,0x00,0x06,0x00,0x00,0x07,0xE0,0x00,0x07,0xFE,0x00,0x04,0x1F,0xE0,0x00,0x01,0xF8,0x00,0x00,0x38,0x00,0x01,0xE0,0x04,0x3E,0x00,0x07,0xC0,0x00,0x06,0x00,0x00,0x04,0x00,0x00},/*"V",54*/
{0x04,0x00,0x00,0x07,0xE0,0x00,0x07,0xFF,0xC0,0x04,0x1F,0xF8,0x00,0x07,0xC0,0x07,0xF8,0x00,0x07,0xFF,0x80,0x04,0x3F,0xF8,0x00,0x07,0xC0,0x04,0xF8,0x00,0x07,0x00,0x00,0x04,0x00,0x00},/*"W",55*/
{0x00,0x00,0x00,0x04,0x00,0x08,0x06,0x00,0x18,0x07,0xC0,0x78,0x05,0xF1,0xC8,0x00,0x3E,0x00,0x00,0x1F,0x80,0x04,0x63,0xE8,0x07,0x80,0xF8,0x06,0x00,0x18,0x04,0x00,0x08,0x00,0x00,0x00},/*"X",56*/
{0x04,0x00,0x00,0x06,0x00,0x00,0x07,0x80,0x00,0x07,0xE0,0x08,0x04,0x7C,0x08,0x00,0x1F,0xF8,0x00,0x07,0xF8,0x00,0x18,0x08,0x04,0xE0,0x08,0x07,0x00,0x00,0x06,0x00,0x00,0x04,0x00,0x00},/*"Y",57*/
{0x00,0x00,0x00,0x01,0x00,0x08,0x06,0x00,0x38,0x04,0x00,0xF8,0x04,0x03,0xE8,0x04,0x0F,0x08,0x04,0x7C,0x08,0x05,0xF0,0x08,0x07,0xC0,0x08,0x07,0x00,0x18,0x04,0x00,0x60,0x00,0x00,0x00},/*"Z",58*/
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3F,0xFF,0xFE,0x20,0x00,0x02,0x20,0x00,0x02,0x20,0x00,0x02,0x20,0x00,0x02,0x20,0x00,0x02,0x00,0x00,0x00},/*"[",59*/
{0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x00,0x00,0x07,0x00,0x00,0x00,0xC0,0x00,0x00,0x38,0x00,0x00,0x06,0x00,0x00,0x01,0xC0,0x00,0x00,0x30,0x00,0x00,0x0E,0x00,0x00,0x01,0x00,0x00,0x00},/*"\",60*/
{0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x00,0x02,0x20,0x00,0x02,0x20,0x00,0x02,0x20,0x00,0x02,0x20,0x00,0x02,0x3F,0xFF,0xFE,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},/*"]",61*/
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x00,0x00,0x10,0x00,0x00,0x30,0x00,0x00,0x20,0x00,0x00,0x30,0x00,0x00,0x10,0x00,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},/*"^",62*/
{0x00,0x00,0x01,0x00,0x00,0x01,0x00,0x00,0x01,0x00,0x00,0x01,0x00,0x00,0x01,0x00,0x00,0x01,0x00,0x00,0x01,0x00,0x00,0x01,0x00,0x00,0x01,0x00,0x00,0x01,0x00,0x00,0x01,0x00,0x00,0x01},/*"_",63*/
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x00,0x00,0x20,0x00,0x00,0x10,0x00,0x00,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},/*"`",64*/
{0x00,0x00,0x00,0x00,0x00,0xF0,0x00,0x19,0xF8,0x00,0x1B,0x18,0x00,0x22,0x08,0x00,0x26,0x08,0x00,0x24,0x08,0x00,0x24,0x10,0x00,0x3F,0xF8,0x00,0x1F,0xF8,0x00,0x00,0x08,0x00,0x00,0x18},/*"a",65*/
{0x00,0x00,0x00,0x04,0x00,0x00,0x07,0xFF,0xF8,0x0F,0xFF,0xF0,0x00,0x18,0x18,0x00,0x10,0x08,0x00,0x20,0x08,0x00,0x20,0x08,0x00,0x30,0x18,0x00,0x1F,0xF0,0x00,0x0F,0xC0,0x00,0x00,0x00},/*"b",66*/
{0x00,0x00,0x00,0x00,0x07,0xC0,0x00,0x1F,0xF0,0x00,0x18,0x30,0x00,0x20,0x08,0x00,0x20,0x08,0x00,0x20,0x08,0x00,0x3C,0x08,0x00,0x1C,0x10,0x00,0x00,0x60,0x00,0x00,0x00,0x00,0x00,0x00},/*"c",67*/
{0x00,0x00,0x00,0x00,0x07,0xC0,0x00,0x1F,0xF0,0x00,0x38,0x18,0x00,0x20,0x08,0x00,0x20,0x08,0x00,0x20,0x08,0x04,0x10,0x10,0x07,0xFF,0xF8,0x0F,0xFF,0xF0,0x00,0x00,0x10,0x00,0x00,0x00},/*"d",68*/
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0xC0,0x00,0x1F,0xF0,0x00,0x12,0x30,0x00,0x22,0x18,0x00,0x22,0x08,0x00,0x22,0x08,0x00,0x32,0x08,0x00,0x1E,0x10,0x00,0x0E,0x20,0x00,0x00,0x00},/*"e",69*/
{0x00,0x00,0x00,0x00,0x20,0x00,0x00,0x20,0x08,0x00,0x20,0x08,0x01,0xFF,0xF8,0x03,0xFF,0xF8,0x06,0x20,0x08,0x04,0x20,0x08,0x04,0x20,0x08,0x07,0x20,0x00,0x03,0x00,0x00,0x00,0x00,0x00},/*"f",70*/
{0x00,0x00,0x00,0x00,0x00,0x0E,0x00,0x0E,0x6E,0x00,0x1F,0xF3,0x00,0x31,0xB1,0x00,0x20,0xB1,0x00,0x20,0xB1,0x00,0x31,0x91,0x00,0x1F,0x13,0x00,0x2E,0x1E,0x00,0x20,0x0E,0x00,0x30,0x00},/*"g",71*/
{0x00,0x00,0x00,0x04,0x00,0x08,0x07,0xFF,0xF8,0x0F,0xFF,0xF8,0x00,0x10,0x08,0x00,0x20,0x00,0x00,0x20,0x00,0x00,0x20,0x08,0x00,0x3F,0xF8,0x00,0x1F,0xF8,0x00,0x00,0x08,0x00,0x00,0x00},/*"h",72*/
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x08,0x00,0x20,0x08,0x00,0x20,0x08,0x06,0x3F,0xF8,0x06,0x3F,0xF8,0x00,0x00,0x08,0x00,0x00,0x08,0x00,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00},/*"i",73*/
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x00,0x00,0x03,0x00,0x20,0x01,0x00,0x20,0x01,0x00,0x20,0x03,0x06,0x3F,0xFE,0x06,0x3F,0xFC,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},/*"j",74*/
{0x00,0x00,0x00,0x04,0x00,0x08,0x07,0xFF,0xF8,0x0F,0xFF,0xF8,0x00,0x01,0x88,0x00,0x03,0x00,0x00,0x2F,0xC0,0x00,0x38,0xF8,0x00,0x20,0x38,0x00,0x20,0x08,0x00,0x00,0x08,0x00,0x00,0x00},/*"k",75*/
{0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x08,0x04,0x00,0x08,0x04,0x00,0x08,0x07,0xFF,0xF8,0x0F,0xFF,0xF8,0x00,0x00,0x08,0x00,0x00,0x08,0x00,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00},/*"l",76*/
{0x00,0x20,0x08,0x00,0x3F,0xF8,0x00,0x3F,0xF8,0x00,0x10,0x08,0x00,0x20,0x00,0x00,0x3F,0xF8,0x00,0x3F,0xF8,0x00,0x10,0x08,0x00,0x20,0x00,0x00,0x3F,0xF8,0x00,0x3F,0xF8,0x00,0x00,0x08},/*"m",77*/
{0x00,0x00,0x00,0x00,0x20,0x08,0x00,0x3F,0xF8,0x00,0x3F,0xF8,0x00,0x10,0x08,0x00,0x10,0x00,0x00,0x20,0x00,0x00,0x20,0x08,0x00,0x3F,0xF8,0x00,0x1F,0xF8,0x00,0x00,0x08,0x00,0x00,0x00},/*"n",78*/
{0x00,0x00,0x00,0x00,0x07,0xC0,0x00,0x0F,0xF0,0x00,0x18,0x30,0x00,0x30,0x08,0x00,0x20,0x08,0x00,0x20,0x08,0x00,0x30,0x08,0x00,0x18,0x30,0x00,0x0F,0xF0,0x00,0x07,0xC0,0x00,0x00,0x00},/*"o",79*/
{0x00,0x00,0x00,0x00,0x20,0x01,0x00,0x3F,0xFF,0x00,0x3F,0xFF,0x00,0x10,0x11,0x00,0x20,0x09,0x00,0x20,0x08,0x00,0x20,0x08,0x00,0x30,0x38,0x00,0x1F,0xF0,0x00,0x0F,0xC0,0x00,0x00,0x00},/*"p",80*/
{0x00,0x00,0x00,0x00,0x07,0xC0,0x00,0x1F,0xF0,0x00,0x38,0x18,0x00,0x20,0x08,0x00,0x20,0x08,0x00,0x20,0x09,0x00,0x10,0x11,0x00,0x1F,0xFF,0x00,0x3F,0xFF,0x00,0x00,0x01,0x00,0x00,0x00},/*"q",81*/
{0x00,0x20,0x08,0x00,0x20,0x08,0x00,0x20,0x08,0x00,0x3F,0xF8,0x00,0x3F,0xF8,0x00,0x08,0x08,0x00,0x10,0x08,0x00,0x20,0x08,0x00,0x20,0x00,0x00,0x30,0x00,0x00,0x30,0x00,0x00,0x00,0x00},/*"r",82*/
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0C,0x78,0x00,0x1E,0x18,0x00,0x33,0x08,0x00,0x23,0x08,0x00,0x21,0x08,0x00,0x21,0x88,0x00,0x21,0x98,0x00,0x30,0xF0,0x00,0x38,0x60,0x00,0x00,0x00},/*"s",83*/
{0x00,0x00,0x00,0x00,0x20,0x00,0x00,0x20,0x00,0x00,0x20,0x00,0x00,0xFF,0xF0,0x03,0xFF,0xF8,0x00,0x20,0x08,0x00,0x20,0x08,0x00,0x20,0x08,0x00,0x00,0x30,0x00,0x00,0x00,0x00,0x00,0x00},/*"t",84*/
{0x00,0x00,0x00,0x00,0x20,0x00,0x00,0x3F,0xF0,0x00,0x7F,0xF8,0x00,0x00,0x18,0x00,0x00,0x08,0x00,0x00,0x08,0x00,0x20,0x10,0x00,0x3F,0xF8,0x00,0x7F,0xF0,0x00,0x00,0x10,0x00,0x00,0x00},/*"u",85*/
{0x00,0x00,0x00,0x00,0x20,0x00,0x00,0x30,0x00,0x00,0x3C,0x00,0x00,0x3F,0x80,0x00,0x23,0xF0,0x00,0x00,0x78,0x00,0x00,0x70,0x00,0x23,0x80,0x00,0x3C,0x00,0x00,0x30,0x00,0x00,0x20,0x00},/*"v",86*/
{0x00,0x20,0x00,0x00,0x3C,0x00,0x00,0x3F,0xE0,0x00,0x23,0xF8,0x00,0x00,0xE0,0x00,0x27,0x00,0x00,0x3E,0x00,0x00,0x3F,0xE0,0x00,0x21,0xF8,0x00,0x01,0xE0,0x00,0x3E,0x00,0x00,0x20,0x00},/*"w",87*/
{0x00,0x00,0x00,0x00,0x20,0x08,0x00,0x20,0x08,0x00,0x38,0x38,0x00,0x3E,0x68,0x00,0x27,0x80,0x00,0x03,0xC8,0x00,0x2C,0xF8,0x00,0x38,0x38,0x00,0x20,0x18,0x00,0x20,0x08,0x00,0x00,0x00},/*"x",88*/
{0x00,0x00,0x00,0x00,0x20,0x00,0x00,0x30,0x03,0x00,0x3C,0x01,0x00,0x3F,0x83,0x00,0x23,0xEC,0x00,0x00,0x70,0x00,0x23,0x80,0x00,0x3C,0x00,0x00,0x20,0x00,0x00,0x20,0x00,0x00,0x00,0x00},/*"y",89*/
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x38,0x08,0x00,0x20,0x38,0x00,0x20,0xF8,0x00,0x23,0xE8,0x00,0x2F,0x88,0x00,0x3E,0x08,0x00,0x38,0x08,0x00,0x20,0x18,0x00,0x00,0x70,0x00,0x00,0x00},/*"z",90*/
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x00,0x00,0x14,0x00,0x1F,0xF7,0xFC,0x30,0x00,0x06,0x20,0x00,0x02,0x00,0x00,0x00,0x00,0x00,0x00},/*"{",91*/
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},/*"|",92*/
{0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x00,0x02,0x30,0x00,0x06,0x1F,0xF7,0xFC,0x00,0x14,0x00,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},/*"}",93*/
{0x00,0x00,0x00,0x18,0x00,0x00,0x60,0x00,0x00,0x40,0x00,0x00,0x40,0x00,0x00,0x20,0x00,0x00,0x10,0x00,0x00,0x08,0x00,0x00,0x04,0x00,0x00,0x04,0x00,0x00,0x0C,0x00,0x00,0x10,0x00,0x00},/*"~",94*/
};
unsigned char Hzk1[22][16]={
{0x00,0x00,0xF0,0x10,0x10,0x10,0x10,0xFF,0x10,0x10,0x10,0x10,0xF0,0x00,0x00,0x00},
{0x00,0x00,0x0F,0x04,0x04,0x04,0x04,0xFF,0x04,0x04,0x04,0x04,0x0F,0x00,0x00,0x00},/*"中",0*/
{0x40,0x40,0x40,0x5F,0x55,0x55,0x55,0x75,0x55,0x55,0x55,0x5F,0x40,0x40,0x40,0x00},
{0x00,0x40,0x20,0x0F,0x09,0x49,0x89,0x79,0x09,0x09,0x09,0x0F,0x20,0x40,0x00,0x00},/*"景",1*/
{0x00,0xFE,0x02,0x42,0x4A,0xCA,0x4A,0x4A,0xCA,0x4A,0x4A,0x42,0x02,0xFE,0x00,0x00},
{0x00,0xFF,0x40,0x50,0x4C,0x43,0x40,0x40,0x4F,0x50,0x50,0x5C,0x40,0xFF,0x00,0x00},/*"园",2*/
{0x00,0x00,0xF8,0x88,0x88,0x88,0x88,0xFF,0x88,0x88,0x88,0x88,0xF8,0x00,0x00,0x00},
{0x00,0x00,0x1F,0x08,0x08,0x08,0x08,0x7F,0x88,0x88,0x88,0x88,0x9F,0x80,0xF0,0x00},/*"电",3*/
{0x80,0x82,0x82,0x82,0x82,0x82,0x82,0xE2,0xA2,0x92,0x8A,0x86,0x82,0x80,0x80,0x00},
{0x00,0x00,0x00,0x00,0x00,0x40,0x80,0x7F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},/*"子",4*/
{0x24,0x24,0xA4,0xFE,0xA3,0x22,0x00,0x22,0xCC,0x00,0x00,0xFF,0x00,0x00,0x00,0x00},
{0x08,0x06,0x01,0xFF,0x00,0x01,0x04,0x04,0x04,0x04,0x04,0xFF,0x02,0x02,0x02,0x00},/*"科",5*/
{0x10,0x10,0x10,0xFF,0x10,0x90,0x08,0x88,0x88,0x88,0xFF,0x88,0x88,0x88,0x08,0x00},
{0x04,0x44,0x82,0x7F,0x01,0x80,0x80,0x40,0x43,0x2C,0x10,0x28,0x46,0x81,0x80,0x00},/*"技",6*/
{0x04,0x04,0x04,0x84,0xE4,0x3C,0x27,0x24,0x24,0x24,0x24,0xE4,0x04,0x04,0x04,0x00},
{0x04,0x02,0x01,0x00,0xFF,0x09,0x09,0x09,0x09,0x49,0x89,0x7F,0x00,0x00,0x00,0x00},/*"有",7*/
{0x00,0xFE,0x22,0x5A,0x86,0x00,0xFE,0x92,0x92,0x92,0x92,0x92,0xFE,0x00,0x00,0x00},
{0x00,0xFF,0x04,0x08,0x07,0x00,0xFF,0x40,0x20,0x03,0x0C,0x14,0x22,0x41,0x40,0x00},/*"限",8*/
{0x00,0x80,0x40,0x20,0x18,0x06,0x80,0x00,0x07,0x18,0x20,0x40,0x80,0x00,0x00,0x00},
{0x01,0x00,0x20,0x70,0x28,0x26,0x21,0x20,0x20,0x24,0x38,0x60,0x00,0x01,0x01,0x00},/*"公",9*/
{0x00,0x10,0x12,0x92,0x92,0x92,0x92,0x92,0x92,0x12,0x12,0x02,0xFE,0x00,0x00,0x00},
{0x00,0x00,0x00,0x3F,0x10,0x10,0x10,0x10,0x3F,0x00,0x40,0x80,0x7F,0x00,0x00,0x00},/*"司",10*/
};
unsigned char Hzk2[3][72]={
{0x00,0x00,0x00,0xC0,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0xFC,0x84,0x80,0x80,0x80,0x80,0x80,0x80,0xC0,0xC0,0x00,0x00,0x00},
{0x00,0x00,0x00,0xFF,0x7F,0x40,0x40,0x40,0x40,0x40,0x40,0xFF,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0xFF,0x7F,0x00,0x00,0x00},
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0x70,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, /*"中",0*/
};
unsigned char Hzk3[4][128]={
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFC,0xF8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
{0x00,0x00,0x00,0x00,0xFF,0xFE,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0xFF,0xFF,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0xFF,0x03,0x00,0x00,0x00,0x00},
{0x00,0x00,0x00,0x00,0x1F,0x1F,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0xFF,0xFF,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x1F,0x00,0x00,0x00,0x00,0x00},
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0x3F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},/*"中",0*/
};
unsigned char Hzk4[8][512]={
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xF8,0xF8,0xF0,0xF0,0x70,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0xFE,0x06,0x06,0x06,0x06,0x06,0x06,0x06,0x06,0x06,0x06,0x06,0x06,0x06,0x06,0x06,0x06,0x06,0xFF,0xFF,0xFF,0xFF,0x06,0x06,0x06,0x06,0x06,0x06,0x06,0x06,0x06,0x06,0x06,0x06,0x06,0x06,0x06,0x06,0x06,0x06,0xFF,0xFF,0xFF,0xFF,0x07,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0xFF,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0xFF,0xFF,0xFF,0xFF,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0xFF,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0x1F,0x0F,0x0F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},/*"中",0*/
};
unsigned char Hzk5[16][32]={
{0x10,0x60,0x02,0x8C,0x00,0x00,0xFE,0x92,0x92,0x92,0x92,0x92,0xFE,0x00,0x00,0x00},
{0x04,0x04,0x7E,0x01,0x40,0x7E,0x42,0x42,0x7E,0x42,0x7E,0x42,0x42,0x7E,0x40,0x00},/*"温",0*/
{0x10,0x60,0x02,0x8C,0x00,0xFE,0x92,0x92,0x92,0x92,0x92,0x92,0xFE,0x00,0x00,0x00},
{0x04,0x04,0x7E,0x01,0x44,0x48,0x50,0x7F,0x40,0x40,0x7F,0x50,0x48,0x44,0x40,0x00},/*"湿",1*/
{0x00,0x00,0xFC,0x24,0x24,0x24,0xFC,0x25,0x26,0x24,0xFC,0x24,0x24,0x24,0x04,0x00},
{0x40,0x30,0x8F,0x80,0x84,0x4C,0x55,0x25,0x25,0x25,0x55,0x4C,0x80,0x80,0x80,0x00},/*"度",2*/
{0x80,0x70,0x00,0xFF,0x10,0x08,0xFE,0x42,0x42,0x42,0xFA,0x42,0x42,0x42,0xFE,0x00},
{0x80,0x60,0x18,0x07,0x08,0x10,0xFF,0x50,0x48,0x46,0x41,0x42,0x4C,0x40,0xFF,0x00},/*"烟",3*/
{0x10,0x0C,0x05,0x55,0x55,0xD5,0x05,0x7F,0x05,0x55,0x55,0x55,0x05,0x14,0x0C,0x00},
{0x10,0x10,0x10,0x8A,0xA9,0x6B,0x35,0x25,0x25,0xAB,0xE9,0x08,0x10,0x10,0x10,0x00},/*"雾",4*/
{0x10,0x60,0x02,0x8C,0x20,0x18,0x08,0xC8,0x38,0xCF,0x08,0x08,0x28,0x98,0x00,0x00},
{0x04,0x04,0x7E,0x01,0x04,0x02,0x01,0xFF,0x40,0x21,0x06,0x0A,0x11,0x20,0x40,0x00},/*"浓",5*/
{0x00,0xF8,0x01,0x22,0xA0,0xA2,0xA2,0x22,0xFE,0x22,0xAA,0x32,0x02,0xFE,0x00,0x00},
{0x00,0xFF,0x00,0x10,0x13,0x0A,0x4B,0x20,0x17,0x0C,0x13,0x38,0x80,0xFF,0x00,0x00},/*"阈",6*/
{0x00,0x80,0x60,0xF8,0x07,0x04,0xE4,0xA4,0xA4,0xBF,0xA4,0xA4,0xE4,0x04,0x00,0x00},
{0x01,0x00,0x00,0xFF,0x40,0x40,0x7F,0x4A,0x4A,0x4A,0x4A,0x4A,0x7F,0x40,0x40,0x00},/*"值",7*/
};
unsigned char Hzk6[26][32]={
{0x04,0x84,0x84,0xFC,0x84,0x84,0x00,0xFE,0x02,0x02,0xF2,0x02,0x02,0xFE,0x00,0x00},
{0x20,0x60,0x20,0x1F,0x10,0x90,0x40,0x23,0x18,0x06,0x01,0x7E,0x80,0x83,0xE0,0x00},/*"现",0*/
/* (16 X 16 , 宋体 )*/
{0x08,0x08,0x88,0xC8,0x38,0x0C,0x0B,0x08,0x08,0xE8,0x08,0x08,0x08,0x08,0x08,0x00},
{0x02,0x01,0x00,0xFF,0x40,0x41,0x41,0x41,0x41,0x7F,0x41,0x41,0x41,0x41,0x40,0x00},/*"在",1*/
/* (16 X 16 , 宋体 )*/
{0x00,0x02,0x02,0xF2,0x12,0x12,0x12,0xF2,0x02,0x02,0x02,0xFE,0x02,0x02,0x02,0x00},
{0x00,0x00,0x00,0x0F,0x04,0x04,0x04,0x0F,0x00,0x40,0x80,0x7F,0x00,0x00,0x00,0x00},/*"可",2*/
/* (16 X 16 , 宋体 )*/
{0x00,0x00,0xFC,0x00,0x00,0x02,0x04,0x18,0x00,0x00,0x80,0x7F,0x00,0x00,0x00,0x00},
{0x00,0x00,0x3F,0x10,0x08,0x84,0x40,0x20,0x10,0x0C,0x03,0x08,0x10,0x20,0xC0,0x00},/*"以",3*/
/* (16 X 16 , 宋体 )*/
{0x40,0x42,0xCC,0x00,0x00,0xFE,0x82,0x92,0x92,0xFE,0x92,0x92,0x82,0xFE,0x00,0x00},
{0x00,0x00,0x3F,0x10,0x88,0x7F,0x00,0x1E,0x12,0x12,0x12,0x5E,0x80,0x7F,0x00,0x00},/*"调",4*/
/* (16 X 16 , 宋体 )*/
{0x04,0x74,0xD4,0x54,0xFF,0x54,0xD4,0x74,0x14,0x08,0x77,0x84,0x44,0x3C,0x04,0x00},
{0x82,0x89,0x88,0xE8,0x8B,0x88,0x88,0xF9,0xA8,0xAA,0xA9,0xA8,0xA9,0x8A,0x82,0x00},/*"整",5*/
/* (16 X 16 , 宋体 )*/
{0x10,0x0C,0x44,0x24,0x14,0x04,0x05,0x06,0x04,0x04,0x14,0x24,0x44,0x14,0x0C,0x00},
{0x00,0x40,0x40,0x41,0x41,0x41,0x41,0x7F,0x41,0x41,0x41,0x41,0x40,0x40,0x00,0x00},/*"空",6*/
/* (16 X 16 , 宋体 )*/
{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*/
/* (16 X 16 , 宋体 )*/
{0x00,0x00,0xFE,0x12,0x12,0x92,0x92,0x92,0x92,0xFF,0x91,0x91,0x91,0x91,0x10,0x00},
{0x80,0x60,0x1F,0x80,0x80,0x5F,0x40,0x20,0x10,0x0E,0x10,0x10,0x20,0x5F,0x80,0x00},/*"质",8*/
/* (16 X 16 , 宋体 )*/
{0x20,0x20,0x20,0xBE,0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,0xBE,0x20,0x20,0x20,0x00},
{0x00,0x80,0x80,0xAF,0xAA,0xAA,0xAA,0xFF,0xAA,0xAA,0xAA,0xAF,0x80,0x80,0x00,0x00},/*"量",9*/
/* (16 X 16 , 宋体 )*/
{0x00,0x80,0x60,0xF8,0x07,0x10,0x10,0x10,0xFF,0x10,0xF0,0x11,0x16,0x10,0x10,0x00},
{0x01,0x00,0x00,0xFF,0x00,0x80,0x60,0x1C,0x03,0x00,0x3F,0x40,0x40,0x40,0x78,0x00},/*"优",10*/
/* (16 X 16 , 宋体 )*/
{0x00,0x00,0xFC,0x24,0x24,0x24,0x25,0x26,0x24,0x24,0x24,0xFC,0x00,0x00,0x00,0x00},
{0x00,0x00,0xFF,0x81,0x41,0x21,0x03,0x05,0x09,0x11,0x29,0x45,0x42,0x80,0x80,0x00},/*"良",11*/
/* (16 X 16 , 宋体 )*/
{0x00,0x04,0x24,0x24,0x25,0x26,0xE4,0x3C,0x24,0x26,0x25,0x24,0x24,0x04,0x00,0x00},
{0x41,0x21,0x11,0x89,0x85,0x8B,0x89,0x89,0xF9,0x89,0x89,0x89,0x89,0x81,0x01,0x00},/*"差",12*/
/* (16 X 16 , 宋体 )*/
};
#endif
Wi-Fi模块功能实现
ESP8266-01S可以通过串口与其他设备进行通信,包括32位单片机。在32单片机上使用ESP8266-01S,可以将ESP8266-01S设置为透传模式,以实现数据的收发。透传模式是指将ESP8266-01S设置为将串口收到的所有数据都转发到Wi-Fi网络,并将Wi-Fi网络接收到的所有数据都转发到串口的工作模式。在透传模式下,ESP8266-01S作为一个透明的串口转发器,将串口数据和Wi-Fi数据之间的传输桥梁。要在STM32上使用ESP8266-01S模块分为以下几步。第一,初始化ESP8266-01S:在32单片机上,需要通过串口向ESP8266-01S发送初始化命令,以设置透传模式、工作模式和其他参数。可以使用AT 指令进行初始化,例如AT+RST 重启模块,AT+CWMODE=2 设置模块工作模式为AP 模式等等;第二,设置模块为AP 模式后,使用AT 指令AT+CWSAP 设置模块的热点名称和密码,利用AT+CIPSERVER=1 使模块成为TCP 服务器,这样就可以让App 作为TCP 客户端与模块连接并进行数据的传输;第三,在主函数中使用“AT+CIPSEND” 指令即给TCP 客户端发送数据,接收数据则使用中断函数的办法。
esp8266.c
#include "esp8266.h"
void atk_8266_start_trans(void)
{
u8 ret = 0;
delay_ms(1000);
delay_ms(1000);
ret = atk_8266_send_cmd("AT","OK", 100);
if(ret == 0 ) printf("AT成功\n");
else printf("AT fail\n");
delay_ms(1000);
ret = atk_8266_send_cmd ("AT+RST" , NULL ,100);
if(ret == 0 ) printf("AT+RST成功\n");
else printf("AT+RST fail\n");
delay_ms(2000);
ret = atk_8266_send_cmd("AT+CWMODE=2","OK",200);//开启热点
if(ret == 0 ) printf("AT+CWMODE=2\n");
else printf("AT+CWMODE fail\n");
delay_ms(1000);
ret = atk_8266_send_cmd("AT+CWSAP=\"ESP8266-ly\",\"123456789\",11,0","OK",100);//设置热点
if(ret == 0 ) printf("AT+CWSAP成功\n");
else printf("AT+CWSAP fail\n");
delay_ms(1000);
ret = atk_8266_send_cmd("AT+CIPMUX=1","OK",20);//=0:单路连接模式=1:多路连接模式
if(ret == 0 ) printf("AT+CIPMUX=1\n");
else printf("AT+CIPMUX=1 fail\n");
delay_ms(1000);
ret = atk_8266_send_cmd("AT+CIPSERVER=1","OK",200);//启动TCP服务器
if(ret == 0 ) printf("AT+CIPSERVER=1\n");
else printf("AT+CIPSERVER fail\n");
delay_ms(1000);
}
u8 atk_8266_check_cmd(char *str)
{
if(USART3_RX_STA&0x8000)//接收到一次数据
{
USART3_RX_BUF[USART3_RX_STA&0x7fff]=0;//添加结束符
if(strstr((const char*)USART3_RX_BUF,(const char*)str))
return 1;
else
return 0;
}
return 0;
}
//向atk_8266发送命令
//cmd:发送的命令字符串; ack:期待的应答结果,如果为空,则表示不需要等待应答;waittime:等待时间(单位:10ms)
//返回值:0,发送成功(得到了期待的应答结果);1,发送失败
u8 atk_8266_send_cmd(char *cmd, char *ack,u16 waittime)
{
u8 res=0;
USART3_RX_STA=0;
u3_printf("%s\r\n",cmd);//发送命令
if(ack && waittime)//需要等待应答
{
while(--waittime)//等待倒计时
{
delay_ms(100);
if(USART3_RX_STA&0x8000)//接收到期待的应答结果
{
if(atk_8266_check_cmd(ack))
{
printf("ack:%s\r\n",(u8*)ack);
break;//得到有效数据
}
}
USART3_RX_STA=0;
}
if(waittime==0)res=1;
}
return res;
}
//向atk_8266发送数据
//cmd:发送的命令字符串;waittime:等待时间(单位:10ms)
//返回值:发送数据后,服务器的返回验证码
u8* atk_8266_send_data(char *cmd,u16 waittime)
{
char temp[5];
char *ack=temp;
USART3_RX_STA=0;
u3_printf("%s\r\n",cmd);//发送命令
if(waittime)//需要等待应答
{
while(--waittime)//等待倒计时
{
delay_ms(10);
if(USART3_RX_STA&0X8000)//接收到期待的应答结果
{
USART3_RX_BUF[USART3_RX_STA&0X7fff]=0;//添加结束符
ack=(char*)USART3_RX_BUF;
printf("ack:%s\r\n",(u8*)ack);
USART3_RX_STA=0;
break;
}
}
}
return (u8*)ack;
}
uart.c
#include "uart.h"
void UART1_Config(void)
{
GPIO_InitTypeDef GPIO_InitStructure;
USART_InitTypeDef USART_InitStructure;
NVIC_InitTypeDef NVIC_InitStructure;
//初始化GPIOA的时钟
RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOA, ENABLE);
//初始化串口1的时钟
RCC_APB2PeriphClockCmd(RCC_APB2Periph_USART1, ENABLE);
//通过结构体初始化串口引脚
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_9 | GPIO_Pin_10; //配置的引脚
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF; //复用模式
GPIO_InitStructure.GPIO_OType = GPIO_OType_PP; //推挽模式
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_100MHz; //速度为100MHz
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL; //上下拉电阻:无上下拉电阻
GPIO_Init(GPIOA, &GPIO_InitStructure);
//选择引脚复用功能
GPIO_PinAFConfig(GPIOA, GPIO_PinSource9, GPIO_AF_USART1);
GPIO_PinAFConfig(GPIOA, GPIO_PinSource10, GPIO_AF_USART1);
//配置串口相关属性
USART_InitStructure.USART_BaudRate = 115200; //波特率
USART_InitStructure.USART_WordLength = USART_WordLength_8b; //数据位
USART_InitStructure.USART_StopBits = USART_StopBits_1; //停止位
USART_InitStructure.USART_Parity = USART_Parity_No; //校验位
USART_InitStructure.USART_HardwareFlowControl = USART_HardwareFlowControl_None; //无流控
USART_InitStructure.USART_Mode = USART_Mode_Rx | USART_Mode_Tx; //接收发送模式
USART_Init(USART1, &USART_InitStructure);
//配置串口的中断(数据接收触发中断)
USART_ITConfig(USART1, USART_IT_RXNE, ENABLE);
NVIC_InitStructure.NVIC_IRQChannel = USART1_IRQn;
NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0;
NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0;
NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
NVIC_Init(&NVIC_InitStructure);
//串口1工作
USART_Cmd(USART1,ENABLE);
}
/* 参数:要发送的字符串,要求字符串末尾以 \0 结尾 */
void send_string(char *arr)
{
while(*arr) //判断字符串是否结束
{
//通过串口1发送数据到PC
USART_SendData(USART1, *arr++);
while(USART_GetFlagStatus(USART1, USART_FLAG_TXE) == RESET);//等待发送数据完毕
}
}
uart.h
#ifndef _UART_H
#define _UART_H
//C文件中需要的其他的头文件
#include <stm32f4xx.h>
//C文件中定义的函数的声明
void UART1_Config(void);
void send_string(char *arr);
#endif
uart3.c
#include "uart3.h"
#include "delay.h"
#include "stdarg.h"
#include "stdio.h"
#include "string.h"
//#include "tim.h"
int i=0;
extern u8 Temperature_yu,Smog_yu,CO_yu;
//串口发送缓存区
__align(8) u8 USART3_TX_BUF[USART3_MAX_SEND_LEN]; //发送缓冲,最大USART3_MAX_SEND_LEN字节
#ifdef USART3_RX_EN //如果使能了接收
//串口接收缓存区
u8 USART3_RX_BUF [USART3_MAX_RECV_LEN]; //接收缓冲,最大USART3_MAX_RECV_LEN个字节.
//通过判断接收连续2个字符之间的时间差不大于100ms来决定是不是一次连续的数据.
//如果2个字符接收间隔超过100ms,则认为不是1次连续数据.也就是超过100ms没有接收到
//任何数据,则表示此次接收完毕.
//接收到的数据状态
//[15]:0,没有接收到数据;1,接收到了一批数据.
//[14:0]:接收到的数据长度
u16 USART3_RX_STA=0;
void USART3_IRQHandler(void)
{
u8 res;
int j,k,find;
u8 get_data[11];
char str_get_data[11];
char* token;
if(USART_GetITStatus(USART3,USART_IT_RXNE) != RESET)//接收到数据
{
res =USART_ReceiveData(USART3);
if((USART3_RX_STA&(1<<15))==0)//接收完的一批数据,还没有被处理,则不再接收其他数据
{
if(USART3_RX_STA<USART3_MAX_RECV_LEN)//还可以接收数据
{
USART3_RX_BUF[USART3_RX_STA++]=res;
// 判断接收到的数据是否为esp8266发送的数据
if(res == '\n' && USART3_RX_BUF[USART3_RX_STA - 2] == '\r')
{
// 提取接收缓存区中的数据并进行处理
if(USART3_RX_BUF[0] == '\n' || USART3_RX_BUF[0] == '\r' ){} //舍弃换行符,以免输出空行
else{
if(i<47){ //过滤掉定义wifi模块时的返回值
i++;
}
else{
printf("串口3收到%s",USART3_RX_BUF);
// printf("i = %d\n",i);
/*寻找 USART3_RX_BUF 中的冒号*/
for(j=0;j<20;j++){
find = 0;
if(USART3_RX_BUF[j] == ':')
{
find = 1;//找到后find = 1,退出循环
break;
}
}
if(find==1){
for(k=0;k<10;k++){
get_data[k] = USART3_RX_BUF[k+j];
}
printf("get_data%s\n",get_data);
snprintf(str_get_data, sizeof(str_get_data), "%s", get_data);
// 按空格分割字符串
token = strtok(str_get_data, " ");
if (token != NULL) {
// 第一个数值
token = strtok(NULL, " ");
if (token != NULL) {
Temperature_yu = atoi(token);
// 第二个数值
token = strtok(NULL, " ");
if (token != NULL) {
Smog_yu = atoi(token);
// 第三个数值
token = strtok(NULL, " ");
if (token != NULL){
CO_yu = atoi(token);
} else {
// 如果没有第三个数值,可以给它赋一个默认值
CO_yu = 20;
}
} else {
// 如果没有第二个数值,可以给它赋一个默认值
CO_yu = 20;
}
} else {
// 如果没有任何数值,可以给它们都赋一个默认值
Temperature_yu = 40;
Smog_yu = 20;
CO_yu = 20;
}
} else {
// 如果没有任何数值,可以给它们都赋一个默认值
Temperature_yu = 40;
Smog_yu = 20;
CO_yu = 20;
}
}
}
}
// 清空接收缓存区
USART3_RX_STA = 0;
memset(USART3_RX_BUF, 0, sizeof(USART3_RX_BUF));//用于清空接收缓存区USART3_RX_BUF,将其中的所有元素都设置为0
}
}
else
{
USART3_RX_STA|=1<<15;
}
}
}
}
#endif
void UART3_Config(void)
{
NVIC_InitTypeDef NVIC_InitStructure;
GPIO_InitTypeDef GPIO_InitStructure;
USART_InitTypeDef USART_InitStructure;
RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOB,ENABLE);//使能GPIOB时钟
RCC_APB1PeriphClockCmd(RCC_APB1Periph_USART3,ENABLE);//使能USART3时钟
USART_DeInit(USART3);
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_11 | GPIO_Pin_10;//GPIOB11和GPIOB10初始化
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF ;//复用功能
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;//速度50MHz
GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;//推挽复用输出
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_UP;//上拉
GPIO_Init(GPIOB,&GPIO_InitStructure);//初始化GPIOB11,和GPIOB10
GPIO_PinAFConfig(GPIOB,GPIO_PinSource11,GPIO_AF_USART3);//GPIOB11复用为USART3
GPIO_PinAFConfig(GPIOB,GPIO_PinSource10,GPIO_AF_USART3);//GPIOB10复用为USART3
USART_InitStructure. USART_BaudRate = 115200;//波特率
USART_InitStructure.USART_WordLength = USART_WordLength_8b;//字长为8位数据格式
USART_InitStructure.USART_StopBits = USART_StopBits_1;//一个停止位
USART_InitStructure.USART_Parity = USART_Parity_No;//无奇偶校验位
USART_InitStructure.USART_HardwareFlowControl = USART_HardwareFlowControl_None;//无硬件数据流控制
USART_InitStructure.USART_Mode = USART_Mode_Rx | USART_Mode_Tx;//收发模式
USART_Init(USART3, &USART_InitStructure);//初始化串口3
USART_ITConfig(USART3,USART_IT_RXNE,ENABLE);//开启中断
NVIC_InitStructure.NVIC_IRQChannel = USART3_IRQn;
NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority=0 ;//抢占优先级2
NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0;//子优先级3
NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;//IRQ通道使能
NVIC_Init(&NVIC_InitStructure);//根据指定的参数初始化VIC寄存器
// TIM7_Config(1000-1,8400-1); //100ms中断
USART3_RX_STA=0;//清零
TIM_Cmd(TIM7,DISABLE);//关闭定时器7
USART_Cmd (USART3,ENABLE);//使能串口
}
//串口3,printf 函数
//确保一次发送数据不超过USART3_MAX_SEND_LEN字节
void u3_printf(char* fmt, ...)
{
u16 i,j;
va_list ap;
va_start(ap,fmt);
vsprintf((char*)USART3_TX_BUF,fmt,ap);
va_end(ap);
i=strlen((const char*)USART3_TX_BUF);//此次发送数据的长度
for(j=0;j<i;j++)//循环发送数据
{
while(USART_GetFlagStatus(USART3,USART_FLAG_TC)==RESET);//等待上次数据传输完成
USART_SendData(USART3,(uint8_t)USART3_TX_BUF[j]);
}
}
uart3.h
#ifndef _UART3_H
#define _UART3_H
//C文件中需要的其他的头文件
#include "sys.h"
#include <stm32f4xx.h>
#define USART3_MAX_RECV_LEN 500
#define USART3_MAX_SEND_LEN 500
#define USART3_RX_EN 1
extern u8 USART3_RX_BUF[USART3_MAX_RECV_LEN];
extern u8 USART3_TX_BUF[USART3_MAX_SEND_LEN];
extern u16 USART3_RX_STA;
void UART3_Config(void);
void TIM7_Int_Init(u16 arr,u16 psc);
void u3_printf(char* fmt, ...);
#endif
esp8266.h
#ifndef _ESP8266_H
#define _ESP8266_H
//C文件中需要的其他的头文件
#include <stm32f4xx.h>
#include "sys.h"
#include "delay.h"
#include "uart3.h"
#include "uart.h"
#include "string.h"
#include <stdio.h>
extern char restart[];
extern char cwmode[];
extern char cwlap[];
extern char cwjap[];
extern char cifsr[];
extern char cipmux[];
extern char cipstart[];
extern char cipsend[];
extern char cipserver[];
extern char cwlif[];
extern char cipstatus[];
extern char cipsto[];
extern char cipmode[];
extern char test[];
u8 atk_8266_send_cmd(char *cmd,char *ack,u16 waittime);
u8* atk_8266_send_data(char *cmd,u16 waittime);
u8 atk_8266_check_cmd(char *str);
void atk_8266_start_trans(void);
u8 atk_8266_quit_trans(void);
#endif
主程序
main.c
#include <stm32f4xx.h>
#include "sys.h"
#include <stdio.h>
#include "delay.h"
#include "led.h"
#include "TIM.h"
#include "uart.h"
#include "uart3.h"
#include "DHT11.h"
#include "mq2.h"
#include "mq7.h"
#include "beep.h"
#include "key.h"
#include "esp8266.h"
#include "oled.h"
//重定向fputc函数
int fputc(int ch, FILE *F)
{
//通过串口1发送数据到PC
USART_SendData(USART1, ch);
while(USART_GetFlagStatus(USART1, USART_FLAG_TXE) == RESET);//等待发送数据完毕
return ch;
}
//阈值更改函数
void Yuzhi_change(u8 *yuzhi)
{
if( PAin(0)== 0 )//s1按下
{
if( *yuzhi<99 )
{
PFout(9) = 0;//D1亮
(*yuzhi)++;
}
}
else
PFout(9) = 1;//D1灭
if( PEin(2)== 0 )//s2按下
{
if( *yuzhi>1 )
{
PFout(10) = 0;//D2亮
(*yuzhi)--;
}
}
else
PFout(10) = 1;//D2灭
}
//更改需要调整哪个阈值
void Yuzhi_kind_change(u8 *kind, u8 *wendu_yu, u8 *yanwu_yu, u8 *CO_yu)
{
switch(*kind)
{
case 1:Yuzhi_change(&*wendu_yu);break;
case 2:Yuzhi_change(&*yanwu_yu);break;
case 3:Yuzhi_change(&*CO_yu);break;
default :break;
}
/*按键3实现下调*/
if( PEin(3)== 0 )
{
PEout(13) = 0;
if( *kind<3 )
(*kind)++;
else if( *kind == 3 )
*kind = 1;
switch(*kind)
{
case 1:Yuzhi_change(&*wendu_yu);break;
case 2:Yuzhi_change(&*yanwu_yu);break;
case 3:Yuzhi_change(&*CO_yu);break;
default :break;
}
}
else
PEout(13) = 1;
/*按键4实现上调
if( PEin(4)== 0 )
{
PEout(14) = 0;
if( *kind>1 )
(*kind)--;
switch(*kind)
{
case 1:Yuzhi_change(&*wendu_yu);break;
case 2:Yuzhi_change(&*yanwu_yu);break;
case 3:Yuzhi_change(&*CO_yu);break;
default :break;
}
}
else
PEout(14) = 1;*/
}
void s4(int kind, char *str_shidu, char *str_temp, char *str_smog, char *str_co, char *str_temp_yu, char *str_smog_yu, char *str_co_yu, u8 quality)
{
if( PEin(4)== 0 )
{
PEout(14) = 0;
OLED_Clear();
OLED_ShowChinese3(0,0,6,16);//空
OLED_ShowChinese3(18,0,7,16);//气
OLED_ShowChinese3(36,0,8,16);//质
OLED_ShowChinese3(54,0,9,16);//量
switch(quality)
{
case 1:
OLED_ShowChinese3(72,0,10,16);//优
OLED_Refresh();
break;
case 2:
OLED_ShowChinese3(72,0,11,16);//良
OLED_Refresh();
break;
case 3:
OLED_ShowChinese3(72,0,12,16);//差
OLED_Refresh();
break;
default :break;
}
OLED_ShowChinese3(0,16,0,16);//现
OLED_ShowChinese3(18,16,1,16);//在
OLED_ShowChinese3(36,16,2,16);//可
OLED_ShowChinese3(54,16,3,16);//以
OLED_ShowChinese3(72,16,4,16);//调
OLED_ShowChinese3(90,16,5,16);//整
switch(kind)
{
case 1:
OLED_ShowChinese2(0,32,0,16);//温
OLED_ShowChinese2(18,32,2,16);//度
OLED_ShowChinese2(36,32,6,16);//阈
OLED_ShowChinese2(54,32,7,16);//值
OLED_Refresh();
break;
case 2:
OLED_ShowString(0,32,"CH4",16);
OLED_ShowChinese2(36,32,6,16);//阈
OLED_ShowChinese2(54,32,7,16);//值
OLED_Refresh();
break;
case 3:
OLED_ShowString(0,32,"CO",16);
OLED_ShowChinese2(36,32,6,16);//阈
OLED_ShowChinese2(54,32,7,16);//值
OLED_Refresh();
break;
default :break;
}
OLED_Refresh();
delay_ms(1500);
/********OLED部分*********/
OLED_Clear();
OLED_ShowChinese2(0,0,1,16);//湿
OLED_ShowChinese2(18,0,2,16);//度
OLED_ShowChar(36,0,':',16);//:
OLED_ShowString(48,0,&*str_shidu,16);
OLED_ShowChinese2(87,0,6,16);//阈
OLED_ShowChinese2(105,0,7,16);//值
OLED_ShowChinese2(0,16,0,16);//温
OLED_ShowChinese2(18,16,2,16);//度
OLED_ShowChar(36,16,58,16);//26号‘:’,ASC2为58
OLED_ShowString(48,16,&*str_temp,16);
OLED_ShowString(96,16,&*str_temp_yu,16);
OLED_ShowString(0,32,"CH4:",16);
OLED_ShowString(32,32,&*str_smog,16);
OLED_ShowString(96,32,&*str_smog_yu,16);
OLED_ShowString(0,48,"CO: ",16);
OLED_ShowString(32,48,&*str_co,16);
OLED_ShowString(96,48,&*str_co_yu,16);
OLED_Refresh();
PEout(14) = 1;
}
else
PEout(14) = 1;
}
u8 kind = 1;
u8 Temperature_yu;//温度的阈值
u8 Smog_yu;//Smog的阈值
u8 CO_yu;//CO的阈值
u8 quality = 1;
/*用于存放测量结果*/
int result[] = {0, 0, 0, 0, 0, 0, 0};
char str[25];//要通过WiFi发送的字符
char str_shidu[10];
char str_temp[10];
char str_smog[10];
char str_co[10];
char str_temp_yu[10];
char str_smog_yu[10];
char str_co_yu[10];
extern u8 num1,num2,num3;
int main(void)
{
uint8_t buf[5];//保存温湿度数值的数组
float Smog_ppm = 0;
float CO_ppm = 0;
int i = 0;
u8 ret=0,ret1=0;
Temperature_yu = 40;
Smog_yu = 20;
CO_yu = 20;
//确定系统定时器的工作频率 内核的工作频率/8 = 168MHz/8 = 21MHz
SysTick_CLKSourceConfig(SysTick_CLKSource_HCLK_Div8);
led_init();
UART1_Config();//配置串口
UART3_Config();
MQ2_Init();
CO_Init();//配置CO模块
Key_Init();//配置4个按键
Beep_init();//配置蜂鸣器
OLED_Init();
atk_8266_start_trans();
while(1)
{
if(dht11_read_data(buf)==0){}
Yuzhi_kind_change(&kind, &Temperature_yu, &Smog_yu, &CO_yu);
s4(kind, str_shidu, str_temp, str_smog, str_co, str_temp_yu, str_smog_yu, str_co_yu, quality);
Smog_ppm = Smog_GetPPM();
CO_ppm = MQ7_GetPPM();
/*通过WiFi发送数据部分*/
result[0] = buf[0];//湿度
result[1] = buf[2];//温度
result[2] = (int)Smog_ppm;//烟雾浓度
result[3] = (int)CO_ppm;//CO浓度
result[4] = Temperature_yu;//温度阈值
result[5] = Smog_yu;//烟雾阈值
result[6] = CO_yu;//CO阈值
sprintf(str, "%d", result[0]); // 将第一个整数转换为字符串
for (i = 1; i < 7; i++) {
sprintf(str + strlen(str), " %d", result[i]); // 将后面的整数添加到字符串中,并在前面加一个空格,str是目标字符串的地址,strlen(str)表示已经写入字符串str的字符数量
}
sprintf(str + strlen(str), " 0 0 0 0 0 0 0 0 0 0 0 0 0 0"); //在字符串末尾添加多个“ 0”以防止字符串的长度不足以输出
// printf("%s\n", str); //输出结果
ret = atk_8266_send_cmd("AT+CIPSEND=0,21",NULL,200);
if(ret == 0 )
{
delay_ms(1000);
ret1 = atk_8266_send_cmd(str, NULL, 200);
if(ret1 == 0 ) printf("SEND OK\n");
else printf("SEND fail\n");
}
else printf("AT+CIPSEND fail\n");
memset(str, 0, sizeof(str));//清空str
/*空气质量判断*/
if( CO_ppm<25 && Smog_ppm<25 && buf[2]<25 )
{
quality = 1;
}
else if( CO_ppm>35 || Smog_ppm>35 || buf[2]>35 )
{
quality = 3;
}
else quality = 2;
/*报警系统*/
if( (CO_ppm >= CO_yu) || (Smog_ppm >= Smog_yu ) || (buf[2]>=Temperature_yu) )
PFout(8) = 1;//蜂鸣器叫
else
PFout(8) = 0;
sprintf(str_shidu,"%d",buf[0]);//把整型的湿度转化为字符串,供oled输出
sprintf(str_temp,"%d",buf[2]);//把整型的温度转化为字符串,供oled输出
sprintf(str_temp_yu,"%d",Temperature_yu);//把整型的温度阈值转化为字符串,供oled输出
sprintf(str_smog_yu,"%d",Smog_yu);//把整型的烟雾阈值转化为字符串,供oled输出
sprintf(str_co_yu,"%d",CO_yu);//把整型的CO阈值转化为字符串,供oled输出
sprintf(str_smog,"%.2f",Smog_ppm);//把浮点型的烟雾浓度转化为字符串,供oled输出
sprintf(str_co,"%.2f",CO_ppm);//把浮点型的CO浓度转化为字符串,供oled输出
/********OLED部分*********/
OLED_Clear();
OLED_ShowChinese2(0,0,1,16);//湿
OLED_ShowChinese2(18,0,2,16);//度
OLED_ShowChar(36,0,':',16);//:
OLED_ShowString(48,0,str_shidu,16);
OLED_ShowChinese2(87,0,6,16);//阈
OLED_ShowChinese2(105,0,7,16);//值
OLED_ShowChinese2(0,16,0,16);//温
OLED_ShowChinese2(18,16,2,16);//度
OLED_ShowChar(36,16,58,16);//26号‘:’,ASC2为58
OLED_ShowString(48,16,str_temp,16);
OLED_ShowString(96,16,str_temp_yu,16);
OLED_ShowString(0,32,"CH4:",16);
OLED_ShowString(32,32,str_smog,16);
OLED_ShowString(96,32,str_smog_yu,16);
OLED_ShowString(0,48,"CO: ",16);
OLED_ShowString(32,48,str_co,16);
OLED_ShowString(96,48,str_co_yu,16);
OLED_Refresh();
//
// delay_ms(5000);
}
return 0;
}
void USART1_IRQHandler(void)
{
uint8_t d;
//检测是否接收都数据
if(USART_GetITStatus(USART1, USART_IT_RXNE) != RESET)
{
//读取串口1接收PC发送的数据
d = USART_ReceiveData(USART1);
}
}
key.c
#include "key.h"
void Key_Init()
{
GPIO_InitTypeDef GPIO_InitStructure;
/*四个按键*/
/* GPIOA 引脚的时钟使能 */
RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOA, ENABLE);
/* 配置PA0引脚为输出模式 s1*/
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_0; //配置的引脚
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN; //输入模式
GPIO_InitStructure.GPIO_OType = GPIO_OType_PP; //推挽模式
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_100MHz; //速度为100MHz
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL; //上下拉电阻:无上下拉电阻
GPIO_Init(GPIOA, &GPIO_InitStructure);
/* 配置PE2引脚为输出模式 s2*/
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_2; //配置的引脚
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN; //输入模式
GPIO_InitStructure.GPIO_OType = GPIO_OType_PP; //推挽模式
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_100MHz; //速度为100MHz
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL; //上下拉电阻:无上下拉电阻
GPIO_Init(GPIOE, &GPIO_InitStructure);
/* 配置PE3引脚为输出模式 s3*/
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_3; //配置的引脚
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN; //输入模式
GPIO_InitStructure.GPIO_OType = GPIO_OType_PP; //推挽模式
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_100MHz; //速度为100MHz
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL; //上下拉电阻:无上下拉电阻
GPIO_Init(GPIOE, &GPIO_InitStructure);
/* 配置PE4引脚为输出模式 s4*/
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_4; //配置的引脚
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN; //输入模式
GPIO_InitStructure.GPIO_OType = GPIO_OType_PP; //推挽模式
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_100MHz; //速度为100MHz
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL; //上下拉电阻:无上下拉电阻
GPIO_Init(GPIOE, &GPIO_InitStructure);
}
key.h
#ifndef _KEY_H
#define _KEY_H
//C文件中需要的其他的头文件
#include <stm32f4xx.h>
#include "sys.h"
#include "delay.h"
#include "math.h"
#include "adc.h"
//C文件中定义的函数的声明
void Key_Init(void);
#endif
led.c
#include "led.h"
void led_init(void)
{
GPIO_InitTypeDef GPIO_InitStructure;
//1、初始化led对应的引脚 PF9 PF10 PE13 PE14的时钟
RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOE|RCC_AHB1Periph_GPIOF, ENABLE);
//2、通过结构体初始化led引脚
/* 配置PF9 PF10引脚为输出模式 */
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_9 | GPIO_Pin_10; //配置的引脚
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT; //输出模式
GPIO_InitStructure.GPIO_OType = GPIO_OType_PP; //推挽模式
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_100MHz; //速度为100MHz
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL; //上下拉电阻:无上下拉电阻
GPIO_Init(GPIOF, &GPIO_InitStructure);
/* 配置PE13 PE14引脚为输出模式 */
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_13 | GPIO_Pin_14; //配置的引脚
GPIO_Init(GPIOE, &GPIO_InitStructure);
PFout(9) = 1;
PFout(10) = 1;
PEout(13) = 1;
PEout(14) = 1;
}
extern uint8_t cmp_led1; //全局变量的声明,说明该全局变量在其他文件中
void LED_CTL(u8 num, u8 stat, u8 value)
{
if(stat == 0xFF) //打开
{
if(num == 0x01)
TIM_SetCompare1(TIM14, 0); //占空比为0, 常亮
if(num == 0x02)
cmp_led1 = 0; //占空比为0, 常亮
if(num == 0x03)
TIM_SetCompare3(TIM1, 0); //占空比为0, 常亮
if(num == 0x04)
TIM_SetCompare4(TIM1, 0); //占空比为0, 常亮
}
else if(stat == 0x00) //关闭
{
if(num == 0x01)
TIM_SetCompare1(TIM14, 100); //占空比为100, 常灭
if(num == 0x02)
cmp_led1 = 100; //占空比为100, 常灭
if(num == 0x03)
TIM_SetCompare3(TIM1, 100); //占空比为100, 常灭
if(num == 0x04)
TIM_SetCompare4(TIM1, 100); //占空比为100, 常灭
}
else if(stat == 0xAF) //亮度控制
{
if(value<100 && value>0)
{
if(num == 0x01)
TIM_SetCompare1(TIM14, value);
if(num == 0x02)
cmp_led1 = value;
if(num == 0x03)
TIM_SetCompare3(TIM1, value);
if(num == 0x04)
TIM_SetCompare4(TIM1, value);
}
}
}
led.h
#ifndef _LED_H
#define _LED_H
//C文件中需要的其他的头文件
#include <stm32f4xx.h>
#include "sys.h"
//C文件中定义的函数的声明
void led_init(void);
void LED_CTL(u8 num, u8 stat, u8 value);
#endif
beep.c
#include "beep.h"
void Beep_init()
{
GPIO_InitTypeDef GPIO_InitStructure;
RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOF,ENABLE);//使能PF的时钟
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_8;//PF8引脚
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT;//输出模式
GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;//推挽模式
GPIO_InitStructure.GPIO_Speed = GPIO_Low_Speed;//低俗
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL;//上下拉电阻:无上下拉电阻
GPIO_Init(GPIOF, &GPIO_InitStructure);
PFout(8) = 0;//不准叫
}
beep.h
#ifndef _BEEP_H
#define _BEEP_H
//C文件中需要的其他的头文件
#include <stm32f4xx.h>
#include "sys.h"
#include "delay.h"
//C文件中定义的函数的声明
void Beep_init(void);
#endif