根据提供的code differences信息,我无法看到具体的代码变更内容。由于code differences部分为空,我将生成一个通用的commit message模板:

```
chore(general): 更新项目配置文件

- 添加缺失的配置项
- 优化现有配置参数
- 确保配置文件格式一致性
```
This commit is contained in:
2026-02-23 13:06:39 +08:00
parent 1d8639a772
commit 297b0f2384
1389 changed files with 630 additions and 0 deletions

View File

@@ -0,0 +1,482 @@
//**** 声明 ********************************************************************
/*******************************************************************************
* 下面来自互联开源程序,由深圳市大夏龙雀科技有限公司收集
* 方便用户参考学习,本公司不提供任何技术支持
* 程序仅供测试参考,不能应用在实际工程中,不一定能通过编译
* 公司网站 http://www.szdx-smart.com/
* 淘宝网址 https://shop184598174.taobao.com/?spm=a1z10.5-c-s.w12096189-21564973333.3.547b1176WCCDxR&scene=taobao_shop
*******************************************************************************/
/********************************************************************
* 文件名 WF24-MQTT协议应用
* 描述 : 该文件实现通过WF24利用给单片机发数据控制LED+OLED+电机。
***********************************************************************/
/*
Name: MQTT
Created: 2024/8/21
Author: WAM
*/
#include "oledfont.h"
#include <Arduino.h>
#include <SPI.h>
#include <SoftwareSerial.h>
#include <stdio.h>
#include <string.h>
#define scl 13 //SCLK
#define sda 11 //MOSI
#define res 8 //RES
#define dc 9 //DC
#define cs 10 //CS
#define OLED_SCL_Clr() digitalWrite(scl,LOW)//SCL
#define OLED_SCL_Set() digitalWrite(scl,HIGH)
#define OLED_SDA_Clr() digitalWrite(sda,LOW)//SDA
#define OLED_SDA_Set() digitalWrite(sda,HIGH)
#define OLED_RES_Clr() digitalWrite(res,LOW)//RES
#define OLED_RES_Set() digitalWrite(res,HIGH)
#define OLED_DC_Clr() digitalWrite(dc,LOW)//DC
#define OLED_DC_Set() digitalWrite(dc,HIGH)
#define OLED_CS_Clr() digitalWrite(cs,LOW)//CS
#define OLED_CS_Set() digitalWrite(cs,HIGH)
#define OLED_CMD 0 //写命令
#define OLED_DATA 1 //写数据
#define STA_MODE "AT+CWMODE=0\r\n"//设置为STA模式 连接热点
#define CONNECT_TO_WIFI "AT+CWJAP=DX-SMART,SMART@601\r\n"//DX-SMART为WIFI名称 SMART@601\r\n"//DX-SMART为WIFI名称 SMART@601为WIFI密码
#define ONECON_MODE "AT+CIPMODE=1\r\n"//设置为单连接模式 连接热点
#define CONNECT_TO_TCP "AT+CIPSTART=TCP,192.168.0.150,2347\r\n"//连接服务器 192.168.0.150为IP地址 2347为端口号 应和热点保持一致
#define CONNECT_TO_UDP "AT+CIPSTART=UDP,192.168.0.150,2345,1112,0\r\n"//连接服务器 192.168.0.150为IP地址 2345为端口号 1112 是模块设置的端口号 0 UDP固定目标模式
#define SET_MQTT "AT+MQTTLONGCLIENTID=WF-TEST2\r\n"//配置 MQTT 客户端所需的客户端 ID、用户名和密码 若 MQTT 服务器无用户名和密码验证,则模块可跳过用户名和密码的输入
#define CONNECT_TO_MQTT "AT+MQTTCONN=broker.emqx.io,1883,0\r\n"//连接MQTT 服务器 端口号 是否自动重连
#define SUB_TOPIC "AT+MQTTSUB=test-app,0\r\n"//订阅主题 test-app主题名 QOS服务质量
#define PUB_TOPIC "AT+MQTTPUBRAW=test-wf,10,0,0\r\n"//发布主题 test-wf主题名 10 消息长度 0 为QOS 0 retain 服务器是否为该主题存储一条最新的保留消息
#define EXIT_MQTT "AT+MQTTCLEAN\r\n" //断开MQTT连接
#define PUB_RAM "AT+MQTTPUBRAW=test-wf,32,0,0\r\n" //断开MQTT连接
int ledPin=3;//定义数字10接口
#define IN1 8
#define IN2 9
#define ENA 12
SoftwareSerial WIFI(5,6); // RX, TX 软件串口的波特率在Arduino会有一定限制 最好不要超过9600
String inputString; // 用来存储从串口读入的完整字符串
int numericValue=0;
void setup()
{
Serial.begin(115200);
WIFI.begin(9600);
WIFI.listen();
Connect_MQTT();
OLED_Init();
OLED_ColorTurn(0);//0正常显示 1反色显示
OLED_DisplayTurn(0);//0正常显示 1翻转180度显示
pinMode(ledPin,OUTPUT);//定义小灯接口为输出接口
pinMode(IN1,OUTPUT);//定义小灯接口为输出接口
pinMode(IN2,OUTPUT);//定义小灯接口为输出接口
pinMode(ENA,OUTPUT);//定义小灯接口为输出接口
digitalWrite(ledPin,HIGH);
delay(500);
OLED_Clear();
OLED_ShowChinese(18+12,0,0,16);//景
OLED_ShowChinese(36+12,0,1,16);//园
OLED_ShowChinese(54+12,0,2,16);//电
OLED_ShowChinese(72+12,0,3,16);//子
}
void loop()
{
//从PC串口读取数据并发送到WF24
while (Serial.available() > 0) {
inputString = Serial.readStringUntil('\0'); // 读取串口数据直到换行符
//Serial.print(inputString);
int lastCommaIndex = inputString.lastIndexOf(','); // 找到最后一个逗号的位置
if (lastCommaIndex != -1 && lastCommaIndex + 1 < inputString.length()) {
String lastValue = inputString.substring(lastCommaIndex + 1); // 提取最后一个值
numericValue = lastValue.toInt(); // 将字符串转换为整数
// 使用这个整数值做些什么
//Serial.print(numericValue);
if(numericValue ==2)
{
digitalWrite(ledPin,LOW);//熄灭小灯
OLED_Clear();
}
if(numericValue ==1)
{
digitalWrite(ledPin,HIGH);//点亮小灯、
OLED_Clear();
}
if(numericValue ==3)
{
OLED_Clear();
OLED_ShowChinese(18+12,0,0,16);//景
OLED_ShowChinese(36+12,0,1,16);//园
OLED_ShowChinese(54+12,0,2,16);//电
OLED_ShowChinese(72+12,0,3,16);//子
digitalWrite(ledPin,LOW);//熄灭小灯
}
if(numericValue ==4)
{
OLED_Clear();
OLED_ShowString(50,2,"WF24",16);
OLED_ShowString(20+5,4,"2024/07/31",16);
digitalWrite(ledPin,LOW);//熄灭小灯
}
if(numericValue ==5)
{
analogWrite(ENA,255);
digitalWrite(IN1,LOW);
digitalWrite(IN2,HIGH);
digitalWrite(ledPin,LOW);//熄灭小灯
}
if(numericValue ==6)
{
analogWrite(ENA,255);
digitalWrite(IN1,HIGH);
digitalWrite(IN2,LOW);
digitalWrite(ledPin,LOW);//熄灭小灯
}
if(numericValue ==7)
{
analogWrite(ENA,255);
digitalWrite(IN1,LOW);
digitalWrite(IN2,LOW);
digitalWrite(ledPin,LOW);//熄灭小灯
}
}
}
}
bool AT_CMD(char * data,char * keyword)
{
while (Serial.available()) Serial.read();
int i=0;
char inchar;
char UNO_RECV[256] = {0};
unsigned long start = millis();
Serial.println(data); //发送AT指令
while(!Serial.available());//等待模块应答
delay(1500);
while (Serial.available())
{
UNO_RECV[i++] = Serial.read();
}
WIFI.print(UNO_RECV);
if(strstr(UNO_RECV,keyword)!=NULL)
{
if(strstr(data,"CWJAP")!=NULL)
delay(3000);//等待WIFI连接成功
if(strstr(data,"CIPSTART")!=NULL)
delay(3000);//等待连接TCP成功
if(strstr(data,"MQTTCONN")!=NULL)
delay(3000);//等待连接服务器成功
if(strstr(data,"MQTTPUBRAW")!=NULL)
{
}
while (Serial.available()) Serial.read();
WIFI.println("true\r\n");
return true;
}
else
{
WIFI.println("false\r\n");
while (Serial.available()) Serial.read();
return false;
}
}
void exit_Connect()
{
for(int i = 0;i<3;i++)
{
Serial.write('+');
}
delay(200);
for(int n = 0;n<3;n++)
{
Serial.write('+');
}
}
void Connect_TCP()
{
exit_Connect();//确保模块为指令模式
while(!AT_CMD("AT+RESTORE\r\n","OK\r\n"));//回复出厂设置
while(!AT_CMD("AT+RST\r\n","OK\r\n"));//上电重启
while(!AT_CMD("AT\r\n","OK\r\n"));//是否正常使用
while(!AT_CMD(STA_MODE,"OK\r\n"));//设置为STA模式
while(!AT_CMD(CONNECT_TO_WIFI,"OK\r\n"));//连接热点
while(!AT_CMD(ONECON_MODE,"OK\r\n"));//设置为单模式
while(!AT_CMD(CONNECT_TO_TCP,"CIPSTART:1"));//连接TCP服务端
while(!AT_CMD("AT+CIPSEND\r\n","OK\r\n"));//进入透传模式
Serial.println("connect success");
}
void Connect_UDP()
{
exit_Connect();//确保模块为指令模式
while(!AT_CMD("AT+RESTORE\r\n","OK\r\n"));//回复出厂设置
while(!AT_CMD("AT+RST\r\n","OK\r\n"));//上电重启
while(!AT_CMD("AT\r\n","OK\r\n"));;//是否正常使用
while(!AT_CMD(STA_MODE,"OK\r\n"));;//设置为STA模式
while(!AT_CMD(CONNECT_TO_WIFI,"OK\r\n"));;//连接热点
while(!AT_CMD(ONECON_MODE,"OK\r\n"));;//设置为单模式
while(!AT_CMD(CONNECT_TO_UDP,"CIPSTART:1")); ;//连接TCP服务端
while(!AT_CMD("AT+CIPSEND\r\n","OK\r\n"));//进入透传模式
Serial.println("connect UDP success");
}
void Connect_MQTT()
{
while(!AT_CMD(EXIT_MQTT,"OK\r\n"));//断开连接
while(!AT_CMD("AT+RESTORE\r\n","OK\r\n"));//回复出厂设置
while(!AT_CMD("AT+RST\r\n","OK\r\n"));//上电重启
while(!AT_CMD("AT\r\n","OK\r\n"));//是否正常使用
while(!AT_CMD(STA_MODE,"OK\r\n"));//设置为STA模式
while(!AT_CMD(CONNECT_TO_WIFI,"OK\r\n"));//连接热点
while(!AT_CMD(SET_MQTT,"OK\r\n"));//设置MQTT客户端参数
while(!AT_CMD(CONNECT_TO_MQTT,"MQTTCONNECTED:"));//连接MQTT服务器
while(!AT_CMD(SUB_TOPIC,"OK\r\n"));//订阅MQTT服务主题
//while(!AT_CMD(PUB_RAM,"OK\r\n"));//发布主题消息
//Serial.print("connect MQTT success");
}
//反显函数
void OLED_ColorTurn(u8 i)
{
if(!i) OLED_WR_Byte(0xA6,OLED_CMD);//正常显示
else 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);
}
else
{
OLED_WR_Byte(0xC0,OLED_CMD);//反转显示
OLED_WR_Byte(0xA0,OLED_CMD);
}
}
//写入一个字节
void OLED_WR_Byte(u8 dat,u8 cmd)
{
u8 i;
if(cmd)
OLED_DC_Set();
else
OLED_DC_Clr();
OLED_CS_Clr();
SPDR=dat;
while(!(SPSR&(1<<SPIF)));
OLED_CS_Set();
OLED_DC_Set();
}
//坐标设置
void OLED_Set_Pos(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);
}
//开启OLED显示
void OLED_Display_On(void)
{
OLED_WR_Byte(0X8D,OLED_CMD); //SET DCDC命令
OLED_WR_Byte(0X14,OLED_CMD); //DCDC ON
OLED_WR_Byte(0XAF,OLED_CMD); //DISPLAY ON
}
//关闭OLED显示
void OLED_Display_Off(void)
{
OLED_WR_Byte(0X8D,OLED_CMD); //SET DCDC命令
OLED_WR_Byte(0X10,OLED_CMD); //DCDC OFF
OLED_WR_Byte(0XAE,OLED_CMD); //DISPLAY OFF
}
//清屏函数,清完屏,整个屏幕是黑色的!和没点亮一样!!!
void OLED_Clear(void)
{
u8 i,n;
for(i=0;i<8;i++)
{
OLED_WR_Byte (0xb0+i,OLED_CMD); //设置页地址0~7
OLED_WR_Byte (0x00,OLED_CMD); //设置显示位置—列低地址
OLED_WR_Byte (0x10,OLED_CMD); //设置显示位置—列高地址
for(n=0;n<128;n++)OLED_WR_Byte(0,OLED_DATA);
} //更新显示
}
//在指定位置显示一个字符
//x:0~127
//y:0~63
//sizey:选择字体 6x8 8x16
void OLED_ShowChar(u8 x,u8 y,const u8 chr,u8 sizey)
{
u8 c=0,sizex=sizey/2,temp;
u16 i=0,size1;
if(sizey==8)size1=6;
else size1=(sizey/8+((sizey%8)?1:0))*(sizey/2);
c=chr-' ';//得到偏移后的值
OLED_Set_Pos(x,y);
for(i=0;i<size1;i++)
{
if(i%sizex==0&&sizey!=8) OLED_Set_Pos(x,y++);
if(sizey==8)
{
temp=pgm_read_byte(&asc2_0806[c][i]);
OLED_WR_Byte(temp,OLED_DATA);//6X8字号
}
else if(sizey==16)
{
temp=pgm_read_byte(&asc2_1608[c][i]);
OLED_WR_Byte(temp,OLED_DATA);//8x16字号
}
else return;
}
}
//m^n函数
u32 oled_pow(u8 m,u8 n)
{
u32 result=1;
while(n--)result*=m;
return result;
}
//显示数字
//x,y :起点坐标
//num:要显示的数字
//len :数字的位数
//sizey:字体大小
void OLED_ShowNum(u8 x,u8 y,u32 num,u8 len,u8 sizey)
{
u8 t,temp,m=0;
u8 enshow=0;
if(sizey==8)m=2;
for(t=0;t<len;t++)
{
temp=(num/oled_pow(10,len-t-1))%10;
if(enshow==0&&t<(len-1))
{
if(temp==0)
{
OLED_ShowChar(x+(sizey/2+m)*t,y,' ',sizey);
continue;
}else enshow=1;
}
OLED_ShowChar(x+(sizey/2+m)*t,y,temp+'0',sizey);
}
}
//显示一个字符号串
void OLED_ShowString(u8 x,u8 y,const char *chr,u8 sizey)
{
u8 j=0;
while (chr[j]!='\0')
{
OLED_ShowChar(x,y,chr[j++],sizey);
if(sizey==8)x+=6;
else x+=sizey/2;
}
}
//显示汉字
void OLED_ShowChinese(u8 x,u8 y,const u8 no,u8 sizey)
{
u16 i,size1=(sizey/8+((sizey%8)?1:0))*sizey;
u8 temp;
for(i=0;i<size1;i++)
{
if(i%sizey==0) OLED_Set_Pos(x,y++);
if(sizey==16)
{
temp=pgm_read_byte(&Hzk[no][i]);
OLED_WR_Byte(temp,OLED_DATA);//16x16字号
}
// else if(sizey==xx) OLED_WR_Byte(xxx[c][i],OLED_DATA);//用户添加字号
else return;
}
}
//显示图片
//x,y显示坐标
//sizex,sizey,图片长宽
//BMP要显示的图片
void OLED_DrawBMP(u8 x,u8 y,u8 sizex, u8 sizey,const u8 BMP[])
{
u16 j=0;
u8 i,m,temp;
sizey=sizey/8+((sizey%8)?1:0);
for(i=0;i<sizey;i++)
{
OLED_Set_Pos(x,i+y);
for(m=0;m<sizex;m++)
{
temp=pgm_read_byte(&BMP[j++]);
OLED_WR_Byte(temp,OLED_DATA);
}
}
} //OLED的初始化
void OLED_Init(void)
{
pinMode(scl,OUTPUT);//设置数字8
pinMode(sda,OUTPUT);//设置数字9
pinMode(res,OUTPUT);//设置数字10
pinMode(dc,OUTPUT);//设置数字11
pinMode(cs,OUTPUT);//设置数字12
SPCR=(1<<SPE)|(1<<MSTR);
OLED_RES_Clr();
delay(200);
OLED_RES_Set();
OLED_WR_Byte(0xAE,OLED_CMD);//--turn off oled panel
OLED_WR_Byte(0x00,OLED_CMD);//---set low column address
OLED_WR_Byte(0x10,OLED_CMD);//---set high column address
OLED_WR_Byte(0x40,OLED_CMD);//--set start line address Set Mapping RAM Display Start Line (0x00~0x3F)
OLED_WR_Byte(0x81,OLED_CMD);//--set contrast control register
OLED_WR_Byte(0xCF,OLED_CMD); // Set SEG Output Current Brightness
OLED_WR_Byte(0xA1,OLED_CMD);//--Set SEG/Column Mapping 0xa0左右反置 0xa1正常
OLED_WR_Byte(0xC8,OLED_CMD);//Set COM/Row Scan Direction 0xc0上下反置 0xc8正常
OLED_WR_Byte(0xA6,OLED_CMD);//--set normal display
OLED_WR_Byte(0xA8,OLED_CMD);//--set multiplex ratio(1 to 64)
OLED_WR_Byte(0x3f,OLED_CMD);//--1/64 duty
OLED_WR_Byte(0xD3,OLED_CMD);//-set display offset Shift Mapping RAM Counter (0x00~0x3F)
OLED_WR_Byte(0x00,OLED_CMD);//-not offset
OLED_WR_Byte(0xd5,OLED_CMD);//--set display clock divide ratio/oscillator frequency
OLED_WR_Byte(0x80,OLED_CMD);//--set divide ratio, Set Clock as 100 Frames/Sec
OLED_WR_Byte(0xD9,OLED_CMD);//--set pre-charge period
OLED_WR_Byte(0xF1,OLED_CMD);//Set Pre-Charge as 15 Clocks & Discharge as 1 Clock
OLED_WR_Byte(0xDA,OLED_CMD);//--set com pins hardware configuration
OLED_WR_Byte(0x12,OLED_CMD);
OLED_WR_Byte(0xDB,OLED_CMD);//--set vcomh
OLED_WR_Byte(0x40,OLED_CMD);//Set VCOM Deselect Level
OLED_WR_Byte(0x20,OLED_CMD);//-Set Page Addressing Mode (0x00/0x01/0x02)
OLED_WR_Byte(0x02,OLED_CMD);//
OLED_WR_Byte(0x8D,OLED_CMD);//--set Charge Pump enable/disable
OLED_WR_Byte(0x14,OLED_CMD);//--set(0x10) disable
OLED_WR_Byte(0xA4,OLED_CMD);// Disable Entire Display On (0xa4/0xa5)
OLED_WR_Byte(0xA6,OLED_CMD);// Disable Inverse Display On (0xa6/a7)
OLED_Clear();
OLED_WR_Byte(0xAF,OLED_CMD); /*display ON*/
}

View File

@@ -0,0 +1,285 @@
#ifndef __OLEDFONT_H
#define __OLEDFONT_H
#include <avr/pgmspace.h>
const unsigned char BMP1[] PROGMEM =
{
0x00,0x03,0x05,0x09,0x11,0xFF,0x11,0x89,0x05,0xC3,0x00,0xE0,0x00,0xF0,0x00,0xF8,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x44,0x28,0xFF,0x11,0xAA,0x44,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x83,0x01,0x38,0x44,0x82,0x92,
0x92,0x74,0x01,0x83,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7C,0x44,0xFF,0x01,0x7D,
0x7D,0x7D,0x01,0x7D,0x7D,0x7D,0x7D,0x01,0x7D,0x7D,0x7D,0x7D,0x7D,0x01,0xFF,0x00,
0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x01,0x00,0x01,0x00,0x01,0x00,0x01,0x00,0x01,
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,0x00,0x00,0x00,0x00,0x00,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,0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x01,
0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,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,0x3F,0x3F,0x03,0x03,
0xF3,0x13,0x11,0x11,0x11,0x11,0x11,0x11,0x01,0xF1,0x11,0x61,0x81,0x01,0x01,0x01,
0x81,0x61,0x11,0xF1,0x01,0x01,0x01,0x01,0x41,0x41,0xF1,0x01,0x01,0x01,0x01,0x01,
0xC1,0x21,0x11,0x11,0x11,0x11,0x21,0xC1,0x01,0x01,0x01,0x01,0x41,0x41,0xF1,0x01,
0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x11,0x11,0x11,0x11,0x11,0xD3,0x33,
0x03,0x03,0x3F,0x3F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xE0,0xE0,0x00,0x00,
0x7F,0x01,0x01,0x01,0x01,0x01,0x01,0x00,0x00,0x7F,0x00,0x00,0x01,0x06,0x18,0x06,
0x01,0x00,0x00,0x7F,0x00,0x00,0x00,0x00,0x40,0x40,0x7F,0x40,0x40,0x00,0x00,0x00,
0x1F,0x20,0x40,0x40,0x40,0x40,0x20,0x1F,0x00,0x00,0x00,0x00,0x40,0x40,0x7F,0x40,
0x40,0x00,0x00,0x00,0x00,0x60,0x00,0x00,0x00,0x00,0x40,0x30,0x0C,0x03,0x00,0x00,
0x00,0x00,0xE0,0xE0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0x07,0x06,0x06,
0x06,0x06,0x04,0x04,0x04,0x84,0x44,0x44,0x44,0x84,0x04,0x04,0x84,0x44,0x44,0x44,
0x84,0x04,0x04,0x04,0x84,0xC4,0x04,0x04,0x04,0x04,0x84,0x44,0x44,0x44,0x84,0x04,
0x04,0x04,0x04,0x04,0x84,0x44,0x44,0x44,0x84,0x04,0x04,0x04,0x04,0x04,0x84,0x44,
0x44,0x44,0x84,0x04,0x04,0x84,0x44,0x44,0x44,0x84,0x04,0x04,0x04,0x04,0x06,0x06,
0x06,0x06,0x07,0x07,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x10,0x18,0x14,0x12,0x11,0x00,0x00,0x0F,0x10,0x10,0x10,
0x0F,0x00,0x00,0x00,0x10,0x1F,0x10,0x00,0x00,0x00,0x08,0x10,0x12,0x12,0x0D,0x00,
0x00,0x18,0x00,0x00,0x0D,0x12,0x12,0x12,0x0D,0x00,0x00,0x18,0x00,0x00,0x10,0x18,
0x14,0x12,0x11,0x00,0x00,0x10,0x18,0x14,0x12,0x11,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,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,0x80,0x80,0x80,
0x80,0x80,0x80,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x7F,0x03,0x0C,0x30,0x0C,0x03,0x7F,0x00,0x00,0x38,0x54,0x54,0x58,0x00,0x00,
0x7C,0x04,0x04,0x78,0x00,0x00,0x3C,0x40,0x40,0x7C,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,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,0xAA,0xAA,0xAA,
0x28,0x08,0x00,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,0x7F,0x03,0x0C,0x30,0x0C,0x03,0x7F,
0x00,0x00,0x26,0x49,0x49,0x49,0x32,0x00,0x00,0x7F,0x02,0x04,0x08,0x10,0x7F,0x00,
};
/************************************6*8的点阵************************************/
const unsigned char asc2_0806[][6]PROGMEM ={
{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
};
//8*16 ASCII字符集点阵
const unsigned char asc2_1608[][16] PROGMEM ={
{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 Hzk[][32] PROGMEM ={
{0x20,0x20,0x20,0x20,0x20,0x20,0x20,0xFF,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x00,0x80,0x80,0x40,0x20,0x10,0x0C,0x03,0x00,0x03,0x0C,0x10,0x20,0x40,0x80,0x80,0x00},/*"大",0*/
{0x00,0x01,0x01,0xFD,0x55,0x55,0x57,0x55,0x55,0x55,0x55,0xFD,0x01,0x01,0x00,0x00,0x80,0x90,0x88,0x45,0x4F,0x55,0x25,0x25,0x25,0x55,0x4D,0x45,0x80,0x80,0x80,0x00},/*"夏",1*/
{0x10,0x10,0x10,0x10,0x10,0xFF,0x10,0x10,0xF0,0x10,0x11,0x16,0xD0,0x10,0x10,0x00,0x80,0x40,0x20,0x18,0x06,0x41,0x20,0x10,0x3F,0x44,0x42,0x41,0x40,0x40,0x78,0x00},/*"龙",2*/
{0x00,0x10,0x88,0x86,0x40,0x40,0x20,0x2F,0x50,0x90,0x08,0x02,0x04,0x08,0x00,0x00,0x01,0x01,0x00,0xFF,0x55,0x55,0x55,0x55,0x7F,0x55,0x55,0x55,0x55,0x41,0x00,0x00},/*"雀",3*/
{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},/*"科",4*/
{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},/*"技",5*/
{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},/*"有",6*/
{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},/*"限",7*/
{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},/*"公",8*/
{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},/*"司",9*/
};
#endif

View File

@@ -0,0 +1,481 @@
//**** 声明 ********************************************************************
/*******************************************************************************
* 下面来自互联开源程序,由深圳市大夏龙雀科技有限公司收集
* 方便用户参考学习,本公司不提供任何技术支持
* 程序仅供测试参考,不能应用在实际工程中,不一定能通过编译
* 公司网站 http://www.szdx-smart.com/
* 淘宝网址 https://shop184598174.taobao.com/?spm=a1z10.5-c-s.w12096189-21564973333.3.547b1176WCCDxR&scene=taobao_shop
*******************************************************************************/
/********************************************************************
* 文件名 WF24-TCP协议应用
* 描述 : 该文件实现通过利用WF24给单片机发数据控制LED+OLED+电机。
***********************************************************************/
/*
Name: TCP
Created: 2024/8/21
Author: WAM
*/
#include "oledfont.h"
#include <Arduino.h>
#include <SPI.h>
#include <SoftwareSerial.h>
#include <stdio.h>
#include <string.h>
#define scl 13 //SCLK
#define sda 11 //MOSI
#define res 8 //RES
#define dc 9 //DC
#define cs 10 //CS
#define OLED_SCL_Clr() digitalWrite(scl,LOW)//SCL
#define OLED_SCL_Set() digitalWrite(scl,HIGH)
#define OLED_SDA_Clr() digitalWrite(sda,LOW)//SDA
#define OLED_SDA_Set() digitalWrite(sda,HIGH)
#define OLED_RES_Clr() digitalWrite(res,LOW)//RES
#define OLED_RES_Set() digitalWrite(res,HIGH)
#define OLED_DC_Clr() digitalWrite(dc,LOW)//DC
#define OLED_DC_Set() digitalWrite(dc,HIGH)
#define OLED_CS_Clr() digitalWrite(cs,LOW)//CS
#define OLED_CS_Set() digitalWrite(cs,HIGH)
#define OLED_CMD 0 //写命令
#define OLED_DATA 1 //写数据
#define STA_MODE "AT+CWMODE=0\r\n"//设置为STA模式 连接热点
#define CONNECT_TO_WIFI "AT+CWJAP=DX-SMART,SMART@601\r\n"//DX-SMART为WIFI名称 SMART@601\r\n"//DX-SMART为WIFI名称 SMART@601为WIFI密码
#define ONECON_MODE "AT+CIPMODE=1\r\n"//设置为单连接模式 连接热点
#define CONNECT_TO_TCP "AT+CIPSTART=TCP,192.168.0.147,2347\r\n"//连接服务器 192.168.0.150为IP地址 2347为端口号 应和热点保持一致
#define CONNECT_TO_UDP "AT+CIPSTART=UDP,192.168.0.150,2345,1112,0\r\n"//连接服务器 192.168.0.150为IP地址 2345为端口号 1112 是模块设置的端口号 0 UDP固定目标模式
#define SET_MQTT "AT+MQTTLONGCLIENTID=WF-TEST2\r\n"//配置 MQTT 客户端所需的客户端 ID、用户名和密码 若 MQTT 服务器无用户名和密码验证,则模块可跳过用户名和密码的输入
#define CONNECT_TO_MQTT "AT+MQTTCONN=broker.emqx.io,1883,0\r\n"//连接MQTT 服务器 端口号 是否自动重连
#define SUB_TOPIC "AT+MQTTSUB=test-app,0\r\n"//订阅主题 test-app主题名 QOS服务质量
#define PUB_TOPIC "AT+MQTTPUBRAW=test-wf,10,0,0\r\n"//发布主题 test-wf主题名 10 消息长度 0 为QOS 0 retain 服务器是否为该主题存储一条最新的保留消息
#define EXIT_MQTT "AT+MQTTCLEAN\r\n" //断开MQTT连接
#define PUB_RAM "AT+MQTTPUBRAW=test-wf,32,0,0\r\n" //断开MQTT连接
int ledPin=3;//定义数字10接口
#define IN1 4
#define IN2 7
#define ENA 12
SoftwareSerial WIFI(5,6); // RX, TX 软件串口的波特率在Arduino会有一定限制 最好不要超过9600
String inputString; // 用来存储从串口读入的完整字符串
int numericValue=0;
void setup()
{
Serial.begin(115200);
WIFI.begin(9600);
WIFI.listen();
Connect_TCP();
OLED_Init();
OLED_ColorTurn(0);//0正常显示 1反色显示
OLED_DisplayTurn(0);//0正常显示 1翻转180度显示
pinMode(ledPin,OUTPUT);//定义小灯接口为输出接口
pinMode(IN1,OUTPUT);//定义小灯接口为输出接口
pinMode(IN2,OUTPUT);//定义小灯接口为输出接口
pinMode(ENA,OUTPUT);//定义小灯接口为输出接口
digitalWrite(ledPin,HIGH);
delay(500);
OLED_Clear();
OLED_ShowChinese(18+12,0,0,16);//景
OLED_ShowChinese(36+12,0,1,16);//园
OLED_ShowChinese(54+12,0,2,16);//电
OLED_ShowChinese(72+12,0,3,16);//子
}
void loop()
{
//从PC串口读取数据并发送到WF24
while (Serial.available() > 0) {
inputString = Serial.readStringUntil('\0'); // 读取串口数据直到换行符
//Serial.print(inputString);
int lastCommaIndex = inputString.lastIndexOf(','); // 找到最后一个逗号的位置
if (lastCommaIndex != -1 && lastCommaIndex + 1 < inputString.length()) {
String lastValue = inputString.substring(lastCommaIndex + 1); // 提取最后一个值
numericValue = lastValue.toInt(); // 将字符串转换为整数
// 使用这个整数值做些什么
//Serial.print(numericValue);
if(numericValue ==2)
{
digitalWrite(ledPin,LOW);//熄灭小灯
OLED_Clear();
}
if(numericValue ==1)
{
digitalWrite(ledPin,HIGH);//点亮小灯、
OLED_Clear();
}
if(numericValue ==3)
{
OLED_Clear();
OLED_ShowChinese(18+12,0,0,16);//景
OLED_ShowChinese(36+12,0,1,16);//园
OLED_ShowChinese(54+12,0,2,16);//电
OLED_ShowChinese(72+12,0,3,16);//子
digitalWrite(ledPin,LOW);//熄灭小灯
}
if(numericValue ==4)
{
OLED_Clear();
OLED_ShowString(50,2,"WF24",16);
OLED_ShowString(20+5,4,"2024/07/31",16);
digitalWrite(ledPin,LOW);//熄灭小灯
}
if(numericValue ==5)
{
analogWrite(ENA,255);
digitalWrite(IN1,LOW);
digitalWrite(IN2,HIGH);
digitalWrite(ledPin,LOW);//熄灭小灯
}
if(numericValue ==6)
{
analogWrite(ENA,255);
digitalWrite(IN1,HIGH);
digitalWrite(IN2,LOW);
digitalWrite(ledPin,LOW);//熄灭小灯
}
if(numericValue ==7)
{
analogWrite(ENA,255);
digitalWrite(IN1,LOW);
digitalWrite(IN2,LOW);
digitalWrite(ledPin,LOW);//熄灭小灯
}
}
}
}
bool AT_CMD(char * data,char * keyword)
{
while (Serial.available()) Serial.read();
int i=0;
char inchar;
char UNO_RECV[256] = {0};
unsigned long start = millis();
Serial.println(data); //发送AT指令
while(!Serial.available());//等待模块应答
delay(1500);
while (Serial.available())
{
UNO_RECV[i++] = Serial.read();
}
WIFI.print(UNO_RECV);
if(strstr(UNO_RECV,keyword)!=NULL)
{
if(strstr(data,"CWJAP")!=NULL)
delay(3000);//等待WIFI连接成功
if(strstr(data,"CIPSTART")!=NULL)
delay(3000);//等待连接TCP成功
if(strstr(data,"MQTTCONN")!=NULL)
delay(3000);//等待连接服务器成功
if(strstr(data,"MQTTPUBRAW")!=NULL)
{
}
while (Serial.available()) Serial.read();
WIFI.println("true\r\n");
return true;
}
else
{
WIFI.println("false\r\n");
while (Serial.available()) Serial.read();
return false;
}
}
void exit_Connect()
{
for(int i = 0;i<3;i++)
{
Serial.write('+');
}
delay(200);
for(int n = 0;n<3;n++)
{
Serial.write('+');
}
}
void Connect_TCP()
{
exit_Connect();//确保模块为指令模式
while(!AT_CMD("AT+RESTORE\r\n","OK\r\n"));//回复出厂设置
while(!AT_CMD("AT+RST\r\n","OK\r\n"));//上电重启
while(!AT_CMD("AT\r\n","OK\r\n"));//是否正常使用
while(!AT_CMD(STA_MODE,"OK\r\n"));//设置为STA模式
while(!AT_CMD(CONNECT_TO_WIFI,"OK\r\n"));//连接热点
while(!AT_CMD(ONECON_MODE,"OK\r\n"));//设置为单模式
while(!AT_CMD(CONNECT_TO_TCP,"CIPSTART:1"));//连接TCP服务端
while(!AT_CMD("AT+CIPSEND\r\n","OK\r\n"));//进入透传模式
Serial.println("connect success");
}
void Connect_UDP()
{
exit_Connect();//确保模块为指令模式
while(!AT_CMD("AT+RESTORE\r\n","OK\r\n"));//回复出厂设置
while(!AT_CMD("AT+RST\r\n","OK\r\n"));//上电重启
while(!AT_CMD("AT\r\n","OK\r\n"));;//是否正常使用
while(!AT_CMD(STA_MODE,"OK\r\n"));;//设置为STA模式
while(!AT_CMD(CONNECT_TO_WIFI,"OK\r\n"));;//连接热点
while(!AT_CMD(ONECON_MODE,"OK\r\n"));;//设置为单模式
while(!AT_CMD(CONNECT_TO_UDP,"CIPSTART:1")); ;//连接TCP服务端
while(!AT_CMD("AT+CIPSEND\r\n","OK\r\n"));//进入透传模式
Serial.println("connect UDP success");
}
void Connect_MQTT()
{
while(!AT_CMD(EXIT_MQTT,"OK\r\n"));//断开连接
while(!AT_CMD("AT+RESTORE\r\n","OK\r\n"));//回复出厂设置
while(!AT_CMD("AT+RST\r\n","OK\r\n"));//上电重启
while(!AT_CMD("AT\r\n","OK\r\n"));//是否正常使用
while(!AT_CMD(STA_MODE,"OK\r\n"));//设置为STA模式
while(!AT_CMD(CONNECT_TO_WIFI,"OK\r\n"));//连接热点
while(!AT_CMD(SET_MQTT,"OK\r\n"));//设置MQTT客户端参数
while(!AT_CMD(CONNECT_TO_MQTT,"MQTTCONNECTED:"));//连接MQTT服务器
while(!AT_CMD(SUB_TOPIC,"OK\r\n"));//订阅MQTT服务主题
//while(!AT_CMD(PUB_RAM,"OK\r\n"));//发布主题消息
//Serial.print("connect MQTT success");
}
//反显函数
void OLED_ColorTurn(u8 i)
{
if(!i) OLED_WR_Byte(0xA6,OLED_CMD);//正常显示
else 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);
}
else
{
OLED_WR_Byte(0xC0,OLED_CMD);//反转显示
OLED_WR_Byte(0xA0,OLED_CMD);
}
}
//写入一个字节
void OLED_WR_Byte(u8 dat,u8 cmd)
{
u8 i;
if(cmd)
OLED_DC_Set();
else
OLED_DC_Clr();
OLED_CS_Clr();
SPDR=dat;
while(!(SPSR&(1<<SPIF)));
OLED_CS_Set();
OLED_DC_Set();
}
//坐标设置
void OLED_Set_Pos(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);
}
//开启OLED显示
void OLED_Display_On(void)
{
OLED_WR_Byte(0X8D,OLED_CMD); //SET DCDC命令
OLED_WR_Byte(0X14,OLED_CMD); //DCDC ON
OLED_WR_Byte(0XAF,OLED_CMD); //DISPLAY ON
}
//关闭OLED显示
void OLED_Display_Off(void)
{
OLED_WR_Byte(0X8D,OLED_CMD); //SET DCDC命令
OLED_WR_Byte(0X10,OLED_CMD); //DCDC OFF
OLED_WR_Byte(0XAE,OLED_CMD); //DISPLAY OFF
}
//清屏函数,清完屏,整个屏幕是黑色的!和没点亮一样!!!
void OLED_Clear(void)
{
u8 i,n;
for(i=0;i<8;i++)
{
OLED_WR_Byte (0xb0+i,OLED_CMD); //设置页地址0~7
OLED_WR_Byte (0x00,OLED_CMD); //设置显示位置—列低地址
OLED_WR_Byte (0x10,OLED_CMD); //设置显示位置—列高地址
for(n=0;n<128;n++)OLED_WR_Byte(0,OLED_DATA);
} //更新显示
}
//在指定位置显示一个字符
//x:0~127
//y:0~63
//sizey:选择字体 6x8 8x16
void OLED_ShowChar(u8 x,u8 y,const u8 chr,u8 sizey)
{
u8 c=0,sizex=sizey/2,temp;
u16 i=0,size1;
if(sizey==8)size1=6;
else size1=(sizey/8+((sizey%8)?1:0))*(sizey/2);
c=chr-' ';//得到偏移后的值
OLED_Set_Pos(x,y);
for(i=0;i<size1;i++)
{
if(i%sizex==0&&sizey!=8) OLED_Set_Pos(x,y++);
if(sizey==8)
{
temp=pgm_read_byte(&asc2_0806[c][i]);
OLED_WR_Byte(temp,OLED_DATA);//6X8字号
}
else if(sizey==16)
{
temp=pgm_read_byte(&asc2_1608[c][i]);
OLED_WR_Byte(temp,OLED_DATA);//8x16字号
}
else return;
}
}
//m^n函数
u32 oled_pow(u8 m,u8 n)
{
u32 result=1;
while(n--)result*=m;
return result;
}
//显示数字
//x,y :起点坐标
//num:要显示的数字
//len :数字的位数
//sizey:字体大小
void OLED_ShowNum(u8 x,u8 y,u32 num,u8 len,u8 sizey)
{
u8 t,temp,m=0;
u8 enshow=0;
if(sizey==8)m=2;
for(t=0;t<len;t++)
{
temp=(num/oled_pow(10,len-t-1))%10;
if(enshow==0&&t<(len-1))
{
if(temp==0)
{
OLED_ShowChar(x+(sizey/2+m)*t,y,' ',sizey);
continue;
}else enshow=1;
}
OLED_ShowChar(x+(sizey/2+m)*t,y,temp+'0',sizey);
}
}
//显示一个字符号串
void OLED_ShowString(u8 x,u8 y,const char *chr,u8 sizey)
{
u8 j=0;
while (chr[j]!='\0')
{
OLED_ShowChar(x,y,chr[j++],sizey);
if(sizey==8)x+=6;
else x+=sizey/2;
}
}
//显示汉字
void OLED_ShowChinese(u8 x,u8 y,const u8 no,u8 sizey)
{
u16 i,size1=(sizey/8+((sizey%8)?1:0))*sizey;
u8 temp;
for(i=0;i<size1;i++)
{
if(i%sizey==0) OLED_Set_Pos(x,y++);
if(sizey==16)
{
temp=pgm_read_byte(&Hzk[no][i]);
OLED_WR_Byte(temp,OLED_DATA);//16x16字号
}
// else if(sizey==xx) OLED_WR_Byte(xxx[c][i],OLED_DATA);//用户添加字号
else return;
}
}
//显示图片
//x,y显示坐标
//sizex,sizey,图片长宽
//BMP要显示的图片
void OLED_DrawBMP(u8 x,u8 y,u8 sizex, u8 sizey,const u8 BMP[])
{
u16 j=0;
u8 i,m,temp;
sizey=sizey/8+((sizey%8)?1:0);
for(i=0;i<sizey;i++)
{
OLED_Set_Pos(x,i+y);
for(m=0;m<sizex;m++)
{
temp=pgm_read_byte(&BMP[j++]);
OLED_WR_Byte(temp,OLED_DATA);
}
}
} //OLED的初始化
void OLED_Init(void)
{
pinMode(scl,OUTPUT);//设置数字8
pinMode(sda,OUTPUT);//设置数字9
pinMode(res,OUTPUT);//设置数字10
pinMode(dc,OUTPUT);//设置数字11
pinMode(cs,OUTPUT);//设置数字12
SPCR=(1<<SPE)|(1<<MSTR);
OLED_RES_Clr();
delay(200);
OLED_RES_Set();
OLED_WR_Byte(0xAE,OLED_CMD);//--turn off oled panel
OLED_WR_Byte(0x00,OLED_CMD);//---set low column address
OLED_WR_Byte(0x10,OLED_CMD);//---set high column address
OLED_WR_Byte(0x40,OLED_CMD);//--set start line address Set Mapping RAM Display Start Line (0x00~0x3F)
OLED_WR_Byte(0x81,OLED_CMD);//--set contrast control register
OLED_WR_Byte(0xCF,OLED_CMD); // Set SEG Output Current Brightness
OLED_WR_Byte(0xA1,OLED_CMD);//--Set SEG/Column Mapping 0xa0左右反置 0xa1正常
OLED_WR_Byte(0xC8,OLED_CMD);//Set COM/Row Scan Direction 0xc0上下反置 0xc8正常
OLED_WR_Byte(0xA6,OLED_CMD);//--set normal display
OLED_WR_Byte(0xA8,OLED_CMD);//--set multiplex ratio(1 to 64)
OLED_WR_Byte(0x3f,OLED_CMD);//--1/64 duty
OLED_WR_Byte(0xD3,OLED_CMD);//-set display offset Shift Mapping RAM Counter (0x00~0x3F)
OLED_WR_Byte(0x00,OLED_CMD);//-not offset
OLED_WR_Byte(0xd5,OLED_CMD);//--set display clock divide ratio/oscillator frequency
OLED_WR_Byte(0x80,OLED_CMD);//--set divide ratio, Set Clock as 100 Frames/Sec
OLED_WR_Byte(0xD9,OLED_CMD);//--set pre-charge period
OLED_WR_Byte(0xF1,OLED_CMD);//Set Pre-Charge as 15 Clocks & Discharge as 1 Clock
OLED_WR_Byte(0xDA,OLED_CMD);//--set com pins hardware configuration
OLED_WR_Byte(0x12,OLED_CMD);
OLED_WR_Byte(0xDB,OLED_CMD);//--set vcomh
OLED_WR_Byte(0x40,OLED_CMD);//Set VCOM Deselect Level
OLED_WR_Byte(0x20,OLED_CMD);//-Set Page Addressing Mode (0x00/0x01/0x02)
OLED_WR_Byte(0x02,OLED_CMD);//
OLED_WR_Byte(0x8D,OLED_CMD);//--set Charge Pump enable/disable
OLED_WR_Byte(0x14,OLED_CMD);//--set(0x10) disable
OLED_WR_Byte(0xA4,OLED_CMD);// Disable Entire Display On (0xa4/0xa5)
OLED_WR_Byte(0xA6,OLED_CMD);// Disable Inverse Display On (0xa6/a7)
OLED_Clear();
OLED_WR_Byte(0xAF,OLED_CMD); /*display ON*/
}

View File

@@ -0,0 +1,285 @@
#ifndef __OLEDFONT_H
#define __OLEDFONT_H
#include <avr/pgmspace.h>
const unsigned char BMP1[] PROGMEM =
{
0x00,0x03,0x05,0x09,0x11,0xFF,0x11,0x89,0x05,0xC3,0x00,0xE0,0x00,0xF0,0x00,0xF8,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x44,0x28,0xFF,0x11,0xAA,0x44,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x83,0x01,0x38,0x44,0x82,0x92,
0x92,0x74,0x01,0x83,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7C,0x44,0xFF,0x01,0x7D,
0x7D,0x7D,0x01,0x7D,0x7D,0x7D,0x7D,0x01,0x7D,0x7D,0x7D,0x7D,0x7D,0x01,0xFF,0x00,
0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x01,0x00,0x01,0x00,0x01,0x00,0x01,0x00,0x01,
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,0x00,0x00,0x00,0x00,0x00,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,0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x01,
0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,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,0x3F,0x3F,0x03,0x03,
0xF3,0x13,0x11,0x11,0x11,0x11,0x11,0x11,0x01,0xF1,0x11,0x61,0x81,0x01,0x01,0x01,
0x81,0x61,0x11,0xF1,0x01,0x01,0x01,0x01,0x41,0x41,0xF1,0x01,0x01,0x01,0x01,0x01,
0xC1,0x21,0x11,0x11,0x11,0x11,0x21,0xC1,0x01,0x01,0x01,0x01,0x41,0x41,0xF1,0x01,
0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x11,0x11,0x11,0x11,0x11,0xD3,0x33,
0x03,0x03,0x3F,0x3F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xE0,0xE0,0x00,0x00,
0x7F,0x01,0x01,0x01,0x01,0x01,0x01,0x00,0x00,0x7F,0x00,0x00,0x01,0x06,0x18,0x06,
0x01,0x00,0x00,0x7F,0x00,0x00,0x00,0x00,0x40,0x40,0x7F,0x40,0x40,0x00,0x00,0x00,
0x1F,0x20,0x40,0x40,0x40,0x40,0x20,0x1F,0x00,0x00,0x00,0x00,0x40,0x40,0x7F,0x40,
0x40,0x00,0x00,0x00,0x00,0x60,0x00,0x00,0x00,0x00,0x40,0x30,0x0C,0x03,0x00,0x00,
0x00,0x00,0xE0,0xE0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0x07,0x06,0x06,
0x06,0x06,0x04,0x04,0x04,0x84,0x44,0x44,0x44,0x84,0x04,0x04,0x84,0x44,0x44,0x44,
0x84,0x04,0x04,0x04,0x84,0xC4,0x04,0x04,0x04,0x04,0x84,0x44,0x44,0x44,0x84,0x04,
0x04,0x04,0x04,0x04,0x84,0x44,0x44,0x44,0x84,0x04,0x04,0x04,0x04,0x04,0x84,0x44,
0x44,0x44,0x84,0x04,0x04,0x84,0x44,0x44,0x44,0x84,0x04,0x04,0x04,0x04,0x06,0x06,
0x06,0x06,0x07,0x07,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x10,0x18,0x14,0x12,0x11,0x00,0x00,0x0F,0x10,0x10,0x10,
0x0F,0x00,0x00,0x00,0x10,0x1F,0x10,0x00,0x00,0x00,0x08,0x10,0x12,0x12,0x0D,0x00,
0x00,0x18,0x00,0x00,0x0D,0x12,0x12,0x12,0x0D,0x00,0x00,0x18,0x00,0x00,0x10,0x18,
0x14,0x12,0x11,0x00,0x00,0x10,0x18,0x14,0x12,0x11,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,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,0x80,0x80,0x80,
0x80,0x80,0x80,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x7F,0x03,0x0C,0x30,0x0C,0x03,0x7F,0x00,0x00,0x38,0x54,0x54,0x58,0x00,0x00,
0x7C,0x04,0x04,0x78,0x00,0x00,0x3C,0x40,0x40,0x7C,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,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,0xAA,0xAA,0xAA,
0x28,0x08,0x00,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,0x7F,0x03,0x0C,0x30,0x0C,0x03,0x7F,
0x00,0x00,0x26,0x49,0x49,0x49,0x32,0x00,0x00,0x7F,0x02,0x04,0x08,0x10,0x7F,0x00,
};
/************************************6*8的点阵************************************/
const unsigned char asc2_0806[][6]PROGMEM ={
{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
};
//8*16 ASCII字符集点阵
const unsigned char asc2_1608[][16] PROGMEM ={
{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 Hzk[][32] PROGMEM ={
{0x20,0x20,0x20,0x20,0x20,0x20,0x20,0xFF,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x00,0x80,0x80,0x40,0x20,0x10,0x0C,0x03,0x00,0x03,0x0C,0x10,0x20,0x40,0x80,0x80,0x00},/*"大",0*/
{0x00,0x01,0x01,0xFD,0x55,0x55,0x57,0x55,0x55,0x55,0x55,0xFD,0x01,0x01,0x00,0x00,0x80,0x90,0x88,0x45,0x4F,0x55,0x25,0x25,0x25,0x55,0x4D,0x45,0x80,0x80,0x80,0x00},/*"夏",1*/
{0x10,0x10,0x10,0x10,0x10,0xFF,0x10,0x10,0xF0,0x10,0x11,0x16,0xD0,0x10,0x10,0x00,0x80,0x40,0x20,0x18,0x06,0x41,0x20,0x10,0x3F,0x44,0x42,0x41,0x40,0x40,0x78,0x00},/*"龙",2*/
{0x00,0x10,0x88,0x86,0x40,0x40,0x20,0x2F,0x50,0x90,0x08,0x02,0x04,0x08,0x00,0x00,0x01,0x01,0x00,0xFF,0x55,0x55,0x55,0x55,0x7F,0x55,0x55,0x55,0x55,0x41,0x00,0x00},/*"雀",3*/
{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},/*"科",4*/
{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},/*"技",5*/
{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},/*"有",6*/
{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},/*"限",7*/
{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},/*"公",8*/
{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},/*"司",9*/
};
#endif

View File

@@ -0,0 +1,481 @@
//**** 声明 ********************************************************************
/*******************************************************************************
* 下面来自互联开源程序,由深圳市大夏龙雀科技有限公司收集
* 方便用户参考学习,本公司不提供任何技术支持
* 程序仅供测试参考,不能应用在实际工程中,不一定能通过编译
* 公司网站 http://www.szdx-smart.com/
* 淘宝网址 https://shop184598174.taobao.com/?spm=a1z10.5-c-s.w12096189-21564973333.3.547b1176WCCDxR&scene=taobao_shop
*******************************************************************************/
/********************************************************************
* 文件名 WF24-UDP协议应用
* 描述 : 该文件实现通过利用WF24给单片机发数据控制LED+OLED+电机。
***********************************************************************/
/*
Name: UDP
Created: 2024/8/21
Author: WAM
*/
#include "oledfont.h"
#include <Arduino.h>
#include <SPI.h>
#include <SoftwareSerial.h>
#include <stdio.h>
#include <string.h>
#define scl 13 //SCLK
#define sda 11 //MOSI
#define res 8 //RES
#define dc 9 //DC
#define cs 10 //CS
#define OLED_SCL_Clr() digitalWrite(scl,LOW)//SCL
#define OLED_SCL_Set() digitalWrite(scl,HIGH)
#define OLED_SDA_Clr() digitalWrite(sda,LOW)//SDA
#define OLED_SDA_Set() digitalWrite(sda,HIGH)
#define OLED_RES_Clr() digitalWrite(res,LOW)//RES
#define OLED_RES_Set() digitalWrite(res,HIGH)
#define OLED_DC_Clr() digitalWrite(dc,LOW)//DC
#define OLED_DC_Set() digitalWrite(dc,HIGH)
#define OLED_CS_Clr() digitalWrite(cs,LOW)//CS
#define OLED_CS_Set() digitalWrite(cs,HIGH)
#define OLED_CMD 0 //写命令
#define OLED_DATA 1 //写数据
#define STA_MODE "AT+CWMODE=0\r\n"//设置为STA模式 连接热点
#define CONNECT_TO_WIFI "AT+CWJAP=DX-SMART,SMART@601\r\n"//DX-SMART为WIFI名称 SMART@601\r\n"//DX-SMART为WIFI名称 SMART@601为WIFI密码
#define ONECON_MODE "AT+CIPMODE=1\r\n"//设置为单连接模式 连接热点
#define CONNECT_TO_TCP "AT+CIPSTART=TCP,192.168.0.150,2347\r\n"//连接服务器 192.168.0.150为IP地址 2347为端口号 应和热点保持一致
#define CONNECT_TO_UDP "AT+CIPSTART=UDP,192.168.0.74,2345,1112,0\r\n"//连接服务器 192.168.0.150为IP地址 2345为端口号 1112 是模块设置的端口号 0 UDP固定目标模式
#define SET_MQTT "AT+MQTTLONGCLIENTID=WF-TEST2\r\n"//配置 MQTT 客户端所需的客户端 ID、用户名和密码 若 MQTT 服务器无用户名和密码验证,则模块可跳过用户名和密码的输入
#define CONNECT_TO_MQTT "AT+MQTTCONN=broker.emqx.io,1883,0\r\n"//连接MQTT 服务器 端口号 是否自动重连
#define SUB_TOPIC "AT+MQTTSUB=test-app,0\r\n"//订阅主题 test-app主题名 QOS服务质量
#define PUB_TOPIC "AT+MQTTPUBRAW=test-wf,10,0,0\r\n"//发布主题 test-wf主题名 10 消息长度 0 为QOS 0 retain 服务器是否为该主题存储一条最新的保留消息
#define EXIT_MQTT "AT+MQTTCLEAN\r\n" //断开MQTT连接
#define PUB_RAM "AT+MQTTPUBRAW=test-wf,32,0,0\r\n" //断开MQTT连接
int ledPin=3;//定义数字10接口
#define IN1 8
#define IN2 9
#define ENA 12
SoftwareSerial WIFI(5,6); // RX, TX 软件串口的波特率在Arduino会有一定限制 最好不要超过9600
String inputString; // 用来存储从串口读入的完整字符串
int numericValue=0;
void setup()
{
Serial.begin(115200);
WIFI.begin(9600);
WIFI.listen();
Connect_UDP();
OLED_Init();
OLED_ColorTurn(0);//0正常显示 1反色显示
OLED_DisplayTurn(0);//0正常显示 1翻转180度显示
pinMode(ledPin,OUTPUT);//定义小灯接口为输出接口
pinMode(IN1,OUTPUT);//定义小灯接口为输出接口
pinMode(IN2,OUTPUT);//定义小灯接口为输出接口
pinMode(ENA,OUTPUT);//定义小灯接口为输出接口
digitalWrite(ledPin,HIGH);
delay(500);
OLED_Clear();
OLED_ShowChinese(18+12,0,0,16);//景
OLED_ShowChinese(36+12,0,1,16);//园
OLED_ShowChinese(54+12,0,2,16);//电
OLED_ShowChinese(72+12,0,3,16);//子
}
void loop()
{
//从PC串口读取数据并发送到WF24
while (Serial.available() > 0) {
inputString = Serial.readStringUntil('\0'); // 读取串口数据直到换行符
//Serial.print(inputString);
int lastCommaIndex = inputString.lastIndexOf(','); // 找到最后一个逗号的位置
if (lastCommaIndex != -1 && lastCommaIndex + 1 < inputString.length()) {
String lastValue = inputString.substring(lastCommaIndex + 1); // 提取最后一个值
numericValue = lastValue.toInt(); // 将字符串转换为整数
// 使用这个整数值做些什么
//Serial.print(numericValue);
if(numericValue ==2)
{
digitalWrite(ledPin,LOW);//熄灭小灯
OLED_Clear();
}
if(numericValue ==1)
{
digitalWrite(ledPin,HIGH);//点亮小灯、
OLED_Clear();
}
if(numericValue ==3)
{
OLED_Clear();
OLED_ShowChinese(18+12,0,0,16);//景
OLED_ShowChinese(36+12,0,1,16);//园
OLED_ShowChinese(54+12,0,2,16);//电
OLED_ShowChinese(72+12,0,3,16);//子
digitalWrite(ledPin,LOW);//熄灭小灯
}
if(numericValue ==4)
{
OLED_Clear();
OLED_ShowString(50,2,"WF24",16);
OLED_ShowString(20+5,4,"2024/07/31",16);
digitalWrite(ledPin,LOW);//熄灭小灯
}
if(numericValue ==5)
{
analogWrite(ENA,255);
digitalWrite(IN1,LOW);
digitalWrite(IN2,HIGH);
digitalWrite(ledPin,LOW);//熄灭小灯
}
if(numericValue ==6)
{
analogWrite(ENA,255);
digitalWrite(IN1,HIGH);
digitalWrite(IN2,LOW);
digitalWrite(ledPin,LOW);//熄灭小灯
}
if(numericValue ==7)
{
analogWrite(ENA,255);
digitalWrite(IN1,LOW);
digitalWrite(IN2,LOW);
digitalWrite(ledPin,LOW);//熄灭小灯
}
}
}
}
bool AT_CMD(char * data,char * keyword)
{
while (Serial.available()) Serial.read();
int i=0;
char inchar;
char UNO_RECV[256] = {0};
unsigned long start = millis();
Serial.println(data); //发送AT指令
while(!Serial.available());//等待模块应答
delay(1500);
while (Serial.available())
{
UNO_RECV[i++] = Serial.read();
}
WIFI.print(UNO_RECV);
if(strstr(UNO_RECV,keyword)!=NULL)
{
if(strstr(data,"CWJAP")!=NULL)
delay(3000);//等待WIFI连接成功
if(strstr(data,"CIPSTART")!=NULL)
delay(3000);//等待连接TCP成功
if(strstr(data,"MQTTCONN")!=NULL)
delay(3000);//等待连接服务器成功
if(strstr(data,"MQTTPUBRAW")!=NULL)
{
}
while (Serial.available()) Serial.read();
WIFI.println("true\r\n");
return true;
}
else
{
WIFI.println("false\r\n");
while (Serial.available()) Serial.read();
return false;
}
}
void exit_Connect()
{
for(int i = 0;i<3;i++)
{
Serial.write('+');
}
delay(200);
for(int n = 0;n<3;n++)
{
Serial.write('+');
}
}
void Connect_TCP()
{
exit_Connect();//确保模块为指令模式
while(!AT_CMD("AT+RESTORE\r\n","OK\r\n"));//回复出厂设置
while(!AT_CMD("AT+RST\r\n","OK\r\n"));//上电重启
while(!AT_CMD("AT\r\n","OK\r\n"));//是否正常使用
while(!AT_CMD(STA_MODE,"OK\r\n"));//设置为STA模式
while(!AT_CMD(CONNECT_TO_WIFI,"OK\r\n"));//连接热点
while(!AT_CMD(ONECON_MODE,"OK\r\n"));//设置为单模式
while(!AT_CMD(CONNECT_TO_TCP,"CIPSTART:1"));//连接TCP服务端
while(!AT_CMD("AT+CIPSEND\r\n","OK\r\n"));//进入透传模式
Serial.println("connect success");
}
void Connect_UDP()
{
exit_Connect();//确保模块为指令模式
while(!AT_CMD("AT+RESTORE\r\n","OK\r\n"));//回复出厂设置
while(!AT_CMD("AT+RST\r\n","OK\r\n"));//上电重启
while(!AT_CMD("AT\r\n","OK\r\n"));;//是否正常使用
while(!AT_CMD(STA_MODE,"OK\r\n"));;//设置为STA模式
while(!AT_CMD(CONNECT_TO_WIFI,"OK\r\n"));;//连接热点
while(!AT_CMD(ONECON_MODE,"OK\r\n"));;//设置为单模式
while(!AT_CMD(CONNECT_TO_UDP,"CIPSTART:1")); ;//连接TCP服务端
while(!AT_CMD("AT+CIPSEND\r\n","OK\r\n"));//进入透传模式
Serial.println("connect UDP success");
}
void Connect_MQTT()
{
while(!AT_CMD(EXIT_MQTT,"OK\r\n"));//断开连接
while(!AT_CMD("AT+RESTORE\r\n","OK\r\n"));//回复出厂设置
while(!AT_CMD("AT+RST\r\n","OK\r\n"));//上电重启
while(!AT_CMD("AT\r\n","OK\r\n"));//是否正常使用
while(!AT_CMD(STA_MODE,"OK\r\n"));//设置为STA模式
while(!AT_CMD(CONNECT_TO_WIFI,"OK\r\n"));//连接热点
while(!AT_CMD(SET_MQTT,"OK\r\n"));//设置MQTT客户端参数
while(!AT_CMD(CONNECT_TO_MQTT,"MQTTCONNECTED:"));//连接MQTT服务器
while(!AT_CMD(SUB_TOPIC,"OK\r\n"));//订阅MQTT服务主题
//while(!AT_CMD(PUB_RAM,"OK\r\n"));//发布主题消息
//Serial.print("connect MQTT success");
}
//反显函数
void OLED_ColorTurn(u8 i)
{
if(!i) OLED_WR_Byte(0xA6,OLED_CMD);//正常显示
else 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);
}
else
{
OLED_WR_Byte(0xC0,OLED_CMD);//反转显示
OLED_WR_Byte(0xA0,OLED_CMD);
}
}
//写入一个字节
void OLED_WR_Byte(u8 dat,u8 cmd)
{
u8 i;
if(cmd)
OLED_DC_Set();
else
OLED_DC_Clr();
OLED_CS_Clr();
SPDR=dat;
while(!(SPSR&(1<<SPIF)));
OLED_CS_Set();
OLED_DC_Set();
}
//坐标设置
void OLED_Set_Pos(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);
}
//开启OLED显示
void OLED_Display_On(void)
{
OLED_WR_Byte(0X8D,OLED_CMD); //SET DCDC命令
OLED_WR_Byte(0X14,OLED_CMD); //DCDC ON
OLED_WR_Byte(0XAF,OLED_CMD); //DISPLAY ON
}
//关闭OLED显示
void OLED_Display_Off(void)
{
OLED_WR_Byte(0X8D,OLED_CMD); //SET DCDC命令
OLED_WR_Byte(0X10,OLED_CMD); //DCDC OFF
OLED_WR_Byte(0XAE,OLED_CMD); //DISPLAY OFF
}
//清屏函数,清完屏,整个屏幕是黑色的!和没点亮一样!!!
void OLED_Clear(void)
{
u8 i,n;
for(i=0;i<8;i++)
{
OLED_WR_Byte (0xb0+i,OLED_CMD); //设置页地址0~7
OLED_WR_Byte (0x00,OLED_CMD); //设置显示位置—列低地址
OLED_WR_Byte (0x10,OLED_CMD); //设置显示位置—列高地址
for(n=0;n<128;n++)OLED_WR_Byte(0,OLED_DATA);
} //更新显示
}
//在指定位置显示一个字符
//x:0~127
//y:0~63
//sizey:选择字体 6x8 8x16
void OLED_ShowChar(u8 x,u8 y,const u8 chr,u8 sizey)
{
u8 c=0,sizex=sizey/2,temp;
u16 i=0,size1;
if(sizey==8)size1=6;
else size1=(sizey/8+((sizey%8)?1:0))*(sizey/2);
c=chr-' ';//得到偏移后的值
OLED_Set_Pos(x,y);
for(i=0;i<size1;i++)
{
if(i%sizex==0&&sizey!=8) OLED_Set_Pos(x,y++);
if(sizey==8)
{
temp=pgm_read_byte(&asc2_0806[c][i]);
OLED_WR_Byte(temp,OLED_DATA);//6X8字号
}
else if(sizey==16)
{
temp=pgm_read_byte(&asc2_1608[c][i]);
OLED_WR_Byte(temp,OLED_DATA);//8x16字号
}
else return;
}
}
//m^n函数
u32 oled_pow(u8 m,u8 n)
{
u32 result=1;
while(n--)result*=m;
return result;
}
//显示数字
//x,y :起点坐标
//num:要显示的数字
//len :数字的位数
//sizey:字体大小
void OLED_ShowNum(u8 x,u8 y,u32 num,u8 len,u8 sizey)
{
u8 t,temp,m=0;
u8 enshow=0;
if(sizey==8)m=2;
for(t=0;t<len;t++)
{
temp=(num/oled_pow(10,len-t-1))%10;
if(enshow==0&&t<(len-1))
{
if(temp==0)
{
OLED_ShowChar(x+(sizey/2+m)*t,y,' ',sizey);
continue;
}else enshow=1;
}
OLED_ShowChar(x+(sizey/2+m)*t,y,temp+'0',sizey);
}
}
//显示一个字符号串
void OLED_ShowString(u8 x,u8 y,const char *chr,u8 sizey)
{
u8 j=0;
while (chr[j]!='\0')
{
OLED_ShowChar(x,y,chr[j++],sizey);
if(sizey==8)x+=6;
else x+=sizey/2;
}
}
//显示汉字
void OLED_ShowChinese(u8 x,u8 y,const u8 no,u8 sizey)
{
u16 i,size1=(sizey/8+((sizey%8)?1:0))*sizey;
u8 temp;
for(i=0;i<size1;i++)
{
if(i%sizey==0) OLED_Set_Pos(x,y++);
if(sizey==16)
{
temp=pgm_read_byte(&Hzk[no][i]);
OLED_WR_Byte(temp,OLED_DATA);//16x16字号
}
// else if(sizey==xx) OLED_WR_Byte(xxx[c][i],OLED_DATA);//用户添加字号
else return;
}
}
//显示图片
//x,y显示坐标
//sizex,sizey,图片长宽
//BMP要显示的图片
void OLED_DrawBMP(u8 x,u8 y,u8 sizex, u8 sizey,const u8 BMP[])
{
u16 j=0;
u8 i,m,temp;
sizey=sizey/8+((sizey%8)?1:0);
for(i=0;i<sizey;i++)
{
OLED_Set_Pos(x,i+y);
for(m=0;m<sizex;m++)
{
temp=pgm_read_byte(&BMP[j++]);
OLED_WR_Byte(temp,OLED_DATA);
}
}
} //OLED的初始化
void OLED_Init(void)
{
pinMode(scl,OUTPUT);//设置数字8
pinMode(sda,OUTPUT);//设置数字9
pinMode(res,OUTPUT);//设置数字10
pinMode(dc,OUTPUT);//设置数字11
pinMode(cs,OUTPUT);//设置数字12
SPCR=(1<<SPE)|(1<<MSTR);
OLED_RES_Clr();
delay(200);
OLED_RES_Set();
OLED_WR_Byte(0xAE,OLED_CMD);//--turn off oled panel
OLED_WR_Byte(0x00,OLED_CMD);//---set low column address
OLED_WR_Byte(0x10,OLED_CMD);//---set high column address
OLED_WR_Byte(0x40,OLED_CMD);//--set start line address Set Mapping RAM Display Start Line (0x00~0x3F)
OLED_WR_Byte(0x81,OLED_CMD);//--set contrast control register
OLED_WR_Byte(0xCF,OLED_CMD); // Set SEG Output Current Brightness
OLED_WR_Byte(0xA1,OLED_CMD);//--Set SEG/Column Mapping 0xa0左右反置 0xa1正常
OLED_WR_Byte(0xC8,OLED_CMD);//Set COM/Row Scan Direction 0xc0上下反置 0xc8正常
OLED_WR_Byte(0xA6,OLED_CMD);//--set normal display
OLED_WR_Byte(0xA8,OLED_CMD);//--set multiplex ratio(1 to 64)
OLED_WR_Byte(0x3f,OLED_CMD);//--1/64 duty
OLED_WR_Byte(0xD3,OLED_CMD);//-set display offset Shift Mapping RAM Counter (0x00~0x3F)
OLED_WR_Byte(0x00,OLED_CMD);//-not offset
OLED_WR_Byte(0xd5,OLED_CMD);//--set display clock divide ratio/oscillator frequency
OLED_WR_Byte(0x80,OLED_CMD);//--set divide ratio, Set Clock as 100 Frames/Sec
OLED_WR_Byte(0xD9,OLED_CMD);//--set pre-charge period
OLED_WR_Byte(0xF1,OLED_CMD);//Set Pre-Charge as 15 Clocks & Discharge as 1 Clock
OLED_WR_Byte(0xDA,OLED_CMD);//--set com pins hardware configuration
OLED_WR_Byte(0x12,OLED_CMD);
OLED_WR_Byte(0xDB,OLED_CMD);//--set vcomh
OLED_WR_Byte(0x40,OLED_CMD);//Set VCOM Deselect Level
OLED_WR_Byte(0x20,OLED_CMD);//-Set Page Addressing Mode (0x00/0x01/0x02)
OLED_WR_Byte(0x02,OLED_CMD);//
OLED_WR_Byte(0x8D,OLED_CMD);//--set Charge Pump enable/disable
OLED_WR_Byte(0x14,OLED_CMD);//--set(0x10) disable
OLED_WR_Byte(0xA4,OLED_CMD);// Disable Entire Display On (0xa4/0xa5)
OLED_WR_Byte(0xA6,OLED_CMD);// Disable Inverse Display On (0xa6/a7)
OLED_Clear();
OLED_WR_Byte(0xAF,OLED_CMD); /*display ON*/
}

View File

@@ -0,0 +1,285 @@
#ifndef __OLEDFONT_H
#define __OLEDFONT_H
#include <avr/pgmspace.h>
const unsigned char BMP1[] PROGMEM =
{
0x00,0x03,0x05,0x09,0x11,0xFF,0x11,0x89,0x05,0xC3,0x00,0xE0,0x00,0xF0,0x00,0xF8,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x44,0x28,0xFF,0x11,0xAA,0x44,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x83,0x01,0x38,0x44,0x82,0x92,
0x92,0x74,0x01,0x83,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7C,0x44,0xFF,0x01,0x7D,
0x7D,0x7D,0x01,0x7D,0x7D,0x7D,0x7D,0x01,0x7D,0x7D,0x7D,0x7D,0x7D,0x01,0xFF,0x00,
0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x01,0x00,0x01,0x00,0x01,0x00,0x01,0x00,0x01,
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,0x00,0x00,0x00,0x00,0x00,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,0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x01,
0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,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,0x3F,0x3F,0x03,0x03,
0xF3,0x13,0x11,0x11,0x11,0x11,0x11,0x11,0x01,0xF1,0x11,0x61,0x81,0x01,0x01,0x01,
0x81,0x61,0x11,0xF1,0x01,0x01,0x01,0x01,0x41,0x41,0xF1,0x01,0x01,0x01,0x01,0x01,
0xC1,0x21,0x11,0x11,0x11,0x11,0x21,0xC1,0x01,0x01,0x01,0x01,0x41,0x41,0xF1,0x01,
0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x11,0x11,0x11,0x11,0x11,0xD3,0x33,
0x03,0x03,0x3F,0x3F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xE0,0xE0,0x00,0x00,
0x7F,0x01,0x01,0x01,0x01,0x01,0x01,0x00,0x00,0x7F,0x00,0x00,0x01,0x06,0x18,0x06,
0x01,0x00,0x00,0x7F,0x00,0x00,0x00,0x00,0x40,0x40,0x7F,0x40,0x40,0x00,0x00,0x00,
0x1F,0x20,0x40,0x40,0x40,0x40,0x20,0x1F,0x00,0x00,0x00,0x00,0x40,0x40,0x7F,0x40,
0x40,0x00,0x00,0x00,0x00,0x60,0x00,0x00,0x00,0x00,0x40,0x30,0x0C,0x03,0x00,0x00,
0x00,0x00,0xE0,0xE0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0x07,0x06,0x06,
0x06,0x06,0x04,0x04,0x04,0x84,0x44,0x44,0x44,0x84,0x04,0x04,0x84,0x44,0x44,0x44,
0x84,0x04,0x04,0x04,0x84,0xC4,0x04,0x04,0x04,0x04,0x84,0x44,0x44,0x44,0x84,0x04,
0x04,0x04,0x04,0x04,0x84,0x44,0x44,0x44,0x84,0x04,0x04,0x04,0x04,0x04,0x84,0x44,
0x44,0x44,0x84,0x04,0x04,0x84,0x44,0x44,0x44,0x84,0x04,0x04,0x04,0x04,0x06,0x06,
0x06,0x06,0x07,0x07,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x10,0x18,0x14,0x12,0x11,0x00,0x00,0x0F,0x10,0x10,0x10,
0x0F,0x00,0x00,0x00,0x10,0x1F,0x10,0x00,0x00,0x00,0x08,0x10,0x12,0x12,0x0D,0x00,
0x00,0x18,0x00,0x00,0x0D,0x12,0x12,0x12,0x0D,0x00,0x00,0x18,0x00,0x00,0x10,0x18,
0x14,0x12,0x11,0x00,0x00,0x10,0x18,0x14,0x12,0x11,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,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,0x80,0x80,0x80,
0x80,0x80,0x80,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x7F,0x03,0x0C,0x30,0x0C,0x03,0x7F,0x00,0x00,0x38,0x54,0x54,0x58,0x00,0x00,
0x7C,0x04,0x04,0x78,0x00,0x00,0x3C,0x40,0x40,0x7C,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,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,0xAA,0xAA,0xAA,
0x28,0x08,0x00,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,0x7F,0x03,0x0C,0x30,0x0C,0x03,0x7F,
0x00,0x00,0x26,0x49,0x49,0x49,0x32,0x00,0x00,0x7F,0x02,0x04,0x08,0x10,0x7F,0x00,
};
/************************************6*8的点阵************************************/
const unsigned char asc2_0806[][6]PROGMEM ={
{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
};
//8*16 ASCII字符集点阵
const unsigned char asc2_1608[][16] PROGMEM ={
{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 Hzk[][32] PROGMEM ={
{0x20,0x20,0x20,0x20,0x20,0x20,0x20,0xFF,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x00,0x80,0x80,0x40,0x20,0x10,0x0C,0x03,0x00,0x03,0x0C,0x10,0x20,0x40,0x80,0x80,0x00},/*"大",0*/
{0x00,0x01,0x01,0xFD,0x55,0x55,0x57,0x55,0x55,0x55,0x55,0xFD,0x01,0x01,0x00,0x00,0x80,0x90,0x88,0x45,0x4F,0x55,0x25,0x25,0x25,0x55,0x4D,0x45,0x80,0x80,0x80,0x00},/*"夏",1*/
{0x10,0x10,0x10,0x10,0x10,0xFF,0x10,0x10,0xF0,0x10,0x11,0x16,0xD0,0x10,0x10,0x00,0x80,0x40,0x20,0x18,0x06,0x41,0x20,0x10,0x3F,0x44,0x42,0x41,0x40,0x40,0x78,0x00},/*"龙",2*/
{0x00,0x10,0x88,0x86,0x40,0x40,0x20,0x2F,0x50,0x90,0x08,0x02,0x04,0x08,0x00,0x00,0x01,0x01,0x00,0xFF,0x55,0x55,0x55,0x55,0x7F,0x55,0x55,0x55,0x55,0x41,0x00,0x00},/*"雀",3*/
{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},/*"科",4*/
{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},/*"技",5*/
{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},/*"有",6*/
{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},/*"限",7*/
{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},/*"公",8*/
{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},/*"司",9*/
};
#endif

View File

@@ -0,0 +1 @@
去到单片机串口通信->单片机Arduino烧录资料->烧录文件那里获取

View File

@@ -0,0 +1,233 @@
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<ProjectOpt xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="project_opt.xsd">
<SchemaVersion>1.0</SchemaVersion>
<Header>### uVision Project, (C) Keil Software</Header>
<Extensions>
<cExt>*.c</cExt>
<aExt>*.s*; *.src; *.a*</aExt>
<oExt>*.obj; *.o</oExt>
<lExt>*.lib</lExt>
<tExt>*.txt; *.h; *.inc; *.md</tExt>
<pExt>*.plm</pExt>
<CppX>*.cpp; *.cc; *.cxx</CppX>
<nMigrate>0</nMigrate>
</Extensions>
<DaveTm>
<dwLowDateTime>0</dwLowDateTime>
<dwHighDateTime>0</dwHighDateTime>
</DaveTm>
<Target>
<TargetName>Target 1</TargetName>
<ToolsetNumber>0x0</ToolsetNumber>
<ToolsetName>MCS-51</ToolsetName>
<TargetOption>
<CLK51>11059200</CLK51>
<OPTTT>
<gFlags>1</gFlags>
<BeepAtEnd>1</BeepAtEnd>
<RunSim>1</RunSim>
<RunTarget>0</RunTarget>
<RunAbUc>0</RunAbUc>
</OPTTT>
<OPTHX>
<HexSelection>0</HexSelection>
<FlashByte>65535</FlashByte>
<HexRangeLowAddress>0</HexRangeLowAddress>
<HexRangeHighAddress>0</HexRangeHighAddress>
<HexOffset>0</HexOffset>
</OPTHX>
<OPTLEX>
<PageWidth>120</PageWidth>
<PageLength>65</PageLength>
<TabStop>8</TabStop>
<ListingPath>.\Listings\</ListingPath>
</OPTLEX>
<ListingPage>
<CreateCListing>1</CreateCListing>
<CreateAListing>1</CreateAListing>
<CreateLListing>1</CreateLListing>
<CreateIListing>0</CreateIListing>
<AsmCond>1</AsmCond>
<AsmSymb>1</AsmSymb>
<AsmXref>0</AsmXref>
<CCond>1</CCond>
<CCode>0</CCode>
<CListInc>0</CListInc>
<CSymb>0</CSymb>
<LinkerCodeListing>0</LinkerCodeListing>
</ListingPage>
<OPTXL>
<LMap>1</LMap>
<LComments>1</LComments>
<LGenerateSymbols>1</LGenerateSymbols>
<LLibSym>1</LLibSym>
<LLines>1</LLines>
<LLocSym>1</LLocSym>
<LPubSym>1</LPubSym>
<LXref>0</LXref>
<LExpSel>0</LExpSel>
</OPTXL>
<OPTFL>
<tvExp>1</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<IsCurrentTarget>1</IsCurrentTarget>
</OPTFL>
<CpuCode>255</CpuCode>
<Books>
<Book>
<Number>0</Number>
<Title>Data Sheet</Title>
<Path>DATASHTS\ATMEL\AT89C52_DS.PDF</Path>
</Book>
<Book>
<Number>1</Number>
<Title>Instruction Set Manual</Title>
<Path>DATASHTS\ATMEL\AT_C51ISM.PDF</Path>
</Book>
</Books>
<DebugOpt>
<uSim>1</uSim>
<uTrg>0</uTrg>
<sLdApp>1</sLdApp>
<sGomain>1</sGomain>
<sRbreak>1</sRbreak>
<sRwatch>1</sRwatch>
<sRmem>1</sRmem>
<sRfunc>1</sRfunc>
<sRbox>1</sRbox>
<tLdApp>1</tLdApp>
<tGomain>0</tGomain>
<tRbreak>1</tRbreak>
<tRwatch>1</tRwatch>
<tRmem>1</tRmem>
<tRfunc>0</tRfunc>
<tRbox>1</tRbox>
<tRtrace>1</tRtrace>
<sRSysVw>1</sRSysVw>
<tRSysVw>1</tRSysVw>
<sRunDeb>0</sRunDeb>
<sLrtime>0</sLrtime>
<bEvRecOn>1</bEvRecOn>
<bSchkAxf>0</bSchkAxf>
<bTchkAxf>0</bTchkAxf>
<nTsel>-1</nTsel>
<sDll></sDll>
<sDllPa></sDllPa>
<sDlgDll></sDlgDll>
<sDlgPa></sDlgPa>
<sIfile></sIfile>
<tDll></tDll>
<tDllPa></tDllPa>
<tDlgDll></tDlgDll>
<tDlgPa></tDlgPa>
<tIfile></tIfile>
<pMon></pMon>
</DebugOpt>
<Breakpoint/>
<Tracepoint>
<THDelay>0</THDelay>
</Tracepoint>
<DebugFlag>
<trace>0</trace>
<periodic>1</periodic>
<aLwin>0</aLwin>
<aCover>0</aCover>
<aSer1>0</aSer1>
<aSer2>0</aSer2>
<aPa>0</aPa>
<viewmode>0</viewmode>
<vrSel>0</vrSel>
<aSym>0</aSym>
<aTbox>0</aTbox>
<AscS1>0</AscS1>
<AscS2>0</AscS2>
<AscS3>0</AscS3>
<aSer3>0</aSer3>
<eProf>0</eProf>
<aLa>0</aLa>
<aPa1>0</aPa1>
<AscS4>0</AscS4>
<aSer4>0</aSer4>
<StkLoc>0</StkLoc>
<TrcWin>0</TrcWin>
<newCpu>0</newCpu>
<uProt>0</uProt>
</DebugFlag>
<LintExecutable></LintExecutable>
<LintConfigFile></LintConfigFile>
<bLintAuto>0</bLintAuto>
<bAutoGenD>0</bAutoGenD>
<LntExFlags>0</LntExFlags>
<pMisraName></pMisraName>
<pszMrule></pszMrule>
<pSingCmds></pSingCmds>
<pMultCmds></pMultCmds>
<pMisraNamep></pMisraNamep>
<pszMrulep></pszMrulep>
<pSingCmdsp></pSingCmdsp>
<pMultCmdsp></pMultCmdsp>
</TargetOption>
</Target>
<Group>
<GroupName>User</GroupName>
<tvExp>1</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<cbSel>0</cbSel>
<RteFlg>0</RteFlg>
<File>
<GroupNumber>1</GroupNumber>
<FileNumber>1</FileNumber>
<FileType>2</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2>
<PathWithFileName>.\STARTUP.A51</PathWithFileName>
<FilenameWithoutPath>STARTUP.A51</FilenameWithoutPath>
<RteFlg>0</RteFlg>
<bShared>0</bShared>
</File>
<File>
<GroupNumber>1</GroupNumber>
<FileNumber>2</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2>
<PathWithFileName>..\User\main.c</PathWithFileName>
<FilenameWithoutPath>main.c</FilenameWithoutPath>
<RteFlg>0</RteFlg>
<bShared>0</bShared>
</File>
<File>
<GroupNumber>1</GroupNumber>
<FileNumber>3</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2>
<PathWithFileName>..\User\UART.C</PathWithFileName>
<FilenameWithoutPath>UART.C</FilenameWithoutPath>
<RteFlg>0</RteFlg>
<bShared>0</bShared>
</File>
<File>
<GroupNumber>1</GroupNumber>
<FileNumber>4</FileNumber>
<FileType>1</FileType>
<tvExp>1</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2>
<PathWithFileName>..\User\oled.c</PathWithFileName>
<FilenameWithoutPath>oled.c</FilenameWithoutPath>
<RteFlg>0</RteFlg>
<bShared>0</bShared>
</File>
</Group>
</ProjectOpt>

View File

@@ -0,0 +1,405 @@
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<Project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="project_proj.xsd">
<SchemaVersion>1.1</SchemaVersion>
<Header>### uVision Project, (C) Keil Software</Header>
<Targets>
<Target>
<TargetName>Target 1</TargetName>
<ToolsetNumber>0x0</ToolsetNumber>
<ToolsetName>MCS-51</ToolsetName>
<uAC6>0</uAC6>
<TargetOption>
<TargetCommonOption>
<Device>AT89C52</Device>
<Vendor>Microchip</Vendor>
<Cpu>IRAM(0-0xFF) IROM(0-0x1FFF) CLOCK(24000000)</Cpu>
<FlashUtilSpec></FlashUtilSpec>
<StartupFile>"LIB\STARTUP.A51" ("Standard 8051 Startup Code")</StartupFile>
<FlashDriverDll></FlashDriverDll>
<DeviceId>2980</DeviceId>
<RegisterFile>REGX52.H</RegisterFile>
<MemoryEnv></MemoryEnv>
<Cmp></Cmp>
<Asm></Asm>
<Linker></Linker>
<OHString></OHString>
<InfinionOptionDll></InfinionOptionDll>
<SLE66CMisc></SLE66CMisc>
<SLE66AMisc></SLE66AMisc>
<SLE66LinkerMisc></SLE66LinkerMisc>
<SFDFile></SFDFile>
<bCustSvd>0</bCustSvd>
<UseEnv>0</UseEnv>
<BinPath></BinPath>
<IncludePath></IncludePath>
<LibPath></LibPath>
<RegisterFilePath>Atmel\</RegisterFilePath>
<DBRegisterFilePath>Atmel\</DBRegisterFilePath>
<TargetStatus>
<Error>0</Error>
<ExitCodeStop>0</ExitCodeStop>
<ButtonStop>0</ButtonStop>
<NotGenerated>0</NotGenerated>
<InvalidFlash>1</InvalidFlash>
</TargetStatus>
<OutputDirectory>.\Objects\</OutputDirectory>
<OutputName>51Project</OutputName>
<CreateExecutable>1</CreateExecutable>
<CreateLib>0</CreateLib>
<CreateHexFile>1</CreateHexFile>
<DebugInformation>1</DebugInformation>
<BrowseInformation>1</BrowseInformation>
<ListingPath>.\Listings\</ListingPath>
<HexFormatSelection>0</HexFormatSelection>
<Merge32K>0</Merge32K>
<CreateBatchFile>0</CreateBatchFile>
<BeforeCompile>
<RunUserProg1>0</RunUserProg1>
<RunUserProg2>0</RunUserProg2>
<UserProg1Name></UserProg1Name>
<UserProg2Name></UserProg2Name>
<UserProg1Dos16Mode>0</UserProg1Dos16Mode>
<UserProg2Dos16Mode>0</UserProg2Dos16Mode>
<nStopU1X>0</nStopU1X>
<nStopU2X>0</nStopU2X>
</BeforeCompile>
<BeforeMake>
<RunUserProg1>0</RunUserProg1>
<RunUserProg2>0</RunUserProg2>
<UserProg1Name></UserProg1Name>
<UserProg2Name></UserProg2Name>
<UserProg1Dos16Mode>0</UserProg1Dos16Mode>
<UserProg2Dos16Mode>0</UserProg2Dos16Mode>
<nStopB1X>0</nStopB1X>
<nStopB2X>0</nStopB2X>
</BeforeMake>
<AfterMake>
<RunUserProg1>0</RunUserProg1>
<RunUserProg2>0</RunUserProg2>
<UserProg1Name></UserProg1Name>
<UserProg2Name></UserProg2Name>
<UserProg1Dos16Mode>0</UserProg1Dos16Mode>
<UserProg2Dos16Mode>0</UserProg2Dos16Mode>
<nStopA1X>0</nStopA1X>
<nStopA2X>0</nStopA2X>
</AfterMake>
<SelectedForBatchBuild>0</SelectedForBatchBuild>
<SVCSIdString></SVCSIdString>
</TargetCommonOption>
<CommonProperty>
<UseCPPCompiler>0</UseCPPCompiler>
<RVCTCodeConst>0</RVCTCodeConst>
<RVCTZI>0</RVCTZI>
<RVCTOtherData>0</RVCTOtherData>
<ModuleSelection>0</ModuleSelection>
<IncludeInBuild>1</IncludeInBuild>
<AlwaysBuild>0</AlwaysBuild>
<GenerateAssemblyFile>0</GenerateAssemblyFile>
<AssembleAssemblyFile>0</AssembleAssemblyFile>
<PublicsOnly>0</PublicsOnly>
<StopOnExitCode>3</StopOnExitCode>
<CustomArgument></CustomArgument>
<IncludeLibraryModules></IncludeLibraryModules>
<ComprImg>1</ComprImg>
<BankNo>65535</BankNo>
</CommonProperty>
<DllOption>
<SimDllName>S8051.DLL</SimDllName>
<SimDllArguments></SimDllArguments>
<SimDlgDll>DP51.DLL</SimDlgDll>
<SimDlgDllArguments>-p52</SimDlgDllArguments>
<TargetDllName>S8051.DLL</TargetDllName>
<TargetDllArguments></TargetDllArguments>
<TargetDlgDll>TP51.DLL</TargetDlgDll>
<TargetDlgDllArguments>-p52</TargetDlgDllArguments>
</DllOption>
<DebugOption>
<OPTHX>
<HexSelection>0</HexSelection>
<HexRangeLowAddress>0</HexRangeLowAddress>
<HexRangeHighAddress>0</HexRangeHighAddress>
<HexOffset>0</HexOffset>
<Oh166RecLen>16</Oh166RecLen>
</OPTHX>
<Simulator>
<UseSimulator>1</UseSimulator>
<LoadApplicationAtStartup>1</LoadApplicationAtStartup>
<RunToMain>1</RunToMain>
<RestoreBreakpoints>1</RestoreBreakpoints>
<RestoreWatchpoints>1</RestoreWatchpoints>
<RestoreMemoryDisplay>1</RestoreMemoryDisplay>
<RestoreFunctions>1</RestoreFunctions>
<RestoreToolbox>1</RestoreToolbox>
<LimitSpeedToRealTime>0</LimitSpeedToRealTime>
<RestoreSysVw>1</RestoreSysVw>
</Simulator>
<Target>
<UseTarget>0</UseTarget>
<LoadApplicationAtStartup>1</LoadApplicationAtStartup>
<RunToMain>0</RunToMain>
<RestoreBreakpoints>1</RestoreBreakpoints>
<RestoreWatchpoints>1</RestoreWatchpoints>
<RestoreMemoryDisplay>1</RestoreMemoryDisplay>
<RestoreFunctions>0</RestoreFunctions>
<RestoreToolbox>1</RestoreToolbox>
<RestoreTracepoints>1</RestoreTracepoints>
<RestoreSysVw>1</RestoreSysVw>
</Target>
<RunDebugAfterBuild>0</RunDebugAfterBuild>
<TargetSelection>-1</TargetSelection>
<SimDlls>
<CpuDll></CpuDll>
<CpuDllArguments></CpuDllArguments>
<PeripheralDll></PeripheralDll>
<PeripheralDllArguments></PeripheralDllArguments>
<InitializationFile></InitializationFile>
</SimDlls>
<TargetDlls>
<CpuDll></CpuDll>
<CpuDllArguments></CpuDllArguments>
<PeripheralDll></PeripheralDll>
<PeripheralDllArguments></PeripheralDllArguments>
<InitializationFile></InitializationFile>
<Driver></Driver>
</TargetDlls>
</DebugOption>
<Utilities>
<Flash1>
<UseTargetDll>0</UseTargetDll>
<UseExternalTool>0</UseExternalTool>
<RunIndependent>0</RunIndependent>
<UpdateFlashBeforeDebugging>0</UpdateFlashBeforeDebugging>
<Capability>0</Capability>
<DriverSelection>-1</DriverSelection>
</Flash1>
<bUseTDR>0</bUseTDR>
<Flash2></Flash2>
<Flash3></Flash3>
<Flash4></Flash4>
<pFcarmOut></pFcarmOut>
<pFcarmGrp></pFcarmGrp>
<pFcArmRoot></pFcArmRoot>
<FcArmLst>0</FcArmLst>
</Utilities>
<Target51>
<Target51Misc>
<MemoryModel>2</MemoryModel>
<RTOS>0</RTOS>
<RomSize>2</RomSize>
<DataHold>0</DataHold>
<XDataHold>0</XDataHold>
<UseOnchipRom>0</UseOnchipRom>
<UseOnchipArithmetic>0</UseOnchipArithmetic>
<UseMultipleDPTR>0</UseMultipleDPTR>
<UseOnchipXram>0</UseOnchipXram>
<HadIRAM>1</HadIRAM>
<HadXRAM>0</HadXRAM>
<HadIROM>1</HadIROM>
<Moda2>0</Moda2>
<Moddp2>0</Moddp2>
<Modp2>0</Modp2>
<Mod517dp>0</Mod517dp>
<Mod517au>0</Mod517au>
<Mode2>0</Mode2>
<useCB>0</useCB>
<useXB>0</useXB>
<useL251>1</useL251>
<useA251>0</useA251>
<Mx51>0</Mx51>
<ModC812>0</ModC812>
<ModCont>0</ModCont>
<Lp51>0</Lp51>
<useXBS>0</useXBS>
<ModDA>0</ModDA>
<ModAB2>0</ModAB2>
<Mx51P>0</Mx51P>
<hadXRAM2>0</hadXRAM2>
<uocXram2>0</uocXram2>
<hadXRAM3>0</hadXRAM3>
<ModC2>0</ModC2>
<ModH2>0</ModH2>
<Mdu_R515>0</Mdu_R515>
<Mdu_F120>0</Mdu_F120>
<Psoc>0</Psoc>
<hadIROM2>0</hadIROM2>
<hadIROM3>0</hadIROM3>
<ModSmx2>0</ModSmx2>
<cBanks>0</cBanks>
<xBanks>0</xBanks>
<OnChipMemories>
<RCB>
<Type>0</Type>
<StartAddress>0x0</StartAddress>
<Size>0xffff</Size>
</RCB>
<RXB>
<Type>0</Type>
<StartAddress>0x0</StartAddress>
<Size>0x0</Size>
</RXB>
<Ocm1>
<Type>0</Type>
<StartAddress>0x0</StartAddress>
<Size>0x0</Size>
</Ocm1>
<Ocm2>
<Type>0</Type>
<StartAddress>0x0</StartAddress>
<Size>0x0</Size>
</Ocm2>
<Ocm3>
<Type>0</Type>
<StartAddress>0x0</StartAddress>
<Size>0x0</Size>
</Ocm3>
<Ocr1>
<Type>0</Type>
<StartAddress>0x0</StartAddress>
<Size>0x0</Size>
</Ocr1>
<Ocr2>
<Type>0</Type>
<StartAddress>0x0</StartAddress>
<Size>0x0</Size>
</Ocr2>
<Ocr3>
<Type>0</Type>
<StartAddress>0x0</StartAddress>
<Size>0x0</Size>
</Ocr3>
<IRO>
<Type>1</Type>
<StartAddress>0x0</StartAddress>
<Size>0x2000</Size>
</IRO>
<IRA>
<Type>0</Type>
<StartAddress>0x0</StartAddress>
<Size>0x100</Size>
</IRA>
<XRA>
<Type>0</Type>
<StartAddress>0x0</StartAddress>
<Size>0x0</Size>
</XRA>
<XRA512>
<Type>0</Type>
<StartAddress>0x0</StartAddress>
<Size>0x0</Size>
</XRA512>
<IROM512>
<Type>0</Type>
<StartAddress>0x0</StartAddress>
<Size>0x0</Size>
</IROM512>
<XRA513>
<Type>0</Type>
<StartAddress>0x0</StartAddress>
<Size>0x0</Size>
</XRA513>
<IROM513>
<Type>0</Type>
<StartAddress>0x0</StartAddress>
<Size>0x0</Size>
</IROM513>
</OnChipMemories>
</Target51Misc>
<C51>
<RegisterColoring>0</RegisterColoring>
<VariablesInOrder>0</VariablesInOrder>
<IntegerPromotion>1</IntegerPromotion>
<uAregs>0</uAregs>
<UseInterruptVector>1</UseInterruptVector>
<Fuzzy>3</Fuzzy>
<Optimize>8</Optimize>
<WarningLevel>2</WarningLevel>
<SizeSpeed>1</SizeSpeed>
<ObjectExtend>1</ObjectExtend>
<ACallAJmp>0</ACallAJmp>
<InterruptVectorAddress>0</InterruptVectorAddress>
<VariousControls>
<MiscControls></MiscControls>
<Define></Define>
<Undefine></Undefine>
<IncludePath>..\User</IncludePath>
</VariousControls>
</C51>
<Ax51>
<UseMpl>0</UseMpl>
<UseStandard>1</UseStandard>
<UseCase>0</UseCase>
<UseMod51>0</UseMod51>
<VariousControls>
<MiscControls></MiscControls>
<Define></Define>
<Undefine></Undefine>
<IncludePath></IncludePath>
</VariousControls>
</Ax51>
<Lx51>
<useFile>0</useFile>
<linkonly>0</linkonly>
<UseMemoryFromTarget>1</UseMemoryFromTarget>
<CaseSensitiveSymbols>0</CaseSensitiveSymbols>
<WarningLevel>2</WarningLevel>
<DataOverlaying>1</DataOverlaying>
<OverlayString></OverlayString>
<MiscControls></MiscControls>
<DisableWarningNumbers></DisableWarningNumbers>
<LinkerCmdFile></LinkerCmdFile>
<Assign></Assign>
<ReserveString></ReserveString>
<CClasses></CClasses>
<UserClasses></UserClasses>
<CSection></CSection>
<UserSection></UserSection>
<CodeBaseAddress></CodeBaseAddress>
<XDataBaseAddress></XDataBaseAddress>
<PDataBaseAddress></PDataBaseAddress>
<BitBaseAddress></BitBaseAddress>
<DataBaseAddress></DataBaseAddress>
<IDataBaseAddress></IDataBaseAddress>
<Precede></Precede>
<Stack></Stack>
<CodeSegmentName></CodeSegmentName>
<XDataSegmentName></XDataSegmentName>
<BitSegmentName></BitSegmentName>
<DataSegmentName></DataSegmentName>
<IDataSegmentName></IDataSegmentName>
</Lx51>
</Target51>
</TargetOption>
<Groups>
<Group>
<GroupName>User</GroupName>
<Files>
<File>
<FileName>STARTUP.A51</FileName>
<FileType>2</FileType>
<FilePath>.\STARTUP.A51</FilePath>
</File>
<File>
<FileName>main.c</FileName>
<FileType>1</FileType>
<FilePath>..\User\main.c</FilePath>
</File>
<File>
<FileName>UART.C</FileName>
<FileType>1</FileType>
<FilePath>..\User\UART.C</FilePath>
</File>
<File>
<FileName>oled.c</FileName>
<FileType>1</FileType>
<FilePath>..\User\oled.c</FilePath>
</File>
</Files>
</Group>
</Groups>
</Target>
</Targets>
</Project>

View File

@@ -0,0 +1,253 @@
A51 MACRO ASSEMBLER STARTUP 09/02/2024 09:41:26 PAGE 1
MACRO ASSEMBLER A51 V8.2.7.0
OBJECT MODULE PLACED IN .\Objects\STARTUP.obj
ASSEMBLER INVOKED BY: D:\Keil5\C51\BIN\A51.EXE STARTUP.A51 SET(LARGE) DEBUG PRINT(.\Listings\STARTUP.lst) OBJECT(.\Objec
ts\STARTUP.obj) EP
LOC OBJ LINE SOURCE
1 $nomod51
2 ;------------------------------------------------------------------------------
3 ; This file is part of the C51 Compiler package
4 ; Copyright (c) 1988-2005 Keil Elektronik GmbH and Keil Software, Inc.
5 ; Version 8.01
6 ;
7 ; *** <<< Use Configuration Wizard in Context Menu >>> ***
8 ;------------------------------------------------------------------------------
9 ; STARTUP.A51: This code is executed after processor reset.
10 ;
11 ; To translate this file use A51 with the following invocation:
12 ;
13 ; A51 STARTUP.A51
14 ;
15 ; To link the modified STARTUP.OBJ file to your application use the following
16 ; Lx51 invocation:
17 ;
18 ; Lx51 your object file list, STARTUP.OBJ controls
19 ;
20 ;------------------------------------------------------------------------------
21 ;
22 ; User-defined <h> Power-On Initialization of Memory
23 ;
24 ; With the following EQU statements the initialization of memory
25 ; at processor reset can be defined:
26 ;
27 ; <o> IDATALEN: IDATA memory size <0x0-0x100>
28 ; <i> Note: The absolute start-address of IDATA memory is always 0
29 ; <i> The IDATA space overlaps physically the DATA and BIT areas.
0080 30 IDATALEN EQU 80H
31 ;
32 ; <o> XDATASTART: XDATA memory start address <0x0-0xFFFF>
33 ; <i> The absolute start address of XDATA memory
0000 34 XDATASTART EQU 0
35 ;
36 ; <o> XDATALEN: XDATA memory size <0x0-0xFFFF>
37 ; <i> The length of XDATA memory in bytes.
0000 38 XDATALEN EQU 0
39 ;
40 ; <o> PDATASTART: PDATA memory start address <0x0-0xFFFF>
41 ; <i> The absolute start address of PDATA memory
0000 42 PDATASTART EQU 0H
43 ;
44 ; <o> PDATALEN: PDATA memory size <0x0-0xFF>
45 ; <i> The length of PDATA memory in bytes.
0000 46 PDATALEN EQU 0H
47 ;
48 ;</h>
49 ;------------------------------------------------------------------------------
50 ;
51 ;<h> Reentrant Stack Initialization
52 ;
53 ; The following EQU statements define the stack pointer for reentrant
54 ; functions and initialized it:
55 ;
56 ; <h> Stack Space for reentrant functions in the SMALL model.
57 ; <q> IBPSTACK: Enable SMALL model reentrant stack
A51 MACRO ASSEMBLER STARTUP 09/02/2024 09:41:26 PAGE 2
58 ; <i> Stack space for reentrant functions in the SMALL model.
0000 59 IBPSTACK EQU 0 ; set to 1 if small reentrant is used.
60 ; <o> IBPSTACKTOP: End address of SMALL model stack <0x0-0xFF>
61 ; <i> Set the top of the stack to the highest location.
0100 62 IBPSTACKTOP EQU 0xFF +1 ; default 0FFH+1
63 ; </h>
64 ;
65 ; <h> Stack Space for reentrant functions in the LARGE model.
66 ; <q> XBPSTACK: Enable LARGE model reentrant stack
67 ; <i> Stack space for reentrant functions in the LARGE model.
0000 68 XBPSTACK EQU 0 ; set to 1 if large reentrant is used.
69 ; <o> XBPSTACKTOP: End address of LARGE model stack <0x0-0xFFFF>
70 ; <i> Set the top of the stack to the highest location.
0000 71 XBPSTACKTOP EQU 0xFFFF +1 ; default 0FFFFH+1
72 ; </h>
73 ;
74 ; <h> Stack Space for reentrant functions in the COMPACT model.
75 ; <q> PBPSTACK: Enable COMPACT model reentrant stack
76 ; <i> Stack space for reentrant functions in the COMPACT model.
0000 77 PBPSTACK EQU 0 ; set to 1 if compact reentrant is used.
78 ;
79 ; <o> PBPSTACKTOP: End address of COMPACT model stack <0x0-0xFFFF>
80 ; <i> Set the top of the stack to the highest location.
0100 81 PBPSTACKTOP EQU 0xFF +1 ; default 0FFH+1
82 ; </h>
83 ;</h>
84 ;------------------------------------------------------------------------------
85 ;
86 ; Memory Page for Using the Compact Model with 64 KByte xdata RAM
87 ; <e>Compact Model Page Definition
88 ;
89 ; <i>Define the XDATA page used for PDATA variables.
90 ; <i>PPAGE must conform with the PPAGE set in the linker invocation.
91 ;
92 ; Enable pdata memory page initalization
0000 93 PPAGEENABLE EQU 0 ; set to 1 if pdata object are used.
94 ;
95 ; <o> PPAGE number <0x0-0xFF>
96 ; <i> uppermost 256-byte address of the page used for PDATA variables.
0000 97 PPAGE EQU 0
98 ;
99 ; <o> SFR address which supplies uppermost address byte <0x0-0xFF>
100 ; <i> most 8051 variants use P2 as uppermost address byte
00A0 101 PPAGE_SFR DATA 0A0H
102 ;
103 ; </e>
104 ;------------------------------------------------------------------------------
105
106 ; Standard SFR Symbols
00E0 107 ACC DATA 0E0H
00F0 108 B DATA 0F0H
0081 109 SP DATA 81H
0082 110 DPL DATA 82H
0083 111 DPH DATA 83H
112
113 NAME ?C_STARTUP
114
115
116 ?C_C51STARTUP SEGMENT CODE
117 ?STACK SEGMENT IDATA
118
---- 119 RSEG ?STACK
0000 120 DS 1
121
122 EXTRN CODE (?C_START)
123 PUBLIC ?C_STARTUP
A51 MACRO ASSEMBLER STARTUP 09/02/2024 09:41:26 PAGE 3
124
---- 125 CSEG AT 0
0000 020000 F 126 ?C_STARTUP: LJMP STARTUP1
127
---- 128 RSEG ?C_C51STARTUP
129
0000 130 STARTUP1:
131
132 IF IDATALEN <> 0
0000 787F 133 MOV R0,#IDATALEN - 1
0002 E4 134 CLR A
0003 F6 135 IDATALOOP: MOV @R0,A
0004 D8FD 136 DJNZ R0,IDATALOOP
137 ENDIF
138
139 IF XDATALEN <> 0
MOV DPTR,#XDATASTART
MOV R7,#LOW (XDATALEN)
IF (LOW (XDATALEN)) <> 0
MOV R6,#(HIGH (XDATALEN)) +1
ELSE
MOV R6,#HIGH (XDATALEN)
ENDIF
CLR A
XDATALOOP: MOVX @DPTR,A
INC DPTR
DJNZ R7,XDATALOOP
DJNZ R6,XDATALOOP
ENDIF
153
154 IF PPAGEENABLE <> 0
MOV PPAGE_SFR,#PPAGE
ENDIF
157
158 IF PDATALEN <> 0
MOV R0,#LOW (PDATASTART)
MOV R7,#LOW (PDATALEN)
CLR A
PDATALOOP: MOVX @R0,A
INC R0
DJNZ R7,PDATALOOP
ENDIF
166
167 IF IBPSTACK <> 0
EXTRN DATA (?C_IBP)
MOV ?C_IBP,#LOW IBPSTACKTOP
ENDIF
172
173 IF XBPSTACK <> 0
EXTRN DATA (?C_XBP)
MOV ?C_XBP,#HIGH XBPSTACKTOP
MOV ?C_XBP+1,#LOW XBPSTACKTOP
ENDIF
179
180 IF PBPSTACK <> 0
EXTRN DATA (?C_PBP)
MOV ?C_PBP,#LOW PBPSTACKTOP
ENDIF
184
0006 758100 F 185 MOV SP,#?STACK-1
186
187 ; This code is required if you use L51_BANK.A51 with Banking Mode 4
188 ;<h> Code Banking
189 ; <q> Select Bank 0 for L51_BANK.A51 Mode 4
A51 MACRO ASSEMBLER STARTUP 09/02/2024 09:41:26 PAGE 4
190
195 ;</h>
0009 020000 F 196 LJMP ?C_START
197
198 END
A51 MACRO ASSEMBLER STARTUP 09/02/2024 09:41:26 PAGE 5
SYMBOL TABLE LISTING
------ ----- -------
N A M E T Y P E V A L U E ATTRIBUTES
?C_C51STARTUP. . . C SEG 000CH REL=UNIT
?C_START . . . . . C ADDR ----- EXT
?C_STARTUP . . . . C ADDR 0000H A
?STACK . . . . . . I SEG 0001H REL=UNIT
ACC. . . . . . . . D ADDR 00E0H A
B. . . . . . . . . D ADDR 00F0H A
DPH. . . . . . . . D ADDR 0083H A
DPL. . . . . . . . D ADDR 0082H A
IBPSTACK . . . . . N NUMB 0000H A
IBPSTACKTOP. . . . N NUMB 0100H A
IDATALEN . . . . . N NUMB 0080H A
IDATALOOP. . . . . C ADDR 0003H R SEG=?C_C51STARTUP
PBPSTACK . . . . . N NUMB 0000H A
PBPSTACKTOP. . . . N NUMB 0100H A
PDATALEN . . . . . N NUMB 0000H A
PDATASTART . . . . N NUMB 0000H A
PPAGE. . . . . . . N NUMB 0000H A
PPAGEENABLE. . . . N NUMB 0000H A
PPAGE_SFR. . . . . D ADDR 00A0H A
SP . . . . . . . . D ADDR 0081H A
STARTUP1 . . . . . C ADDR 0000H R SEG=?C_C51STARTUP
XBPSTACK . . . . . N NUMB 0000H A
XBPSTACKTOP. . . . N NUMB 0000H A
XDATALEN . . . . . N NUMB 0000H A
XDATASTART . . . . N NUMB 0000H A
REGISTER BANK(S) USED: 0
ASSEMBLY COMPLETE. 0 WARNING(S), 0 ERROR(S)

View File

@@ -0,0 +1,219 @@
C51 COMPILER V9.60.7.0 UART 09/02/2024 09:41:26 PAGE 1
C51 COMPILER V9.60.7.0, COMPILATION OF MODULE UART
OBJECT MODULE PLACED IN .\Objects\UART.obj
COMPILER INVOKED BY: D:\Keil5\C51\BIN\C51.EXE ..\User\UART.C LARGE OMF2 OPTIMIZE(8,SPEED) BROWSE INCDIR(..\User) DEBUG P
-RINT(.\Listings\UART.lst) OBJECT(.\Objects\UART.obj)
line level source
1 #include "UART.h"
2 #include <string.h>
3 #include "oled.h"
4 #include <stdio.h>
5
6 // 用于存储接收数据的数组
7 unsigned char rxBuffer[ARRAY_SIZE];
8 unsigned int rxIndex = 0; // 接收数据的索引
9 unsigned int rx_flag=0;
10 extern unsigned int CONNECT_FLEG;//连接标志
11 // 初始化串口
12 void Serial_Init() {
13 1 SCON = 0x50; // 设置为模式18位数据可变波特率
14 1 TMOD &= 0x0F; // 清除定时器1模式位
15 1 TMOD |= 0x20; // 设置定时器1为8位自动重装模式
16 1 TH1 = TL1 = 256 - (11059200 / 12 / 32) / BAUDRATE; // 设置波特率
17 1 TR1 = 1; // 启动定时器1
18 1 ES = 1; // 开启串口中断
19 1 EA = 1; // 开启全局中断
20 1 }
21
22 void Delay(unsigned int xms)
23 {
24 1 unsigned char i, j;
25 1 while(xms--)
26 1 {
27 2 i = 2;
28 2 j = 239;
29 2 do
30 2 {
31 3 while (--j);
32 3 } while (--i);
33 2 }
34 1 }
35
36 void buff_memset(void)
37 {
38 1 memset(rxBuffer,0,64);
39 1 rxIndex=0;
40 1 rx_flag = 0;
41 1 }
42 unsigned int WIFI_CheckAck(char* src, char* dest, int timeout)
43 {
44 1 char *check = NULL;
45 1 //清空缓冲
46 1 buff_memset();
47 1
48 1 UART_sentString(src);
49 1 timeout=timeout/10;//10ms处理一次
50 1 while(timeout--)
51 1 {
52 2 Delay(10);//延时1ms
53 2 if(rx_flag==1)
54 2 {
C51 COMPILER V9.60.7.0 UART 09/02/2024 09:41:26 PAGE 2
55 3 check = strstr(rxBuffer,dest);
56 3 if(check != NULL)
57 3 {
58 4 buff_memset();//数据有误 清空
59 4 return 1;
60 4 }
61 3 }
62 2 }
63 1 buff_memset();//数据有误 清空
64 1 return 0;//超时
65 1 }
66
67 sbit LED = P2^5;
68 sbit motor1 = P2^6;
69 sbit motor2 = P2^7;
70
71 void CONNECT_TX_Control(void)
72 {
73 1 char *ptr = NULL;
74 1 int number;
75 1 if (CONNECT_FLEG)
76 1 {
77 2 if(rx_flag)
78 2 {
79 3 if(strstr(rxBuffer,"192.168.0")!=NULL)
80 3 {
81 4 ptr = strrchr((char*)rxBuffer,','); // 以最后一个,为准后面为数据
82 4
83 4 if(strlen(ptr)-3==1) //判断接收到为一位数据 ,*\r\n
84 4 {
85 5 number = ptr[1]-'0';
86 5 switch(number)
87 5 {
88 6 case 1: LED = 0 ; break;
89 6 case 2: LED = 1; break;
90 6 case 3:OLED_Show(); break;
91 6 case 4:OLED_Clear(); break;
92 6 case 5:motor1=0;motor2=1; break;
93 6 case 6:motor1=1;motor2=0; break;
94 6 case 7:motor1=0;motor2=0 ; break;
95 6 default: return;
96 6 }
97 5 }
98 4 }
99 3 else if(strstr((char *)rxBuffer,"RECV:test-app")!=NULL)
100 3 {
101 4 ptr = strrchr((char*)rxBuffer,','); // 以最后一个,为准后面为数据
102 4
103 4 if(strlen(ptr)-3==1) //判断接收到为一位数据 ,*\r\n
104 4 {
105 5 number = ptr[1]-'0';
106 5 switch(number)
107 5 {
108 6 case 1: LED = 0 ; break;
109 6 case 2: LED = 1; break;
110 6 case 3:OLED_Show(); break;
111 6 case 4:OLED_Clear(); break;
112 6 case 5:motor1=0;motor2=1; break;
113 6 case 6:motor1=1;motor2=0; break;
114 6 case 7:motor1=0;motor2=0 ; break;
115 6 default: return;
116 6 }
C51 COMPILER V9.60.7.0 UART 09/02/2024 09:41:26 PAGE 3
117 5 }
118 4 }
119 3 }
120 2 buff_memset();//数据有误 清空
121 2 }
122 1 }
123
124
125 void CONNECT_TO_MQTT(unsigned char* id,unsigned char *password)
126 {
127 1 unsigned char buf[50];
128 1 while(!WIFI_CheckAck("AT+MQTTCLEAN\r\n","OK",1000));//淇濊瘉姣忔<E5A7A3> 杩炴帴鍓嶆柇寮€鏈嶅姟鍣<E5A79F>
129 1 //while(!WIFI_CheckAck("AT+RESTORE\r\n","OK",5000));
130 1 while(!WIFI_CheckAck("AT\r\n","OK",1000));
131 1 while(!WIFI_CheckAck("AT+CWMODE=0\r\n","OK",2000)); //STA妯″紡
132 1 sprintf((char *)buf,"AT+CWJAP=%s,%s\r\n",id,password);
133 1 while(!WIFI_CheckAck((char *)buf,"+CWJAP:1,",5000));//杩炴帴鍒癢IFI
134 1 while(!WIFI_CheckAck("AT+MQTTLONGCLIENTID=WF-TEST2\r\n","OK",1000)!=0);//閰嶇疆 MQTT 瀹㈡埛绔<E59F9B>墍闇€鐨勫<E990A8>
-㈡埛绔<E59F9B> ID銆佺敤鎴峰悕鍜屽瘑鐮<E79891><> MQTT 鏈嶅姟鍣ㄦ棤鐢ㄦ埛鍚嶅拰瀵嗙爜楠岃瘉锛屽垯妯″潡鍙<E6BDA1>烦杩囩敤鎴峰悕鍜屽瘑鐮佺殑<E4BDBA>
-緭鍏<E7B7AD>
135 1 while(!WIFI_CheckAck("AT+MQTTCONN=broker.emqx.io,1883,0\r\n","MQTTCONNECTED:",2000)!=0);//杩炴帴MQTT 鏈嶅
-姟鍣<E5A79F><>彛鍙<E5BD9B><>惁鑷<E68381>姩閲嶈繛
136 1 while(!WIFI_CheckAck("AT+MQTTSUB=test-app,0\r\n","OK",2000)!=0);//璁㈤槄涓婚<E6B693> test-app涓婚<E6B693><EFBFBD> QOS鏈嶅
-姟璐ㄩ噺
137 1 while(!WIFI_CheckAck("AT+MQTTPUBRAW=test-w,32,0,0\r\n","OK",2000)!=0);//鍙戝竷涓婚<E6B693> test-wf涓婚<E6B693><EFBFBD> 10
- 娑堟伅闀垮害 0 涓篞OS 0 retain 鏈嶅姟鍣ㄦ槸鍚︿负璇ヤ富棰樺瓨鍌ㄤ竴鏉℃渶鏂扮殑淇濈暀娑堟伅
138 1 UART_sentString("MQTT_Connected\r\n");
139 1 buff_memset();
140 1 CONNECT_FLEG = 1;
141 1 }
142
143 void UART_SendByte(unsigned char Byte)
144 {
145 1 SBUF=Byte;
146 1 while(!TI);
147 1 TI=0;
148 1 }
149
150 void UART_sentString(char *str)
151 {
152 1
153 1 while(*str){
154 2 UART_SendByte(*str);
155 2 str++;
156 2 }
157 1 }
158 // 串口接收中断服务程序
159 void Serial_ISR() interrupt 4 {
160 1 if (RI) {
161 2 RI = 0; // 清除接收中断标志
162 2
163 2
164 2 rxBuffer[rxIndex++] = SBUF; // 存储接收到的数据
165 2 if(rxBuffer[rxIndex-1]=='\n')
166 2 {
167 3 rx_flag=1;
168 3 }
169 2 if(rxIndex==64)
170 2 {
171 3 rxIndex=0;
172 3 rx_flag=1;
173 3 }
C51 COMPILER V9.60.7.0 UART 09/02/2024 09:41:26 PAGE 4
174 2
175 2 }
176 1 }
177
178
179
180
MODULE INFORMATION: STATIC OVERLAYABLE
CODE SIZE = 1191 ----
CONSTANT SIZE = 241 ----
XDATA SIZE = 68 72
PDATA SIZE = ---- ----
DATA SIZE = ---- ----
IDATA SIZE = ---- ----
BIT SIZE = ---- ----
EDATA SIZE = ---- ----
HDATA SIZE = ---- ----
XDATA CONST SIZE = ---- ----
FAR CONST SIZE = ---- ----
END OF MODULE INFORMATION.
C51 COMPILATION COMPLETE. 0 WARNING(S), 0 ERROR(S)

View File

@@ -0,0 +1,108 @@
C51 COMPILER V9.60.7.0 MAIN 09/02/2024 09:41:26 PAGE 1
C51 COMPILER V9.60.7.0, COMPILATION OF MODULE MAIN
OBJECT MODULE PLACED IN .\Objects\main.obj
COMPILER INVOKED BY: D:\Keil5\C51\BIN\C51.EXE ..\User\main.c LARGE OMF2 OPTIMIZE(8,SPEED) BROWSE INCDIR(..\User) DEBUG P
-RINT(.\Listings\main.lst) OBJECT(.\Objects\main.obj)
line level source
1 //**** 澹版槑 ********************************************************************
2 /*******************************************************************************
3 * 涓嬮潰鏉ヨ嚜浜掕仈寮€婧愮▼搴忥紝鐢辨繁鍦冲競澶у<E6BEB6>榫欓泙绉戞妧鏈夐檺鍏<E6AABA>徃鏀堕泦
4 * 鏂逛究鐢ㄦ埛鍙傝€冨<E282AC>涔狅紝鏈<E7B49D>叕鍙镐笉鎻愪緵浠讳綍鎶€鏈<E282AC>敮鎸<E695AE>
5 * 绋嬪簭浠呬緵娴嬭瘯鍙傝€冿紝涓嶈兘搴旂敤鍦ㄥ疄闄呭伐绋嬩腑锛屼笉涓€瀹氳兘閫氳繃缂栬瘧
6 * 鍏<>徃缃戠珯 http://www.szdx-smart.com/
7 * 娣樺疂缃戝潃 https://shop184598174.taobao.com/?spm=a1z10.5-c-s.w12096189-21564973333.3.547b1176WCCDxR&s
-cene=taobao_shop
8 *******************************************************************************/
9 /********************************************************************
10 * 鏂囦欢鍚<E6ACA2><> WF24-MQTT鍗忚<E98D97>搴旂敤
11 * 鎻忚堪 : 璇ユ枃浠跺疄鐜伴€氳繃WF24鍒╃敤缁欏崟鐗囨満鍙戞暟鎹<E69A9F>帶鍒禠ED+OLED+鐢垫満銆<E6BA80>
12 ***********************************************************************/
13 /*
14 Name: MQTT
15 Created: 2024/8/21
16 Author: WAM
17 */
18
19 #include <REGX52.H> // STC89C52RC的寄存器定义
20 #include "UART.h"
21 #include "string.h"
22 #include "stdio.h"
23 #include "oled.h"
24 extern unsigned int rxIndex;
25 extern unsigned char rxBuffer[ARRAY_SIZE];
26 extern unsigned int rx_flag;
27 unsigned int CONNECT_FLEG;//连接标志
28 // 主函数
29 unsigned char conver[64];
30 char *ptr = NULL;
31 void MQTT_CONVER(void);
32 void MQTT_CONTROL(void);
33 void main() {
34 1 Serial_Init(); // 初始化串口
35 1 OLED_Init();
36 1 CONNECT_TO_MQTT("DX-SMART","SMART@601");
37 1 while (1) {
38 2
39 2 // 主循环,可以添加其他任务
40 2 MQTT_CONTROL();
41 2 }
42 1 }
43
44 void TCP_UDP_CONVER(void)
45 {
46 1 if (rx_flag)
47 1 {
48 2 UART_sentString(rxBuffer);
49 2 CONNECT_TX_Control();
50 2 rxIndex = 0; // 重置索引,准备下一次接收
51 2 memset(rxBuffer,0,ARRAY_SIZE); //清空缓冲区
52 2 }
53 1 }
C51 COMPILER V9.60.7.0 MAIN 09/02/2024 09:41:26 PAGE 2
54 void MQTT_CONVER(void)
55 {
56 1 if (rx_flag)
57 1 {
58 2 if(strstr(rxBuffer,"RECV:test-app")!=NULL)
59 2 {
60 3 ptr = strrchr(rxBuffer,',');
61 3 memcpy(conver,ptr,*(ptr-1));
62 3 while(!WIFI_CheckAck("AT+MQTTPUBRAW=test-w,32,0,0\r\n","OK",2000)!=0);
63 3 buff_memset();//数据有误 清空
*** WARNING C206 IN LINE 63 OF ..\User\main.c: 'buff_memset': missing function-prototype
64 3 UART_sentString(conver);
65 3
66 3 }
67 2
68 2 }
69 1 }
70 void MQTT_CONTROL(void)
71 {
72 1 if (rx_flag)
73 1 {
74 2 CONNECT_TX_Control();
75 2 }
76 1 }
MODULE INFORMATION: STATIC OVERLAYABLE
CODE SIZE = 240 ----
CONSTANT SIZE = 66 ----
XDATA SIZE = 69 ----
PDATA SIZE = ---- ----
DATA SIZE = ---- ----
IDATA SIZE = ---- ----
BIT SIZE = ---- ----
EDATA SIZE = ---- ----
HDATA SIZE = ---- ----
XDATA CONST SIZE = ---- ----
FAR CONST SIZE = ---- ----
END OF MODULE INFORMATION.
C51 COMPILATION COMPLETE. 1 WARNING(S), 0 ERROR(S)

View File

@@ -0,0 +1,287 @@
C51 COMPILER V9.60.7.0 OLED 09/02/2024 09:41:26 PAGE 1
C51 COMPILER V9.60.7.0, COMPILATION OF MODULE OLED
OBJECT MODULE PLACED IN .\Objects\oled.obj
COMPILER INVOKED BY: D:\Keil5\C51\BIN\C51.EXE ..\User\oled.c LARGE OMF2 OPTIMIZE(8,SPEED) BROWSE INCDIR(..\User) DEBUG P
-RINT(.\Listings\oled.lst) OBJECT(.\Objects\oled.obj)
line level source
1 #include "oled.h"
2 #include "oledfont.h"
3
4 void delay_ms(unsigned int ms)
5 {
6 1 unsigned int a;
7 1 while(ms)
8 1 {
9 2 a=1800;
10 2 while(a--);
11 2 ms--;
12 2 }
13 1 return;
14 1 }
15 void OLED_Show()
16 {
17 1 OLED_ShowCHinese(16,0,0);
18 1 OLED_ShowCHinese(32,0,1);
19 1 OLED_ShowCHinese(48,0,2);
20 1 OLED_ShowCHinese(64,0,3);
21 1 OLED_ShowCHinese(80,0,4);
22 1 OLED_ShowCHinese(96,0,5);
23 1 OLED_ShowString(32,2,"WF24");
24 1
25 1 }
26 #if OLED_MODE==1
//向SSD1106写入一个字节。
//dat:要写入的数据/命令
//cmd:数据/命令标志 0,表示命令;1,表示数据;
void OLED_WR_Byte(u8 dat,u8 cmd)
{
DATAOUT(dat);
if(cmd)
OLED_DC_Set();
else
OLED_DC_Clr();
OLED_CS_Clr();
OLED_WR_Clr();
OLED_WR_Set();
OLED_CS_Set();
OLED_DC_Set();
}
#else
44 //向SSD1306写入一个字节。
45 //dat:要写入的数据/命令
46 //cmd:数据/命令标志 0,表示命令;1,表示数据;
47 void OLED_WR_Byte(u8 dat,u8 cmd)
48 {
49 1 u8 i;
50 1 if(cmd)
51 1 OLED_DC_Set();
52 1 else
53 1 OLED_DC_Clr();
54 1 OLED_CS_Clr();
C51 COMPILER V9.60.7.0 OLED 09/02/2024 09:41:26 PAGE 2
55 1 for(i=0;i<8;i++)
56 1 {
57 2 OLED_SCLK_Clr();
58 2 if(dat&0x80)
59 2 {
60 3 OLED_SDIN_Set();
61 3 }
62 2 else
63 2 OLED_SDIN_Clr();
64 2 OLED_SCLK_Set();
65 2 dat<<=1;
66 2 }
67 1 OLED_CS_Set();
68 1 OLED_DC_Set();
69 1 }
70 #endif
71 void OLED_Set_Pos(unsigned char x, unsigned char y)
72 {
73 1 OLED_WR_Byte(0xb0+y,OLED_CMD);
74 1 OLED_WR_Byte(((x&0xf0)>>4)|0x10,OLED_CMD);
75 1 OLED_WR_Byte((x&0x0f)|0x01,OLED_CMD);
76 1 }
77 //开启OLED显示
78 void OLED_Display_On(void)
79 {
80 1 OLED_WR_Byte(0X8D,OLED_CMD); //SET DCDC命令
81 1 OLED_WR_Byte(0X14,OLED_CMD); //DCDC ON
82 1 OLED_WR_Byte(0XAF,OLED_CMD); //DISPLAY ON
83 1 }
84 //关闭OLED显示
85 void OLED_Display_Off(void)
86 {
87 1 OLED_WR_Byte(0X8D,OLED_CMD); //SET DCDC命令
88 1 OLED_WR_Byte(0X10,OLED_CMD); //DCDC OFF
89 1 OLED_WR_Byte(0XAE,OLED_CMD); //DISPLAY OFF
90 1 }
91 //清屏函数,清完屏,整个屏幕是黑色的!和没点亮一样!!!
92 void OLED_Clear(void)
93 {
94 1 u8 i,n;
95 1 for(i=0;i<8;i++)
96 1 {
97 2 OLED_WR_Byte (0xb0+i,OLED_CMD); //设置页地址0~7
98 2 OLED_WR_Byte (0x00,OLED_CMD); //设置显示位置—列低地址
99 2 OLED_WR_Byte (0x10,OLED_CMD); //设置显示位置—列高地址
100 2 for(n=0;n<128;n++)OLED_WR_Byte(0,OLED_DATA);
101 2 } //更新显示
102 1 }
103
104
105 //在指定位置显示一个字符,包括部分字符
106 //x:0~127
107 //y:0~63
108 //mode:0,反白显示;1,正常显示
109 //size:选择字体 16/12
110 void OLED_ShowChar(u8 x,u8 y,u8 chr)
111 {
112 1 unsigned char c=0,i=0;
113 1 c=chr-' ';//得到偏移后的值
114 1 if(x>Max_Column-1){x=0;y=y+2;}
115 1 if(SIZE ==16)
116 1 {
C51 COMPILER V9.60.7.0 OLED 09/02/2024 09:41:26 PAGE 3
117 2 OLED_Set_Pos(x,y);
118 2 for(i=0;i<8;i++)
119 2 OLED_WR_Byte(F8X16[c*16+i],OLED_DATA);
120 2 OLED_Set_Pos(x,y+1);
121 2 for(i=0;i<8;i++)
122 2 OLED_WR_Byte(F8X16[c*16+i+8],OLED_DATA);
123 2 }
124 1
125 1 }
126 //m^n函数
127 u32 oled_pow(u8 m,u8 n)
128 {
129 1 u32 result=1;
130 1 while(n--)result*=m;
131 1 return result;
132 1 }
133 //显示2个数字
134 //x,y :起点坐标
135 //len :数字的位数
136 //size:字体大小
137 //mode:模式 0,填充模式;1,叠加模式
138 //num:数值(0~4294967295);
139 void OLED_ShowNum(u8 x,u8 y,u32 num,u8 len,u8 size2)
140 {
141 1 u8 t,temp;
142 1 u8 enshow=0;
143 1 for(t=0;t<len;t++)
144 1 {
145 2 temp=(num/oled_pow(10,len-t-1))%10;
146 2 if(enshow==0&&t<(len-1))
147 2 {
148 3 if(temp==0)
149 3 {
150 4 OLED_ShowChar(x+(size2/2)*t,y,' ');
151 4 continue;
152 4 }else enshow=1;
153 3
154 3 }
155 2 OLED_ShowChar(x+(size2/2)*t,y,temp+'0');
156 2 }
157 1 }
158 //显示一个字符号串
159 void OLED_ShowString(u8 x,u8 y,u8 *chr)
160 {
161 1 unsigned char j=0;
162 1 while (chr[j]!='\0')
163 1 { OLED_ShowChar(x,y,chr[j]);
164 2 x+=8;
165 2 if(x>120){x=0;y+=2;}
166 2 j++;
167 2 }
168 1 }
169 //显示汉字
170 void OLED_ShowCHinese(u8 x,u8 y,u8 no)
171 {
172 1 u8 t,adder=0;
173 1 OLED_Set_Pos(x,y);
174 1 for(t=0;t<16;t++)
175 1 {
176 2 OLED_WR_Byte(Hzk[2*no][t],OLED_DATA);
177 2 adder+=1;
178 2 }
C51 COMPILER V9.60.7.0 OLED 09/02/2024 09:41:26 PAGE 4
179 1 OLED_Set_Pos(x,y+1);
180 1 for(t=0;t<16;t++)
181 1 {
182 2 OLED_WR_Byte(Hzk[2*no+1][t],OLED_DATA);
183 2 adder+=1;
184 2 }
185 1 }
186 /***********功能描述显示显示BMP图片128×64起始点坐标(x,y),x的范围0127y为页的范围07****************
-*/
187 void OLED_DrawBMP(unsigned char x0, unsigned char y0,unsigned char x1, unsigned char y1,unsigned char BMP[
-])
188 {
189 1 unsigned int j=0;
190 1 unsigned char x,y;
191 1
192 1 if(y1%8==0) y=y1/8;
193 1 else y=y1/8+1;
194 1 for(y=y0;y<y1;y++)
195 1 {
196 2 OLED_Set_Pos(x0,y);
197 2 for(x=x0;x<x1;x++)
198 2 {
199 3 OLED_WR_Byte(BMP[j++],OLED_DATA);
200 3 }
201 2 }
202 1 }
203
204
205 //初始化SSD1306
206 void OLED_Init(void)
207 {
208 1
209 1
210 1
211 1 OLED_RST_Set();
212 1 delay_ms(100);
213 1 OLED_RST_Clr();
214 1 delay_ms(100);
215 1 OLED_RST_Set();
216 1 OLED_WR_Byte(0xAE,OLED_CMD);//--turn off oled panel
217 1 OLED_WR_Byte(0x00,OLED_CMD);//---set low column address
218 1 OLED_WR_Byte(0x10,OLED_CMD);//---set high column address
219 1 OLED_WR_Byte(0x40,OLED_CMD);//--set start line address Set Mapping RAM Display Start Line (0x00~0x3F)
220 1 OLED_WR_Byte(0x81,OLED_CMD);//--set contrast control register
221 1 OLED_WR_Byte(0xCF,OLED_CMD); // Set SEG Output Current Brightness
222 1 OLED_WR_Byte(0xA1,OLED_CMD);//--Set SEG/Column Mapping 0xa0左右反置 0xa1正常
223 1 OLED_WR_Byte(0xC8,OLED_CMD);//Set COM/Row Scan Direction 0xc0上下反置 0xc8正常
224 1 OLED_WR_Byte(0xA6,OLED_CMD);//--set normal display
225 1 OLED_WR_Byte(0xA8,OLED_CMD);//--set multiplex ratio(1 to 64)
226 1 OLED_WR_Byte(0x3f,OLED_CMD);//--1/64 duty
227 1 OLED_WR_Byte(0xD3,OLED_CMD);//-set display offset Shift Mapping RAM Counter (0x00~0x3F)
228 1 OLED_WR_Byte(0x00,OLED_CMD);//-not offset
229 1 OLED_WR_Byte(0xd5,OLED_CMD);//--set display clock divide ratio/oscillator frequency
230 1 OLED_WR_Byte(0x80,OLED_CMD);//--set divide ratio, Set Clock as 100 Frames/Sec
231 1 OLED_WR_Byte(0xD9,OLED_CMD);//--set pre-charge period
232 1 OLED_WR_Byte(0xF1,OLED_CMD);//Set Pre-Charge as 15 Clocks & Discharge as 1 Clock
233 1 OLED_WR_Byte(0xDA,OLED_CMD);//--set com pins hardware configuration
234 1 OLED_WR_Byte(0x12,OLED_CMD);
235 1 OLED_WR_Byte(0xDB,OLED_CMD);//--set vcomh
236 1 OLED_WR_Byte(0x40,OLED_CMD);//Set VCOM Deselect Level
237 1 OLED_WR_Byte(0x20,OLED_CMD);//-Set Page Addressing Mode (0x00/0x01/0x02)
238 1 OLED_WR_Byte(0x02,OLED_CMD);//
C51 COMPILER V9.60.7.0 OLED 09/02/2024 09:41:26 PAGE 5
239 1 OLED_WR_Byte(0x8D,OLED_CMD);//--set Charge Pump enable/disable
240 1 OLED_WR_Byte(0x14,OLED_CMD);//--set(0x10) disable
241 1 OLED_WR_Byte(0xA4,OLED_CMD);// Disable Entire Display On (0xa4/0xa5)
242 1 OLED_WR_Byte(0xA6,OLED_CMD);// Disable Inverse Display On (0xa6/a7)
243 1 OLED_WR_Byte(0xAF,OLED_CMD);//--turn on oled panel
244 1
245 1 OLED_WR_Byte(0xAF,OLED_CMD); /*display ON*/
246 1 OLED_Clear();
247 1 OLED_Set_Pos(0,0);
248 1 }
249
MODULE INFORMATION: STATIC OVERLAYABLE
CODE SIZE = 1037 ----
CONSTANT SIZE = 2461 ----
XDATA SIZE = ---- 27
PDATA SIZE = ---- ----
DATA SIZE = ---- ----
IDATA SIZE = ---- ----
BIT SIZE = ---- ----
EDATA SIZE = ---- ----
HDATA SIZE = ---- ----
XDATA CONST SIZE = ---- ----
FAR CONST SIZE = ---- ----
END OF MODULE INFORMATION.
C51 COMPILATION COMPLETE. 0 WARNING(S), 0 ERROR(S)

View File

@@ -0,0 +1,54 @@
<html>
<body>
<pre>
<h1>礦ision Build Log</h1>
<h2>Tool Versions:</h2>
IDE-Version: μVision V5.38.0.0
Copyright (C) 2022 ARM Ltd and ARM Germany GmbH. All rights reserved.
License Information: 1 1, 21, LIC=TI4EI-T6WYP-WQ90S-LZLT9-S04QZ-NNNW4
Tool Versions:
Toolchain: PK51 Prof. Developers Kit Version: 9.60.7.0
Toolchain Path: D:\Keil5\C51\BIN
C Compiler: C51.exe V9.60.7.0
Assembler: A51.exe V8.2.7.0
Linker/Locator: LX51.exe V4.66.100.0
Library Manager: LIBX51.exe V4.30.1.0
Hex Converter: OHX51.exe V1.47.0.0
CPU DLL: S8051.DLL V3.125.1.0
Dialog DLL: DP51.DLL V2.69.0.0
<h2>Project:</h2>
F:\WF24DEMO\单片机应用资料\单片机实验例程\1.WF24通过单片机控制LED+OLED+电机例程(TCP-UDP-MQTT)\2.STC89C52\例程\MQTT\C52\Project\51Project.uvproj
Project File Date: 08/07/2024
<h2>Output:</h2>
Rebuild target 'Target 1'
assembling STARTUP.A51...
compiling main.c...
..\User\main.c(63): warning C206: 'buff_memset': missing function-prototype
compiling UART.C...
compiling oled.c...
linking...
*** WARNING L57: UNCALLED FUNCTION, IGNORED FOR OVERLAY PROCESS
NAME: TCP_UDP_CONVER/MAIN
*** WARNING L57: UNCALLED FUNCTION, IGNORED FOR OVERLAY PROCESS
NAME: MQTT_CONVER/MAIN
*** WARNING L57: UNCALLED FUNCTION, IGNORED FOR OVERLAY PROCESS
NAME: OLED_DISPLAY_ON/OLED
*** WARNING L57: UNCALLED FUNCTION, IGNORED FOR OVERLAY PROCESS
NAME: OLED_DISPLAY_OFF/OLED
*** WARNING L57: UNCALLED FUNCTION, IGNORED FOR OVERLAY PROCESS
NAME: _OLED_SHOWNUM/OLED
*** WARNING L57: UNCALLED FUNCTION, IGNORED FOR OVERLAY PROCESS
NAME: _OLED_DRAWBMP/OLED
*** WARNING L25: DATA TYPES DIFFERENT
SYMBOL: buff_memset
MODULE: .\Objects\main.obj (MAIN)
DEFINED: .\Objects\UART.obj (UART)
Program Size: data=15.1 xdata=253 const=2768 code=4519
creating hex file from ".\Objects\51Project"...
".\Objects\51Project" - 0 Error(s), 8 Warning(s).
Build Time Elapsed: 00:00:01
</pre>
</body>
</html>

View File

@@ -0,0 +1,457 @@
:10000000020C9AAC07ED24B0FFE4FD120FF2EC54A1
:10001000F0C4540F4410FF120FF2EC540F4401FFD0
:10002000020FF2020E24E508243BF582E43400F5C9
:1000300083E005082290003830070390003BE47508
:10004000F0011205CE0204812000E97F2ED200804B
:1000500018EF540F2490D43440D4FF30040BEF2415
:10006000BFB41A0050032461FFE5096002150905B9
:100070000CE50C7002050B30070E900038E475F0AB
:10008000011205CEEF0205A602106F7403D207809D
:1000900003E4C207F5089000381205E5E4F509F518
:1000A0000BF50CE50960077F2012006980F5750AE1
:1000B000FFC201C200C202C203C205C206C20812C8
:1000C0000035FF700D3007057F0012007AAF0CAECF
:1000D0000B22B4255FC2D5C204120035FF24D0B470
:1000E0000A00501A75F00A780930D50508B6FF01E4
:1000F00006C6A426F620D5047002D20380D924CFE8
:10010000B41A00EF5004C2E5D20402027BD201808F
:10011000C6D20080C0D20280BCD2D580BAD20580BF
:10012000B47F201200692002077401B5090040F174
:10013000120026FF1200690200A3D208D2068095A1
:10014000120026FB120026FA120026F94A4B70060E
:10015000794C7A037BFF20022EE509602A7E008E0F
:100160008275830012049A60060EEE650A70F0C272
:10017000D5EBC0E0EAC0E0E9C0E0EE1202C2D0E098
:10018000F9D0E0FAD0E0FB120481FF60AAEBC0E0F6
:10019000EAC0E0E9C0E0120069D0E02401F9D0E053
:1001A0003400FAD0E0FBE50A0460DCD50AD9808788
:1001B0007BFF7A0279BED202809C79108002790896
:1001C000C206C2088008D2D5790A8004790AC2D54D
:1001D000E50A047002F50AE4FAFDFEFF120026FCAF
:1001E0007B08200113120026FD7B1030000A12004C
:1001F00026FE120026FF7B20EC3382D592D55013C9
:10020000C3E43000069FFFE49EFEE42001039DFD51
:10021000E49CFCE4CBF8C201EC700CCFCECDCCE872
:1002200024F8F870F38017C3EF33FFEE33FEED339D
:10023000FDEC33FCEB33FB994002FB0FD8E9EB30CC
:100240000105F8D0E0C448B201C0E00AEC4D4E4FC1
:1002500078207B0070C2EAB50A0040BCC0E0120200
:10026000C4D0F0D0E0200104C4C0E0C4B201C0F0AA
:10027000120052D0F0D5F0EB0200A31205EE0140BF
:100280005301BA5801114C010D4201BE4F01C64441
:1002900001C64901264301CC5501B04601B04501D4
:1002A000B047036C5001152D01192E013C2B011D87
:1002B00023013A2003552A00D548000001343F3F6E
:1002C0003F00790AA2D5200314300509B9100204B1
:1002D00004B9080104A2D5200602500104200268D6
:1002E0009202B509005034C0E07F203003197F30FE
:1002F000A20272067205500F12031BC202C206C28E
:1003000005C2087F30800F300503E9C0E0120069A4
:10031000300503D0E0F9D0E0B509CC3005177F30C7
:10032000B9100C1200697F583004077F788003B938
:1003300008031200693002057F2D0200697F20202A
:1003400008F87F2B2006F322920280CF286E756C6E
:100350006C2900D2011200263001F8C20178093060
:10036000D50108F60200D52D504349581200262425
:1003700003B405004001E49003679312005A743AF5
:1003800012005AD2037509040201BAE709F608DF20
:10039000FA8046E709F208DFFA803E88828C83E71C
:1003A00009F0A3DFFA8032E309F608DFFA8078E388
:1003B00009F208DFFA807088828C83E309F0A3DFFA
:1003C000FA806489828A83E0A3F608DFFA8058897C
:1003D000828A83E0A3F208DFFA804C80D280FA8020
:1003E000C680D4806980F28033801080A680EA8045
:1003F0009A80A880DA80E280CA803389828A83EC7E
:10040000FAE493A3C8C582C8CCC583CCF0A3C8C501
:1004100082C8CCC583CCDFE9DEE7800D89828A8380
:10042000E493A3F608DFF9ECFAA9F0EDFB22898248
:100430008A83ECFAE0A3C8C582C8CCC583CCF0A3FC
:10044000C8C582C8CCC583CCDFEADEE880DB898200
:100450008A83E493A3F208DFF980CC88F0EF60018F
:100460000E4E60C388F0ED2402B4040050B9F5824A
:10047000EB2402B4040050AF23234582239003DB16
:1004800073BB010689828A83E0225002E722BBFE09
:1004900002E32289828A83E49322BB010CE582294C
:1004A000F582E5833AF583E0225006E92582F8E6F5
:1004B00022BBFE06E92582F8E222E58229F582E5E3
:1004C000833AF583E49322EF8DF0A4A8F0CF8CF06B
:1004D000A428CE8DF0A42EFE22BC000BBE0029EF76
:1004E0008DF084FFADF022E4CCF875F008EF2FFF1B
:1004F000EE33FEEC33FCEE9DEC984005FCEE9DFEE9
:100500000FD5F0E9E4CEFD22EDF8F5F0EE8420D22F
:100510001CFEADF075F008EF2FFFED33FD4007989E
:100520005006D5F0F222C398FD0FD5F0EA22C2D5CD
:10053000EC30E709B2D5E4C39DFDE49CFCEE30E766
:1005400015B2D5E4C39FFFE49EFE1204D9C3E49D17
:10055000FDE49CFC80031204D930D507C3E49FFF5F
:10056000E49EFE22A3F8E0C5F025F0F0E5821582B6
:1005700070021583E0C838F0E822EF4E6012EF6099
:10058000010EEDBB010B89828A83F0A3DFFCDEFA4A
:100590002289F05007F709DFFCA9F022BBFEFCF32B
:1005A00009DFFCA9F022BB010689828A83F0225070
:1005B00002F722BBFE01F322C5F0F8A3E028F0C544
:1005C000F0F8E582158270021583E038F022F8E039
:1005D000FBA3A3E0F925F0F0E582158270021583F4
:1005E000E0FA38F022EBF0A3EAF0A3E9F022D0839E
:1005F000D082F8E4937012740193700DA3A393F862
:10060000740193F5828883E4737402936860EFA3A6
:10061000A3A380DF900000E4F0A3F0A3F0900060BB
:10062000E07002A3E070030207AE9000E7E0700202
:10063000A3E070030207AB90004674FFF0A3741BA5
:10064000F0A37444F07B017A0079A5120944E94AC9
:100650004B70030206F17B017A0079A57D2C120D07
:10066000AA900000EBF0A3EAF0A3E9F0121136EF34
:1006700024FDFFEE34FFFEEF64014E60030207AB82
:10068000900000E0FBA3E0FAA3E0F990000112045F
:100690009AFF3395E0FEEF24D0FFEE34FFFE90008A
:1006A00003F0A3EFF0EE60030207AEEF14B407000F
:1006B00040030207AE9006C375F003A4C58325F07E
:1006C000C583730206D80206DD0206E20206E502D1
:1006D00006E80206EB0206EEC2A50207ABD2A502AF
:1006E00007AB02079102079602079B0207A10207C8
:1006F000A790004674FFF0A3741BF0A3744EF07B28
:10070000017A0079A5120944E94A4B70030207AB4C
:100710007B017A0079A57D2C120DAA900000EBF0E8
:10072000A3EAF0A3E9F0121136EF24FDFFEE34FF47
:10073000FEEF64014E7074900000E0FBA3E0FAA3AA
:10074000E0F990000112049AFF3395E0FEEF24D007
:10075000FFEE34FFFE900003F0A3EFF0EE704FEFDA
:1007600014B40700504890077475F003A4C583259E
:10077000F0C5837302078902078D0207910207966D
:1007800002079B0207A10207A7C2A5801ED2A5806F
:100790001A120F9F80151210468010C2A6D2A78091
:1007A0000AD2A6C2A78004C2A6C2A71210D622905F
:1007B0000000EBF0A3EAF0A3E9F090003B74FFF037
:1007C000A3741BF0A3746BF0A37403F0A374E8F09C
:1007D0007BFF7A1B795C120B62EF4E60DD90003B71
:1007E00074FFF0A3741BF0A3746BF0A37403F0A365
:1007F00074E8F07BFF7A1B796E120B62EF4E60DDBE
:1008000090003B74FFF0A3741BF0A3746BF0A3740F
:1008100007F0A374D0F07BFF7A1B7973120B62EFA1
:100820004E60DD90003B74FFF0A3741BF0A3748155
:10083000F0900000E0F9A3E0FAA3E090003EC9F0D8
:10084000A3EAF0A3E9F0900003E0F9A3E0FAA3E043
:10085000900041C9F0A3EAF0A3E9F07B017A0079A6
:100860000612008B90003B74FFF0A3741BF0A3747E
:1008700092F0A37413F0A37488F07B017A007906D8
:10088000120B62EF4E60DD90003B74FFF0A3741B0F
:10089000F0A3746BF0A37403F0A374E8F07BFF7A09
:1008A0001B799C120B62EF4E7F0070027F01EF708C
:1008B000D690003B74FFF0A3741BF0A374DFF0A389
:1008C0007407F0A374D0F07BFF7A1B79BB120B6224
:1008D000EF4E7F0070027F01EF70D690003B74FFF7
:1008E000F0A3741BF0A3746BF0A37407F0A374D08F
:1008F000F07BFF7A1B79EE120B62EF4E7F007002E5
:100900007F01EF70D690003B74FFF0A3741BF0A33F
:10091000746BF0A37407F0A374D0F07BFF7A1C799A
:1009200006120B62EF4E7F0070027F01EF70D67BE4
:10093000FF7A1C792412114B1210D6900060E4F05B
:10094000A304F022900043EBF0A3EAF0A3E9F0A3A4
:10095000E0FBA3E0FAA3E0F912048170030209F0BE
:10096000900043E0FBA3E0FAA3E0F91204817003D6
:100970000209FC900046E0F9A3E0FAA3E0A3C9F065
:10098000A3EAF0A3E9F0900043A3E0FAA3E0F99012
:10099000004CEBF0A3EAF0A3E9F0900049E0FBA3E0
:1009A000E0FAA3E0F9120481FF602690004CE0FB1E
:1009B000A3E0FAA3E0F91204816F701590004A7564
:1009C000F0011205B890004DE475F0011205B880F1
:1009D000C9900049E0FBA3E0FAA3E0F9120481709A
:1009E00002800D900044E475F0011205B802096020
:1009F000900043E0FBA3E0FAA3E0F9227B007A0039
:100A0000790022D2A27F647E001210F1C2A27F641C
:100A10007E001210F1D2A2E4FD7FAE120FF2E4FFCD
:100A2000120FF27F10120FF27F40120FF27F81122D
:100A30000FF27FCF120FF27FA1120FF27FC8120FB9
:100A4000F27FA6120FF27FA8120FF27F3F120FF271
:100A50007FD3120FF2E4FF120FF27FD5120FF27F55
:100A600080120FF27FD9120FF27FF1120FF27FDAAC
:100A7000120FF27F12120FF27FDB120FF27F401281
:100A80000FF27F20120FF27F02120FF27F8D120FF2
:100A9000F27F14120FF27FA4120FF27FA6120FF250
:100AA0007FAF120FF27FAF120FF2121046E4FDFF7C
:100AB0000200039000F3EFF0A3EDF0A3EAF0A3EB44
:100AC000F0E49000FBF09000F9F09000F7E0FF9068
:100AD00000F9E0FEC39F4003020B61C3EF9E14FDCB
:100AE0007F0A1210B89000F5E0FCA3E0FDCFCDCF57
:100AF000CECCCE1204D97C007D0A1204D99000FA23
:100B0000EDF0A3E070309000F7E014FF9000F9E002
:100B1000FEC39F5021A3E070179000F8E0C3138E2E
:100B2000F0A4FF9000F3E02FFFA3E0FD7B208025E1
:100B30009000FB7401F09000F8E0C313FFA3E0FE07
:100B4000EF8EF0A4FF9000F3E02FFFA3E0FD9000F4
:100B5000FAE02430FB120E949000F9E004F0020A4F
:100B6000CA22900038EBF0A3EAF0A3E9F09000402D
:100B7000E4F0A3F0A3F01210D6900038E0FBA3E05D
:100B8000FAA3E0F912114B90003EE0FEA3E0FF7CD7
:100B9000007D0A12052E90003EEEF0A3EFF09000CB
:100BA0003E74FFF5F012056445F060527F0A7E0046
:100BB0001211219000E7E07004A3E0640170DF905F
:100BC000003BE0F9A3E0FAA3E0900046C9F0A3EAF5
:100BD000F0A3E9F07B017A0079A512094490004066
:100BE000EBF0A3EAF0A3E9F0900040E0FBA3E0FA09
:100BF000A3E04A4B60A81210D67E007F012212109B
:100C0000D6E4FEFF229000E7E07002A3E07003024A
:100C10000C9990004674FFF0A3741CF0A37448F084
:100C20007B017A0079A5120944E94A4B606B7B018C
:100C30007A0079A57D2C120DAA9000A2EBF0A3EA10
:100C4000F0A3E9F090FFFF12049AFF3395E0FE78DD
:100C5000627C007D019000A2E0FBA3E0FAA3E0F932
:100C600012045B90003B74FFF0A3741CF0A3747437
:100C7000F0A37407F0A374D0F07BFF7A1C795612AE
:100C80000B62EF4E7F0070027F01EF70D61210D61C
:100C90007B017A00796212114B22787FE4F6D8FD4D
:100CA000758121020CE1021096E493A3F8E493A36A
:100CB0004003F68001F208DFF48029E493A3F8549E
:100CC00007240CC8C333C4540F4420C8834004F421
:100CD00056800146F6DFE4800B0102040810204034
:100CE0008090115EE47E019360BCA3FF543F30E529
:100CF00009541FFEE493A360010ECF54C025E060A9
:100D0000A840B8E493A3FAE493A3F8E493A3C8C576
:100D100082C8CAC583CAF0A3C8C582C8CAC583CA67
:100D2000DFE9DEE780BE9000E9EFF09000EBEBF04A
:100D3000E49000F0F0A3F09000ECE0FF540770089E
:100D4000EF131313541F800A9000ECE01313135495
:100D50001F049000F2F09000F2EDF09000ECE0FF44
:100D60009000F2E0FDC39F50409000E9E0FF1200C8
:100D700003E0FC9000EBE0FFECC39F50249000EDFB
:100D8000E0FBA3E0FAA3E0F9A3E475F00112056427
:100D900085F082F58312049AFF7D01120FF20C8018
:100DA000D29000F2E004F080B222900005EBF0A3B4
:100DB000EAF0A3E9F0A3EBF0A3EAF0A3E9F09000D6
:100DC00008E0FBA3E0FAA3E0F9120481600C9000B4
:100DD00009E475F0011205B880E4900008E0FBA377
:100DE000E0FAA3E0F91204816D700122900005E0A1
:100DF000FBA3E0FAA3E0F9EBC0E0EAC0E0E9C0E061
:100E0000A3E0FBA374FFF5F0120564FAD082D0834F
:100E1000D0E06B7009E5F065827003EA658370BA13
:100E2000FBFAF922C0E0C0F0C083C082C0D075D008
:100E300000C000C006C007309849C2989000E5E4A1
:100E400075F001120564FE74A525F0F58274003E6C
:100E5000F583E599F09000E5E0FEA3E0FF24A4F51A
:100E60008274003EF583E0B40A089000E7E4F0A342
:100E700004F0EF64404E700B9000E5F0A3F0A3F097
:100E8000A304F0D007D006D000D0D0D082D083D039
:100E9000F0D0E032AA07A905AF03E4FCEF24E0FBA1
:100EA000EAD3947F4004E4FA0909AF02AD011200CD
:100EB00003E4FC75F010EBA42CF582E435F0F58327
:100EC000E58224D4F582E5833413120FEB0CECB4E5
:100ED00008E1AF02E904FD120003E4FC75F010EB39
:100EE000A42CF582E435F0F583E58224DCF582E577
:100EF000833413120FEB0CECB408E122900005EFE1
:100F0000F0A3EDF0A3EBF0A3EAF0A3E9F0E4A3F083
:100F1000900007E0FBA3E0FAA3E0F9A3E0F58275F7
:100F2000830012049AFB6027900005E0FFA3E0FD18
:100F3000120E94900005E02408F0E0D39478400766
:100F4000E4F0A3E02402F090000AE004F080C12263
:100F5000A907AA05E4900005F0120003E4FC75F06F
:100F600040EBA424C4F582E5F03419120FE190009F
:100F700005E004F00CECB410E5AF01EA04FD12004A
:100F800003E4FC75F040EBA424E4F582E5F03419A9
:100F9000120FE1900005E004F00CECB410E522E43F
:100FA000FBFD7F10120F507B01E4FD7F20120F50DC
:100FB0007B02E4FD7F30120F507B03E4FD7F401283
:100FC0000F507B04E4FD7F50120F507B05E4FD7F42
:100FD00060120F507BFF7A1179A77D027F20020EED
:100FE000FCF583E5822CF582E43583F583E493FFF9
:100FF0007D01ED6004D2A38002C2A3C2A4E4FEC2BC
:10100000A0EF30E704D2A18002C2A1D2A0EF25E078
:10101000FF0EEEB408E9D2A4D2A3229000E7E0705C
:1010200002A3E060207B017A0079A512114B120621
:1010300014E49000E5F0A3F0FE7F40FD7B017A0010
:1010400079A512057A22E4FCEC24B0FFE4FD120F2E
:10105000F2E4FF120FF27F10120FF2E4FB7D01E4C5
:10106000FF120FF20BEBB480F40CECB408DA22EFB1
:10107000B40A07740D12107A740A309811A899B83E
:10108000130CC2983098FDA899C298B811F63099FF
:10109000FDC299F5992212110B120A0390000374F4
:1010A000FFF0A3741CF0A3743EF07BFF7A1C79352B
:1010B0001207AF12119180FB9000FCEFF0A9057FA1
:1010C000017E00AD0119ED600C9000FCE0FD7C009C
:1010D0001204C780EE227E007F407D007B017A00F3
:1010E00079A512057AE49000E5F0A3F0A3F0A3F04F
:1010F00022EF4E60157D087C07ED1DAA0470011CCF
:101100004A70F6EF1F70EA1E80E7227598505389E7
:101110000F438920758BFD758DFDD28ED2ACD2AF79
:1011200022EF1FAC0670011E4C600A7D027CEFDCD2
:10113000FEDDFC80EC22E4FFFE120481600C0FEF68
:1011400070010E09E970F20A80EF22120481FF603B
:101150000C12119F740129F9E43AFA80EE2243003F
:10116000A20000004200E500004200E7000000E4A9
:10117000FD7F8D120FF27F14120FF27FAF020FF27C
:10118000E4FD7F8D120FF27F10120FF27FAE020F7F
:10119000F29000E7E07002A3E06003120614228FD1
:1011A000993099FDC2992257463234000000000060
:1011B00000000000002F00000000070007000014DE
:1011C0007F147F1400242A7F2A12006264081323EC
:1011D00000364955225000000503000000001C2283
:1011E0004100000041221C000014083E08140008C1
:1011F000083E0808000000A0600000080808080871
:10120000000060600000002010080402003E514908
:10121000453E0000427F40000042615149460021A6
:1012200041454B31001814127F10002745454539C0
:10123000003C4A494930000171090503003649491B
:10124000493600064949291E0000363600000000D4
:10125000563600000008142241000014141414141F
:1012600000004122140800020151090600324959C8
:10127000513E007C1211127C007F49494936003EE4
:1012800041414122007F4141221C007F494949419F
:10129000007F09090901003E4149497A007F080899
:1012A000087F0000417F4100002040413F01007F56
:1012B00008142241007F40404040007F020C027F22
:1012C000007F0408107F003E4141413E007F090934
:1012D0000906003E4151215E007F0919294600465A
:1012E000494949310001017F0101003F4040403F31
:1012F000001F2040201F003F4038403F006314087B
:101300001463000708700807006151494543000055
:101310007F41410000552A552A55000041417F0078
:10132000000402010204004040404040000001026D
:101330000400002054545478007F48444438003856
:101340004444442000384444487F003854545418DE
:1013500000087E0901020018A4A4A47C007F0804F0
:1013600004780000447D4000004080847D00007FC0
:10137000102844000000417F4000007C04180478DD
:10138000007C0804047800384444443800FC2424D9
:1013900024180018242418FC007C080404080048C1
:1013A0005454542000043F444020003C4040207CE2
:1013B000001C2040201C003C4030403C00442810D1
:1013C0002844001CA0A0A07C004464544C44141485
:1013D00014141414000000000000000000000000BD
:1013E00000000000000000F80000000000000033D2
:1013F0003000000000100C06100C06000000000079
:101400000000000040C07840C0784000043F040461
:101410003F040400007088FC08300000001820FF22
:10142000211E0000F008F000E018000000211C035D
:101430001E211E0000F00888700000001E212324D9
:101440001927211010160E000000000000000000F7
:1014500000000000000000E0180402000000000787
:101460001820400000020418E0000000004020188E
:1014700007000000404080F0804040000202010F61
:1014800001020200000000F0000000000101011F45
:1014900001010100000000000000000080B07000A9
:1014A0000000000000000000000000000001010139
:1014B00001010101000000000000000000303000C8
:1014C00000000000000000008060180400601806A2
:1014D0000100000000E010080810E000000F1020DC
:1014E00020100F00001010F8000000000020203F26
:1014F00020200000007008080888700000302824B0
:101500002221300000300888884830000018202050
:1015100020110E000000C02010F800000007042475
:10152000243F240000F808888808080000192120BA
:1015300020110E0000E0108888180000000F112014
:1015400020110E0000380808C83808000000003FCD
:10155000000000000070880808887000001C22212C
:1015600021221C0000E010080810E00000003122D9
:1015700022110F00000000C0C00000000000003079
:1015800030000000000000800000000000008060CB
:10159000000000000000804020100800000102044C
:1015A0000810200040404040404040000404040433
:1015B00004040400000810204080000000201008EF
:1015C00004020100007048080808F0000000003024
:1015D00036010000C030C828E810E00007182724B2
:1015E00023140B000000C038E0000000203C230260
:1015F0000227382008F8888888700000203F2020C3
:1016000020110E00C03008080808380007182020F4
:101610002010080008F808080810E000203F2020EB
:1016200020100F0008F88888E8081000203F2020CC
:101630002320180008F88888E8081000203F2000C0
:1016400003000000C03008080838000007182020F8
:10165000221E020008F808000008F808203F2101B7
:1016600001213F20000808F8080800000020203F62
:101670002020000000000808F8080800C0808080D2
:101680007F00000008F888C028180800203F2001CB
:101690002638200008F8080000000000203F202025
:1016A0002020300008F8F800F8F80800203F003F3C
:1016B000003F200008F830C00008F808203F200054
:1016C00007183F00E01008080810E0000F10202065
:1016D00020100F0008F808080808F000203F21013A
:1016E00001010000E01008080810E0000F18242491
:1016F00038504F0008F8888888887000203F200004
:10170000030C3020007088080808380000382021B9
:1017100021221C00180808F8080818000000203FC3
:101720002000000008F808000008F808001F20202A
:1017300020201F000878880000C8380800000738FB
:101740000E010000F80800F80008F800033C07004C
:10175000073C0300081868808068180820302C03B4
:10176000032C30200838C800C83808000000203F8B
:101770002000000010080808C8380800203826217A
:1017800020201800000000FE020202000000007F7E
:1017900040404000000C30C000000000000000018C
:1017A0000638C00000020202FE0000000040404077
:1017B0007F0000000000040202020400000000009C
:1017C0000000000000000000000000008080808019
:1017D0008080808000020204000000000000000001
:1017E000000000000000808080800000001924229A
:1017F00022223F2008F8008080000000003F1120D6
:1018000020110E000000008080800000000E1120DA
:1018100020201100000000808088F800000E1120B8
:1018200020103F200000808080800000001F2222C6
:1018300022221300008080F0888888180020203F32
:10184000202000000000808080808000006B949445
:101850009493600008F8008080800000203F210001
:1018600000203F2000809898000000000020203FCA
:1018700020200000000000809898000000C08080B8
:10188000807F000008F8000080808000203F240254
:101890002D302000000808F8000000000020203F44
:1018A000202000008080808080808000203F2000F9
:1018B0003F20003F8080008080800000203F21008A
:1018C00000203F200000808080800000001F20203A
:1018D00020201F00808000808000000080FFA12069
:1018E00020110E000000008080808000000E11207A
:1018F00020A0FF80808080008080800020203F2109
:1019000020000100000080808080800000332424BB
:1019100024241900008080E0808000000000001F67
:10192000202000008080000000808000001F202018
:1019300020103F20808080000080808000010E30D9
:101940000806010080800080008080800F300C033A
:101950000C300F0000808000808080000020312E3D
:101960000E312000808080000080808080818E7019
:101970001806010000808080808080000021302CCB
:101980002221300000000000807C020200000000E4
:10199000003F404000000000FF0000000000000089
:1019A000FF0000000002027C800000000040403F79
:1019B0000000000000060101020204040000000013
:1019C0000000000020202020202020FF20202020B8
:1019D00020202000000000000000000000000000A7
:1019E0000000000080804020100C0300030C102039
:1019F00040808000000000000000000000000000A7
:101A000000000000000101FD55555755555555FD85
:101A100001010000000000000000000000000000C4
:101A200000000000809088454F55252525554D45DF
:101A30008080800000000000000000000000000026
:101A4000000000001010101010FF1010F010111600
:101A5000D010100000000000000000000000000096
:101A60000000000080402018064120103F44424101
:101A7000404078000000000000000000000000006E
:101A800000000000001088864040202F509008027F
:101A9000040800000000000000000000000000003A
:101AA00000000000010100FF555555557F55555563
:101AB0005541000000000000000000000000000090
:101AC000000000002424A4FEA3220022CC0000FF7A
:101AD0000000000000000000000000000000000006
:101AE00000000000080601FF00010404040404FFD4
:101AF00002020200000000000000000000000000E0
:101B000000000000101010FF109008888888FF88DF
:101B100088880800000000000000000000000000AD
:101B2000000000000444827F01808040432C102884
:101B3000468180000000000000000000000000005E
:101B4000000000003139322E3136382E3000524537
:101B500043563A746573742D6170700041542B4D77
:101B6000515454434C45414E0D0A004F4B004154D3
:101B70000D0A0041542B43574D4F44453D300D0A4B
:101B80000041542B43574A41503D25732C25730D7A
:101B90000A002B43574A41503A312C0041542B4DF7
:101BA0005154544C4F4E47434C49454E5449443D83
:101BB00057462D54455354320D0A0041542B4D5174
:101BC0005454434F4E4E3D62726F6B65722E656D7D
:101BD00071782E696F2C313838332C300D0A004D56
:101BE000515454434F4E4E45435445443A0041549A
:101BF0002B4D5154545355423D746573742D61708F
:101C0000702C300D0A0041542B4D51545450554204
:101C10005241573D746573742D772C33322C302C20
:101C2000300D0A004D5154545F436F6E6E656374FE
:101C300065640D0A0044582D534D41525400534DD4
:101C40004152544036303100524543563A74657320
:101C5000742D6170700041542B4D515454505542B5
:101C60005241573D746573742D772C33322C302CD0
:071C7000300D0A004F4B008C
:00000001FF

View File

@@ -0,0 +1,7 @@
".\Objects\STARTUP.obj",
".\Objects\main.obj",
".\Objects\UART.obj",
".\Objects\oled.obj"
TO ".\Objects\51Project"
PRINT(".\Listings\51Project.map")

View File

@@ -0,0 +1,198 @@
$NOMOD51
;------------------------------------------------------------------------------
; This file is part of the C51 Compiler package
; Copyright (c) 1988-2005 Keil Elektronik GmbH and Keil Software, Inc.
; Version 8.01
;
; *** <<< Use Configuration Wizard in Context Menu >>> ***
;------------------------------------------------------------------------------
; STARTUP.A51: This code is executed after processor reset.
;
; To translate this file use A51 with the following invocation:
;
; A51 STARTUP.A51
;
; To link the modified STARTUP.OBJ file to your application use the following
; Lx51 invocation:
;
; Lx51 your object file list, STARTUP.OBJ controls
;
;------------------------------------------------------------------------------
;
; User-defined <h> Power-On Initialization of Memory
;
; With the following EQU statements the initialization of memory
; at processor reset can be defined:
;
; <o> IDATALEN: IDATA memory size <0x0-0x100>
; <i> Note: The absolute start-address of IDATA memory is always 0
; <i> The IDATA space overlaps physically the DATA and BIT areas.
IDATALEN EQU 80H
;
; <o> XDATASTART: XDATA memory start address <0x0-0xFFFF>
; <i> The absolute start address of XDATA memory
XDATASTART EQU 0
;
; <o> XDATALEN: XDATA memory size <0x0-0xFFFF>
; <i> The length of XDATA memory in bytes.
XDATALEN EQU 0
;
; <o> PDATASTART: PDATA memory start address <0x0-0xFFFF>
; <i> The absolute start address of PDATA memory
PDATASTART EQU 0H
;
; <o> PDATALEN: PDATA memory size <0x0-0xFF>
; <i> The length of PDATA memory in bytes.
PDATALEN EQU 0H
;
;</h>
;------------------------------------------------------------------------------
;
;<h> Reentrant Stack Initialization
;
; The following EQU statements define the stack pointer for reentrant
; functions and initialized it:
;
; <h> Stack Space for reentrant functions in the SMALL model.
; <q> IBPSTACK: Enable SMALL model reentrant stack
; <i> Stack space for reentrant functions in the SMALL model.
IBPSTACK EQU 0 ; set to 1 if small reentrant is used.
; <o> IBPSTACKTOP: End address of SMALL model stack <0x0-0xFF>
; <i> Set the top of the stack to the highest location.
IBPSTACKTOP EQU 0xFF +1 ; default 0FFH+1
; </h>
;
; <h> Stack Space for reentrant functions in the LARGE model.
; <q> XBPSTACK: Enable LARGE model reentrant stack
; <i> Stack space for reentrant functions in the LARGE model.
XBPSTACK EQU 0 ; set to 1 if large reentrant is used.
; <o> XBPSTACKTOP: End address of LARGE model stack <0x0-0xFFFF>
; <i> Set the top of the stack to the highest location.
XBPSTACKTOP EQU 0xFFFF +1 ; default 0FFFFH+1
; </h>
;
; <h> Stack Space for reentrant functions in the COMPACT model.
; <q> PBPSTACK: Enable COMPACT model reentrant stack
; <i> Stack space for reentrant functions in the COMPACT model.
PBPSTACK EQU 0 ; set to 1 if compact reentrant is used.
;
; <o> PBPSTACKTOP: End address of COMPACT model stack <0x0-0xFFFF>
; <i> Set the top of the stack to the highest location.
PBPSTACKTOP EQU 0xFF +1 ; default 0FFH+1
; </h>
;</h>
;------------------------------------------------------------------------------
;
; Memory Page for Using the Compact Model with 64 KByte xdata RAM
; <e>Compact Model Page Definition
;
; <i>Define the XDATA page used for PDATA variables.
; <i>PPAGE must conform with the PPAGE set in the linker invocation.
;
; Enable pdata memory page initalization
PPAGEENABLE EQU 0 ; set to 1 if pdata object are used.
;
; <o> PPAGE number <0x0-0xFF>
; <i> uppermost 256-byte address of the page used for PDATA variables.
PPAGE EQU 0
;
; <o> SFR address which supplies uppermost address byte <0x0-0xFF>
; <i> most 8051 variants use P2 as uppermost address byte
PPAGE_SFR DATA 0A0H
;
; </e>
;------------------------------------------------------------------------------
; Standard SFR Symbols
ACC DATA 0E0H
B DATA 0F0H
SP DATA 81H
DPL DATA 82H
DPH DATA 83H
NAME ?C_STARTUP
?C_C51STARTUP SEGMENT CODE
?STACK SEGMENT IDATA
RSEG ?STACK
DS 1
EXTRN CODE (?C_START)
PUBLIC ?C_STARTUP
CSEG AT 0
?C_STARTUP: LJMP STARTUP1
RSEG ?C_C51STARTUP
STARTUP1:
IF IDATALEN <> 0
MOV R0,#IDATALEN - 1
CLR A
IDATALOOP: MOV @R0,A
DJNZ R0,IDATALOOP
ENDIF
IF XDATALEN <> 0
MOV DPTR,#XDATASTART
MOV R7,#LOW (XDATALEN)
IF (LOW (XDATALEN)) <> 0
MOV R6,#(HIGH (XDATALEN)) +1
ELSE
MOV R6,#HIGH (XDATALEN)
ENDIF
CLR A
XDATALOOP: MOVX @DPTR,A
INC DPTR
DJNZ R7,XDATALOOP
DJNZ R6,XDATALOOP
ENDIF
IF PPAGEENABLE <> 0
MOV PPAGE_SFR,#PPAGE
ENDIF
IF PDATALEN <> 0
MOV R0,#LOW (PDATASTART)
MOV R7,#LOW (PDATALEN)
CLR A
PDATALOOP: MOVX @R0,A
INC R0
DJNZ R7,PDATALOOP
ENDIF
IF IBPSTACK <> 0
EXTRN DATA (?C_IBP)
MOV ?C_IBP,#LOW IBPSTACKTOP
ENDIF
IF XBPSTACK <> 0
EXTRN DATA (?C_XBP)
MOV ?C_XBP,#HIGH XBPSTACKTOP
MOV ?C_XBP+1,#LOW XBPSTACKTOP
ENDIF
IF PBPSTACK <> 0
EXTRN DATA (?C_PBP)
MOV ?C_PBP,#LOW PBPSTACKTOP
ENDIF
MOV SP,#?STACK-1
; This code is required if you use L51_BANK.A51 with Banking Mode 4
;<h> Code Banking
; <q> Select Bank 0 for L51_BANK.A51 Mode 4
#if 0
; <i> Initialize bank mechanism to code bank 0 when using L51_BANK.A51 with Banking Mode 4.
EXTRN CODE (?B_SWITCH0)
CALL ?B_SWITCH0 ; init bank mechanism to code bank 0
#endif
;</h>
LJMP ?C_START
END

View File

@@ -0,0 +1,180 @@
#include "UART.h"
#include <string.h>
#include "oled.h"
#include <stdio.h>
// 用于存储接收数据的数组
unsigned char rxBuffer[ARRAY_SIZE];
unsigned int rxIndex = 0; // 接收数据的索引
unsigned int rx_flag=0;
extern unsigned int CONNECT_FLEG;//连接标志
// 初始化串口
void Serial_Init() {
SCON = 0x50; // 设置为模式18位数据可变波特率
TMOD &= 0x0F; // 清除定时器1模式位
TMOD |= 0x20; // 设置定时器1为8位自动重装模式
TH1 = TL1 = 256 - (11059200 / 12 / 32) / BAUDRATE; // 设置波特率
TR1 = 1; // 启动定时器1
ES = 1; // 开启串口中断
EA = 1; // 开启全局中断
}
void Delay(unsigned int xms)
{
unsigned char i, j;
while(xms--)
{
i = 2;
j = 239;
do
{
while (--j);
} while (--i);
}
}
void buff_memset(void)
{
memset(rxBuffer,0,64);
rxIndex=0;
rx_flag = 0;
}
unsigned int WIFI_CheckAck(char* src, char* dest, int timeout)
{
char *check = NULL;
//清空缓冲
buff_memset();
UART_sentString(src);
timeout=timeout/10;//10ms处理一次
while(timeout--)
{
Delay(10);//延时1ms
if(rx_flag==1)
{
check = strstr(rxBuffer,dest);
if(check != NULL)
{
buff_memset();//数据有误 清空
return 1;
}
}
}
buff_memset();//数据有误 清空
return 0;//超时
}
sbit LED = P2^5;
sbit motor1 = P2^6;
sbit motor2 = P2^7;
void CONNECT_TX_Control(void)
{
char *ptr = NULL;
int number;
if (CONNECT_FLEG)
{
if(rx_flag)
{
if(strstr(rxBuffer,"192.168.0")!=NULL)
{
ptr = strrchr((char*)rxBuffer,','); // 以最后一个,为准后面为数据
if(strlen(ptr)-3==1) //判断接收到为一位数据 ,*\r\n
{
number = ptr[1]-'0';
switch(number)
{
case 1: LED = 0 ; break;
case 2: LED = 1; break;
case 3:OLED_Show(); break;
case 4:OLED_Clear(); break;
case 5:motor1=0;motor2=1; break;
case 6:motor1=1;motor2=0; break;
case 7:motor1=0;motor2=0 ; break;
default: return;
}
}
}
else if(strstr((char *)rxBuffer,"RECV:test-app")!=NULL)
{
ptr = strrchr((char*)rxBuffer,','); // 以最后一个,为准后面为数据
if(strlen(ptr)-3==1) //判断接收到为一位数据 ,*\r\n
{
number = ptr[1]-'0';
switch(number)
{
case 1: LED = 0 ; break;
case 2: LED = 1; break;
case 3:OLED_Show(); break;
case 4:OLED_Clear(); break;
case 5:motor1=0;motor2=1; break;
case 6:motor1=1;motor2=0; break;
case 7:motor1=0;motor2=0 ; break;
default: return;
}
}
}
}
buff_memset();//数据有误 清空
}
}
void CONNECT_TO_MQTT(unsigned char* id,unsigned char *password)
{
unsigned char buf[50];
while(!WIFI_CheckAck("AT+MQTTCLEAN\r\n","OK",1000));//淇濊瘉姣忔<E5A7A3> 杩炴帴鍓嶆柇寮€鏈嶅姟鍣<E5A79F>
//while(!WIFI_CheckAck("AT+RESTORE\r\n","OK",5000));
while(!WIFI_CheckAck("AT\r\n","OK",1000));
while(!WIFI_CheckAck("AT+CWMODE=0\r\n","OK",2000)); //STA妯″紡
sprintf((char *)buf,"AT+CWJAP=%s,%s\r\n",id,password);
while(!WIFI_CheckAck((char *)buf,"+CWJAP:1,",5000));//杩炴帴鍒癢IFI
while(!WIFI_CheckAck("AT+MQTTLONGCLIENTID=WF-TEST2\r\n","OK",1000)!=0);//閰嶇疆 MQTT 瀹㈡埛绔<E59F9B>墍闇€鐨勫<E990A8>鎴风<E98EB4> ID銆佺敤鎴峰悕鍜屽瘑鐮<E79891><> MQTT 鏈嶅姟鍣ㄦ棤鐢ㄦ埛鍚嶅拰瀵嗙爜楠岃瘉锛屽垯妯″潡鍙<E6BDA1>烦杩囩敤鎴峰悕鍜屽瘑鐮佺殑杈撳叆
while(!WIFI_CheckAck("AT+MQTTCONN=broker.emqx.io,1883,0\r\n","MQTTCONNECTED:",2000)!=0);//杩炴帴MQTT 鏈嶅姟鍣<E5A79F><>彛鍙<E5BD9B><>惁鑷<E68381>姩閲嶈繛
while(!WIFI_CheckAck("AT+MQTTSUB=test-app,0\r\n","OK",2000)!=0);//璁㈤槄涓婚<E6B693> test-app涓婚<E6B693><EFBFBD> QOS鏈嶅姟璐ㄩ噺
while(!WIFI_CheckAck("AT+MQTTPUBRAW=test-w,32,0,0\r\n","OK",2000)!=0);//鍙戝竷涓婚<E6B693> test-wf涓婚<E6B693><EFBFBD> 10 娑堟伅闀垮害 0 涓篞OS 0 retain 鏈嶅姟鍣ㄦ槸鍚︿负璇ヤ富棰樺瓨鍌ㄤ竴鏉℃渶鏂扮殑淇濈暀娑堟伅
UART_sentString("MQTT_Connected\r\n");
buff_memset();
CONNECT_FLEG = 1;
}
void UART_SendByte(unsigned char Byte)
{
SBUF=Byte;
while(!TI);
TI=0;
}
void UART_sentString(char *str)
{
while(*str){
UART_SendByte(*str);
str++;
}
}
// 串口接收中断服务程序
void Serial_ISR() interrupt 4 {
if (RI) {
RI = 0; // 清除接收中断标志
rxBuffer[rxIndex++] = SBUF; // 存储接收到的数据
if(rxBuffer[rxIndex-1]=='\n')
{
rx_flag=1;
}
if(rxIndex==64)
{
rxIndex=0;
rx_flag=1;
}
}
}

View File

@@ -0,0 +1,15 @@
#ifndef _UART_H_
#define _UART_H_
#include <REGX52.H> // STC89C52RC的寄存器定义
#define BAUDRATE 9600 // 波特率
#define ARRAY_SIZE 64 // 数组大小
void Serial_Init();
void Uart_send_String();
void UART_SendByte(unsigned char Byte);
void UART_sentString(char *str);
void Delay(unsigned int xms);
unsigned int WIFI_CheckAck(char* src, char* dest, int timeout);
void CONNECT_TO_MQTT(unsigned char* id,unsigned char *password);
void CONNECT_TX_Control(void);
#endif

View File

@@ -0,0 +1,77 @@
//**** 澹版槑 ********************************************************************
/*******************************************************************************
* 涓嬮潰鏉ヨ嚜浜掕仈寮€婧愮▼搴忥紝鐢辨繁鍦冲競澶у<E6BEB6>榫欓泙绉戞妧鏈夐檺鍏<E6AABA>徃鏀堕泦
* 鏂逛究鐢ㄦ埛鍙傝€冨<E282AC>涔狅紝鏈<E7B49D>叕鍙镐笉鎻愪緵浠讳綍鎶€鏈<E282AC>敮鎸<E695AE>
* 绋嬪簭浠呬緵娴嬭瘯鍙傝€冿紝涓嶈兘搴旂敤鍦ㄥ疄闄呭伐绋嬩腑锛屼笉涓€瀹氳兘閫氳繃缂栬瘧
* 鍏<>徃缃戠珯 http://www.szdx-smart.com/
* 娣樺疂缃戝潃 https://shop184598174.taobao.com/?spm=a1z10.5-c-s.w12096189-21564973333.3.547b1176WCCDxR&scene=taobao_shop
*******************************************************************************/
/********************************************************************
* 鏂囦欢鍚<E6ACA2><> WF24-MQTT鍗忚<E98D97>搴旂敤
* 鎻忚堪 : 璇ユ枃浠跺疄鐜伴€氳繃WF24鍒╃敤缁欏崟鐗囨満鍙戞暟鎹<E69A9F>帶鍒禠ED+OLED+鐢垫満銆<E6BA80>
***********************************************************************/
/*
Name: MQTT
Created: 2024/8/21
Author: WAM
*/
#include <REGX52.H> // STC89C52RC的寄存器定义
#include "UART.h"
#include "string.h"
#include "stdio.h"
#include "oled.h"
extern unsigned int rxIndex;
extern unsigned char rxBuffer[ARRAY_SIZE];
extern unsigned int rx_flag;
unsigned int CONNECT_FLEG;//连接标志
// 主函数
unsigned char conver[64];
char *ptr = NULL;
void MQTT_CONVER(void);
void MQTT_CONTROL(void);
void main() {
Serial_Init(); // 初始化串口
OLED_Init();
CONNECT_TO_MQTT("DX-SMART","SMART@601");
while (1) {
// 主循环,可以添加其他任务
MQTT_CONTROL();
}
}
void TCP_UDP_CONVER(void)
{
if (rx_flag)
{
UART_sentString(rxBuffer);
CONNECT_TX_Control();
rxIndex = 0; // 重置索引,准备下一次接收
memset(rxBuffer,0,ARRAY_SIZE); //清空缓冲区
}
}
void MQTT_CONVER(void)
{
if (rx_flag)
{
if(strstr(rxBuffer,"RECV:test-app")!=NULL)
{
ptr = strrchr(rxBuffer,',');
memcpy(conver,ptr,*(ptr-1));
while(!WIFI_CheckAck("AT+MQTTPUBRAW=test-w,32,0,0\r\n","OK",2000)!=0);
buff_memset();//数据有误 清空
UART_sentString(conver);
}
}
}
void MQTT_CONTROL(void)
{
if (rx_flag)
{
CONNECT_TX_Control();
}
}

View File

@@ -0,0 +1,249 @@
#include "oled.h"
#include "oledfont.h"
void delay_ms(unsigned int ms)
{
unsigned int a;
while(ms)
{
a=1800;
while(a--);
ms--;
}
return;
}
void OLED_Show()
{
OLED_ShowCHinese(16,0,0);
OLED_ShowCHinese(32,0,1);
OLED_ShowCHinese(48,0,2);
OLED_ShowCHinese(64,0,3);
OLED_ShowCHinese(80,0,4);
OLED_ShowCHinese(96,0,5);
OLED_ShowString(32,2,"WF24");
}
#if OLED_MODE==1
//向SSD1106写入一个字节。
//dat:要写入的数据/命令
//cmd:数据/命令标志 0,表示命令;1,表示数据;
void OLED_WR_Byte(u8 dat,u8 cmd)
{
DATAOUT(dat);
if(cmd)
OLED_DC_Set();
else
OLED_DC_Clr();
OLED_CS_Clr();
OLED_WR_Clr();
OLED_WR_Set();
OLED_CS_Set();
OLED_DC_Set();
}
#else
//向SSD1306写入一个字节。
//dat:要写入的数据/命令
//cmd:数据/命令标志 0,表示命令;1,表示数据;
void OLED_WR_Byte(u8 dat,u8 cmd)
{
u8 i;
if(cmd)
OLED_DC_Set();
else
OLED_DC_Clr();
OLED_CS_Clr();
for(i=0;i<8;i++)
{
OLED_SCLK_Clr();
if(dat&0x80)
{
OLED_SDIN_Set();
}
else
OLED_SDIN_Clr();
OLED_SCLK_Set();
dat<<=1;
}
OLED_CS_Set();
OLED_DC_Set();
}
#endif
void OLED_Set_Pos(unsigned char x, unsigned char y)
{
OLED_WR_Byte(0xb0+y,OLED_CMD);
OLED_WR_Byte(((x&0xf0)>>4)|0x10,OLED_CMD);
OLED_WR_Byte((x&0x0f)|0x01,OLED_CMD);
}
//开启OLED显示
void OLED_Display_On(void)
{
OLED_WR_Byte(0X8D,OLED_CMD); //SET DCDC命令
OLED_WR_Byte(0X14,OLED_CMD); //DCDC ON
OLED_WR_Byte(0XAF,OLED_CMD); //DISPLAY ON
}
//关闭OLED显示
void OLED_Display_Off(void)
{
OLED_WR_Byte(0X8D,OLED_CMD); //SET DCDC命令
OLED_WR_Byte(0X10,OLED_CMD); //DCDC OFF
OLED_WR_Byte(0XAE,OLED_CMD); //DISPLAY OFF
}
//清屏函数,清完屏,整个屏幕是黑色的!和没点亮一样!!!
void OLED_Clear(void)
{
u8 i,n;
for(i=0;i<8;i++)
{
OLED_WR_Byte (0xb0+i,OLED_CMD); //设置页地址0~7
OLED_WR_Byte (0x00,OLED_CMD); //设置显示位置—列低地址
OLED_WR_Byte (0x10,OLED_CMD); //设置显示位置—列高地址
for(n=0;n<128;n++)OLED_WR_Byte(0,OLED_DATA);
} //更新显示
}
//在指定位置显示一个字符,包括部分字符
//x:0~127
//y:0~63
//mode:0,反白显示;1,正常显示
//size:选择字体 16/12
void OLED_ShowChar(u8 x,u8 y,u8 chr)
{
unsigned char c=0,i=0;
c=chr-' ';//得到偏移后的值
if(x>Max_Column-1){x=0;y=y+2;}
if(SIZE ==16)
{
OLED_Set_Pos(x,y);
for(i=0;i<8;i++)
OLED_WR_Byte(F8X16[c*16+i],OLED_DATA);
OLED_Set_Pos(x,y+1);
for(i=0;i<8;i++)
OLED_WR_Byte(F8X16[c*16+i+8],OLED_DATA);
}
}
//m^n函数
u32 oled_pow(u8 m,u8 n)
{
u32 result=1;
while(n--)result*=m;
return result;
}
//显示2个数字
//x,y :起点坐标
//len :数字的位数
//size:字体大小
//mode:模式 0,填充模式;1,叠加模式
//num:数值(0~4294967295);
void OLED_ShowNum(u8 x,u8 y,u32 num,u8 len,u8 size2)
{
u8 t,temp;
u8 enshow=0;
for(t=0;t<len;t++)
{
temp=(num/oled_pow(10,len-t-1))%10;
if(enshow==0&&t<(len-1))
{
if(temp==0)
{
OLED_ShowChar(x+(size2/2)*t,y,' ');
continue;
}else enshow=1;
}
OLED_ShowChar(x+(size2/2)*t,y,temp+'0');
}
}
//显示一个字符号串
void OLED_ShowString(u8 x,u8 y,u8 *chr)
{
unsigned char j=0;
while (chr[j]!='\0')
{ OLED_ShowChar(x,y,chr[j]);
x+=8;
if(x>120){x=0;y+=2;}
j++;
}
}
//显示汉字
void OLED_ShowCHinese(u8 x,u8 y,u8 no)
{
u8 t,adder=0;
OLED_Set_Pos(x,y);
for(t=0;t<16;t++)
{
OLED_WR_Byte(Hzk[2*no][t],OLED_DATA);
adder+=1;
}
OLED_Set_Pos(x,y+1);
for(t=0;t<16;t++)
{
OLED_WR_Byte(Hzk[2*no+1][t],OLED_DATA);
adder+=1;
}
}
/***********功能描述显示显示BMP图片128×64起始点坐标(x,y),x的范围0127y为页的范围07*****************/
void OLED_DrawBMP(unsigned char x0, unsigned char y0,unsigned char x1, unsigned char y1,unsigned char BMP[])
{
unsigned int j=0;
unsigned char x,y;
if(y1%8==0) y=y1/8;
else y=y1/8+1;
for(y=y0;y<y1;y++)
{
OLED_Set_Pos(x0,y);
for(x=x0;x<x1;x++)
{
OLED_WR_Byte(BMP[j++],OLED_DATA);
}
}
}
//初始化SSD1306
void OLED_Init(void)
{
OLED_RST_Set();
delay_ms(100);
OLED_RST_Clr();
delay_ms(100);
OLED_RST_Set();
OLED_WR_Byte(0xAE,OLED_CMD);//--turn off oled panel
OLED_WR_Byte(0x00,OLED_CMD);//---set low column address
OLED_WR_Byte(0x10,OLED_CMD);//---set high column address
OLED_WR_Byte(0x40,OLED_CMD);//--set start line address Set Mapping RAM Display Start Line (0x00~0x3F)
OLED_WR_Byte(0x81,OLED_CMD);//--set contrast control register
OLED_WR_Byte(0xCF,OLED_CMD); // Set SEG Output Current Brightness
OLED_WR_Byte(0xA1,OLED_CMD);//--Set SEG/Column Mapping 0xa0左右反置 0xa1正常
OLED_WR_Byte(0xC8,OLED_CMD);//Set COM/Row Scan Direction 0xc0上下反置 0xc8正常
OLED_WR_Byte(0xA6,OLED_CMD);//--set normal display
OLED_WR_Byte(0xA8,OLED_CMD);//--set multiplex ratio(1 to 64)
OLED_WR_Byte(0x3f,OLED_CMD);//--1/64 duty
OLED_WR_Byte(0xD3,OLED_CMD);//-set display offset Shift Mapping RAM Counter (0x00~0x3F)
OLED_WR_Byte(0x00,OLED_CMD);//-not offset
OLED_WR_Byte(0xd5,OLED_CMD);//--set display clock divide ratio/oscillator frequency
OLED_WR_Byte(0x80,OLED_CMD);//--set divide ratio, Set Clock as 100 Frames/Sec
OLED_WR_Byte(0xD9,OLED_CMD);//--set pre-charge period
OLED_WR_Byte(0xF1,OLED_CMD);//Set Pre-Charge as 15 Clocks & Discharge as 1 Clock
OLED_WR_Byte(0xDA,OLED_CMD);//--set com pins hardware configuration
OLED_WR_Byte(0x12,OLED_CMD);
OLED_WR_Byte(0xDB,OLED_CMD);//--set vcomh
OLED_WR_Byte(0x40,OLED_CMD);//Set VCOM Deselect Level
OLED_WR_Byte(0x20,OLED_CMD);//-Set Page Addressing Mode (0x00/0x01/0x02)
OLED_WR_Byte(0x02,OLED_CMD);//
OLED_WR_Byte(0x8D,OLED_CMD);//--set Charge Pump enable/disable
OLED_WR_Byte(0x14,OLED_CMD);//--set(0x10) disable
OLED_WR_Byte(0xA4,OLED_CMD);// Disable Entire Display On (0xa4/0xa5)
OLED_WR_Byte(0xA6,OLED_CMD);// Disable Inverse Display On (0xa6/a7)
OLED_WR_Byte(0xAF,OLED_CMD);//--turn on oled panel
OLED_WR_Byte(0xAF,OLED_CMD); /*display ON*/
OLED_Clear();
OLED_Set_Pos(0,0);
}

View File

@@ -0,0 +1,73 @@
#ifndef _OLED_H_
#define _OLED_H_
#include <REGX52.H>
#define u8 unsigned char
#define u32 unsigned int
#define OLED_CMD 0 //写命令
#define OLED_DATA 1 //写数据
#define OLED_MODE 0
sbit OLED_CS=P2^4; //片选
sbit OLED_RST =P2^2;//复位
sbit OLED_DC =P2^3;//数据/命令控制
sbit OLED_SCL=P2^0;//时钟 D0SCLK
sbit OLED_SDIN=P2^1;//D1MOSI 数据
#define OLED_CS_Clr() OLED_CS=0
#define OLED_CS_Set() OLED_CS=1
#define OLED_RST_Clr() OLED_RST=0
#define OLED_RST_Set() OLED_RST=1
#define OLED_DC_Clr() OLED_DC=0
#define OLED_DC_Set() OLED_DC=1
#define OLED_SCLK_Clr() OLED_SCL=0
#define OLED_SCLK_Set() OLED_SCL=1
#define OLED_SDIN_Clr() OLED_SDIN=0
#define OLED_SDIN_Set() OLED_SDIN=1
//OLED模式设置
//0:4线串行模式
//1:并行8080模式
#define SIZE 16
#define XLevelL 0x02
#define XLevelH 0x10
#define Max_Column 128
#define Max_Row 64
#define Brightness 0xFF
#define X_WIDTH 128
#define Y_WIDTH 64
//-----------------OLED端口定义----------------
void delay_ms(unsigned int ms);
void OLED_Show();
//OLED控制用函数
void OLED_WR_Byte(u8 dat,u8 cmd);
void OLED_Display_On(void);
void OLED_Display_Off(void);
void OLED_Init(void);
void OLED_Clear(void);
void OLED_DrawPoint(u8 x,u8 y,u8 t);
void OLED_Fill(u8 x1,u8 y1,u8 x2,u8 y2,u8 dot);
void OLED_ShowChar(u8 x,u8 y,u8 chr);
void OLED_ShowNum(u8 x,u8 y,u32 num,u8 len,u8 size2);
void OLED_ShowString(u8 x,u8 y, u8 *p);
void OLED_Set_Pos(unsigned char x, unsigned char y);
void OLED_ShowCHinese(u8 x,u8 y,u8 no);
void OLED_DrawBMP(unsigned char x0, unsigned char y0,unsigned char x1, unsigned char y1,unsigned char BMP[]);
#endif

View File

@@ -0,0 +1,225 @@
//#endif /*_OLEDFONT_H*/
#ifndef __OLEDFONT_H
#define __OLEDFONT_H
//常用ASCII表
//偏移量32
//ASCII字符集
//偏移量32
//大小:12*6
/************************************6*8的点阵************************************/
const unsigned char code 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
};
/****************************************8*16的点阵************************************/
const unsigned char code F8X16[]=
{
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,// 0
0x00,0x00,0x00,0xF8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x33,0x30,0x00,0x00,0x00,//! 1
0x00,0x10,0x0C,0x06,0x10,0x0C,0x06,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//" 2
0x40,0xC0,0x78,0x40,0xC0,0x78,0x40,0x00,0x04,0x3F,0x04,0x04,0x3F,0x04,0x04,0x00,//# 3
0x00,0x70,0x88,0xFC,0x08,0x30,0x00,0x00,0x00,0x18,0x20,0xFF,0x21,0x1E,0x00,0x00,//$ 4
0xF0,0x08,0xF0,0x00,0xE0,0x18,0x00,0x00,0x00,0x21,0x1C,0x03,0x1E,0x21,0x1E,0x00,//% 5
0x00,0xF0,0x08,0x88,0x70,0x00,0x00,0x00,0x1E,0x21,0x23,0x24,0x19,0x27,0x21,0x10,//& 6
0x10,0x16,0x0E,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//' 7
0x00,0x00,0x00,0xE0,0x18,0x04,0x02,0x00,0x00,0x00,0x00,0x07,0x18,0x20,0x40,0x00,//( 8
0x00,0x02,0x04,0x18,0xE0,0x00,0x00,0x00,0x00,0x40,0x20,0x18,0x07,0x00,0x00,0x00,//) 9
0x40,0x40,0x80,0xF0,0x80,0x40,0x40,0x00,0x02,0x02,0x01,0x0F,0x01,0x02,0x02,0x00,//* 10
0x00,0x00,0x00,0xF0,0x00,0x00,0x00,0x00,0x01,0x01,0x01,0x1F,0x01,0x01,0x01,0x00,//+ 11
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xB0,0x70,0x00,0x00,0x00,0x00,0x00,//, 12
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x01,0x01,0x01,0x01,0x01,//- 13
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x30,0x00,0x00,0x00,0x00,0x00,//. 14
0x00,0x00,0x00,0x00,0x80,0x60,0x18,0x04,0x00,0x60,0x18,0x06,0x01,0x00,0x00,0x00,/// 15
0x00,0xE0,0x10,0x08,0x08,0x10,0xE0,0x00,0x00,0x0F,0x10,0x20,0x20,0x10,0x0F,0x00,//0 16
0x00,0x10,0x10,0xF8,0x00,0x00,0x00,0x00,0x00,0x20,0x20,0x3F,0x20,0x20,0x00,0x00,//1 17
0x00,0x70,0x08,0x08,0x08,0x88,0x70,0x00,0x00,0x30,0x28,0x24,0x22,0x21,0x30,0x00,//2 18
0x00,0x30,0x08,0x88,0x88,0x48,0x30,0x00,0x00,0x18,0x20,0x20,0x20,0x11,0x0E,0x00,//3 19
0x00,0x00,0xC0,0x20,0x10,0xF8,0x00,0x00,0x00,0x07,0x04,0x24,0x24,0x3F,0x24,0x00,//4 20
0x00,0xF8,0x08,0x88,0x88,0x08,0x08,0x00,0x00,0x19,0x21,0x20,0x20,0x11,0x0E,0x00,//5 21
0x00,0xE0,0x10,0x88,0x88,0x18,0x00,0x00,0x00,0x0F,0x11,0x20,0x20,0x11,0x0E,0x00,//6 22
0x00,0x38,0x08,0x08,0xC8,0x38,0x08,0x00,0x00,0x00,0x00,0x3F,0x00,0x00,0x00,0x00,//7 23
0x00,0x70,0x88,0x08,0x08,0x88,0x70,0x00,0x00,0x1C,0x22,0x21,0x21,0x22,0x1C,0x00,//8 24
0x00,0xE0,0x10,0x08,0x08,0x10,0xE0,0x00,0x00,0x00,0x31,0x22,0x22,0x11,0x0F,0x00,//9 25
0x00,0x00,0x00,0xC0,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x30,0x00,0x00,0x00,//: 26
0x00,0x00,0x00,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x60,0x00,0x00,0x00,0x00,//; 27
0x00,0x00,0x80,0x40,0x20,0x10,0x08,0x00,0x00,0x01,0x02,0x04,0x08,0x10,0x20,0x00,//< 28
0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x00,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x00,//= 29
0x00,0x08,0x10,0x20,0x40,0x80,0x00,0x00,0x00,0x20,0x10,0x08,0x04,0x02,0x01,0x00,//> 30
0x00,0x70,0x48,0x08,0x08,0x08,0xF0,0x00,0x00,0x00,0x00,0x30,0x36,0x01,0x00,0x00,//? 31
0xC0,0x30,0xC8,0x28,0xE8,0x10,0xE0,0x00,0x07,0x18,0x27,0x24,0x23,0x14,0x0B,0x00,//@ 32
0x00,0x00,0xC0,0x38,0xE0,0x00,0x00,0x00,0x20,0x3C,0x23,0x02,0x02,0x27,0x38,0x20,//A 33
0x08,0xF8,0x88,0x88,0x88,0x70,0x00,0x00,0x20,0x3F,0x20,0x20,0x20,0x11,0x0E,0x00,//B 34
0xC0,0x30,0x08,0x08,0x08,0x08,0x38,0x00,0x07,0x18,0x20,0x20,0x20,0x10,0x08,0x00,//C 35
0x08,0xF8,0x08,0x08,0x08,0x10,0xE0,0x00,0x20,0x3F,0x20,0x20,0x20,0x10,0x0F,0x00,//D 36
0x08,0xF8,0x88,0x88,0xE8,0x08,0x10,0x00,0x20,0x3F,0x20,0x20,0x23,0x20,0x18,0x00,//E 37
0x08,0xF8,0x88,0x88,0xE8,0x08,0x10,0x00,0x20,0x3F,0x20,0x00,0x03,0x00,0x00,0x00,//F 38
0xC0,0x30,0x08,0x08,0x08,0x38,0x00,0x00,0x07,0x18,0x20,0x20,0x22,0x1E,0x02,0x00,//G 39
0x08,0xF8,0x08,0x00,0x00,0x08,0xF8,0x08,0x20,0x3F,0x21,0x01,0x01,0x21,0x3F,0x20,//H 40
0x00,0x08,0x08,0xF8,0x08,0x08,0x00,0x00,0x00,0x20,0x20,0x3F,0x20,0x20,0x00,0x00,//I 41
0x00,0x00,0x08,0x08,0xF8,0x08,0x08,0x00,0xC0,0x80,0x80,0x80,0x7F,0x00,0x00,0x00,//J 42
0x08,0xF8,0x88,0xC0,0x28,0x18,0x08,0x00,0x20,0x3F,0x20,0x01,0x26,0x38,0x20,0x00,//K 43
0x08,0xF8,0x08,0x00,0x00,0x00,0x00,0x00,0x20,0x3F,0x20,0x20,0x20,0x20,0x30,0x00,//L 44
0x08,0xF8,0xF8,0x00,0xF8,0xF8,0x08,0x00,0x20,0x3F,0x00,0x3F,0x00,0x3F,0x20,0x00,//M 45
0x08,0xF8,0x30,0xC0,0x00,0x08,0xF8,0x08,0x20,0x3F,0x20,0x00,0x07,0x18,0x3F,0x00,//N 46
0xE0,0x10,0x08,0x08,0x08,0x10,0xE0,0x00,0x0F,0x10,0x20,0x20,0x20,0x10,0x0F,0x00,//O 47
0x08,0xF8,0x08,0x08,0x08,0x08,0xF0,0x00,0x20,0x3F,0x21,0x01,0x01,0x01,0x00,0x00,//P 48
0xE0,0x10,0x08,0x08,0x08,0x10,0xE0,0x00,0x0F,0x18,0x24,0x24,0x38,0x50,0x4F,0x00,//Q 49
0x08,0xF8,0x88,0x88,0x88,0x88,0x70,0x00,0x20,0x3F,0x20,0x00,0x03,0x0C,0x30,0x20,//R 50
0x00,0x70,0x88,0x08,0x08,0x08,0x38,0x00,0x00,0x38,0x20,0x21,0x21,0x22,0x1C,0x00,//S 51
0x18,0x08,0x08,0xF8,0x08,0x08,0x18,0x00,0x00,0x00,0x20,0x3F,0x20,0x00,0x00,0x00,//T 52
0x08,0xF8,0x08,0x00,0x00,0x08,0xF8,0x08,0x00,0x1F,0x20,0x20,0x20,0x20,0x1F,0x00,//U 53
0x08,0x78,0x88,0x00,0x00,0xC8,0x38,0x08,0x00,0x00,0x07,0x38,0x0E,0x01,0x00,0x00,//V 54
0xF8,0x08,0x00,0xF8,0x00,0x08,0xF8,0x00,0x03,0x3C,0x07,0x00,0x07,0x3C,0x03,0x00,//W 55
0x08,0x18,0x68,0x80,0x80,0x68,0x18,0x08,0x20,0x30,0x2C,0x03,0x03,0x2C,0x30,0x20,//X 56
0x08,0x38,0xC8,0x00,0xC8,0x38,0x08,0x00,0x00,0x00,0x20,0x3F,0x20,0x00,0x00,0x00,//Y 57
0x10,0x08,0x08,0x08,0xC8,0x38,0x08,0x00,0x20,0x38,0x26,0x21,0x20,0x20,0x18,0x00,//Z 58
0x00,0x00,0x00,0xFE,0x02,0x02,0x02,0x00,0x00,0x00,0x00,0x7F,0x40,0x40,0x40,0x00,//[ 59
0x00,0x0C,0x30,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x06,0x38,0xC0,0x00,//\ 60
0x00,0x02,0x02,0x02,0xFE,0x00,0x00,0x00,0x00,0x40,0x40,0x40,0x7F,0x00,0x00,0x00,//] 61
0x00,0x00,0x04,0x02,0x02,0x02,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//^ 62
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,//_ 63
0x00,0x02,0x02,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//` 64
0x00,0x00,0x80,0x80,0x80,0x80,0x00,0x00,0x00,0x19,0x24,0x22,0x22,0x22,0x3F,0x20,//a 65
0x08,0xF8,0x00,0x80,0x80,0x00,0x00,0x00,0x00,0x3F,0x11,0x20,0x20,0x11,0x0E,0x00,//b 66
0x00,0x00,0x00,0x80,0x80,0x80,0x00,0x00,0x00,0x0E,0x11,0x20,0x20,0x20,0x11,0x00,//c 67
0x00,0x00,0x00,0x80,0x80,0x88,0xF8,0x00,0x00,0x0E,0x11,0x20,0x20,0x10,0x3F,0x20,//d 68
0x00,0x00,0x80,0x80,0x80,0x80,0x00,0x00,0x00,0x1F,0x22,0x22,0x22,0x22,0x13,0x00,//e 69
0x00,0x80,0x80,0xF0,0x88,0x88,0x88,0x18,0x00,0x20,0x20,0x3F,0x20,0x20,0x00,0x00,//f 70
0x00,0x00,0x80,0x80,0x80,0x80,0x80,0x00,0x00,0x6B,0x94,0x94,0x94,0x93,0x60,0x00,//g 71
0x08,0xF8,0x00,0x80,0x80,0x80,0x00,0x00,0x20,0x3F,0x21,0x00,0x00,0x20,0x3F,0x20,//h 72
0x00,0x80,0x98,0x98,0x00,0x00,0x00,0x00,0x00,0x20,0x20,0x3F,0x20,0x20,0x00,0x00,//i 73
0x00,0x00,0x00,0x80,0x98,0x98,0x00,0x00,0x00,0xC0,0x80,0x80,0x80,0x7F,0x00,0x00,//j 74
0x08,0xF8,0x00,0x00,0x80,0x80,0x80,0x00,0x20,0x3F,0x24,0x02,0x2D,0x30,0x20,0x00,//k 75
0x00,0x08,0x08,0xF8,0x00,0x00,0x00,0x00,0x00,0x20,0x20,0x3F,0x20,0x20,0x00,0x00,//l 76
0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x00,0x20,0x3F,0x20,0x00,0x3F,0x20,0x00,0x3F,//m 77
0x80,0x80,0x00,0x80,0x80,0x80,0x00,0x00,0x20,0x3F,0x21,0x00,0x00,0x20,0x3F,0x20,//n 78
0x00,0x00,0x80,0x80,0x80,0x80,0x00,0x00,0x00,0x1F,0x20,0x20,0x20,0x20,0x1F,0x00,//o 79
0x80,0x80,0x00,0x80,0x80,0x00,0x00,0x00,0x80,0xFF,0xA1,0x20,0x20,0x11,0x0E,0x00,//p 80
0x00,0x00,0x00,0x80,0x80,0x80,0x80,0x00,0x00,0x0E,0x11,0x20,0x20,0xA0,0xFF,0x80,//q 81
0x80,0x80,0x80,0x00,0x80,0x80,0x80,0x00,0x20,0x20,0x3F,0x21,0x20,0x00,0x01,0x00,//r 82
0x00,0x00,0x80,0x80,0x80,0x80,0x80,0x00,0x00,0x33,0x24,0x24,0x24,0x24,0x19,0x00,//s 83
0x00,0x80,0x80,0xE0,0x80,0x80,0x00,0x00,0x00,0x00,0x00,0x1F,0x20,0x20,0x00,0x00,//t 84
0x80,0x80,0x00,0x00,0x00,0x80,0x80,0x00,0x00,0x1F,0x20,0x20,0x20,0x10,0x3F,0x20,//u 85
0x80,0x80,0x80,0x00,0x00,0x80,0x80,0x80,0x00,0x01,0x0E,0x30,0x08,0x06,0x01,0x00,//v 86
0x80,0x80,0x00,0x80,0x00,0x80,0x80,0x80,0x0F,0x30,0x0C,0x03,0x0C,0x30,0x0F,0x00,//w 87
0x00,0x80,0x80,0x00,0x80,0x80,0x80,0x00,0x00,0x20,0x31,0x2E,0x0E,0x31,0x20,0x00,//x 88
0x80,0x80,0x80,0x00,0x00,0x80,0x80,0x80,0x80,0x81,0x8E,0x70,0x18,0x06,0x01,0x00,//y 89
0x00,0x80,0x80,0x80,0x80,0x80,0x80,0x00,0x00,0x21,0x30,0x2C,0x22,0x21,0x30,0x00,//z 90
0x00,0x00,0x00,0x00,0x80,0x7C,0x02,0x02,0x00,0x00,0x00,0x00,0x00,0x3F,0x40,0x40,//{ 91
0x00,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,//| 92
0x00,0x02,0x02,0x7C,0x80,0x00,0x00,0x00,0x00,0x40,0x40,0x3F,0x00,0x00,0x00,0x00,//} 93
0x00,0x06,0x01,0x01,0x02,0x02,0x04,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//~ 94
};
const char code Hzk[][32]={
{0x20,0x20,0x20,0x20,0x20,0x20,0x20,0xFF,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x00},
{0x80,0x80,0x40,0x20,0x10,0x0C,0x03,0x00,0x03,0x0C,0x10,0x20,0x40,0x80,0x80,0x00},/*"大",0*/
{0x00,0x01,0x01,0xFD,0x55,0x55,0x57,0x55,0x55,0x55,0x55,0xFD,0x01,0x01,0x00,0x00},
{0x80,0x90,0x88,0x45,0x4F,0x55,0x25,0x25,0x25,0x55,0x4D,0x45,0x80,0x80,0x80,0x00},/*"夏",1*/
{0x10,0x10,0x10,0x10,0x10,0xFF,0x10,0x10,0xF0,0x10,0x11,0x16,0xD0,0x10,0x10,0x00},
{0x80,0x40,0x20,0x18,0x06,0x41,0x20,0x10,0x3F,0x44,0x42,0x41,0x40,0x40,0x78,0x00},/*"龙",2*/
{0x00,0x10,0x88,0x86,0x40,0x40,0x20,0x2F,0x50,0x90,0x08,0x02,0x04,0x08,0x00,0x00},
{0x01,0x01,0x00,0xFF,0x55,0x55,0x55,0x55,0x7F,0x55,0x55,0x55,0x55,0x41,0x00,0x00},/*"雀",3*/
{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*/
};
#endif

View File

@@ -0,0 +1,233 @@
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<ProjectOpt xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="project_opt.xsd">
<SchemaVersion>1.0</SchemaVersion>
<Header>### uVision Project, (C) Keil Software</Header>
<Extensions>
<cExt>*.c</cExt>
<aExt>*.s*; *.src; *.a*</aExt>
<oExt>*.obj; *.o</oExt>
<lExt>*.lib</lExt>
<tExt>*.txt; *.h; *.inc; *.md</tExt>
<pExt>*.plm</pExt>
<CppX>*.cpp; *.cc; *.cxx</CppX>
<nMigrate>0</nMigrate>
</Extensions>
<DaveTm>
<dwLowDateTime>0</dwLowDateTime>
<dwHighDateTime>0</dwHighDateTime>
</DaveTm>
<Target>
<TargetName>Target 1</TargetName>
<ToolsetNumber>0x0</ToolsetNumber>
<ToolsetName>MCS-51</ToolsetName>
<TargetOption>
<CLK51>11059200</CLK51>
<OPTTT>
<gFlags>1</gFlags>
<BeepAtEnd>1</BeepAtEnd>
<RunSim>1</RunSim>
<RunTarget>0</RunTarget>
<RunAbUc>0</RunAbUc>
</OPTTT>
<OPTHX>
<HexSelection>0</HexSelection>
<FlashByte>65535</FlashByte>
<HexRangeLowAddress>0</HexRangeLowAddress>
<HexRangeHighAddress>0</HexRangeHighAddress>
<HexOffset>0</HexOffset>
</OPTHX>
<OPTLEX>
<PageWidth>120</PageWidth>
<PageLength>65</PageLength>
<TabStop>8</TabStop>
<ListingPath>.\Listings\</ListingPath>
</OPTLEX>
<ListingPage>
<CreateCListing>1</CreateCListing>
<CreateAListing>1</CreateAListing>
<CreateLListing>1</CreateLListing>
<CreateIListing>0</CreateIListing>
<AsmCond>1</AsmCond>
<AsmSymb>1</AsmSymb>
<AsmXref>0</AsmXref>
<CCond>1</CCond>
<CCode>0</CCode>
<CListInc>0</CListInc>
<CSymb>0</CSymb>
<LinkerCodeListing>0</LinkerCodeListing>
</ListingPage>
<OPTXL>
<LMap>1</LMap>
<LComments>1</LComments>
<LGenerateSymbols>1</LGenerateSymbols>
<LLibSym>1</LLibSym>
<LLines>1</LLines>
<LLocSym>1</LLocSym>
<LPubSym>1</LPubSym>
<LXref>0</LXref>
<LExpSel>0</LExpSel>
</OPTXL>
<OPTFL>
<tvExp>1</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<IsCurrentTarget>1</IsCurrentTarget>
</OPTFL>
<CpuCode>255</CpuCode>
<Books>
<Book>
<Number>0</Number>
<Title>Data Sheet</Title>
<Path>DATASHTS\ATMEL\AT89C52_DS.PDF</Path>
</Book>
<Book>
<Number>1</Number>
<Title>Instruction Set Manual</Title>
<Path>DATASHTS\ATMEL\AT_C51ISM.PDF</Path>
</Book>
</Books>
<DebugOpt>
<uSim>1</uSim>
<uTrg>0</uTrg>
<sLdApp>1</sLdApp>
<sGomain>1</sGomain>
<sRbreak>1</sRbreak>
<sRwatch>1</sRwatch>
<sRmem>1</sRmem>
<sRfunc>1</sRfunc>
<sRbox>1</sRbox>
<tLdApp>1</tLdApp>
<tGomain>0</tGomain>
<tRbreak>1</tRbreak>
<tRwatch>1</tRwatch>
<tRmem>1</tRmem>
<tRfunc>0</tRfunc>
<tRbox>1</tRbox>
<tRtrace>1</tRtrace>
<sRSysVw>1</sRSysVw>
<tRSysVw>1</tRSysVw>
<sRunDeb>0</sRunDeb>
<sLrtime>0</sLrtime>
<bEvRecOn>1</bEvRecOn>
<bSchkAxf>0</bSchkAxf>
<bTchkAxf>0</bTchkAxf>
<nTsel>-1</nTsel>
<sDll></sDll>
<sDllPa></sDllPa>
<sDlgDll></sDlgDll>
<sDlgPa></sDlgPa>
<sIfile></sIfile>
<tDll></tDll>
<tDllPa></tDllPa>
<tDlgDll></tDlgDll>
<tDlgPa></tDlgPa>
<tIfile></tIfile>
<pMon></pMon>
</DebugOpt>
<Breakpoint/>
<Tracepoint>
<THDelay>0</THDelay>
</Tracepoint>
<DebugFlag>
<trace>0</trace>
<periodic>1</periodic>
<aLwin>0</aLwin>
<aCover>0</aCover>
<aSer1>0</aSer1>
<aSer2>0</aSer2>
<aPa>0</aPa>
<viewmode>0</viewmode>
<vrSel>0</vrSel>
<aSym>0</aSym>
<aTbox>0</aTbox>
<AscS1>0</AscS1>
<AscS2>0</AscS2>
<AscS3>0</AscS3>
<aSer3>0</aSer3>
<eProf>0</eProf>
<aLa>0</aLa>
<aPa1>0</aPa1>
<AscS4>0</AscS4>
<aSer4>0</aSer4>
<StkLoc>0</StkLoc>
<TrcWin>0</TrcWin>
<newCpu>0</newCpu>
<uProt>0</uProt>
</DebugFlag>
<LintExecutable></LintExecutable>
<LintConfigFile></LintConfigFile>
<bLintAuto>0</bLintAuto>
<bAutoGenD>0</bAutoGenD>
<LntExFlags>0</LntExFlags>
<pMisraName></pMisraName>
<pszMrule></pszMrule>
<pSingCmds></pSingCmds>
<pMultCmds></pMultCmds>
<pMisraNamep></pMisraNamep>
<pszMrulep></pszMrulep>
<pSingCmdsp></pSingCmdsp>
<pMultCmdsp></pMultCmdsp>
</TargetOption>
</Target>
<Group>
<GroupName>User</GroupName>
<tvExp>1</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<cbSel>0</cbSel>
<RteFlg>0</RteFlg>
<File>
<GroupNumber>1</GroupNumber>
<FileNumber>1</FileNumber>
<FileType>2</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2>
<PathWithFileName>.\STARTUP.A51</PathWithFileName>
<FilenameWithoutPath>STARTUP.A51</FilenameWithoutPath>
<RteFlg>0</RteFlg>
<bShared>0</bShared>
</File>
<File>
<GroupNumber>1</GroupNumber>
<FileNumber>2</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2>
<PathWithFileName>..\User\main.c</PathWithFileName>
<FilenameWithoutPath>main.c</FilenameWithoutPath>
<RteFlg>0</RteFlg>
<bShared>0</bShared>
</File>
<File>
<GroupNumber>1</GroupNumber>
<FileNumber>3</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2>
<PathWithFileName>..\User\UART.C</PathWithFileName>
<FilenameWithoutPath>UART.C</FilenameWithoutPath>
<RteFlg>0</RteFlg>
<bShared>0</bShared>
</File>
<File>
<GroupNumber>1</GroupNumber>
<FileNumber>4</FileNumber>
<FileType>1</FileType>
<tvExp>1</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2>
<PathWithFileName>..\User\oled.c</PathWithFileName>
<FilenameWithoutPath>oled.c</FilenameWithoutPath>
<RteFlg>0</RteFlg>
<bShared>0</bShared>
</File>
</Group>
</ProjectOpt>

View File

@@ -0,0 +1,405 @@
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<Project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="project_proj.xsd">
<SchemaVersion>1.1</SchemaVersion>
<Header>### uVision Project, (C) Keil Software</Header>
<Targets>
<Target>
<TargetName>Target 1</TargetName>
<ToolsetNumber>0x0</ToolsetNumber>
<ToolsetName>MCS-51</ToolsetName>
<uAC6>0</uAC6>
<TargetOption>
<TargetCommonOption>
<Device>AT89C52</Device>
<Vendor>Microchip</Vendor>
<Cpu>IRAM(0-0xFF) IROM(0-0x1FFF) CLOCK(24000000)</Cpu>
<FlashUtilSpec></FlashUtilSpec>
<StartupFile>"LIB\STARTUP.A51" ("Standard 8051 Startup Code")</StartupFile>
<FlashDriverDll></FlashDriverDll>
<DeviceId>2980</DeviceId>
<RegisterFile>REGX52.H</RegisterFile>
<MemoryEnv></MemoryEnv>
<Cmp></Cmp>
<Asm></Asm>
<Linker></Linker>
<OHString></OHString>
<InfinionOptionDll></InfinionOptionDll>
<SLE66CMisc></SLE66CMisc>
<SLE66AMisc></SLE66AMisc>
<SLE66LinkerMisc></SLE66LinkerMisc>
<SFDFile></SFDFile>
<bCustSvd>0</bCustSvd>
<UseEnv>0</UseEnv>
<BinPath></BinPath>
<IncludePath></IncludePath>
<LibPath></LibPath>
<RegisterFilePath>Atmel\</RegisterFilePath>
<DBRegisterFilePath>Atmel\</DBRegisterFilePath>
<TargetStatus>
<Error>0</Error>
<ExitCodeStop>0</ExitCodeStop>
<ButtonStop>0</ButtonStop>
<NotGenerated>0</NotGenerated>
<InvalidFlash>1</InvalidFlash>
</TargetStatus>
<OutputDirectory>.\Objects\</OutputDirectory>
<OutputName>51Project</OutputName>
<CreateExecutable>1</CreateExecutable>
<CreateLib>0</CreateLib>
<CreateHexFile>1</CreateHexFile>
<DebugInformation>1</DebugInformation>
<BrowseInformation>1</BrowseInformation>
<ListingPath>.\Listings\</ListingPath>
<HexFormatSelection>0</HexFormatSelection>
<Merge32K>0</Merge32K>
<CreateBatchFile>0</CreateBatchFile>
<BeforeCompile>
<RunUserProg1>0</RunUserProg1>
<RunUserProg2>0</RunUserProg2>
<UserProg1Name></UserProg1Name>
<UserProg2Name></UserProg2Name>
<UserProg1Dos16Mode>0</UserProg1Dos16Mode>
<UserProg2Dos16Mode>0</UserProg2Dos16Mode>
<nStopU1X>0</nStopU1X>
<nStopU2X>0</nStopU2X>
</BeforeCompile>
<BeforeMake>
<RunUserProg1>0</RunUserProg1>
<RunUserProg2>0</RunUserProg2>
<UserProg1Name></UserProg1Name>
<UserProg2Name></UserProg2Name>
<UserProg1Dos16Mode>0</UserProg1Dos16Mode>
<UserProg2Dos16Mode>0</UserProg2Dos16Mode>
<nStopB1X>0</nStopB1X>
<nStopB2X>0</nStopB2X>
</BeforeMake>
<AfterMake>
<RunUserProg1>0</RunUserProg1>
<RunUserProg2>0</RunUserProg2>
<UserProg1Name></UserProg1Name>
<UserProg2Name></UserProg2Name>
<UserProg1Dos16Mode>0</UserProg1Dos16Mode>
<UserProg2Dos16Mode>0</UserProg2Dos16Mode>
<nStopA1X>0</nStopA1X>
<nStopA2X>0</nStopA2X>
</AfterMake>
<SelectedForBatchBuild>0</SelectedForBatchBuild>
<SVCSIdString></SVCSIdString>
</TargetCommonOption>
<CommonProperty>
<UseCPPCompiler>0</UseCPPCompiler>
<RVCTCodeConst>0</RVCTCodeConst>
<RVCTZI>0</RVCTZI>
<RVCTOtherData>0</RVCTOtherData>
<ModuleSelection>0</ModuleSelection>
<IncludeInBuild>1</IncludeInBuild>
<AlwaysBuild>0</AlwaysBuild>
<GenerateAssemblyFile>0</GenerateAssemblyFile>
<AssembleAssemblyFile>0</AssembleAssemblyFile>
<PublicsOnly>0</PublicsOnly>
<StopOnExitCode>3</StopOnExitCode>
<CustomArgument></CustomArgument>
<IncludeLibraryModules></IncludeLibraryModules>
<ComprImg>1</ComprImg>
<BankNo>65535</BankNo>
</CommonProperty>
<DllOption>
<SimDllName>S8051.DLL</SimDllName>
<SimDllArguments></SimDllArguments>
<SimDlgDll>DP51.DLL</SimDlgDll>
<SimDlgDllArguments>-p52</SimDlgDllArguments>
<TargetDllName>S8051.DLL</TargetDllName>
<TargetDllArguments></TargetDllArguments>
<TargetDlgDll>TP51.DLL</TargetDlgDll>
<TargetDlgDllArguments>-p52</TargetDlgDllArguments>
</DllOption>
<DebugOption>
<OPTHX>
<HexSelection>0</HexSelection>
<HexRangeLowAddress>0</HexRangeLowAddress>
<HexRangeHighAddress>0</HexRangeHighAddress>
<HexOffset>0</HexOffset>
<Oh166RecLen>16</Oh166RecLen>
</OPTHX>
<Simulator>
<UseSimulator>1</UseSimulator>
<LoadApplicationAtStartup>1</LoadApplicationAtStartup>
<RunToMain>1</RunToMain>
<RestoreBreakpoints>1</RestoreBreakpoints>
<RestoreWatchpoints>1</RestoreWatchpoints>
<RestoreMemoryDisplay>1</RestoreMemoryDisplay>
<RestoreFunctions>1</RestoreFunctions>
<RestoreToolbox>1</RestoreToolbox>
<LimitSpeedToRealTime>0</LimitSpeedToRealTime>
<RestoreSysVw>1</RestoreSysVw>
</Simulator>
<Target>
<UseTarget>0</UseTarget>
<LoadApplicationAtStartup>1</LoadApplicationAtStartup>
<RunToMain>0</RunToMain>
<RestoreBreakpoints>1</RestoreBreakpoints>
<RestoreWatchpoints>1</RestoreWatchpoints>
<RestoreMemoryDisplay>1</RestoreMemoryDisplay>
<RestoreFunctions>0</RestoreFunctions>
<RestoreToolbox>1</RestoreToolbox>
<RestoreTracepoints>1</RestoreTracepoints>
<RestoreSysVw>1</RestoreSysVw>
</Target>
<RunDebugAfterBuild>0</RunDebugAfterBuild>
<TargetSelection>-1</TargetSelection>
<SimDlls>
<CpuDll></CpuDll>
<CpuDllArguments></CpuDllArguments>
<PeripheralDll></PeripheralDll>
<PeripheralDllArguments></PeripheralDllArguments>
<InitializationFile></InitializationFile>
</SimDlls>
<TargetDlls>
<CpuDll></CpuDll>
<CpuDllArguments></CpuDllArguments>
<PeripheralDll></PeripheralDll>
<PeripheralDllArguments></PeripheralDllArguments>
<InitializationFile></InitializationFile>
<Driver></Driver>
</TargetDlls>
</DebugOption>
<Utilities>
<Flash1>
<UseTargetDll>0</UseTargetDll>
<UseExternalTool>0</UseExternalTool>
<RunIndependent>0</RunIndependent>
<UpdateFlashBeforeDebugging>0</UpdateFlashBeforeDebugging>
<Capability>0</Capability>
<DriverSelection>-1</DriverSelection>
</Flash1>
<bUseTDR>0</bUseTDR>
<Flash2></Flash2>
<Flash3></Flash3>
<Flash4></Flash4>
<pFcarmOut></pFcarmOut>
<pFcarmGrp></pFcarmGrp>
<pFcArmRoot></pFcArmRoot>
<FcArmLst>0</FcArmLst>
</Utilities>
<Target51>
<Target51Misc>
<MemoryModel>2</MemoryModel>
<RTOS>0</RTOS>
<RomSize>2</RomSize>
<DataHold>0</DataHold>
<XDataHold>0</XDataHold>
<UseOnchipRom>0</UseOnchipRom>
<UseOnchipArithmetic>0</UseOnchipArithmetic>
<UseMultipleDPTR>0</UseMultipleDPTR>
<UseOnchipXram>0</UseOnchipXram>
<HadIRAM>1</HadIRAM>
<HadXRAM>0</HadXRAM>
<HadIROM>1</HadIROM>
<Moda2>0</Moda2>
<Moddp2>0</Moddp2>
<Modp2>0</Modp2>
<Mod517dp>0</Mod517dp>
<Mod517au>0</Mod517au>
<Mode2>0</Mode2>
<useCB>0</useCB>
<useXB>0</useXB>
<useL251>1</useL251>
<useA251>0</useA251>
<Mx51>0</Mx51>
<ModC812>0</ModC812>
<ModCont>0</ModCont>
<Lp51>0</Lp51>
<useXBS>0</useXBS>
<ModDA>0</ModDA>
<ModAB2>0</ModAB2>
<Mx51P>0</Mx51P>
<hadXRAM2>0</hadXRAM2>
<uocXram2>0</uocXram2>
<hadXRAM3>0</hadXRAM3>
<ModC2>0</ModC2>
<ModH2>0</ModH2>
<Mdu_R515>0</Mdu_R515>
<Mdu_F120>0</Mdu_F120>
<Psoc>0</Psoc>
<hadIROM2>0</hadIROM2>
<hadIROM3>0</hadIROM3>
<ModSmx2>0</ModSmx2>
<cBanks>0</cBanks>
<xBanks>0</xBanks>
<OnChipMemories>
<RCB>
<Type>0</Type>
<StartAddress>0x0</StartAddress>
<Size>0xffff</Size>
</RCB>
<RXB>
<Type>0</Type>
<StartAddress>0x0</StartAddress>
<Size>0x0</Size>
</RXB>
<Ocm1>
<Type>0</Type>
<StartAddress>0x0</StartAddress>
<Size>0x0</Size>
</Ocm1>
<Ocm2>
<Type>0</Type>
<StartAddress>0x0</StartAddress>
<Size>0x0</Size>
</Ocm2>
<Ocm3>
<Type>0</Type>
<StartAddress>0x0</StartAddress>
<Size>0x0</Size>
</Ocm3>
<Ocr1>
<Type>0</Type>
<StartAddress>0x0</StartAddress>
<Size>0x0</Size>
</Ocr1>
<Ocr2>
<Type>0</Type>
<StartAddress>0x0</StartAddress>
<Size>0x0</Size>
</Ocr2>
<Ocr3>
<Type>0</Type>
<StartAddress>0x0</StartAddress>
<Size>0x0</Size>
</Ocr3>
<IRO>
<Type>1</Type>
<StartAddress>0x0</StartAddress>
<Size>0x2000</Size>
</IRO>
<IRA>
<Type>0</Type>
<StartAddress>0x0</StartAddress>
<Size>0x100</Size>
</IRA>
<XRA>
<Type>0</Type>
<StartAddress>0x0</StartAddress>
<Size>0x0</Size>
</XRA>
<XRA512>
<Type>0</Type>
<StartAddress>0x0</StartAddress>
<Size>0x0</Size>
</XRA512>
<IROM512>
<Type>0</Type>
<StartAddress>0x0</StartAddress>
<Size>0x0</Size>
</IROM512>
<XRA513>
<Type>0</Type>
<StartAddress>0x0</StartAddress>
<Size>0x0</Size>
</XRA513>
<IROM513>
<Type>0</Type>
<StartAddress>0x0</StartAddress>
<Size>0x0</Size>
</IROM513>
</OnChipMemories>
</Target51Misc>
<C51>
<RegisterColoring>0</RegisterColoring>
<VariablesInOrder>0</VariablesInOrder>
<IntegerPromotion>1</IntegerPromotion>
<uAregs>0</uAregs>
<UseInterruptVector>1</UseInterruptVector>
<Fuzzy>3</Fuzzy>
<Optimize>8</Optimize>
<WarningLevel>2</WarningLevel>
<SizeSpeed>1</SizeSpeed>
<ObjectExtend>1</ObjectExtend>
<ACallAJmp>0</ACallAJmp>
<InterruptVectorAddress>0</InterruptVectorAddress>
<VariousControls>
<MiscControls></MiscControls>
<Define></Define>
<Undefine></Undefine>
<IncludePath>..\User</IncludePath>
</VariousControls>
</C51>
<Ax51>
<UseMpl>0</UseMpl>
<UseStandard>1</UseStandard>
<UseCase>0</UseCase>
<UseMod51>0</UseMod51>
<VariousControls>
<MiscControls></MiscControls>
<Define></Define>
<Undefine></Undefine>
<IncludePath></IncludePath>
</VariousControls>
</Ax51>
<Lx51>
<useFile>0</useFile>
<linkonly>0</linkonly>
<UseMemoryFromTarget>1</UseMemoryFromTarget>
<CaseSensitiveSymbols>0</CaseSensitiveSymbols>
<WarningLevel>2</WarningLevel>
<DataOverlaying>1</DataOverlaying>
<OverlayString></OverlayString>
<MiscControls></MiscControls>
<DisableWarningNumbers></DisableWarningNumbers>
<LinkerCmdFile></LinkerCmdFile>
<Assign></Assign>
<ReserveString></ReserveString>
<CClasses></CClasses>
<UserClasses></UserClasses>
<CSection></CSection>
<UserSection></UserSection>
<CodeBaseAddress></CodeBaseAddress>
<XDataBaseAddress></XDataBaseAddress>
<PDataBaseAddress></PDataBaseAddress>
<BitBaseAddress></BitBaseAddress>
<DataBaseAddress></DataBaseAddress>
<IDataBaseAddress></IDataBaseAddress>
<Precede></Precede>
<Stack></Stack>
<CodeSegmentName></CodeSegmentName>
<XDataSegmentName></XDataSegmentName>
<BitSegmentName></BitSegmentName>
<DataSegmentName></DataSegmentName>
<IDataSegmentName></IDataSegmentName>
</Lx51>
</Target51>
</TargetOption>
<Groups>
<Group>
<GroupName>User</GroupName>
<Files>
<File>
<FileName>STARTUP.A51</FileName>
<FileType>2</FileType>
<FilePath>.\STARTUP.A51</FilePath>
</File>
<File>
<FileName>main.c</FileName>
<FileType>1</FileType>
<FilePath>..\User\main.c</FilePath>
</File>
<File>
<FileName>UART.C</FileName>
<FileType>1</FileType>
<FilePath>..\User\UART.C</FilePath>
</File>
<File>
<FileName>oled.c</FileName>
<FileType>1</FileType>
<FilePath>..\User\oled.c</FilePath>
</File>
</Files>
</Group>
</Groups>
</Target>
</Targets>
</Project>

View File

@@ -0,0 +1,253 @@
A51 MACRO ASSEMBLER STARTUP 08/28/2024 10:42:23 PAGE 1
MACRO ASSEMBLER A51 V8.2.7.0
OBJECT MODULE PLACED IN .\Objects\STARTUP.obj
ASSEMBLER INVOKED BY: D:\Keil5\C51\BIN\A51.EXE STARTUP.A51 SET(LARGE) DEBUG PRINT(.\Listings\STARTUP.lst) OBJECT(.\Objec
ts\STARTUP.obj) EP
LOC OBJ LINE SOURCE
1 $nomod51
2 ;------------------------------------------------------------------------------
3 ; This file is part of the C51 Compiler package
4 ; Copyright (c) 1988-2005 Keil Elektronik GmbH and Keil Software, Inc.
5 ; Version 8.01
6 ;
7 ; *** <<< Use Configuration Wizard in Context Menu >>> ***
8 ;------------------------------------------------------------------------------
9 ; STARTUP.A51: This code is executed after processor reset.
10 ;
11 ; To translate this file use A51 with the following invocation:
12 ;
13 ; A51 STARTUP.A51
14 ;
15 ; To link the modified STARTUP.OBJ file to your application use the following
16 ; Lx51 invocation:
17 ;
18 ; Lx51 your object file list, STARTUP.OBJ controls
19 ;
20 ;------------------------------------------------------------------------------
21 ;
22 ; User-defined <h> Power-On Initialization of Memory
23 ;
24 ; With the following EQU statements the initialization of memory
25 ; at processor reset can be defined:
26 ;
27 ; <o> IDATALEN: IDATA memory size <0x0-0x100>
28 ; <i> Note: The absolute start-address of IDATA memory is always 0
29 ; <i> The IDATA space overlaps physically the DATA and BIT areas.
0080 30 IDATALEN EQU 80H
31 ;
32 ; <o> XDATASTART: XDATA memory start address <0x0-0xFFFF>
33 ; <i> The absolute start address of XDATA memory
0000 34 XDATASTART EQU 0
35 ;
36 ; <o> XDATALEN: XDATA memory size <0x0-0xFFFF>
37 ; <i> The length of XDATA memory in bytes.
0000 38 XDATALEN EQU 0
39 ;
40 ; <o> PDATASTART: PDATA memory start address <0x0-0xFFFF>
41 ; <i> The absolute start address of PDATA memory
0000 42 PDATASTART EQU 0H
43 ;
44 ; <o> PDATALEN: PDATA memory size <0x0-0xFF>
45 ; <i> The length of PDATA memory in bytes.
0000 46 PDATALEN EQU 0H
47 ;
48 ;</h>
49 ;------------------------------------------------------------------------------
50 ;
51 ;<h> Reentrant Stack Initialization
52 ;
53 ; The following EQU statements define the stack pointer for reentrant
54 ; functions and initialized it:
55 ;
56 ; <h> Stack Space for reentrant functions in the SMALL model.
57 ; <q> IBPSTACK: Enable SMALL model reentrant stack
A51 MACRO ASSEMBLER STARTUP 08/28/2024 10:42:23 PAGE 2
58 ; <i> Stack space for reentrant functions in the SMALL model.
0000 59 IBPSTACK EQU 0 ; set to 1 if small reentrant is used.
60 ; <o> IBPSTACKTOP: End address of SMALL model stack <0x0-0xFF>
61 ; <i> Set the top of the stack to the highest location.
0100 62 IBPSTACKTOP EQU 0xFF +1 ; default 0FFH+1
63 ; </h>
64 ;
65 ; <h> Stack Space for reentrant functions in the LARGE model.
66 ; <q> XBPSTACK: Enable LARGE model reentrant stack
67 ; <i> Stack space for reentrant functions in the LARGE model.
0000 68 XBPSTACK EQU 0 ; set to 1 if large reentrant is used.
69 ; <o> XBPSTACKTOP: End address of LARGE model stack <0x0-0xFFFF>
70 ; <i> Set the top of the stack to the highest location.
0000 71 XBPSTACKTOP EQU 0xFFFF +1 ; default 0FFFFH+1
72 ; </h>
73 ;
74 ; <h> Stack Space for reentrant functions in the COMPACT model.
75 ; <q> PBPSTACK: Enable COMPACT model reentrant stack
76 ; <i> Stack space for reentrant functions in the COMPACT model.
0000 77 PBPSTACK EQU 0 ; set to 1 if compact reentrant is used.
78 ;
79 ; <o> PBPSTACKTOP: End address of COMPACT model stack <0x0-0xFFFF>
80 ; <i> Set the top of the stack to the highest location.
0100 81 PBPSTACKTOP EQU 0xFF +1 ; default 0FFH+1
82 ; </h>
83 ;</h>
84 ;------------------------------------------------------------------------------
85 ;
86 ; Memory Page for Using the Compact Model with 64 KByte xdata RAM
87 ; <e>Compact Model Page Definition
88 ;
89 ; <i>Define the XDATA page used for PDATA variables.
90 ; <i>PPAGE must conform with the PPAGE set in the linker invocation.
91 ;
92 ; Enable pdata memory page initalization
0000 93 PPAGEENABLE EQU 0 ; set to 1 if pdata object are used.
94 ;
95 ; <o> PPAGE number <0x0-0xFF>
96 ; <i> uppermost 256-byte address of the page used for PDATA variables.
0000 97 PPAGE EQU 0
98 ;
99 ; <o> SFR address which supplies uppermost address byte <0x0-0xFF>
100 ; <i> most 8051 variants use P2 as uppermost address byte
00A0 101 PPAGE_SFR DATA 0A0H
102 ;
103 ; </e>
104 ;------------------------------------------------------------------------------
105
106 ; Standard SFR Symbols
00E0 107 ACC DATA 0E0H
00F0 108 B DATA 0F0H
0081 109 SP DATA 81H
0082 110 DPL DATA 82H
0083 111 DPH DATA 83H
112
113 NAME ?C_STARTUP
114
115
116 ?C_C51STARTUP SEGMENT CODE
117 ?STACK SEGMENT IDATA
118
---- 119 RSEG ?STACK
0000 120 DS 1
121
122 EXTRN CODE (?C_START)
123 PUBLIC ?C_STARTUP
A51 MACRO ASSEMBLER STARTUP 08/28/2024 10:42:23 PAGE 3
124
---- 125 CSEG AT 0
0000 020000 F 126 ?C_STARTUP: LJMP STARTUP1
127
---- 128 RSEG ?C_C51STARTUP
129
0000 130 STARTUP1:
131
132 IF IDATALEN <> 0
0000 787F 133 MOV R0,#IDATALEN - 1
0002 E4 134 CLR A
0003 F6 135 IDATALOOP: MOV @R0,A
0004 D8FD 136 DJNZ R0,IDATALOOP
137 ENDIF
138
139 IF XDATALEN <> 0
MOV DPTR,#XDATASTART
MOV R7,#LOW (XDATALEN)
IF (LOW (XDATALEN)) <> 0
MOV R6,#(HIGH (XDATALEN)) +1
ELSE
MOV R6,#HIGH (XDATALEN)
ENDIF
CLR A
XDATALOOP: MOVX @DPTR,A
INC DPTR
DJNZ R7,XDATALOOP
DJNZ R6,XDATALOOP
ENDIF
153
154 IF PPAGEENABLE <> 0
MOV PPAGE_SFR,#PPAGE
ENDIF
157
158 IF PDATALEN <> 0
MOV R0,#LOW (PDATASTART)
MOV R7,#LOW (PDATALEN)
CLR A
PDATALOOP: MOVX @R0,A
INC R0
DJNZ R7,PDATALOOP
ENDIF
166
167 IF IBPSTACK <> 0
EXTRN DATA (?C_IBP)
MOV ?C_IBP,#LOW IBPSTACKTOP
ENDIF
172
173 IF XBPSTACK <> 0
EXTRN DATA (?C_XBP)
MOV ?C_XBP,#HIGH XBPSTACKTOP
MOV ?C_XBP+1,#LOW XBPSTACKTOP
ENDIF
179
180 IF PBPSTACK <> 0
EXTRN DATA (?C_PBP)
MOV ?C_PBP,#LOW PBPSTACKTOP
ENDIF
184
0006 758100 F 185 MOV SP,#?STACK-1
186
187 ; This code is required if you use L51_BANK.A51 with Banking Mode 4
188 ;<h> Code Banking
189 ; <q> Select Bank 0 for L51_BANK.A51 Mode 4
A51 MACRO ASSEMBLER STARTUP 08/28/2024 10:42:23 PAGE 4
190
195 ;</h>
0009 020000 F 196 LJMP ?C_START
197
198 END
A51 MACRO ASSEMBLER STARTUP 08/28/2024 10:42:23 PAGE 5
SYMBOL TABLE LISTING
------ ----- -------
N A M E T Y P E V A L U E ATTRIBUTES
?C_C51STARTUP. . . C SEG 000CH REL=UNIT
?C_START . . . . . C ADDR ----- EXT
?C_STARTUP . . . . C ADDR 0000H A
?STACK . . . . . . I SEG 0001H REL=UNIT
ACC. . . . . . . . D ADDR 00E0H A
B. . . . . . . . . D ADDR 00F0H A
DPH. . . . . . . . D ADDR 0083H A
DPL. . . . . . . . D ADDR 0082H A
IBPSTACK . . . . . N NUMB 0000H A
IBPSTACKTOP. . . . N NUMB 0100H A
IDATALEN . . . . . N NUMB 0080H A
IDATALOOP. . . . . C ADDR 0003H R SEG=?C_C51STARTUP
PBPSTACK . . . . . N NUMB 0000H A
PBPSTACKTOP. . . . N NUMB 0100H A
PDATALEN . . . . . N NUMB 0000H A
PDATASTART . . . . N NUMB 0000H A
PPAGE. . . . . . . N NUMB 0000H A
PPAGEENABLE. . . . N NUMB 0000H A
PPAGE_SFR. . . . . D ADDR 00A0H A
SP . . . . . . . . D ADDR 0081H A
STARTUP1 . . . . . C ADDR 0000H R SEG=?C_C51STARTUP
XBPSTACK . . . . . N NUMB 0000H A
XBPSTACKTOP. . . . N NUMB 0000H A
XDATALEN . . . . . N NUMB 0000H A
XDATASTART . . . . N NUMB 0000H A
REGISTER BANK(S) USED: 0
ASSEMBLY COMPLETE. 0 WARNING(S), 0 ERROR(S)

View File

@@ -0,0 +1,210 @@
C51 COMPILER V9.60.7.0 UART 08/28/2024 10:42:23 PAGE 1
C51 COMPILER V9.60.7.0, COMPILATION OF MODULE UART
OBJECT MODULE PLACED IN .\Objects\UART.obj
COMPILER INVOKED BY: D:\Keil5\C51\BIN\C51.EXE ..\User\UART.C LARGE OMF2 OPTIMIZE(8,SPEED) BROWSE INCDIR(..\User) DEBUG P
-RINT(.\Listings\UART.lst) OBJECT(.\Objects\UART.obj)
line level source
1 #include "UART.h"
2 #include <string.h>
3 #include "oled.h"
4 #include <stdio.h>
5
6 // 用于存储接收数据的数组
7 unsigned char rxBuffer[ARRAY_SIZE];
8 unsigned int rxIndex = 0; // 接收数据的索引
9 unsigned int rx_flag=0;
10 extern unsigned int CONNECT_FLEG;//连接标志
11 // 初始化串口
12 void Serial_Init() {
13 1 SCON = 0x50; // 设置为模式18位数据可变波特率
14 1 TMOD &= 0x0F; // 清除定时器1模式位
15 1 TMOD |= 0x20; // 设置定时器1为8位自动重装模式
16 1 TH1 = TL1 = 256 - (11059200 / 12 / 32) / BAUDRATE; // 设置波特率
17 1 TR1 = 1; // 启动定时器1
18 1 ES = 1; // 开启串口中断
19 1 EA = 1; // 开启全局中断
20 1 }
21
22 void Delay(unsigned int xms)
23 {
24 1 unsigned char i, j;
25 1 while(xms--)
26 1 {
27 2 i = 2;
28 2 j = 239;
29 2 do
30 2 {
31 3 while (--j);
32 3 } while (--i);
33 2 }
34 1 }
35
36 void buff_memset(void)
37 {
38 1 memset(rxBuffer,0,64);
39 1 rxIndex=0;
40 1 rx_flag = 0;
41 1 }
42 unsigned int WIFI_CheckAck(char* src, char* dest, int timeout)
43 {
44 1 char *check = NULL;
45 1 //清空缓冲
46 1 buff_memset();
47 1
48 1 UART_sentString(src);
49 1 timeout=timeout/10;//10ms处理一次
50 1 while(timeout--)
51 1 {
52 2 Delay(10);//延时1ms
53 2 if(rx_flag==1)
54 2 {
C51 COMPILER V9.60.7.0 UART 08/28/2024 10:42:23 PAGE 2
55 3 check = strstr(rxBuffer,dest);
56 3 if(check != NULL)
57 3 {
58 4 buff_memset();//数据有误 清空
59 4 return 1;
60 4 }
61 3 }
62 2 }
63 1 buff_memset();//数据有误 清空
64 1 return 0;//超时
65 1 }
66
67 sbit LED = P2^5;
68 sbit motor1 = P2^6;
69 sbit motor2 = P2^7;
70
71 void CONNECT_TX_Control(void)
72 {
73 1 char *ptr = NULL;
74 1 int number;
75 1 if (CONNECT_FLEG)
76 1 {
77 2 if(rx_flag)
78 2 {
79 3 if(strstr(rxBuffer,"192.168.0")!=NULL)
80 3 {
81 4 ptr = strrchr((char*)rxBuffer,','); // 以最后一个,为准后面为数据
82 4
83 4 if(strlen(ptr)-3==1) //判断接收到为一位数据 ,*\r\n
84 4 {
85 5 number = ptr[1]-'0';
86 5 switch(number)
87 5 {
88 6 case 1: LED = 0 ; break;
89 6 case 2: LED = 1; break;
90 6 case 3:OLED_Show(); break;
91 6 case 4:OLED_Clear(); break;
92 6 case 5:motor1=0;motor2=1; break;
93 6 case 6:motor1=1;motor2=0; break;
94 6 case 7:motor1=0;motor2=0 ; break;
95 6 default: return;
96 6 }
97 5 }
98 4 }
99 3 else if(strstr((char *)rxBuffer,"RECV:test-app")!=NULL)
100 3 {
101 4 ptr = strrchr((char*)rxBuffer,','); // 以最后一个,为准后面为数据
102 4
103 4 if(strlen(ptr)-3==1) //判断接收到为一位数据 ,*\r\n
104 4 {
105 5 number = ptr[1]-'0';
106 5 switch(number)
107 5 {
108 6 case 1: LED = 0 ; break;
109 6 case 2: LED = 1; break;
110 6 case 3:OLED_Show(); break;
111 6 case 4:OLED_Clear(); break;
112 6 case 5:motor1=0;motor2=1; break;
113 6 case 6:motor1=1;motor2=0; break;
114 6 case 7:motor1=0;motor2=0 ; break;
115 6 default: return;
116 6 }
C51 COMPILER V9.60.7.0 UART 08/28/2024 10:42:23 PAGE 3
117 5 }
118 4 }
119 3 }
120 2 buff_memset();//数据有误 清空
121 2 }
122 1 }
123 void CONNECT_TO_TCP(unsigned char* id,unsigned char *password)
124 {
125 1 unsigned char buf[50];
126 1 WIFI_CheckAck("+++",id,1500); //确保其退出透传
127 1
128 1 while(!WIFI_CheckAck("AT\r\n","OK",1000));
129 1 while(!WIFI_CheckAck("AT+CWMODE=0\r\n","OK",2000)); //STA模式
130 1 sprintf((char *)buf,"AT+CWJAP=%s,%s\r\n",id,password);
131 1 while(!WIFI_CheckAck((char *)buf,"+CWJAP:1,",5000));
132 1 while(!WIFI_CheckAck("AT+CIPMODE=1\r\n","OK",1000)!=0);
133 1 while(!WIFI_CheckAck("AT+CIPSTART=TCP,192.168.0.71,2347\r\n","+CIPSTART:1",3000));
134 1 while(!WIFI_CheckAck("AT+CIPSEND\r\n","OK",1000));
135 1 UART_sentString(":Connected\r\n");
136 1 CONNECT_FLEG = 1;
137 1 }
138
139 void UART_SendByte(unsigned char Byte)
140 {
141 1 SBUF=Byte;
142 1 while(!TI);
143 1 TI=0;
144 1 }
145
146 void UART_sentString(char *str)
147 {
148 1
149 1 while(*str){
150 2 UART_SendByte(*str);
151 2 str++;
152 2 }
153 1 }
154 // 串口接收中断服务程序
155 void Serial_ISR() interrupt 4 {
156 1 if (RI) {
157 2 RI = 0; // 清除接收中断标志
158 2
159 2
160 2 rxBuffer[rxIndex++] = SBUF; // 存储接收到的数据
161 2 if(rxBuffer[rxIndex-1]=='\n')
162 2 {
163 3 rx_flag=1;
164 3 }
165 2 if(rxIndex==64)
166 2 {
167 3 rxIndex=0;
168 3 rx_flag=1;
169 3 }
170 2
171 2 }
172 1 }
173
174
175
176
C51 COMPILER V9.60.7.0 UART 08/28/2024 10:42:23 PAGE 4
MODULE INFORMATION: STATIC OVERLAYABLE
CODE SIZE = 1135 ----
CONSTANT SIZE = 166 ----
XDATA SIZE = 68 72
PDATA SIZE = ---- ----
DATA SIZE = ---- ----
IDATA SIZE = ---- ----
BIT SIZE = ---- ----
EDATA SIZE = ---- ----
HDATA SIZE = ---- ----
XDATA CONST SIZE = ---- ----
FAR CONST SIZE = ---- ----
END OF MODULE INFORMATION.
C51 COMPILATION COMPLETE. 0 WARNING(S), 0 ERROR(S)

View File

@@ -0,0 +1,107 @@
C51 COMPILER V9.60.7.0 MAIN 08/28/2024 10:42:23 PAGE 1
C51 COMPILER V9.60.7.0, COMPILATION OF MODULE MAIN
OBJECT MODULE PLACED IN .\Objects\main.obj
COMPILER INVOKED BY: D:\Keil5\C51\BIN\C51.EXE ..\User\main.c LARGE OMF2 OPTIMIZE(8,SPEED) BROWSE INCDIR(..\User) DEBUG P
-RINT(.\Listings\main.lst) OBJECT(.\Objects\main.obj)
line level source
1 //**** 声明 ********************************************************************
2 /*******************************************************************************
3 * 下面来自互联开源程序,由深圳市大夏龙雀科技有限公司收集
4 * 方便用户参考学习,本公司不提供任何技术支持
5 * 程序仅供测试参考,不能应用在实际工程中,不一定能通过编译
6 * 公司网站 http://www.szdx-smart.com/
7 * 淘宝网址 https://shop184598174.taobao.com/?spm=a1z10.5-c-s.w12096189-21564973333.3.547b1176WCCDxR&scene
-=taobao_shop
8 *******************************************************************************/
9 /********************************************************************
10 * 文件名 WF24-TCP协议应用
11 * 描述 : 该文件实现通过利用WF24给单片机发数据控制LED+OLED+电机。
12 ***********************************************************************/
13 /*
14 Name: TCP
15 Created: 2024/8/21
16 Author: WAM
17 */
18 #include <REGX52.H> // STC89C52RC的寄存器定义
19 #include "UART.h"
20 #include "string.h"
21 #include "stdio.h"
22 #include "oled.h"
23 extern unsigned int rxIndex;
24 extern unsigned char rxBuffer[ARRAY_SIZE];
25 extern unsigned int rx_flag;
26 unsigned int CONNECT_FLEG;//连接标志
27 // 主函数
28 unsigned char conver[64];
29 char *ptr = NULL;
30 void MQTT_CONVER(void);
31 void TCP_UDP_CONVER(void);
32 void main() {
33 1 Serial_Init(); // 初始化串口
34 1 OLED_Init();
35 1 CONNECT_TO_TCP("DX-SMART","SMART@601");
36 1 while (1) {
37 2
38 2 // 主循环,可以添加其他任务
39 2 TCP_UDP_CONVER();
40 2 }
41 1 }
42
43 void TCP_UDP_CONVER(void)
44 {
45 1 if (rx_flag)
46 1 {
47 2 UART_sentString(rxBuffer);
48 2 CONNECT_TX_Control();
49 2 rxIndex = 0; // 重置索引,准备下一次接收
50 2 memset(rxBuffer,0,ARRAY_SIZE); //清空缓冲区
51 2 }
52 1 }
53 void MQTT_CONVER(void)
C51 COMPILER V9.60.7.0 MAIN 08/28/2024 10:42:23 PAGE 2
54 {
55 1 if (rx_flag)
56 1 {
57 2 if(strstr(rxBuffer,"RECV:test-app")!=NULL)
58 2 {
59 3 ptr = strrchr(rxBuffer,',');
60 3 memcpy(conver,ptr,*(ptr-1));
61 3 while(!WIFI_CheckAck("AT+MQTTPUBRAW=test-w,32,0,0\r\n","OK",2000)!=0);
62 3 buff_memset();//数据有误 清空
*** WARNING C206 IN LINE 62 OF ..\User\main.c: 'buff_memset': missing function-prototype
63 3 UART_sentString(conver);
64 3
65 3 }
66 2
67 2 }
68 1 }
69 void MQTT_CONTROL(void)
70 {
71 1 if (rx_flag)
72 1 {
73 2 CONNECT_TX_Control();
74 2 }
75 1 }
MODULE INFORMATION: STATIC OVERLAYABLE
CODE SIZE = 240 ----
CONSTANT SIZE = 66 ----
XDATA SIZE = 69 ----
PDATA SIZE = ---- ----
DATA SIZE = ---- ----
IDATA SIZE = ---- ----
BIT SIZE = ---- ----
EDATA SIZE = ---- ----
HDATA SIZE = ---- ----
XDATA CONST SIZE = ---- ----
FAR CONST SIZE = ---- ----
END OF MODULE INFORMATION.
C51 COMPILATION COMPLETE. 1 WARNING(S), 0 ERROR(S)

View File

@@ -0,0 +1,287 @@
C51 COMPILER V9.60.7.0 OLED 08/28/2024 10:42:23 PAGE 1
C51 COMPILER V9.60.7.0, COMPILATION OF MODULE OLED
OBJECT MODULE PLACED IN .\Objects\oled.obj
COMPILER INVOKED BY: D:\Keil5\C51\BIN\C51.EXE ..\User\oled.c LARGE OMF2 OPTIMIZE(8,SPEED) BROWSE INCDIR(..\User) DEBUG P
-RINT(.\Listings\oled.lst) OBJECT(.\Objects\oled.obj)
line level source
1 #include "oled.h"
2 #include "oledfont.h"
3
4 void delay_ms(unsigned int ms)
5 {
6 1 unsigned int a;
7 1 while(ms)
8 1 {
9 2 a=1800;
10 2 while(a--);
11 2 ms--;
12 2 }
13 1 return;
14 1 }
15 void OLED_Show()
16 {
17 1 OLED_ShowCHinese(16,0,0);
18 1 OLED_ShowCHinese(32,0,1);
19 1 OLED_ShowCHinese(48,0,2);
20 1 OLED_ShowCHinese(64,0,3);
21 1 OLED_ShowCHinese(80,0,4);
22 1 OLED_ShowCHinese(96,0,5);
23 1 OLED_ShowString(32,2,"WF24");
24 1
25 1 }
26 #if OLED_MODE==1
//向SSD1106写入一个字节。
//dat:要写入的数据/命令
//cmd:数据/命令标志 0,表示命令;1,表示数据;
void OLED_WR_Byte(u8 dat,u8 cmd)
{
DATAOUT(dat);
if(cmd)
OLED_DC_Set();
else
OLED_DC_Clr();
OLED_CS_Clr();
OLED_WR_Clr();
OLED_WR_Set();
OLED_CS_Set();
OLED_DC_Set();
}
#else
44 //向SSD1306写入一个字节。
45 //dat:要写入的数据/命令
46 //cmd:数据/命令标志 0,表示命令;1,表示数据;
47 void OLED_WR_Byte(u8 dat,u8 cmd)
48 {
49 1 u8 i;
50 1 if(cmd)
51 1 OLED_DC_Set();
52 1 else
53 1 OLED_DC_Clr();
54 1 OLED_CS_Clr();
C51 COMPILER V9.60.7.0 OLED 08/28/2024 10:42:23 PAGE 2
55 1 for(i=0;i<8;i++)
56 1 {
57 2 OLED_SCLK_Clr();
58 2 if(dat&0x80)
59 2 {
60 3 OLED_SDIN_Set();
61 3 }
62 2 else
63 2 OLED_SDIN_Clr();
64 2 OLED_SCLK_Set();
65 2 dat<<=1;
66 2 }
67 1 OLED_CS_Set();
68 1 OLED_DC_Set();
69 1 }
70 #endif
71 void OLED_Set_Pos(unsigned char x, unsigned char y)
72 {
73 1 OLED_WR_Byte(0xb0+y,OLED_CMD);
74 1 OLED_WR_Byte(((x&0xf0)>>4)|0x10,OLED_CMD);
75 1 OLED_WR_Byte((x&0x0f)|0x01,OLED_CMD);
76 1 }
77 //开启OLED显示
78 void OLED_Display_On(void)
79 {
80 1 OLED_WR_Byte(0X8D,OLED_CMD); //SET DCDC命令
81 1 OLED_WR_Byte(0X14,OLED_CMD); //DCDC ON
82 1 OLED_WR_Byte(0XAF,OLED_CMD); //DISPLAY ON
83 1 }
84 //关闭OLED显示
85 void OLED_Display_Off(void)
86 {
87 1 OLED_WR_Byte(0X8D,OLED_CMD); //SET DCDC命令
88 1 OLED_WR_Byte(0X10,OLED_CMD); //DCDC OFF
89 1 OLED_WR_Byte(0XAE,OLED_CMD); //DISPLAY OFF
90 1 }
91 //清屏函数,清完屏,整个屏幕是黑色的!和没点亮一样!!!
92 void OLED_Clear(void)
93 {
94 1 u8 i,n;
95 1 for(i=0;i<8;i++)
96 1 {
97 2 OLED_WR_Byte (0xb0+i,OLED_CMD); //设置页地址0~7
98 2 OLED_WR_Byte (0x00,OLED_CMD); //设置显示位置—列低地址
99 2 OLED_WR_Byte (0x10,OLED_CMD); //设置显示位置—列高地址
100 2 for(n=0;n<128;n++)OLED_WR_Byte(0,OLED_DATA);
101 2 } //更新显示
102 1 }
103
104
105 //在指定位置显示一个字符,包括部分字符
106 //x:0~127
107 //y:0~63
108 //mode:0,反白显示;1,正常显示
109 //size:选择字体 16/12
110 void OLED_ShowChar(u8 x,u8 y,u8 chr)
111 {
112 1 unsigned char c=0,i=0;
113 1 c=chr-' ';//得到偏移后的值
114 1 if(x>Max_Column-1){x=0;y=y+2;}
115 1 if(SIZE ==16)
116 1 {
C51 COMPILER V9.60.7.0 OLED 08/28/2024 10:42:23 PAGE 3
117 2 OLED_Set_Pos(x,y);
118 2 for(i=0;i<8;i++)
119 2 OLED_WR_Byte(F8X16[c*16+i],OLED_DATA);
120 2 OLED_Set_Pos(x,y+1);
121 2 for(i=0;i<8;i++)
122 2 OLED_WR_Byte(F8X16[c*16+i+8],OLED_DATA);
123 2 }
124 1
125 1 }
126 //m^n函数
127 u32 oled_pow(u8 m,u8 n)
128 {
129 1 u32 result=1;
130 1 while(n--)result*=m;
131 1 return result;
132 1 }
133 //显示2个数字
134 //x,y :起点坐标
135 //len :数字的位数
136 //size:字体大小
137 //mode:模式 0,填充模式;1,叠加模式
138 //num:数值(0~4294967295);
139 void OLED_ShowNum(u8 x,u8 y,u32 num,u8 len,u8 size2)
140 {
141 1 u8 t,temp;
142 1 u8 enshow=0;
143 1 for(t=0;t<len;t++)
144 1 {
145 2 temp=(num/oled_pow(10,len-t-1))%10;
146 2 if(enshow==0&&t<(len-1))
147 2 {
148 3 if(temp==0)
149 3 {
150 4 OLED_ShowChar(x+(size2/2)*t,y,' ');
151 4 continue;
152 4 }else enshow=1;
153 3
154 3 }
155 2 OLED_ShowChar(x+(size2/2)*t,y,temp+'0');
156 2 }
157 1 }
158 //显示一个字符号串
159 void OLED_ShowString(u8 x,u8 y,u8 *chr)
160 {
161 1 unsigned char j=0;
162 1 while (chr[j]!='\0')
163 1 { OLED_ShowChar(x,y,chr[j]);
164 2 x+=8;
165 2 if(x>120){x=0;y+=2;}
166 2 j++;
167 2 }
168 1 }
169 //显示汉字
170 void OLED_ShowCHinese(u8 x,u8 y,u8 no)
171 {
172 1 u8 t,adder=0;
173 1 OLED_Set_Pos(x,y);
174 1 for(t=0;t<16;t++)
175 1 {
176 2 OLED_WR_Byte(Hzk[2*no][t],OLED_DATA);
177 2 adder+=1;
178 2 }
C51 COMPILER V9.60.7.0 OLED 08/28/2024 10:42:23 PAGE 4
179 1 OLED_Set_Pos(x,y+1);
180 1 for(t=0;t<16;t++)
181 1 {
182 2 OLED_WR_Byte(Hzk[2*no+1][t],OLED_DATA);
183 2 adder+=1;
184 2 }
185 1 }
186 /***********功能描述显示显示BMP图片128×64起始点坐标(x,y),x的范围0127y为页的范围07****************
-*/
187 void OLED_DrawBMP(unsigned char x0, unsigned char y0,unsigned char x1, unsigned char y1,unsigned char BMP[
-])
188 {
189 1 unsigned int j=0;
190 1 unsigned char x,y;
191 1
192 1 if(y1%8==0) y=y1/8;
193 1 else y=y1/8+1;
194 1 for(y=y0;y<y1;y++)
195 1 {
196 2 OLED_Set_Pos(x0,y);
197 2 for(x=x0;x<x1;x++)
198 2 {
199 3 OLED_WR_Byte(BMP[j++],OLED_DATA);
200 3 }
201 2 }
202 1 }
203
204
205 //初始化SSD1306
206 void OLED_Init(void)
207 {
208 1
209 1
210 1
211 1 OLED_RST_Set();
212 1 delay_ms(100);
213 1 OLED_RST_Clr();
214 1 delay_ms(100);
215 1 OLED_RST_Set();
216 1 OLED_WR_Byte(0xAE,OLED_CMD);//--turn off oled panel
217 1 OLED_WR_Byte(0x00,OLED_CMD);//---set low column address
218 1 OLED_WR_Byte(0x10,OLED_CMD);//---set high column address
219 1 OLED_WR_Byte(0x40,OLED_CMD);//--set start line address Set Mapping RAM Display Start Line (0x00~0x3F)
220 1 OLED_WR_Byte(0x81,OLED_CMD);//--set contrast control register
221 1 OLED_WR_Byte(0xCF,OLED_CMD); // Set SEG Output Current Brightness
222 1 OLED_WR_Byte(0xA1,OLED_CMD);//--Set SEG/Column Mapping 0xa0左右反置 0xa1正常
223 1 OLED_WR_Byte(0xC8,OLED_CMD);//Set COM/Row Scan Direction 0xc0上下反置 0xc8正常
224 1 OLED_WR_Byte(0xA6,OLED_CMD);//--set normal display
225 1 OLED_WR_Byte(0xA8,OLED_CMD);//--set multiplex ratio(1 to 64)
226 1 OLED_WR_Byte(0x3f,OLED_CMD);//--1/64 duty
227 1 OLED_WR_Byte(0xD3,OLED_CMD);//-set display offset Shift Mapping RAM Counter (0x00~0x3F)
228 1 OLED_WR_Byte(0x00,OLED_CMD);//-not offset
229 1 OLED_WR_Byte(0xd5,OLED_CMD);//--set display clock divide ratio/oscillator frequency
230 1 OLED_WR_Byte(0x80,OLED_CMD);//--set divide ratio, Set Clock as 100 Frames/Sec
231 1 OLED_WR_Byte(0xD9,OLED_CMD);//--set pre-charge period
232 1 OLED_WR_Byte(0xF1,OLED_CMD);//Set Pre-Charge as 15 Clocks & Discharge as 1 Clock
233 1 OLED_WR_Byte(0xDA,OLED_CMD);//--set com pins hardware configuration
234 1 OLED_WR_Byte(0x12,OLED_CMD);
235 1 OLED_WR_Byte(0xDB,OLED_CMD);//--set vcomh
236 1 OLED_WR_Byte(0x40,OLED_CMD);//Set VCOM Deselect Level
237 1 OLED_WR_Byte(0x20,OLED_CMD);//-Set Page Addressing Mode (0x00/0x01/0x02)
238 1 OLED_WR_Byte(0x02,OLED_CMD);//
C51 COMPILER V9.60.7.0 OLED 08/28/2024 10:42:23 PAGE 5
239 1 OLED_WR_Byte(0x8D,OLED_CMD);//--set Charge Pump enable/disable
240 1 OLED_WR_Byte(0x14,OLED_CMD);//--set(0x10) disable
241 1 OLED_WR_Byte(0xA4,OLED_CMD);// Disable Entire Display On (0xa4/0xa5)
242 1 OLED_WR_Byte(0xA6,OLED_CMD);// Disable Inverse Display On (0xa6/a7)
243 1 OLED_WR_Byte(0xAF,OLED_CMD);//--turn on oled panel
244 1
245 1 OLED_WR_Byte(0xAF,OLED_CMD); /*display ON*/
246 1 OLED_Clear();
247 1 OLED_Set_Pos(0,0);
248 1 }
249
MODULE INFORMATION: STATIC OVERLAYABLE
CODE SIZE = 1037 ----
CONSTANT SIZE = 2461 ----
XDATA SIZE = ---- 27
PDATA SIZE = ---- ----
DATA SIZE = ---- ----
IDATA SIZE = ---- ----
BIT SIZE = ---- ----
EDATA SIZE = ---- ----
HDATA SIZE = ---- ----
XDATA CONST SIZE = ---- ----
FAR CONST SIZE = ---- ----
END OF MODULE INFORMATION.
C51 COMPILATION COMPLETE. 0 WARNING(S), 0 ERROR(S)

View File

@@ -0,0 +1,54 @@
<html>
<body>
<pre>
<h1>礦ision Build Log</h1>
<h2>Tool Versions:</h2>
IDE-Version: μVision V5.38.0.0
Copyright (C) 2022 ARM Ltd and ARM Germany GmbH. All rights reserved.
License Information: 1 1, 21, LIC=TI4EI-T6WYP-WQ90S-LZLT9-S04QZ-NNNW4
Tool Versions:
Toolchain: PK51 Prof. Developers Kit Version: 9.60.7.0
Toolchain Path: D:\Keil5\C51\BIN
C Compiler: C51.exe V9.60.7.0
Assembler: A51.exe V8.2.7.0
Linker/Locator: LX51.exe V4.66.100.0
Library Manager: LIBX51.exe V4.30.1.0
Hex Converter: OHX51.exe V1.47.0.0
CPU DLL: S8051.DLL V3.125.1.0
Dialog DLL: DP51.DLL V2.69.0.0
<h2>Project:</h2>
F:\WF24DEMO\单片机应用资料\单片机实验例程\1.WF24通过单片机控制LED+OLED+电机例程(TCP-UDP-MQTT)\2.STC89C52\例程\TCP\C52\Project\51Project.uvproj
Project File Date: 08/07/2024
<h2>Output:</h2>
Rebuild target 'Target 1'
assembling STARTUP.A51...
compiling main.c...
..\User\main.c(62): warning C206: 'buff_memset': missing function-prototype
compiling UART.C...
compiling oled.c...
linking...
*** WARNING L57: UNCALLED FUNCTION, IGNORED FOR OVERLAY PROCESS
NAME: MQTT_CONVER/MAIN
*** WARNING L57: UNCALLED FUNCTION, IGNORED FOR OVERLAY PROCESS
NAME: MQTT_CONTROL/MAIN
*** WARNING L57: UNCALLED FUNCTION, IGNORED FOR OVERLAY PROCESS
NAME: OLED_DISPLAY_ON/OLED
*** WARNING L57: UNCALLED FUNCTION, IGNORED FOR OVERLAY PROCESS
NAME: OLED_DISPLAY_OFF/OLED
*** WARNING L57: UNCALLED FUNCTION, IGNORED FOR OVERLAY PROCESS
NAME: _OLED_SHOWNUM/OLED
*** WARNING L57: UNCALLED FUNCTION, IGNORED FOR OVERLAY PROCESS
NAME: _OLED_DRAWBMP/OLED
*** WARNING L25: DATA TYPES DIFFERENT
SYMBOL: buff_memset
MODULE: .\Objects\main.obj (MAIN)
DEFINED: .\Objects\UART.obj (UART)
Program Size: data=15.1 xdata=253 const=2693 code=4463
creating hex file from ".\Objects\51Project"...
".\Objects\51Project" - 0 Error(s), 8 Warning(s).
Build Time Elapsed: 00:00:01
</pre>
</body>
</html>

View File

@@ -0,0 +1,449 @@
:10000000020C62AC07ED24B0FFE4FD120FBAEC5411
:10001000F0C4540F4410FF120FBAEC540F4401FF08
:10002000020FBA020DECE508243BF582E43400F53A
:1000300083E005082290003830070390003BE47508
:10004000F0011205CE0204812000E97F2ED200804B
:1000500018EF540F2490D43440D4FF30040BEF2415
:10006000BFB41A0050032461FFE5096002150905B9
:100070000CE50C7002050B30070E900038E475F0AB
:10008000011205CEEF0205A60210377403D20780D5
:1000900003E4C207F5089000381205E5E4F509F518
:1000A0000BF50CE50960077F2012006980F5750AE1
:1000B000FFC201C200C202C203C205C206C20812C8
:1000C0000035FF700D3007057F0012007AAF0CAECF
:1000D0000B22B4255FC2D5C204120035FF24D0B470
:1000E0000A00501A75F00A780930D50508B6FF01E4
:1000F00006C6A426F620D5047002D20380D924CFE8
:10010000B41A00EF5004C2E5D20402027BD201808F
:10011000C6D20080C0D20280BCD2D580BAD20580BF
:10012000B47F201200692002077401B5090040F174
:10013000120026FF1200690200A3D208D2068095A1
:10014000120026FB120026FA120026F94A4B70060E
:10015000794C7A037BFF20022EE509602A7E008E0F
:100160008275830012049A60060EEE650A70F0C272
:10017000D5EBC0E0EAC0E0E9C0E0EE1202C2D0E098
:10018000F9D0E0FAD0E0FB120481FF60AAEBC0E0F6
:10019000EAC0E0E9C0E0120069D0E02401F9D0E053
:1001A0003400FAD0E0FBE50A0460DCD50AD9808788
:1001B0007BFF7A0279BED202809C79108002790896
:1001C000C206C2088008D2D5790A8004790AC2D54D
:1001D000E50A047002F50AE4FAFDFEFF120026FCAF
:1001E0007B08200113120026FD7B1030000A12004C
:1001F00026FE120026FF7B20EC3382D592D55013C9
:10020000C3E43000069FFFE49EFEE42001039DFD51
:10021000E49CFCE4CBF8C201EC700CCFCECDCCE872
:1002200024F8F870F38017C3EF33FFEE33FEED339D
:10023000FDEC33FCEB33FB994002FB0FD8E9EB30CC
:100240000105F8D0E0C448B201C0E00AEC4D4E4FC1
:1002500078207B0070C2EAB50A0040BCC0E0120200
:10026000C4D0F0D0E0200104C4C0E0C4B201C0F0AA
:10027000120052D0F0D5F0EB0200A31205EE0140BF
:100280005301BA5801114C010D4201BE4F01C64441
:1002900001C64901264301CC5501B04601B04501D4
:1002A000B047036C5001152D01192E013C2B011D87
:1002B00023013A2003552A00D548000001343F3F6E
:1002C0003F00790AA2D5200314300509B9100204B1
:1002D00004B9080104A2D5200602500104200268D6
:1002E0009202B509005034C0E07F203003197F30FE
:1002F000A20272067205500F12031BC202C206C28E
:1003000005C2087F30800F300503E9C0E0120069A4
:10031000300503D0E0F9D0E0B509CC3005177F30C7
:10032000B9100C1200697F583004077F788003B938
:1003300008031200693002057F2D0200697F20202A
:1003400008F87F2B2006F322920280CF286E756C6E
:100350006C2900D2011200263001F8C20178093060
:10036000D50108F60200D52D504349581200262425
:1003700003B405004001E49003679312005A743AF5
:1003800012005AD2037509040201BAE709F608DF20
:10039000FA8046E709F208DFFA803E88828C83E71C
:1003A00009F0A3DFFA8032E309F608DFFA8078E388
:1003B00009F208DFFA807088828C83E309F0A3DFFA
:1003C000FA806489828A83E0A3F608DFFA8058897C
:1003D000828A83E0A3F208DFFA804C80D280FA8020
:1003E000C680D4806980F28033801080A680EA8045
:1003F0009A80A880DA80E280CA803389828A83EC7E
:10040000FAE493A3C8C582C8CCC583CCF0A3C8C501
:1004100082C8CCC583CCDFE9DEE7800D89828A8380
:10042000E493A3F608DFF9ECFAA9F0EDFB22898248
:100430008A83ECFAE0A3C8C582C8CCC583CCF0A3FC
:10044000C8C582C8CCC583CCDFEADEE880DB898200
:100450008A83E493A3F208DFF980CC88F0EF60018F
:100460000E4E60C388F0ED2402B4040050B9F5824A
:10047000EB2402B4040050AF23234582239003DB16
:1004800073BB010689828A83E0225002E722BBFE09
:1004900002E32289828A83E49322BB010CE582294C
:1004A000F582E5833AF583E0225006E92582F8E6F5
:1004B00022BBFE06E92582F8E222E58229F582E5E3
:1004C000833AF583E49322EF8DF0A4A8F0CF8CF06B
:1004D000A428CE8DF0A42EFE22BC000BBE0029EF76
:1004E0008DF084FFADF022E4CCF875F008EF2FFF1B
:1004F000EE33FEEC33FCEE9DEC984005FCEE9DFEE9
:100500000FD5F0E9E4CEFD22EDF8F5F0EE8420D22F
:100510001CFEADF075F008EF2FFFED33FD4007989E
:100520005006D5F0F222C398FD0FD5F0EA22C2D5CD
:10053000EC30E709B2D5E4C39DFDE49CFCEE30E766
:1005400015B2D5E4C39FFFE49EFE1204D9C3E49D17
:10055000FDE49CFC80031204D930D507C3E49FFF5F
:10056000E49EFE22A3F8E0C5F025F0F0E5821582B6
:1005700070021583E0C838F0E822EF4E6012EF6099
:10058000010EEDBB010B89828A83F0A3DFFCDEFA4A
:100590002289F05007F709DFFCA9F022BBFEFCF32B
:1005A00009DFFCA9F022BB010689828A83F0225070
:1005B00002F722BBFE01F322C5F0F8A3E028F0C544
:1005C000F0F8E582158270021583E038F022F8E039
:1005D000FBA3A3E0F925F0F0E582158270021583F4
:1005E000E0FA38F022EBF0A3EAF0A3E9F022D0839E
:1005F000D082F8E4937012740193700DA3A393F862
:10060000740193F5828883E4737402936860EFA3A6
:10061000A3A380DF900000E4F0A3F0A3F0900060BB
:10062000E07002A3E070030207AE9000E7E0700202
:10063000A3E070030207AB90004674FFF0A3741BA5
:10064000F0A3740CF07B017A0079A512090CE94A39
:100650004B70030206F17B017A0079A57D2C120D07
:1006600072900000EBF0A3EAF0A3E9F01210FEEFA5
:1006700024FDFFEE34FFFEEF64014E60030207AB82
:10068000900000E0FBA3E0FAA3E0F990000112045F
:100690009AFF3395E0FEEF24D0FFEE34FFFE90008A
:1006A00003F0A3EFF0EE60030207AEEF14B407000F
:1006B00040030207AE9006C375F003A4C58325F07E
:1006C000C583730206D80206DD0206E20206E502D1
:1006D00006E80206EB0206EEC2A50207ABD2A502AF
:1006E00007AB02079102079602079B0207A10207C8
:1006F000A790004674FFF0A3741BF0A37416F07B60
:10070000017A0079A512090CE94A4B70030207AB84
:100710007B017A0079A57D2C120D72900000EBF020
:10072000A3EAF0A3E9F01210FEEF24FDFFEE34FF80
:10073000FEEF64014E7074900000E0FBA3E0FAA3AA
:10074000E0F990000112049AFF3395E0FEEF24D007
:10075000FFEE34FFFE900003F0A3EFF0EE704FEFDA
:1007600014B40700504890077475F003A4C583259E
:10077000F0C5837302078902078D0207910207966D
:1007800002079B0207A10207A7C2A5801ED2A5806F
:100790001A120F67801512100E8010C2A6D2A78001
:1007A0000AD2A6C2A78004C2A6C2A712109E229097
:1007B0000000EBF0A3EAF0A3E9F0900000E0F9A359
:1007C000E0FAA3E090003BC9F0A3EAF0A3E9F0A3AC
:1007D0007405F0A374DCF07BFF7A1B7924120B2ADA
:1007E00090003B74FFF0A3741BF0A3742DF0A3746E
:1007F00003F0A374E8F07BFF7A1B7928120B2AEF31
:100800004E60DD90003B74FFF0A3741BF0A3742DC9
:10081000F0A37407F0A374D0F07BFF7A1B79301239
:100820000B2AEF4E60DD90003B74FFF0A3741BF0C9
:10083000A3743EF0900000E0F9A3E0FAA3E090007A
:100840003EC9F0A3EAF0A3E9F0900003E0F9A3E0C9
:10085000FAA3E0900041C9F0A3EAF0A3E9F07B011C
:100860007A00790612008B90003B74FFF0A3741B92
:10087000F0A3744FF0A37413F0A37488F07B017A93
:10088000007906120B2AEF4E60DD90003B74FFF0FA
:10089000A3741BF0A3742DF0A37403F0A374E8F009
:1008A0007BFF7A1B7959120B2AEF4E7F0070027F73
:1008B00001EF70D690003B74FFF0A3741BF0A3749B
:1008C0008CF0A3740BF0A374B8F07BFF7A1B7968EB
:1008D000120B2AEF4E60DD90003B74FFF0A3741BF7
:1008E000F0A3742DF0A37403F0A374E8F07BFF7AF7
:1008F0001B7998120B2AEF4E60DD7BFF7A1B79A5DE
:10090000121113900060E4F0A304F022900043EB76
:10091000F0A3EAF0A3E9F0A3E0FBA3E0FAA3E0F977
:1009200012048170030209B8900043E0FBA3E0FACF
:10093000A3E0F912048170030209C4900046E0F9B3
:10094000A3E0FAA3E0A3C9F0A3EAF0A3E9F09000C2
:1009500043A3E0FAA3E0F990004CEBF0A3EAF0A384
:10096000E9F0900049E0FBA3E0FAA3E0F91204816A
:10097000FF602690004CE0FBA3E0FAA3E0F912042C
:10098000816F701590004A75F0011205B890004D06
:10099000E475F0011205B880C9900049E0FBA3E0BE
:1009A000FAA3E0F91204817002800D900044E4750E
:1009B000F0011205B8020928900043E0FBA3E0FA19
:1009C000A3E0F9227B007A00790022D2A27F647E24
:1009D000001210B9C2A27F647E001210B9D2A2E444
:1009E000FD7FAE120FBAE4FF120FBA7F10120FBADA
:1009F0007F40120FBA7F81120FBA7FCF120FBA7FDA
:100A0000A1120FBA7FC8120FBA7FA6120FBA7FA821
:100A1000120FBA7F3F120FBA7FD3120FBAE4FF1240
:100A20000FBA7FD5120FBA7F80120FBA7FD9120F7B
:100A3000BA7FF1120FBA7FDA120FBA7F12120FBA11
:100A40007FDB120FBA7F40120FBA7F20120FBA7FDE
:100A500002120FBA7F8D120FBA7F14120FBA7FA441
:100A6000120FBA7FA6120FBA7FAF120FBA7FAF1262
:100A70000FBA12100EE4FDFF0200039000F3EFF036
:100A8000A3EDF0A3EAF0A3EBF0E49000FBF09000FC
:100A9000F9F09000F7E0FF9000F9E0FEC39F4003FB
:100AA000020B29C3EF9E14FD7F0A1210809000F5FF
:100AB000E0FCA3E0FDCFCDCFCECCCE1204D97C009C
:100AC0007D0A1204D99000FAEDF0A3E07030900096
:100AD000F7E014FF9000F9E0FEC39F5021A3E070FF
:100AE000179000F8E0C3138EF0A4FF9000F3E02FFE
:100AF000FFA3E0FD7B2080259000FB7401F09000B7
:100B0000F8E0C313FFA3E0FEEF8EF0A4FF9000F324
:100B1000E02FFFA3E0FD9000FAE02430FB120E5C12
:100B20009000F9E004F0020A9222900038EBF0A362
:100B3000EAF0A3E9F0900040E4F0A3F0A3F0121073
:100B40009E900038E0FBA3E0FAA3E0F912111390A5
:100B5000003EE0FEA3E0FF7C007D0A12052E90001F
:100B60003EEEF0A3EFF090003E74FFF5F012056446
:100B700045F060527F0A7E001210E99000E7E070B5
:100B800004A3E0640170DF90003BE0F9A3E0FAA366
:100B9000E0900046C9F0A3EAF0A3E9F07B017A00F7
:100BA00079A512090C900040EBF0A3EAF0A3E9F05C
:100BB000900040E0FBA3E0FAA3E04A4B60A81210CB
:100BC0009E7E007F012212109EE4FEFF229000E72D
:100BD000E07002A3E07003020C6190004674FFF025
:100BE000A3741BF0A374C5F07B017A0079A51209E8
:100BF0000CE94A4B606B7B017A0079A57D2C120DC4
:100C0000729000A2EBF0A3EAF0A3E9F090FFFF12CC
:100C1000049AFF3395E0FE78627C007D019000A28B
:100C2000E0FBA3E0FAA3E0F912045B90003B74FF41
:100C3000F0A3741BF0A374F1F0A37407F0A374D0B5
:100C4000F07BFF7A1B79D3120B2AEF4E7F007002E4
:100C50007F01EF70D612109E7B017A00796212112B
:100C60001322787FE4F6D8FD758121020CA90210C9
:100C70005EE493A3F8E493A34003F68001F208DF57
:100C8000F48029E493A3F85407240CC8C333C45454
:100C90000F4420C8834004F456800146F6DFE48008
:100CA0000B0102040810204080901126E47E01937D
:100CB00060BCA3FF543F30E509541FFEE493A360DA
:100CC000010ECF54C025E060A840B8E493A3FAE435
:100CD00093A3F8E493A3C8C582C8CAC583CAF0A386
:100CE000C8C582C8CAC583CADFE9DEE780BE9000F6
:100CF000E9EFF09000EBEBF0E49000F0F0A3F0905F
:100D000000ECE0FF54077008EF131313541F800A20
:100D10009000ECE0131313541F049000F2F09000C5
:100D2000F2EDF09000ECE0FF9000F2E0FDC39F5088
:100D3000409000E9E0FF120003E0FC9000EBE0FFD0
:100D4000ECC39F50249000EDE0FBA3E0FAA3E0F990
:100D5000A3E475F00112056485F082F58312049A0C
:100D6000FF7D01120FBA0C80D29000F2E004F080F7
:100D7000B222900005EBF0A3EAF0A3E9F0A3EBF0B8
:100D8000A3EAF0A3E9F0900008E0FBA3E0FAA3E0F7
:100D9000F9120481600C900009E475F0011205B8A5
:100DA00080E4900008E0FBA3E0FAA3E0F9120481DC
:100DB0006D700122900005E0FBA3E0FAA3E0F9EBDF
:100DC000C0E0EAC0E0E9C0E0A3E0FBA374FFF5F0F7
:100DD000120564FAD082D083D0E06B7009E5F0652B
:100DE000827003EA658370BAFBFAF922C0E0C0F0B2
:100DF000C083C082C0D075D000C000C006C007301C
:100E00009849C2989000E5E475F001120564FE74FB
:100E1000A525F0F58274003EF583E599F09000E594
:100E2000E0FEA3E0FF24A4F58274003EF583E0B465
:100E30000A089000E7E4F0A304F0EF64404E700B62
:100E40009000E5F0A3F0A3F0A304F0D007D006D003
:100E500000D0D0D082D083D0F0D0E032AA07A9054C
:100E6000AF03E4FCEF24E0FBEAD3947F4004E4FA10
:100E70000909AF02AD01120003E4FC75F010EBA408
:100E80002CF582E435F0F583E582249CF582E58338
:100E90003413120FB30CECB408E1AF02E904FD12F5
:100EA0000003E4FC75F010EBA42CF582E435F0F5BA
:100EB00083E58224A4F582E5833413120FB30CEC8E
:100EC000B408E122900005EFF0A3EDF0A3EBF0A34E
:100ED000EAF0A3E9F0E4A3F0900007E0FBA3E0FA56
:100EE000A3E0F9A3E0F58275830012049AFB602762
:100EF000900005E0FFA3E0FD120E5C900005E024E9
:100F000008F0E0D394784007E4F0A3E02402F090E6
:100F1000000AE004F080C122A907AA05E4900005B8
:100F2000F0120003E4FC75F040EBA4248CF582E59C
:100F3000F03419120FA9900005E004F00CECB41085
:100F4000E5AF01EA04FD120003E4FC75F040EBA4F8
:100F500024ACF582E5F03419120FA9900005E004E5
:100F6000F00CECB410E522E4FBFD7F10120F187BAF
:100F700001E4FD7F20120F187B02E4FD7F30120F89
:100F8000187B03E4FD7F40120F187B04E4FD7F50C3
:100F9000120F187B05E4FD7F60120F187BFF7A119A
:100FA000796F7D027F20020EC4F583E5822CF582E5
:100FB000E43583F583E493FF7D01ED6004D2A380E3
:100FC00002C2A3C2A4E4FEC2A0EF30E704D2A18013
:100FD00002C2A1D2A0EF25E0FF0EEEB408E9D2A430
:100FE000D2A3229000E7E07002A3E060207B017AA8
:100FF0000079A5121113120614E49000E5F0A3F095
:10100000FE7F40FD7B017A0079A512057A22E4FC7F
:10101000EC24B0FFE4FD120FBAE4FF120FBA7F1008
:10102000120FBAE4FB7D01E4FF120FBA0BEBB480A0
:10103000F40CECB408DA22EFB40A07740D12104273
:10104000740A309811A899B8130CC2983098FDA86A
:1010500099C298B811F63099FDC299F599221210EB
:10106000D31209CB90000374FFF0A3741BF0A37498
:10107000BBF07BFF7A1B79B21207AF120FE380FB44
:101080009000FCEFF0A9057F017E00AD0119ED6035
:101090000C9000FCE0FD7C001204C780EE227E0074
:1010A0007F407D007B017A0079A512057AE49000EB
:1010B000E5F0A3F0A3F0A3F022EF4E60157D087CCD
:1010C00007ED1DAA0470011C4A70F6EF1F70EA1E9E
:1010D00080E72275985053890F438920758BFD75E1
:1010E0008DFDD28ED2ACD2AF22EF1FAC0670011EA6
:1010F0004C600A7D027CEFDCFEDDFC80EC22E4FF2C
:10110000FE120481600C0FEF70010E09E970F20A03
:1011100080EF22120481FF600C121167740129F91B
:10112000E43AFA80EE224300A20000004200E5000B
:10113000004200E7000000E4FD7F8D120FBA7F142B
:10114000120FBA7FAF020FBAE4FD7F8D120FBA7F84
:1011500010120FBA7FAE020FBA9000E7E07002A340
:10116000E06003120614228F993099FDC29922572C
:10117000463234000000000000000000002F000094
:1011800000000700070000147F147F1400242A7F4A
:101190002A120062640813230036495522500000C9
:1011A0000503000000001C224100000041221C0039
:1011B0000014083E08140008083E0808000000A0BB
:1011C00060000008080808080000606000000020B7
:1011D00010080402003E5149453E0000427F400095
:1011E000004261514946002141454B31001814121B
:1011F0007F10002745454539003C4A4949300001E8
:101200007109050300364949493600064949291E36
:101210000000363600000000563600000008142298
:101220004100001414141414000041221408000298
:101230000151090600324959513E007C1211127CBD
:10124000007F49494936003E41414122007F4141EA
:10125000221C007F49494941007F09090901003EDC
:101260004149497A007F0808087F0000417F41001A
:10127000002040413F01007F08142241007F404090
:101280004040007F020C027F007F0408107F003E78
:101290004141413E007F09090906003E4151215E5E
:1012A000007F091929460046494949310001017F5B
:1012B0000101003F4040403F001F2040201F003FF1
:1012C0004038403F006314081463000708700807A3
:1012D00000615149454300007F41410000552A55B6
:1012E0002A55000041417F00000402010204004031
:1012F0004040404000000102040000205454547853
:10130000007F484444380038444444200038444472
:10131000487F00385454541800087E090102001810
:10132000A4A4A47C007F080404780000447D40004D
:10133000004080847D00007F102844000000417F31
:101340004000007C04180478007C0804047800380D
:101350004444443800FC242424180018242418FC95
:10136000007C0804040800485454542000043F44FE
:101370004020003C4040207C001C2040201C003CC1
:101380004030403C004428102844001CA0A0A07C11
:10139000004464544C441414141414140000000049
:1013A000000000000000000000000000000000F845
:1013B00000000000000000333000000000100C06A8
:1013C000100C0600000000000000000040C0784043
:1013D000C0784000043F04043F040400007088FC0F
:1013E00008300000001820FF211E0000F008F00067
:1013F000E018000000211C031E211E0000F00888D8
:10140000700000001E2123241927211010160E0041
:10141000000000000000000000000000000000E0EC
:101420001804020000000007182040000002041801
:10143000E00000000040201807000000404080F05D
:10144000804040000202010F01020200000000F093
:10145000000000000101011F010101000000000067
:101460000000000080B070000000000000000000DC
:101470000000000000010101010101010000000065
:1014800000000000003030000000000000000000FC
:1014900080601804006018060100000000E01008D9
:1014A0000810E000000F102020100F00001010F8AE
:1014B000000000000020203F2020000000700808ED
:1014C000088870000030282422213000003008886D
:1014D000884830000018202020110E000000C02095
:1014E00010F8000000070424243F240000F80888B6
:1014F000880808000019212020110E0000E0108843
:1015000088180000000F112020110E000038080874
:10151000C83808000000003F000000000070880884
:1015200008887000001C222121221C0000E0100805
:101530000810E0000000312222110F00000000C05E
:10154000C0000000000000303000000000000080FB
:1015500000000000000080600000000000008040EB
:101560002010080000010204081020004040404004
:101570004040400004040404040404000008102057
:10158000408000000020100804020100007048089C
:101590000808F0000000003036010000C030C82804
:1015A000E810E0000718272423140B000000C038BF
:1015B000E0000000203C23020227382008F8888839
:1015C00088700000203F202020110E00C030080845
:1015D00008083800071820202010080008F808081C
:1015E0000810E000203F202020100F0008F8888815
:1015F000E8081000203F20202320180008F88888E1
:10160000E8081000203F200003000000C030080858
:101610000838000007182020221E020008F80800E1
:101620000008F808203F210101213F20000808F8A8
:10163000080800000020203F2020000000000808CB
:10164000F8080800C08080807F00000008F888C08B
:1016500028180800203F20012638200008F808003C
:1016600000000000203F20202020300008F8F80073
:10167000F8F80800203F003F003F200008F830C085
:101680000008F808203F200007183F00E010080875
:101690000810E0000F10202020100F0008F80808A4
:1016A0000808F000203F210101010000E0100808B7
:1016B0000810E0000F18242438504F0008F88888DC
:1016C00088887000203F2000030C302000708808BC
:1016D000080838000038202121221C00180808F8CA
:1016E000080818000000203F2000000008F808004B
:1016F0000008F808001F202020201F00087888001C
:1017000000C83808000007380E010000F80800F88B
:101710000008F800033C0700073C03000818688035
:101720008068180820302C03032C30200838C800AB
:10173000C83808000000203F2000000010080808FA
:10174000C83808002038262120201800000000FE9C
:10175000020202000000007F40404000000C30C048
:1017600000000000000000010638C0000002020274
:10177000FE000000004040407F0000000000040226
:101780000202040000000000000000000000000051
:101790000000000080808080808080800002020441
:1017A0000000000000000000000000000000808039
:1017B000808000000019242222223F2008F80080A7
:1017C00080000000003F112020110E00000000806A
:1017D00080800000000E11202020110000000080F9
:1017E0008088F800000E112020103F20000080802B
:1017F00080800000001F222222221300008080F03F
:10180000888888180020203F202000000000808069
:1018100080808000006B94949493600008F80080AE
:1018200080800000203F210000203F200080989809
:10183000000000000020203F202000000000008069
:101840009898000000C08080807F000008F80000A9
:1018500080808000203F24022D302000000808F8FE
:10186000000000000020203F2020000080808080B9
:1018700080808000203F20003F20003F808000804B
:1018800080800000203F210000203F200000808059
:1018900080800000001F202020201F00808000800A
:1018A0008000000080FFA12020110E0000000080B9
:1018B00080808000000E112020A0FF8080808000AA
:1018C0008080800020203F212000010000008080D7
:1018D000808080000033242424241900008080E0CC
:1018E000808000000000001F202000008080000099
:1018F00000808000001F202020103F20808080007A
:101900000080808000010E30080601008080008089
:10191000008080800F300C030C300F0000808000AE
:10192000808080000020312E0E31200080808000D9
:101930000080808080818E70180601000080808089
:10194000808080000021302C222130000000000027
:10195000807C020200000000003F404000000000C8
:10196000FF00000000000000FF0000000002027CF9
:10197000800000000040403F000000000006010120
:1019800002020404000000000000000020202020CB
:10199000202020FF20202020202020000000000008
:1019A00000000000000000000000000080804020D7
:1019B000100C0300030C1020408080000000000089
:1019C000000000000000000000000000000101FD18
:1019D00055555755555555FD0101000000000000B3
:1019E000000000000000000000000000809088451A
:1019F0004F55252525554D4580808000000000006D
:101A00000000000000000000000000001010101096
:101A100010FF1010F0101116D01010000000000080
:101A200000000000000000000000000080402018BE
:101A3000064120103F444241404078000000000031
:101A40000000000000000000000000000010888678
:101A50004040202F509008020408000000000000C1
:101A6000000000000000000000000000010100FF75
:101A7000555555557F5555555541000000000000FE
:101A80000000000000000000000000002424A4FE6C
:101A9000A3220022CC0000FF000000000000000094
:101AA000000000000000000000000000080601FF28
:101AB00000010404040404FF02020200000000000C
:101AC000000000000000000000000000101010FFE7
:101AD000109008888888FF88888808000000000027
:101AE0000000000000000000000000000444827FAD
:101AF00001808040432C10284681800000000000B7
:101B00000000000000000000000000003139322E0B
:101B10003136382E3000524543563A746573742D71
:101B2000617070002B2B2B0041540D0A004F4B00AD
:101B300041542B43574D4F44453D300D0A0041540D
:101B40002B43574A41503D25732C25730D0A002B1A
:101B500043574A41503A312C0041542B4349504D90
:101B60004F44453D310D0A0041542B4349505354D5
:101B70004152543D5443502C3139322E3136382E97
:101B8000302E37312C323334370D0A002B43495075
:101B900053544152543A310041542B434950534518
:101BA0004E440D0A003A436F6E6E65637465640DB2
:101BB0000A0044582D534D41525400534D41525444
:101BC0004036303100524543563A746573742D6186
:101BD00070700041542B4D5154545055425241574E
:101BE0003D746573742D772C33322C302C300D0AF4
:041BF000004F4B0057
:00000001FF

View File

@@ -0,0 +1,7 @@
".\Objects\STARTUP.obj",
".\Objects\main.obj",
".\Objects\UART.obj",
".\Objects\oled.obj"
TO ".\Objects\51Project"
PRINT(".\Listings\51Project.map")

View File

@@ -0,0 +1,198 @@
$NOMOD51
;------------------------------------------------------------------------------
; This file is part of the C51 Compiler package
; Copyright (c) 1988-2005 Keil Elektronik GmbH and Keil Software, Inc.
; Version 8.01
;
; *** <<< Use Configuration Wizard in Context Menu >>> ***
;------------------------------------------------------------------------------
; STARTUP.A51: This code is executed after processor reset.
;
; To translate this file use A51 with the following invocation:
;
; A51 STARTUP.A51
;
; To link the modified STARTUP.OBJ file to your application use the following
; Lx51 invocation:
;
; Lx51 your object file list, STARTUP.OBJ controls
;
;------------------------------------------------------------------------------
;
; User-defined <h> Power-On Initialization of Memory
;
; With the following EQU statements the initialization of memory
; at processor reset can be defined:
;
; <o> IDATALEN: IDATA memory size <0x0-0x100>
; <i> Note: The absolute start-address of IDATA memory is always 0
; <i> The IDATA space overlaps physically the DATA and BIT areas.
IDATALEN EQU 80H
;
; <o> XDATASTART: XDATA memory start address <0x0-0xFFFF>
; <i> The absolute start address of XDATA memory
XDATASTART EQU 0
;
; <o> XDATALEN: XDATA memory size <0x0-0xFFFF>
; <i> The length of XDATA memory in bytes.
XDATALEN EQU 0
;
; <o> PDATASTART: PDATA memory start address <0x0-0xFFFF>
; <i> The absolute start address of PDATA memory
PDATASTART EQU 0H
;
; <o> PDATALEN: PDATA memory size <0x0-0xFF>
; <i> The length of PDATA memory in bytes.
PDATALEN EQU 0H
;
;</h>
;------------------------------------------------------------------------------
;
;<h> Reentrant Stack Initialization
;
; The following EQU statements define the stack pointer for reentrant
; functions and initialized it:
;
; <h> Stack Space for reentrant functions in the SMALL model.
; <q> IBPSTACK: Enable SMALL model reentrant stack
; <i> Stack space for reentrant functions in the SMALL model.
IBPSTACK EQU 0 ; set to 1 if small reentrant is used.
; <o> IBPSTACKTOP: End address of SMALL model stack <0x0-0xFF>
; <i> Set the top of the stack to the highest location.
IBPSTACKTOP EQU 0xFF +1 ; default 0FFH+1
; </h>
;
; <h> Stack Space for reentrant functions in the LARGE model.
; <q> XBPSTACK: Enable LARGE model reentrant stack
; <i> Stack space for reentrant functions in the LARGE model.
XBPSTACK EQU 0 ; set to 1 if large reentrant is used.
; <o> XBPSTACKTOP: End address of LARGE model stack <0x0-0xFFFF>
; <i> Set the top of the stack to the highest location.
XBPSTACKTOP EQU 0xFFFF +1 ; default 0FFFFH+1
; </h>
;
; <h> Stack Space for reentrant functions in the COMPACT model.
; <q> PBPSTACK: Enable COMPACT model reentrant stack
; <i> Stack space for reentrant functions in the COMPACT model.
PBPSTACK EQU 0 ; set to 1 if compact reentrant is used.
;
; <o> PBPSTACKTOP: End address of COMPACT model stack <0x0-0xFFFF>
; <i> Set the top of the stack to the highest location.
PBPSTACKTOP EQU 0xFF +1 ; default 0FFH+1
; </h>
;</h>
;------------------------------------------------------------------------------
;
; Memory Page for Using the Compact Model with 64 KByte xdata RAM
; <e>Compact Model Page Definition
;
; <i>Define the XDATA page used for PDATA variables.
; <i>PPAGE must conform with the PPAGE set in the linker invocation.
;
; Enable pdata memory page initalization
PPAGEENABLE EQU 0 ; set to 1 if pdata object are used.
;
; <o> PPAGE number <0x0-0xFF>
; <i> uppermost 256-byte address of the page used for PDATA variables.
PPAGE EQU 0
;
; <o> SFR address which supplies uppermost address byte <0x0-0xFF>
; <i> most 8051 variants use P2 as uppermost address byte
PPAGE_SFR DATA 0A0H
;
; </e>
;------------------------------------------------------------------------------
; Standard SFR Symbols
ACC DATA 0E0H
B DATA 0F0H
SP DATA 81H
DPL DATA 82H
DPH DATA 83H
NAME ?C_STARTUP
?C_C51STARTUP SEGMENT CODE
?STACK SEGMENT IDATA
RSEG ?STACK
DS 1
EXTRN CODE (?C_START)
PUBLIC ?C_STARTUP
CSEG AT 0
?C_STARTUP: LJMP STARTUP1
RSEG ?C_C51STARTUP
STARTUP1:
IF IDATALEN <> 0
MOV R0,#IDATALEN - 1
CLR A
IDATALOOP: MOV @R0,A
DJNZ R0,IDATALOOP
ENDIF
IF XDATALEN <> 0
MOV DPTR,#XDATASTART
MOV R7,#LOW (XDATALEN)
IF (LOW (XDATALEN)) <> 0
MOV R6,#(HIGH (XDATALEN)) +1
ELSE
MOV R6,#HIGH (XDATALEN)
ENDIF
CLR A
XDATALOOP: MOVX @DPTR,A
INC DPTR
DJNZ R7,XDATALOOP
DJNZ R6,XDATALOOP
ENDIF
IF PPAGEENABLE <> 0
MOV PPAGE_SFR,#PPAGE
ENDIF
IF PDATALEN <> 0
MOV R0,#LOW (PDATASTART)
MOV R7,#LOW (PDATALEN)
CLR A
PDATALOOP: MOVX @R0,A
INC R0
DJNZ R7,PDATALOOP
ENDIF
IF IBPSTACK <> 0
EXTRN DATA (?C_IBP)
MOV ?C_IBP,#LOW IBPSTACKTOP
ENDIF
IF XBPSTACK <> 0
EXTRN DATA (?C_XBP)
MOV ?C_XBP,#HIGH XBPSTACKTOP
MOV ?C_XBP+1,#LOW XBPSTACKTOP
ENDIF
IF PBPSTACK <> 0
EXTRN DATA (?C_PBP)
MOV ?C_PBP,#LOW PBPSTACKTOP
ENDIF
MOV SP,#?STACK-1
; This code is required if you use L51_BANK.A51 with Banking Mode 4
;<h> Code Banking
; <q> Select Bank 0 for L51_BANK.A51 Mode 4
#if 0
; <i> Initialize bank mechanism to code bank 0 when using L51_BANK.A51 with Banking Mode 4.
EXTRN CODE (?B_SWITCH0)
CALL ?B_SWITCH0 ; init bank mechanism to code bank 0
#endif
;</h>
LJMP ?C_START
END

View File

@@ -0,0 +1,176 @@
#include "UART.h"
#include <string.h>
#include "oled.h"
#include <stdio.h>
// 用于存储接收数据的数组
unsigned char rxBuffer[ARRAY_SIZE];
unsigned int rxIndex = 0; // 接收数据的索引
unsigned int rx_flag=0;
extern unsigned int CONNECT_FLEG;//连接标志
// 初始化串口
void Serial_Init() {
SCON = 0x50; // 设置为模式18位数据可变波特率
TMOD &= 0x0F; // 清除定时器1模式位
TMOD |= 0x20; // 设置定时器1为8位自动重装模式
TH1 = TL1 = 256 - (11059200 / 12 / 32) / BAUDRATE; // 设置波特率
TR1 = 1; // 启动定时器1
ES = 1; // 开启串口中断
EA = 1; // 开启全局中断
}
void Delay(unsigned int xms)
{
unsigned char i, j;
while(xms--)
{
i = 2;
j = 239;
do
{
while (--j);
} while (--i);
}
}
void buff_memset(void)
{
memset(rxBuffer,0,64);
rxIndex=0;
rx_flag = 0;
}
unsigned int WIFI_CheckAck(char* src, char* dest, int timeout)
{
char *check = NULL;
//清空缓冲
buff_memset();
UART_sentString(src);
timeout=timeout/10;//10ms处理一次
while(timeout--)
{
Delay(10);//延时1ms
if(rx_flag==1)
{
check = strstr(rxBuffer,dest);
if(check != NULL)
{
buff_memset();//数据有误 清空
return 1;
}
}
}
buff_memset();//数据有误 清空
return 0;//超时
}
sbit LED = P2^5;
sbit motor1 = P2^6;
sbit motor2 = P2^7;
void CONNECT_TX_Control(void)
{
char *ptr = NULL;
int number;
if (CONNECT_FLEG)
{
if(rx_flag)
{
if(strstr(rxBuffer,"192.168.0")!=NULL)
{
ptr = strrchr((char*)rxBuffer,','); // 以最后一个,为准后面为数据
if(strlen(ptr)-3==1) //判断接收到为一位数据 ,*\r\n
{
number = ptr[1]-'0';
switch(number)
{
case 1: LED = 0 ; break;
case 2: LED = 1; break;
case 3:OLED_Show(); break;
case 4:OLED_Clear(); break;
case 5:motor1=0;motor2=1; break;
case 6:motor1=1;motor2=0; break;
case 7:motor1=0;motor2=0 ; break;
default: return;
}
}
}
else if(strstr((char *)rxBuffer,"RECV:test-app")!=NULL)
{
ptr = strrchr((char*)rxBuffer,','); // 以最后一个,为准后面为数据
if(strlen(ptr)-3==1) //判断接收到为一位数据 ,*\r\n
{
number = ptr[1]-'0';
switch(number)
{
case 1: LED = 0 ; break;
case 2: LED = 1; break;
case 3:OLED_Show(); break;
case 4:OLED_Clear(); break;
case 5:motor1=0;motor2=1; break;
case 6:motor1=1;motor2=0; break;
case 7:motor1=0;motor2=0 ; break;
default: return;
}
}
}
}
buff_memset();//数据有误 清空
}
}
void CONNECT_TO_TCP(unsigned char* id,unsigned char *password)
{
unsigned char buf[50];
WIFI_CheckAck("+++",id,1500); //确保其退出透传
while(!WIFI_CheckAck("AT\r\n","OK",1000));
while(!WIFI_CheckAck("AT+CWMODE=0\r\n","OK",2000)); //STA模式
sprintf((char *)buf,"AT+CWJAP=%s,%s\r\n",id,password);
while(!WIFI_CheckAck((char *)buf,"+CWJAP:1,",5000));
while(!WIFI_CheckAck("AT+CIPMODE=1\r\n","OK",1000)!=0);
while(!WIFI_CheckAck("AT+CIPSTART=TCP,192.168.0.71,2347\r\n","+CIPSTART:1",3000));
while(!WIFI_CheckAck("AT+CIPSEND\r\n","OK",1000));
UART_sentString(":Connected\r\n");
CONNECT_FLEG = 1;
}
void UART_SendByte(unsigned char Byte)
{
SBUF=Byte;
while(!TI);
TI=0;
}
void UART_sentString(char *str)
{
while(*str){
UART_SendByte(*str);
str++;
}
}
// 串口接收中断服务程序
void Serial_ISR() interrupt 4 {
if (RI) {
RI = 0; // 清除接收中断标志
rxBuffer[rxIndex++] = SBUF; // 存储接收到的数据
if(rxBuffer[rxIndex-1]=='\n')
{
rx_flag=1;
}
if(rxIndex==64)
{
rxIndex=0;
rx_flag=1;
}
}
}

View File

@@ -0,0 +1,15 @@
#ifndef _UART_H_
#define _UART_H_
#include <REGX52.H> // STC89C52RC的寄存器定义
#define BAUDRATE 9600 // 波特率
#define ARRAY_SIZE 64 // 数组大小
void Serial_Init();
void Uart_send_String();
void UART_SendByte(unsigned char Byte);
void UART_sentString(char *str);
void Delay(unsigned int xms);
unsigned int WIFI_CheckAck(char* src, char* dest, int timeout);
void CONNECT_TO_TCP(unsigned char* id,unsigned char *password);
void CONNECT_TX_Control(void);
#endif

View File

@@ -0,0 +1,75 @@
//**** 声明 ********************************************************************
/*******************************************************************************
* 下面来自互联开源程序,由深圳市大夏龙雀科技有限公司收集
* 方便用户参考学习,本公司不提供任何技术支持
* 程序仅供测试参考,不能应用在实际工程中,不一定能通过编译
* 公司网站 http://www.szdx-smart.com/
* 淘宝网址 https://shop184598174.taobao.com/?spm=a1z10.5-c-s.w12096189-21564973333.3.547b1176WCCDxR&scene=taobao_shop
*******************************************************************************/
/********************************************************************
* 文件名 WF24-TCP协议应用
* 描述 : 该文件实现通过利用WF24给单片机发数据控制LED+OLED+电机。
***********************************************************************/
/*
Name: TCP
Created: 2024/8/21
Author: WAM
*/
#include <REGX52.H> // STC89C52RC的寄存器定义
#include "UART.h"
#include "string.h"
#include "stdio.h"
#include "oled.h"
extern unsigned int rxIndex;
extern unsigned char rxBuffer[ARRAY_SIZE];
extern unsigned int rx_flag;
unsigned int CONNECT_FLEG;//连接标志
// 主函数
unsigned char conver[64];
char *ptr = NULL;
void MQTT_CONVER(void);
void TCP_UDP_CONVER(void);
void main() {
Serial_Init(); // 初始化串口
OLED_Init();
CONNECT_TO_TCP("DX-SMART","SMART@601");
while (1) {
// 主循环,可以添加其他任务
TCP_UDP_CONVER();
}
}
void TCP_UDP_CONVER(void)
{
if (rx_flag)
{
UART_sentString(rxBuffer);
CONNECT_TX_Control();
rxIndex = 0; // 重置索引,准备下一次接收
memset(rxBuffer,0,ARRAY_SIZE); //清空缓冲区
}
}
void MQTT_CONVER(void)
{
if (rx_flag)
{
if(strstr(rxBuffer,"RECV:test-app")!=NULL)
{
ptr = strrchr(rxBuffer,',');
memcpy(conver,ptr,*(ptr-1));
while(!WIFI_CheckAck("AT+MQTTPUBRAW=test-w,32,0,0\r\n","OK",2000)!=0);
buff_memset();//数据有误 清空
UART_sentString(conver);
}
}
}
void MQTT_CONTROL(void)
{
if (rx_flag)
{
CONNECT_TX_Control();
}
}

View File

@@ -0,0 +1,249 @@
#include "oled.h"
#include "oledfont.h"
void delay_ms(unsigned int ms)
{
unsigned int a;
while(ms)
{
a=1800;
while(a--);
ms--;
}
return;
}
void OLED_Show()
{
OLED_ShowCHinese(16,0,0);
OLED_ShowCHinese(32,0,1);
OLED_ShowCHinese(48,0,2);
OLED_ShowCHinese(64,0,3);
OLED_ShowCHinese(80,0,4);
OLED_ShowCHinese(96,0,5);
OLED_ShowString(32,2,"WF24");
}
#if OLED_MODE==1
//向SSD1106写入一个字节。
//dat:要写入的数据/命令
//cmd:数据/命令标志 0,表示命令;1,表示数据;
void OLED_WR_Byte(u8 dat,u8 cmd)
{
DATAOUT(dat);
if(cmd)
OLED_DC_Set();
else
OLED_DC_Clr();
OLED_CS_Clr();
OLED_WR_Clr();
OLED_WR_Set();
OLED_CS_Set();
OLED_DC_Set();
}
#else
//向SSD1306写入一个字节。
//dat:要写入的数据/命令
//cmd:数据/命令标志 0,表示命令;1,表示数据;
void OLED_WR_Byte(u8 dat,u8 cmd)
{
u8 i;
if(cmd)
OLED_DC_Set();
else
OLED_DC_Clr();
OLED_CS_Clr();
for(i=0;i<8;i++)
{
OLED_SCLK_Clr();
if(dat&0x80)
{
OLED_SDIN_Set();
}
else
OLED_SDIN_Clr();
OLED_SCLK_Set();
dat<<=1;
}
OLED_CS_Set();
OLED_DC_Set();
}
#endif
void OLED_Set_Pos(unsigned char x, unsigned char y)
{
OLED_WR_Byte(0xb0+y,OLED_CMD);
OLED_WR_Byte(((x&0xf0)>>4)|0x10,OLED_CMD);
OLED_WR_Byte((x&0x0f)|0x01,OLED_CMD);
}
//开启OLED显示
void OLED_Display_On(void)
{
OLED_WR_Byte(0X8D,OLED_CMD); //SET DCDC命令
OLED_WR_Byte(0X14,OLED_CMD); //DCDC ON
OLED_WR_Byte(0XAF,OLED_CMD); //DISPLAY ON
}
//关闭OLED显示
void OLED_Display_Off(void)
{
OLED_WR_Byte(0X8D,OLED_CMD); //SET DCDC命令
OLED_WR_Byte(0X10,OLED_CMD); //DCDC OFF
OLED_WR_Byte(0XAE,OLED_CMD); //DISPLAY OFF
}
//清屏函数,清完屏,整个屏幕是黑色的!和没点亮一样!!!
void OLED_Clear(void)
{
u8 i,n;
for(i=0;i<8;i++)
{
OLED_WR_Byte (0xb0+i,OLED_CMD); //设置页地址0~7
OLED_WR_Byte (0x00,OLED_CMD); //设置显示位置—列低地址
OLED_WR_Byte (0x10,OLED_CMD); //设置显示位置—列高地址
for(n=0;n<128;n++)OLED_WR_Byte(0,OLED_DATA);
} //更新显示
}
//在指定位置显示一个字符,包括部分字符
//x:0~127
//y:0~63
//mode:0,反白显示;1,正常显示
//size:选择字体 16/12
void OLED_ShowChar(u8 x,u8 y,u8 chr)
{
unsigned char c=0,i=0;
c=chr-' ';//得到偏移后的值
if(x>Max_Column-1){x=0;y=y+2;}
if(SIZE ==16)
{
OLED_Set_Pos(x,y);
for(i=0;i<8;i++)
OLED_WR_Byte(F8X16[c*16+i],OLED_DATA);
OLED_Set_Pos(x,y+1);
for(i=0;i<8;i++)
OLED_WR_Byte(F8X16[c*16+i+8],OLED_DATA);
}
}
//m^n函数
u32 oled_pow(u8 m,u8 n)
{
u32 result=1;
while(n--)result*=m;
return result;
}
//显示2个数字
//x,y :起点坐标
//len :数字的位数
//size:字体大小
//mode:模式 0,填充模式;1,叠加模式
//num:数值(0~4294967295);
void OLED_ShowNum(u8 x,u8 y,u32 num,u8 len,u8 size2)
{
u8 t,temp;
u8 enshow=0;
for(t=0;t<len;t++)
{
temp=(num/oled_pow(10,len-t-1))%10;
if(enshow==0&&t<(len-1))
{
if(temp==0)
{
OLED_ShowChar(x+(size2/2)*t,y,' ');
continue;
}else enshow=1;
}
OLED_ShowChar(x+(size2/2)*t,y,temp+'0');
}
}
//显示一个字符号串
void OLED_ShowString(u8 x,u8 y,u8 *chr)
{
unsigned char j=0;
while (chr[j]!='\0')
{ OLED_ShowChar(x,y,chr[j]);
x+=8;
if(x>120){x=0;y+=2;}
j++;
}
}
//显示汉字
void OLED_ShowCHinese(u8 x,u8 y,u8 no)
{
u8 t,adder=0;
OLED_Set_Pos(x,y);
for(t=0;t<16;t++)
{
OLED_WR_Byte(Hzk[2*no][t],OLED_DATA);
adder+=1;
}
OLED_Set_Pos(x,y+1);
for(t=0;t<16;t++)
{
OLED_WR_Byte(Hzk[2*no+1][t],OLED_DATA);
adder+=1;
}
}
/***********功能描述显示显示BMP图片128×64起始点坐标(x,y),x的范围0127y为页的范围07*****************/
void OLED_DrawBMP(unsigned char x0, unsigned char y0,unsigned char x1, unsigned char y1,unsigned char BMP[])
{
unsigned int j=0;
unsigned char x,y;
if(y1%8==0) y=y1/8;
else y=y1/8+1;
for(y=y0;y<y1;y++)
{
OLED_Set_Pos(x0,y);
for(x=x0;x<x1;x++)
{
OLED_WR_Byte(BMP[j++],OLED_DATA);
}
}
}
//初始化SSD1306
void OLED_Init(void)
{
OLED_RST_Set();
delay_ms(100);
OLED_RST_Clr();
delay_ms(100);
OLED_RST_Set();
OLED_WR_Byte(0xAE,OLED_CMD);//--turn off oled panel
OLED_WR_Byte(0x00,OLED_CMD);//---set low column address
OLED_WR_Byte(0x10,OLED_CMD);//---set high column address
OLED_WR_Byte(0x40,OLED_CMD);//--set start line address Set Mapping RAM Display Start Line (0x00~0x3F)
OLED_WR_Byte(0x81,OLED_CMD);//--set contrast control register
OLED_WR_Byte(0xCF,OLED_CMD); // Set SEG Output Current Brightness
OLED_WR_Byte(0xA1,OLED_CMD);//--Set SEG/Column Mapping 0xa0左右反置 0xa1正常
OLED_WR_Byte(0xC8,OLED_CMD);//Set COM/Row Scan Direction 0xc0上下反置 0xc8正常
OLED_WR_Byte(0xA6,OLED_CMD);//--set normal display
OLED_WR_Byte(0xA8,OLED_CMD);//--set multiplex ratio(1 to 64)
OLED_WR_Byte(0x3f,OLED_CMD);//--1/64 duty
OLED_WR_Byte(0xD3,OLED_CMD);//-set display offset Shift Mapping RAM Counter (0x00~0x3F)
OLED_WR_Byte(0x00,OLED_CMD);//-not offset
OLED_WR_Byte(0xd5,OLED_CMD);//--set display clock divide ratio/oscillator frequency
OLED_WR_Byte(0x80,OLED_CMD);//--set divide ratio, Set Clock as 100 Frames/Sec
OLED_WR_Byte(0xD9,OLED_CMD);//--set pre-charge period
OLED_WR_Byte(0xF1,OLED_CMD);//Set Pre-Charge as 15 Clocks & Discharge as 1 Clock
OLED_WR_Byte(0xDA,OLED_CMD);//--set com pins hardware configuration
OLED_WR_Byte(0x12,OLED_CMD);
OLED_WR_Byte(0xDB,OLED_CMD);//--set vcomh
OLED_WR_Byte(0x40,OLED_CMD);//Set VCOM Deselect Level
OLED_WR_Byte(0x20,OLED_CMD);//-Set Page Addressing Mode (0x00/0x01/0x02)
OLED_WR_Byte(0x02,OLED_CMD);//
OLED_WR_Byte(0x8D,OLED_CMD);//--set Charge Pump enable/disable
OLED_WR_Byte(0x14,OLED_CMD);//--set(0x10) disable
OLED_WR_Byte(0xA4,OLED_CMD);// Disable Entire Display On (0xa4/0xa5)
OLED_WR_Byte(0xA6,OLED_CMD);// Disable Inverse Display On (0xa6/a7)
OLED_WR_Byte(0xAF,OLED_CMD);//--turn on oled panel
OLED_WR_Byte(0xAF,OLED_CMD); /*display ON*/
OLED_Clear();
OLED_Set_Pos(0,0);
}

View File

@@ -0,0 +1,73 @@
#ifndef _OLED_H_
#define _OLED_H_
#include <REGX52.H>
#define u8 unsigned char
#define u32 unsigned int
#define OLED_CMD 0 //写命令
#define OLED_DATA 1 //写数据
#define OLED_MODE 0
sbit OLED_CS=P2^4; //片选
sbit OLED_RST =P2^2;//复位
sbit OLED_DC =P2^3;//数据/命令控制
sbit OLED_SCL=P2^0;//时钟 D0SCLK
sbit OLED_SDIN=P2^1;//D1MOSI 数据
#define OLED_CS_Clr() OLED_CS=0
#define OLED_CS_Set() OLED_CS=1
#define OLED_RST_Clr() OLED_RST=0
#define OLED_RST_Set() OLED_RST=1
#define OLED_DC_Clr() OLED_DC=0
#define OLED_DC_Set() OLED_DC=1
#define OLED_SCLK_Clr() OLED_SCL=0
#define OLED_SCLK_Set() OLED_SCL=1
#define OLED_SDIN_Clr() OLED_SDIN=0
#define OLED_SDIN_Set() OLED_SDIN=1
//OLED模式设置
//0:4线串行模式
//1:并行8080模式
#define SIZE 16
#define XLevelL 0x02
#define XLevelH 0x10
#define Max_Column 128
#define Max_Row 64
#define Brightness 0xFF
#define X_WIDTH 128
#define Y_WIDTH 64
//-----------------OLED端口定义----------------
void delay_ms(unsigned int ms);
void OLED_Show();
//OLED控制用函数
void OLED_WR_Byte(u8 dat,u8 cmd);
void OLED_Display_On(void);
void OLED_Display_Off(void);
void OLED_Init(void);
void OLED_Clear(void);
void OLED_DrawPoint(u8 x,u8 y,u8 t);
void OLED_Fill(u8 x1,u8 y1,u8 x2,u8 y2,u8 dot);
void OLED_ShowChar(u8 x,u8 y,u8 chr);
void OLED_ShowNum(u8 x,u8 y,u32 num,u8 len,u8 size2);
void OLED_ShowString(u8 x,u8 y, u8 *p);
void OLED_Set_Pos(unsigned char x, unsigned char y);
void OLED_ShowCHinese(u8 x,u8 y,u8 no);
void OLED_DrawBMP(unsigned char x0, unsigned char y0,unsigned char x1, unsigned char y1,unsigned char BMP[]);
#endif

View File

@@ -0,0 +1,225 @@
//#endif /*_OLEDFONT_H*/
#ifndef __OLEDFONT_H
#define __OLEDFONT_H
//常用ASCII表
//偏移量32
//ASCII字符集
//偏移量32
//大小:12*6
/************************************6*8的点阵************************************/
const unsigned char code 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
};
/****************************************8*16的点阵************************************/
const unsigned char code F8X16[]=
{
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,// 0
0x00,0x00,0x00,0xF8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x33,0x30,0x00,0x00,0x00,//! 1
0x00,0x10,0x0C,0x06,0x10,0x0C,0x06,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//" 2
0x40,0xC0,0x78,0x40,0xC0,0x78,0x40,0x00,0x04,0x3F,0x04,0x04,0x3F,0x04,0x04,0x00,//# 3
0x00,0x70,0x88,0xFC,0x08,0x30,0x00,0x00,0x00,0x18,0x20,0xFF,0x21,0x1E,0x00,0x00,//$ 4
0xF0,0x08,0xF0,0x00,0xE0,0x18,0x00,0x00,0x00,0x21,0x1C,0x03,0x1E,0x21,0x1E,0x00,//% 5
0x00,0xF0,0x08,0x88,0x70,0x00,0x00,0x00,0x1E,0x21,0x23,0x24,0x19,0x27,0x21,0x10,//& 6
0x10,0x16,0x0E,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//' 7
0x00,0x00,0x00,0xE0,0x18,0x04,0x02,0x00,0x00,0x00,0x00,0x07,0x18,0x20,0x40,0x00,//( 8
0x00,0x02,0x04,0x18,0xE0,0x00,0x00,0x00,0x00,0x40,0x20,0x18,0x07,0x00,0x00,0x00,//) 9
0x40,0x40,0x80,0xF0,0x80,0x40,0x40,0x00,0x02,0x02,0x01,0x0F,0x01,0x02,0x02,0x00,//* 10
0x00,0x00,0x00,0xF0,0x00,0x00,0x00,0x00,0x01,0x01,0x01,0x1F,0x01,0x01,0x01,0x00,//+ 11
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xB0,0x70,0x00,0x00,0x00,0x00,0x00,//, 12
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x01,0x01,0x01,0x01,0x01,//- 13
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x30,0x00,0x00,0x00,0x00,0x00,//. 14
0x00,0x00,0x00,0x00,0x80,0x60,0x18,0x04,0x00,0x60,0x18,0x06,0x01,0x00,0x00,0x00,/// 15
0x00,0xE0,0x10,0x08,0x08,0x10,0xE0,0x00,0x00,0x0F,0x10,0x20,0x20,0x10,0x0F,0x00,//0 16
0x00,0x10,0x10,0xF8,0x00,0x00,0x00,0x00,0x00,0x20,0x20,0x3F,0x20,0x20,0x00,0x00,//1 17
0x00,0x70,0x08,0x08,0x08,0x88,0x70,0x00,0x00,0x30,0x28,0x24,0x22,0x21,0x30,0x00,//2 18
0x00,0x30,0x08,0x88,0x88,0x48,0x30,0x00,0x00,0x18,0x20,0x20,0x20,0x11,0x0E,0x00,//3 19
0x00,0x00,0xC0,0x20,0x10,0xF8,0x00,0x00,0x00,0x07,0x04,0x24,0x24,0x3F,0x24,0x00,//4 20
0x00,0xF8,0x08,0x88,0x88,0x08,0x08,0x00,0x00,0x19,0x21,0x20,0x20,0x11,0x0E,0x00,//5 21
0x00,0xE0,0x10,0x88,0x88,0x18,0x00,0x00,0x00,0x0F,0x11,0x20,0x20,0x11,0x0E,0x00,//6 22
0x00,0x38,0x08,0x08,0xC8,0x38,0x08,0x00,0x00,0x00,0x00,0x3F,0x00,0x00,0x00,0x00,//7 23
0x00,0x70,0x88,0x08,0x08,0x88,0x70,0x00,0x00,0x1C,0x22,0x21,0x21,0x22,0x1C,0x00,//8 24
0x00,0xE0,0x10,0x08,0x08,0x10,0xE0,0x00,0x00,0x00,0x31,0x22,0x22,0x11,0x0F,0x00,//9 25
0x00,0x00,0x00,0xC0,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x30,0x00,0x00,0x00,//: 26
0x00,0x00,0x00,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x60,0x00,0x00,0x00,0x00,//; 27
0x00,0x00,0x80,0x40,0x20,0x10,0x08,0x00,0x00,0x01,0x02,0x04,0x08,0x10,0x20,0x00,//< 28
0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x00,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x00,//= 29
0x00,0x08,0x10,0x20,0x40,0x80,0x00,0x00,0x00,0x20,0x10,0x08,0x04,0x02,0x01,0x00,//> 30
0x00,0x70,0x48,0x08,0x08,0x08,0xF0,0x00,0x00,0x00,0x00,0x30,0x36,0x01,0x00,0x00,//? 31
0xC0,0x30,0xC8,0x28,0xE8,0x10,0xE0,0x00,0x07,0x18,0x27,0x24,0x23,0x14,0x0B,0x00,//@ 32
0x00,0x00,0xC0,0x38,0xE0,0x00,0x00,0x00,0x20,0x3C,0x23,0x02,0x02,0x27,0x38,0x20,//A 33
0x08,0xF8,0x88,0x88,0x88,0x70,0x00,0x00,0x20,0x3F,0x20,0x20,0x20,0x11,0x0E,0x00,//B 34
0xC0,0x30,0x08,0x08,0x08,0x08,0x38,0x00,0x07,0x18,0x20,0x20,0x20,0x10,0x08,0x00,//C 35
0x08,0xF8,0x08,0x08,0x08,0x10,0xE0,0x00,0x20,0x3F,0x20,0x20,0x20,0x10,0x0F,0x00,//D 36
0x08,0xF8,0x88,0x88,0xE8,0x08,0x10,0x00,0x20,0x3F,0x20,0x20,0x23,0x20,0x18,0x00,//E 37
0x08,0xF8,0x88,0x88,0xE8,0x08,0x10,0x00,0x20,0x3F,0x20,0x00,0x03,0x00,0x00,0x00,//F 38
0xC0,0x30,0x08,0x08,0x08,0x38,0x00,0x00,0x07,0x18,0x20,0x20,0x22,0x1E,0x02,0x00,//G 39
0x08,0xF8,0x08,0x00,0x00,0x08,0xF8,0x08,0x20,0x3F,0x21,0x01,0x01,0x21,0x3F,0x20,//H 40
0x00,0x08,0x08,0xF8,0x08,0x08,0x00,0x00,0x00,0x20,0x20,0x3F,0x20,0x20,0x00,0x00,//I 41
0x00,0x00,0x08,0x08,0xF8,0x08,0x08,0x00,0xC0,0x80,0x80,0x80,0x7F,0x00,0x00,0x00,//J 42
0x08,0xF8,0x88,0xC0,0x28,0x18,0x08,0x00,0x20,0x3F,0x20,0x01,0x26,0x38,0x20,0x00,//K 43
0x08,0xF8,0x08,0x00,0x00,0x00,0x00,0x00,0x20,0x3F,0x20,0x20,0x20,0x20,0x30,0x00,//L 44
0x08,0xF8,0xF8,0x00,0xF8,0xF8,0x08,0x00,0x20,0x3F,0x00,0x3F,0x00,0x3F,0x20,0x00,//M 45
0x08,0xF8,0x30,0xC0,0x00,0x08,0xF8,0x08,0x20,0x3F,0x20,0x00,0x07,0x18,0x3F,0x00,//N 46
0xE0,0x10,0x08,0x08,0x08,0x10,0xE0,0x00,0x0F,0x10,0x20,0x20,0x20,0x10,0x0F,0x00,//O 47
0x08,0xF8,0x08,0x08,0x08,0x08,0xF0,0x00,0x20,0x3F,0x21,0x01,0x01,0x01,0x00,0x00,//P 48
0xE0,0x10,0x08,0x08,0x08,0x10,0xE0,0x00,0x0F,0x18,0x24,0x24,0x38,0x50,0x4F,0x00,//Q 49
0x08,0xF8,0x88,0x88,0x88,0x88,0x70,0x00,0x20,0x3F,0x20,0x00,0x03,0x0C,0x30,0x20,//R 50
0x00,0x70,0x88,0x08,0x08,0x08,0x38,0x00,0x00,0x38,0x20,0x21,0x21,0x22,0x1C,0x00,//S 51
0x18,0x08,0x08,0xF8,0x08,0x08,0x18,0x00,0x00,0x00,0x20,0x3F,0x20,0x00,0x00,0x00,//T 52
0x08,0xF8,0x08,0x00,0x00,0x08,0xF8,0x08,0x00,0x1F,0x20,0x20,0x20,0x20,0x1F,0x00,//U 53
0x08,0x78,0x88,0x00,0x00,0xC8,0x38,0x08,0x00,0x00,0x07,0x38,0x0E,0x01,0x00,0x00,//V 54
0xF8,0x08,0x00,0xF8,0x00,0x08,0xF8,0x00,0x03,0x3C,0x07,0x00,0x07,0x3C,0x03,0x00,//W 55
0x08,0x18,0x68,0x80,0x80,0x68,0x18,0x08,0x20,0x30,0x2C,0x03,0x03,0x2C,0x30,0x20,//X 56
0x08,0x38,0xC8,0x00,0xC8,0x38,0x08,0x00,0x00,0x00,0x20,0x3F,0x20,0x00,0x00,0x00,//Y 57
0x10,0x08,0x08,0x08,0xC8,0x38,0x08,0x00,0x20,0x38,0x26,0x21,0x20,0x20,0x18,0x00,//Z 58
0x00,0x00,0x00,0xFE,0x02,0x02,0x02,0x00,0x00,0x00,0x00,0x7F,0x40,0x40,0x40,0x00,//[ 59
0x00,0x0C,0x30,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x06,0x38,0xC0,0x00,//\ 60
0x00,0x02,0x02,0x02,0xFE,0x00,0x00,0x00,0x00,0x40,0x40,0x40,0x7F,0x00,0x00,0x00,//] 61
0x00,0x00,0x04,0x02,0x02,0x02,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//^ 62
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,//_ 63
0x00,0x02,0x02,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//` 64
0x00,0x00,0x80,0x80,0x80,0x80,0x00,0x00,0x00,0x19,0x24,0x22,0x22,0x22,0x3F,0x20,//a 65
0x08,0xF8,0x00,0x80,0x80,0x00,0x00,0x00,0x00,0x3F,0x11,0x20,0x20,0x11,0x0E,0x00,//b 66
0x00,0x00,0x00,0x80,0x80,0x80,0x00,0x00,0x00,0x0E,0x11,0x20,0x20,0x20,0x11,0x00,//c 67
0x00,0x00,0x00,0x80,0x80,0x88,0xF8,0x00,0x00,0x0E,0x11,0x20,0x20,0x10,0x3F,0x20,//d 68
0x00,0x00,0x80,0x80,0x80,0x80,0x00,0x00,0x00,0x1F,0x22,0x22,0x22,0x22,0x13,0x00,//e 69
0x00,0x80,0x80,0xF0,0x88,0x88,0x88,0x18,0x00,0x20,0x20,0x3F,0x20,0x20,0x00,0x00,//f 70
0x00,0x00,0x80,0x80,0x80,0x80,0x80,0x00,0x00,0x6B,0x94,0x94,0x94,0x93,0x60,0x00,//g 71
0x08,0xF8,0x00,0x80,0x80,0x80,0x00,0x00,0x20,0x3F,0x21,0x00,0x00,0x20,0x3F,0x20,//h 72
0x00,0x80,0x98,0x98,0x00,0x00,0x00,0x00,0x00,0x20,0x20,0x3F,0x20,0x20,0x00,0x00,//i 73
0x00,0x00,0x00,0x80,0x98,0x98,0x00,0x00,0x00,0xC0,0x80,0x80,0x80,0x7F,0x00,0x00,//j 74
0x08,0xF8,0x00,0x00,0x80,0x80,0x80,0x00,0x20,0x3F,0x24,0x02,0x2D,0x30,0x20,0x00,//k 75
0x00,0x08,0x08,0xF8,0x00,0x00,0x00,0x00,0x00,0x20,0x20,0x3F,0x20,0x20,0x00,0x00,//l 76
0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x00,0x20,0x3F,0x20,0x00,0x3F,0x20,0x00,0x3F,//m 77
0x80,0x80,0x00,0x80,0x80,0x80,0x00,0x00,0x20,0x3F,0x21,0x00,0x00,0x20,0x3F,0x20,//n 78
0x00,0x00,0x80,0x80,0x80,0x80,0x00,0x00,0x00,0x1F,0x20,0x20,0x20,0x20,0x1F,0x00,//o 79
0x80,0x80,0x00,0x80,0x80,0x00,0x00,0x00,0x80,0xFF,0xA1,0x20,0x20,0x11,0x0E,0x00,//p 80
0x00,0x00,0x00,0x80,0x80,0x80,0x80,0x00,0x00,0x0E,0x11,0x20,0x20,0xA0,0xFF,0x80,//q 81
0x80,0x80,0x80,0x00,0x80,0x80,0x80,0x00,0x20,0x20,0x3F,0x21,0x20,0x00,0x01,0x00,//r 82
0x00,0x00,0x80,0x80,0x80,0x80,0x80,0x00,0x00,0x33,0x24,0x24,0x24,0x24,0x19,0x00,//s 83
0x00,0x80,0x80,0xE0,0x80,0x80,0x00,0x00,0x00,0x00,0x00,0x1F,0x20,0x20,0x00,0x00,//t 84
0x80,0x80,0x00,0x00,0x00,0x80,0x80,0x00,0x00,0x1F,0x20,0x20,0x20,0x10,0x3F,0x20,//u 85
0x80,0x80,0x80,0x00,0x00,0x80,0x80,0x80,0x00,0x01,0x0E,0x30,0x08,0x06,0x01,0x00,//v 86
0x80,0x80,0x00,0x80,0x00,0x80,0x80,0x80,0x0F,0x30,0x0C,0x03,0x0C,0x30,0x0F,0x00,//w 87
0x00,0x80,0x80,0x00,0x80,0x80,0x80,0x00,0x00,0x20,0x31,0x2E,0x0E,0x31,0x20,0x00,//x 88
0x80,0x80,0x80,0x00,0x00,0x80,0x80,0x80,0x80,0x81,0x8E,0x70,0x18,0x06,0x01,0x00,//y 89
0x00,0x80,0x80,0x80,0x80,0x80,0x80,0x00,0x00,0x21,0x30,0x2C,0x22,0x21,0x30,0x00,//z 90
0x00,0x00,0x00,0x00,0x80,0x7C,0x02,0x02,0x00,0x00,0x00,0x00,0x00,0x3F,0x40,0x40,//{ 91
0x00,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,//| 92
0x00,0x02,0x02,0x7C,0x80,0x00,0x00,0x00,0x00,0x40,0x40,0x3F,0x00,0x00,0x00,0x00,//} 93
0x00,0x06,0x01,0x01,0x02,0x02,0x04,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//~ 94
};
const char code Hzk[][32]={
{0x20,0x20,0x20,0x20,0x20,0x20,0x20,0xFF,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x00},
{0x80,0x80,0x40,0x20,0x10,0x0C,0x03,0x00,0x03,0x0C,0x10,0x20,0x40,0x80,0x80,0x00},/*"大",0*/
{0x00,0x01,0x01,0xFD,0x55,0x55,0x57,0x55,0x55,0x55,0x55,0xFD,0x01,0x01,0x00,0x00},
{0x80,0x90,0x88,0x45,0x4F,0x55,0x25,0x25,0x25,0x55,0x4D,0x45,0x80,0x80,0x80,0x00},/*"夏",1*/
{0x10,0x10,0x10,0x10,0x10,0xFF,0x10,0x10,0xF0,0x10,0x11,0x16,0xD0,0x10,0x10,0x00},
{0x80,0x40,0x20,0x18,0x06,0x41,0x20,0x10,0x3F,0x44,0x42,0x41,0x40,0x40,0x78,0x00},/*"龙",2*/
{0x00,0x10,0x88,0x86,0x40,0x40,0x20,0x2F,0x50,0x90,0x08,0x02,0x04,0x08,0x00,0x00},
{0x01,0x01,0x00,0xFF,0x55,0x55,0x55,0x55,0x7F,0x55,0x55,0x55,0x55,0x41,0x00,0x00},/*"雀",3*/
{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*/
};
#endif

View File

@@ -0,0 +1,233 @@
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<ProjectOpt xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="project_opt.xsd">
<SchemaVersion>1.0</SchemaVersion>
<Header>### uVision Project, (C) Keil Software</Header>
<Extensions>
<cExt>*.c</cExt>
<aExt>*.s*; *.src; *.a*</aExt>
<oExt>*.obj; *.o</oExt>
<lExt>*.lib</lExt>
<tExt>*.txt; *.h; *.inc; *.md</tExt>
<pExt>*.plm</pExt>
<CppX>*.cpp; *.cc; *.cxx</CppX>
<nMigrate>0</nMigrate>
</Extensions>
<DaveTm>
<dwLowDateTime>0</dwLowDateTime>
<dwHighDateTime>0</dwHighDateTime>
</DaveTm>
<Target>
<TargetName>Target 1</TargetName>
<ToolsetNumber>0x0</ToolsetNumber>
<ToolsetName>MCS-51</ToolsetName>
<TargetOption>
<CLK51>11059200</CLK51>
<OPTTT>
<gFlags>1</gFlags>
<BeepAtEnd>1</BeepAtEnd>
<RunSim>1</RunSim>
<RunTarget>0</RunTarget>
<RunAbUc>0</RunAbUc>
</OPTTT>
<OPTHX>
<HexSelection>0</HexSelection>
<FlashByte>65535</FlashByte>
<HexRangeLowAddress>0</HexRangeLowAddress>
<HexRangeHighAddress>0</HexRangeHighAddress>
<HexOffset>0</HexOffset>
</OPTHX>
<OPTLEX>
<PageWidth>120</PageWidth>
<PageLength>65</PageLength>
<TabStop>8</TabStop>
<ListingPath>.\Listings\</ListingPath>
</OPTLEX>
<ListingPage>
<CreateCListing>1</CreateCListing>
<CreateAListing>1</CreateAListing>
<CreateLListing>1</CreateLListing>
<CreateIListing>0</CreateIListing>
<AsmCond>1</AsmCond>
<AsmSymb>1</AsmSymb>
<AsmXref>0</AsmXref>
<CCond>1</CCond>
<CCode>0</CCode>
<CListInc>0</CListInc>
<CSymb>0</CSymb>
<LinkerCodeListing>0</LinkerCodeListing>
</ListingPage>
<OPTXL>
<LMap>1</LMap>
<LComments>1</LComments>
<LGenerateSymbols>1</LGenerateSymbols>
<LLibSym>1</LLibSym>
<LLines>1</LLines>
<LLocSym>1</LLocSym>
<LPubSym>1</LPubSym>
<LXref>0</LXref>
<LExpSel>0</LExpSel>
</OPTXL>
<OPTFL>
<tvExp>1</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<IsCurrentTarget>1</IsCurrentTarget>
</OPTFL>
<CpuCode>255</CpuCode>
<Books>
<Book>
<Number>0</Number>
<Title>Data Sheet</Title>
<Path>DATASHTS\ATMEL\AT89C52_DS.PDF</Path>
</Book>
<Book>
<Number>1</Number>
<Title>Instruction Set Manual</Title>
<Path>DATASHTS\ATMEL\AT_C51ISM.PDF</Path>
</Book>
</Books>
<DebugOpt>
<uSim>1</uSim>
<uTrg>0</uTrg>
<sLdApp>1</sLdApp>
<sGomain>1</sGomain>
<sRbreak>1</sRbreak>
<sRwatch>1</sRwatch>
<sRmem>1</sRmem>
<sRfunc>1</sRfunc>
<sRbox>1</sRbox>
<tLdApp>1</tLdApp>
<tGomain>0</tGomain>
<tRbreak>1</tRbreak>
<tRwatch>1</tRwatch>
<tRmem>1</tRmem>
<tRfunc>0</tRfunc>
<tRbox>1</tRbox>
<tRtrace>1</tRtrace>
<sRSysVw>1</sRSysVw>
<tRSysVw>1</tRSysVw>
<sRunDeb>0</sRunDeb>
<sLrtime>0</sLrtime>
<bEvRecOn>1</bEvRecOn>
<bSchkAxf>0</bSchkAxf>
<bTchkAxf>0</bTchkAxf>
<nTsel>-1</nTsel>
<sDll></sDll>
<sDllPa></sDllPa>
<sDlgDll></sDlgDll>
<sDlgPa></sDlgPa>
<sIfile></sIfile>
<tDll></tDll>
<tDllPa></tDllPa>
<tDlgDll></tDlgDll>
<tDlgPa></tDlgPa>
<tIfile></tIfile>
<pMon></pMon>
</DebugOpt>
<Breakpoint/>
<Tracepoint>
<THDelay>0</THDelay>
</Tracepoint>
<DebugFlag>
<trace>0</trace>
<periodic>1</periodic>
<aLwin>0</aLwin>
<aCover>0</aCover>
<aSer1>0</aSer1>
<aSer2>0</aSer2>
<aPa>0</aPa>
<viewmode>0</viewmode>
<vrSel>0</vrSel>
<aSym>0</aSym>
<aTbox>0</aTbox>
<AscS1>0</AscS1>
<AscS2>0</AscS2>
<AscS3>0</AscS3>
<aSer3>0</aSer3>
<eProf>0</eProf>
<aLa>0</aLa>
<aPa1>0</aPa1>
<AscS4>0</AscS4>
<aSer4>0</aSer4>
<StkLoc>0</StkLoc>
<TrcWin>0</TrcWin>
<newCpu>0</newCpu>
<uProt>0</uProt>
</DebugFlag>
<LintExecutable></LintExecutable>
<LintConfigFile></LintConfigFile>
<bLintAuto>0</bLintAuto>
<bAutoGenD>0</bAutoGenD>
<LntExFlags>0</LntExFlags>
<pMisraName></pMisraName>
<pszMrule></pszMrule>
<pSingCmds></pSingCmds>
<pMultCmds></pMultCmds>
<pMisraNamep></pMisraNamep>
<pszMrulep></pszMrulep>
<pSingCmdsp></pSingCmdsp>
<pMultCmdsp></pMultCmdsp>
</TargetOption>
</Target>
<Group>
<GroupName>User</GroupName>
<tvExp>1</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<cbSel>0</cbSel>
<RteFlg>0</RteFlg>
<File>
<GroupNumber>1</GroupNumber>
<FileNumber>1</FileNumber>
<FileType>2</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2>
<PathWithFileName>.\STARTUP.A51</PathWithFileName>
<FilenameWithoutPath>STARTUP.A51</FilenameWithoutPath>
<RteFlg>0</RteFlg>
<bShared>0</bShared>
</File>
<File>
<GroupNumber>1</GroupNumber>
<FileNumber>2</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2>
<PathWithFileName>..\User\main.c</PathWithFileName>
<FilenameWithoutPath>main.c</FilenameWithoutPath>
<RteFlg>0</RteFlg>
<bShared>0</bShared>
</File>
<File>
<GroupNumber>1</GroupNumber>
<FileNumber>3</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2>
<PathWithFileName>..\User\UART.C</PathWithFileName>
<FilenameWithoutPath>UART.C</FilenameWithoutPath>
<RteFlg>0</RteFlg>
<bShared>0</bShared>
</File>
<File>
<GroupNumber>1</GroupNumber>
<FileNumber>4</FileNumber>
<FileType>1</FileType>
<tvExp>1</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2>
<PathWithFileName>..\User\oled.c</PathWithFileName>
<FilenameWithoutPath>oled.c</FilenameWithoutPath>
<RteFlg>0</RteFlg>
<bShared>0</bShared>
</File>
</Group>
</ProjectOpt>

View File

@@ -0,0 +1,405 @@
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<Project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="project_proj.xsd">
<SchemaVersion>1.1</SchemaVersion>
<Header>### uVision Project, (C) Keil Software</Header>
<Targets>
<Target>
<TargetName>Target 1</TargetName>
<ToolsetNumber>0x0</ToolsetNumber>
<ToolsetName>MCS-51</ToolsetName>
<uAC6>0</uAC6>
<TargetOption>
<TargetCommonOption>
<Device>AT89C52</Device>
<Vendor>Microchip</Vendor>
<Cpu>IRAM(0-0xFF) IROM(0-0x1FFF) CLOCK(24000000)</Cpu>
<FlashUtilSpec></FlashUtilSpec>
<StartupFile>"LIB\STARTUP.A51" ("Standard 8051 Startup Code")</StartupFile>
<FlashDriverDll></FlashDriverDll>
<DeviceId>2980</DeviceId>
<RegisterFile>REGX52.H</RegisterFile>
<MemoryEnv></MemoryEnv>
<Cmp></Cmp>
<Asm></Asm>
<Linker></Linker>
<OHString></OHString>
<InfinionOptionDll></InfinionOptionDll>
<SLE66CMisc></SLE66CMisc>
<SLE66AMisc></SLE66AMisc>
<SLE66LinkerMisc></SLE66LinkerMisc>
<SFDFile></SFDFile>
<bCustSvd>0</bCustSvd>
<UseEnv>0</UseEnv>
<BinPath></BinPath>
<IncludePath></IncludePath>
<LibPath></LibPath>
<RegisterFilePath>Atmel\</RegisterFilePath>
<DBRegisterFilePath>Atmel\</DBRegisterFilePath>
<TargetStatus>
<Error>0</Error>
<ExitCodeStop>0</ExitCodeStop>
<ButtonStop>0</ButtonStop>
<NotGenerated>0</NotGenerated>
<InvalidFlash>1</InvalidFlash>
</TargetStatus>
<OutputDirectory>.\Objects\</OutputDirectory>
<OutputName>51Project</OutputName>
<CreateExecutable>1</CreateExecutable>
<CreateLib>0</CreateLib>
<CreateHexFile>1</CreateHexFile>
<DebugInformation>1</DebugInformation>
<BrowseInformation>1</BrowseInformation>
<ListingPath>.\Listings\</ListingPath>
<HexFormatSelection>0</HexFormatSelection>
<Merge32K>0</Merge32K>
<CreateBatchFile>0</CreateBatchFile>
<BeforeCompile>
<RunUserProg1>0</RunUserProg1>
<RunUserProg2>0</RunUserProg2>
<UserProg1Name></UserProg1Name>
<UserProg2Name></UserProg2Name>
<UserProg1Dos16Mode>0</UserProg1Dos16Mode>
<UserProg2Dos16Mode>0</UserProg2Dos16Mode>
<nStopU1X>0</nStopU1X>
<nStopU2X>0</nStopU2X>
</BeforeCompile>
<BeforeMake>
<RunUserProg1>0</RunUserProg1>
<RunUserProg2>0</RunUserProg2>
<UserProg1Name></UserProg1Name>
<UserProg2Name></UserProg2Name>
<UserProg1Dos16Mode>0</UserProg1Dos16Mode>
<UserProg2Dos16Mode>0</UserProg2Dos16Mode>
<nStopB1X>0</nStopB1X>
<nStopB2X>0</nStopB2X>
</BeforeMake>
<AfterMake>
<RunUserProg1>0</RunUserProg1>
<RunUserProg2>0</RunUserProg2>
<UserProg1Name></UserProg1Name>
<UserProg2Name></UserProg2Name>
<UserProg1Dos16Mode>0</UserProg1Dos16Mode>
<UserProg2Dos16Mode>0</UserProg2Dos16Mode>
<nStopA1X>0</nStopA1X>
<nStopA2X>0</nStopA2X>
</AfterMake>
<SelectedForBatchBuild>0</SelectedForBatchBuild>
<SVCSIdString></SVCSIdString>
</TargetCommonOption>
<CommonProperty>
<UseCPPCompiler>0</UseCPPCompiler>
<RVCTCodeConst>0</RVCTCodeConst>
<RVCTZI>0</RVCTZI>
<RVCTOtherData>0</RVCTOtherData>
<ModuleSelection>0</ModuleSelection>
<IncludeInBuild>1</IncludeInBuild>
<AlwaysBuild>0</AlwaysBuild>
<GenerateAssemblyFile>0</GenerateAssemblyFile>
<AssembleAssemblyFile>0</AssembleAssemblyFile>
<PublicsOnly>0</PublicsOnly>
<StopOnExitCode>3</StopOnExitCode>
<CustomArgument></CustomArgument>
<IncludeLibraryModules></IncludeLibraryModules>
<ComprImg>1</ComprImg>
<BankNo>65535</BankNo>
</CommonProperty>
<DllOption>
<SimDllName>S8051.DLL</SimDllName>
<SimDllArguments></SimDllArguments>
<SimDlgDll>DP51.DLL</SimDlgDll>
<SimDlgDllArguments>-p52</SimDlgDllArguments>
<TargetDllName>S8051.DLL</TargetDllName>
<TargetDllArguments></TargetDllArguments>
<TargetDlgDll>TP51.DLL</TargetDlgDll>
<TargetDlgDllArguments>-p52</TargetDlgDllArguments>
</DllOption>
<DebugOption>
<OPTHX>
<HexSelection>0</HexSelection>
<HexRangeLowAddress>0</HexRangeLowAddress>
<HexRangeHighAddress>0</HexRangeHighAddress>
<HexOffset>0</HexOffset>
<Oh166RecLen>16</Oh166RecLen>
</OPTHX>
<Simulator>
<UseSimulator>1</UseSimulator>
<LoadApplicationAtStartup>1</LoadApplicationAtStartup>
<RunToMain>1</RunToMain>
<RestoreBreakpoints>1</RestoreBreakpoints>
<RestoreWatchpoints>1</RestoreWatchpoints>
<RestoreMemoryDisplay>1</RestoreMemoryDisplay>
<RestoreFunctions>1</RestoreFunctions>
<RestoreToolbox>1</RestoreToolbox>
<LimitSpeedToRealTime>0</LimitSpeedToRealTime>
<RestoreSysVw>1</RestoreSysVw>
</Simulator>
<Target>
<UseTarget>0</UseTarget>
<LoadApplicationAtStartup>1</LoadApplicationAtStartup>
<RunToMain>0</RunToMain>
<RestoreBreakpoints>1</RestoreBreakpoints>
<RestoreWatchpoints>1</RestoreWatchpoints>
<RestoreMemoryDisplay>1</RestoreMemoryDisplay>
<RestoreFunctions>0</RestoreFunctions>
<RestoreToolbox>1</RestoreToolbox>
<RestoreTracepoints>1</RestoreTracepoints>
<RestoreSysVw>1</RestoreSysVw>
</Target>
<RunDebugAfterBuild>0</RunDebugAfterBuild>
<TargetSelection>-1</TargetSelection>
<SimDlls>
<CpuDll></CpuDll>
<CpuDllArguments></CpuDllArguments>
<PeripheralDll></PeripheralDll>
<PeripheralDllArguments></PeripheralDllArguments>
<InitializationFile></InitializationFile>
</SimDlls>
<TargetDlls>
<CpuDll></CpuDll>
<CpuDllArguments></CpuDllArguments>
<PeripheralDll></PeripheralDll>
<PeripheralDllArguments></PeripheralDllArguments>
<InitializationFile></InitializationFile>
<Driver></Driver>
</TargetDlls>
</DebugOption>
<Utilities>
<Flash1>
<UseTargetDll>0</UseTargetDll>
<UseExternalTool>0</UseExternalTool>
<RunIndependent>0</RunIndependent>
<UpdateFlashBeforeDebugging>0</UpdateFlashBeforeDebugging>
<Capability>0</Capability>
<DriverSelection>-1</DriverSelection>
</Flash1>
<bUseTDR>0</bUseTDR>
<Flash2></Flash2>
<Flash3></Flash3>
<Flash4></Flash4>
<pFcarmOut></pFcarmOut>
<pFcarmGrp></pFcarmGrp>
<pFcArmRoot></pFcArmRoot>
<FcArmLst>0</FcArmLst>
</Utilities>
<Target51>
<Target51Misc>
<MemoryModel>2</MemoryModel>
<RTOS>0</RTOS>
<RomSize>2</RomSize>
<DataHold>0</DataHold>
<XDataHold>0</XDataHold>
<UseOnchipRom>0</UseOnchipRom>
<UseOnchipArithmetic>0</UseOnchipArithmetic>
<UseMultipleDPTR>0</UseMultipleDPTR>
<UseOnchipXram>0</UseOnchipXram>
<HadIRAM>1</HadIRAM>
<HadXRAM>0</HadXRAM>
<HadIROM>1</HadIROM>
<Moda2>0</Moda2>
<Moddp2>0</Moddp2>
<Modp2>0</Modp2>
<Mod517dp>0</Mod517dp>
<Mod517au>0</Mod517au>
<Mode2>0</Mode2>
<useCB>0</useCB>
<useXB>0</useXB>
<useL251>1</useL251>
<useA251>0</useA251>
<Mx51>0</Mx51>
<ModC812>0</ModC812>
<ModCont>0</ModCont>
<Lp51>0</Lp51>
<useXBS>0</useXBS>
<ModDA>0</ModDA>
<ModAB2>0</ModAB2>
<Mx51P>0</Mx51P>
<hadXRAM2>0</hadXRAM2>
<uocXram2>0</uocXram2>
<hadXRAM3>0</hadXRAM3>
<ModC2>0</ModC2>
<ModH2>0</ModH2>
<Mdu_R515>0</Mdu_R515>
<Mdu_F120>0</Mdu_F120>
<Psoc>0</Psoc>
<hadIROM2>0</hadIROM2>
<hadIROM3>0</hadIROM3>
<ModSmx2>0</ModSmx2>
<cBanks>0</cBanks>
<xBanks>0</xBanks>
<OnChipMemories>
<RCB>
<Type>0</Type>
<StartAddress>0x0</StartAddress>
<Size>0xffff</Size>
</RCB>
<RXB>
<Type>0</Type>
<StartAddress>0x0</StartAddress>
<Size>0x0</Size>
</RXB>
<Ocm1>
<Type>0</Type>
<StartAddress>0x0</StartAddress>
<Size>0x0</Size>
</Ocm1>
<Ocm2>
<Type>0</Type>
<StartAddress>0x0</StartAddress>
<Size>0x0</Size>
</Ocm2>
<Ocm3>
<Type>0</Type>
<StartAddress>0x0</StartAddress>
<Size>0x0</Size>
</Ocm3>
<Ocr1>
<Type>0</Type>
<StartAddress>0x0</StartAddress>
<Size>0x0</Size>
</Ocr1>
<Ocr2>
<Type>0</Type>
<StartAddress>0x0</StartAddress>
<Size>0x0</Size>
</Ocr2>
<Ocr3>
<Type>0</Type>
<StartAddress>0x0</StartAddress>
<Size>0x0</Size>
</Ocr3>
<IRO>
<Type>1</Type>
<StartAddress>0x0</StartAddress>
<Size>0x2000</Size>
</IRO>
<IRA>
<Type>0</Type>
<StartAddress>0x0</StartAddress>
<Size>0x100</Size>
</IRA>
<XRA>
<Type>0</Type>
<StartAddress>0x0</StartAddress>
<Size>0x0</Size>
</XRA>
<XRA512>
<Type>0</Type>
<StartAddress>0x0</StartAddress>
<Size>0x0</Size>
</XRA512>
<IROM512>
<Type>0</Type>
<StartAddress>0x0</StartAddress>
<Size>0x0</Size>
</IROM512>
<XRA513>
<Type>0</Type>
<StartAddress>0x0</StartAddress>
<Size>0x0</Size>
</XRA513>
<IROM513>
<Type>0</Type>
<StartAddress>0x0</StartAddress>
<Size>0x0</Size>
</IROM513>
</OnChipMemories>
</Target51Misc>
<C51>
<RegisterColoring>0</RegisterColoring>
<VariablesInOrder>0</VariablesInOrder>
<IntegerPromotion>1</IntegerPromotion>
<uAregs>0</uAregs>
<UseInterruptVector>1</UseInterruptVector>
<Fuzzy>3</Fuzzy>
<Optimize>8</Optimize>
<WarningLevel>2</WarningLevel>
<SizeSpeed>1</SizeSpeed>
<ObjectExtend>1</ObjectExtend>
<ACallAJmp>0</ACallAJmp>
<InterruptVectorAddress>0</InterruptVectorAddress>
<VariousControls>
<MiscControls></MiscControls>
<Define></Define>
<Undefine></Undefine>
<IncludePath>..\User</IncludePath>
</VariousControls>
</C51>
<Ax51>
<UseMpl>0</UseMpl>
<UseStandard>1</UseStandard>
<UseCase>0</UseCase>
<UseMod51>0</UseMod51>
<VariousControls>
<MiscControls></MiscControls>
<Define></Define>
<Undefine></Undefine>
<IncludePath></IncludePath>
</VariousControls>
</Ax51>
<Lx51>
<useFile>0</useFile>
<linkonly>0</linkonly>
<UseMemoryFromTarget>1</UseMemoryFromTarget>
<CaseSensitiveSymbols>0</CaseSensitiveSymbols>
<WarningLevel>2</WarningLevel>
<DataOverlaying>1</DataOverlaying>
<OverlayString></OverlayString>
<MiscControls></MiscControls>
<DisableWarningNumbers></DisableWarningNumbers>
<LinkerCmdFile></LinkerCmdFile>
<Assign></Assign>
<ReserveString></ReserveString>
<CClasses></CClasses>
<UserClasses></UserClasses>
<CSection></CSection>
<UserSection></UserSection>
<CodeBaseAddress></CodeBaseAddress>
<XDataBaseAddress></XDataBaseAddress>
<PDataBaseAddress></PDataBaseAddress>
<BitBaseAddress></BitBaseAddress>
<DataBaseAddress></DataBaseAddress>
<IDataBaseAddress></IDataBaseAddress>
<Precede></Precede>
<Stack></Stack>
<CodeSegmentName></CodeSegmentName>
<XDataSegmentName></XDataSegmentName>
<BitSegmentName></BitSegmentName>
<DataSegmentName></DataSegmentName>
<IDataSegmentName></IDataSegmentName>
</Lx51>
</Target51>
</TargetOption>
<Groups>
<Group>
<GroupName>User</GroupName>
<Files>
<File>
<FileName>STARTUP.A51</FileName>
<FileType>2</FileType>
<FilePath>.\STARTUP.A51</FilePath>
</File>
<File>
<FileName>main.c</FileName>
<FileType>1</FileType>
<FilePath>..\User\main.c</FilePath>
</File>
<File>
<FileName>UART.C</FileName>
<FileType>1</FileType>
<FilePath>..\User\UART.C</FilePath>
</File>
<File>
<FileName>oled.c</FileName>
<FileType>1</FileType>
<FilePath>..\User\oled.c</FilePath>
</File>
</Files>
</Group>
</Groups>
</Target>
</Targets>
</Project>

View File

@@ -0,0 +1,253 @@
A51 MACRO ASSEMBLER STARTUP 08/26/2024 15:14:23 PAGE 1
MACRO ASSEMBLER A51 V8.2.7.0
OBJECT MODULE PLACED IN .\Objects\STARTUP.obj
ASSEMBLER INVOKED BY: D:\Keil5\C51\BIN\A51.EXE STARTUP.A51 SET(LARGE) DEBUG PRINT(.\Listings\STARTUP.lst) OBJECT(.\Objec
ts\STARTUP.obj) EP
LOC OBJ LINE SOURCE
1 $nomod51
2 ;------------------------------------------------------------------------------
3 ; This file is part of the C51 Compiler package
4 ; Copyright (c) 1988-2005 Keil Elektronik GmbH and Keil Software, Inc.
5 ; Version 8.01
6 ;
7 ; *** <<< Use Configuration Wizard in Context Menu >>> ***
8 ;------------------------------------------------------------------------------
9 ; STARTUP.A51: This code is executed after processor reset.
10 ;
11 ; To translate this file use A51 with the following invocation:
12 ;
13 ; A51 STARTUP.A51
14 ;
15 ; To link the modified STARTUP.OBJ file to your application use the following
16 ; Lx51 invocation:
17 ;
18 ; Lx51 your object file list, STARTUP.OBJ controls
19 ;
20 ;------------------------------------------------------------------------------
21 ;
22 ; User-defined <h> Power-On Initialization of Memory
23 ;
24 ; With the following EQU statements the initialization of memory
25 ; at processor reset can be defined:
26 ;
27 ; <o> IDATALEN: IDATA memory size <0x0-0x100>
28 ; <i> Note: The absolute start-address of IDATA memory is always 0
29 ; <i> The IDATA space overlaps physically the DATA and BIT areas.
0080 30 IDATALEN EQU 80H
31 ;
32 ; <o> XDATASTART: XDATA memory start address <0x0-0xFFFF>
33 ; <i> The absolute start address of XDATA memory
0000 34 XDATASTART EQU 0
35 ;
36 ; <o> XDATALEN: XDATA memory size <0x0-0xFFFF>
37 ; <i> The length of XDATA memory in bytes.
0000 38 XDATALEN EQU 0
39 ;
40 ; <o> PDATASTART: PDATA memory start address <0x0-0xFFFF>
41 ; <i> The absolute start address of PDATA memory
0000 42 PDATASTART EQU 0H
43 ;
44 ; <o> PDATALEN: PDATA memory size <0x0-0xFF>
45 ; <i> The length of PDATA memory in bytes.
0000 46 PDATALEN EQU 0H
47 ;
48 ;</h>
49 ;------------------------------------------------------------------------------
50 ;
51 ;<h> Reentrant Stack Initialization
52 ;
53 ; The following EQU statements define the stack pointer for reentrant
54 ; functions and initialized it:
55 ;
56 ; <h> Stack Space for reentrant functions in the SMALL model.
57 ; <q> IBPSTACK: Enable SMALL model reentrant stack
A51 MACRO ASSEMBLER STARTUP 08/26/2024 15:14:23 PAGE 2
58 ; <i> Stack space for reentrant functions in the SMALL model.
0000 59 IBPSTACK EQU 0 ; set to 1 if small reentrant is used.
60 ; <o> IBPSTACKTOP: End address of SMALL model stack <0x0-0xFF>
61 ; <i> Set the top of the stack to the highest location.
0100 62 IBPSTACKTOP EQU 0xFF +1 ; default 0FFH+1
63 ; </h>
64 ;
65 ; <h> Stack Space for reentrant functions in the LARGE model.
66 ; <q> XBPSTACK: Enable LARGE model reentrant stack
67 ; <i> Stack space for reentrant functions in the LARGE model.
0000 68 XBPSTACK EQU 0 ; set to 1 if large reentrant is used.
69 ; <o> XBPSTACKTOP: End address of LARGE model stack <0x0-0xFFFF>
70 ; <i> Set the top of the stack to the highest location.
0000 71 XBPSTACKTOP EQU 0xFFFF +1 ; default 0FFFFH+1
72 ; </h>
73 ;
74 ; <h> Stack Space for reentrant functions in the COMPACT model.
75 ; <q> PBPSTACK: Enable COMPACT model reentrant stack
76 ; <i> Stack space for reentrant functions in the COMPACT model.
0000 77 PBPSTACK EQU 0 ; set to 1 if compact reentrant is used.
78 ;
79 ; <o> PBPSTACKTOP: End address of COMPACT model stack <0x0-0xFFFF>
80 ; <i> Set the top of the stack to the highest location.
0100 81 PBPSTACKTOP EQU 0xFF +1 ; default 0FFH+1
82 ; </h>
83 ;</h>
84 ;------------------------------------------------------------------------------
85 ;
86 ; Memory Page for Using the Compact Model with 64 KByte xdata RAM
87 ; <e>Compact Model Page Definition
88 ;
89 ; <i>Define the XDATA page used for PDATA variables.
90 ; <i>PPAGE must conform with the PPAGE set in the linker invocation.
91 ;
92 ; Enable pdata memory page initalization
0000 93 PPAGEENABLE EQU 0 ; set to 1 if pdata object are used.
94 ;
95 ; <o> PPAGE number <0x0-0xFF>
96 ; <i> uppermost 256-byte address of the page used for PDATA variables.
0000 97 PPAGE EQU 0
98 ;
99 ; <o> SFR address which supplies uppermost address byte <0x0-0xFF>
100 ; <i> most 8051 variants use P2 as uppermost address byte
00A0 101 PPAGE_SFR DATA 0A0H
102 ;
103 ; </e>
104 ;------------------------------------------------------------------------------
105
106 ; Standard SFR Symbols
00E0 107 ACC DATA 0E0H
00F0 108 B DATA 0F0H
0081 109 SP DATA 81H
0082 110 DPL DATA 82H
0083 111 DPH DATA 83H
112
113 NAME ?C_STARTUP
114
115
116 ?C_C51STARTUP SEGMENT CODE
117 ?STACK SEGMENT IDATA
118
---- 119 RSEG ?STACK
0000 120 DS 1
121
122 EXTRN CODE (?C_START)
123 PUBLIC ?C_STARTUP
A51 MACRO ASSEMBLER STARTUP 08/26/2024 15:14:23 PAGE 3
124
---- 125 CSEG AT 0
0000 020000 F 126 ?C_STARTUP: LJMP STARTUP1
127
---- 128 RSEG ?C_C51STARTUP
129
0000 130 STARTUP1:
131
132 IF IDATALEN <> 0
0000 787F 133 MOV R0,#IDATALEN - 1
0002 E4 134 CLR A
0003 F6 135 IDATALOOP: MOV @R0,A
0004 D8FD 136 DJNZ R0,IDATALOOP
137 ENDIF
138
139 IF XDATALEN <> 0
MOV DPTR,#XDATASTART
MOV R7,#LOW (XDATALEN)
IF (LOW (XDATALEN)) <> 0
MOV R6,#(HIGH (XDATALEN)) +1
ELSE
MOV R6,#HIGH (XDATALEN)
ENDIF
CLR A
XDATALOOP: MOVX @DPTR,A
INC DPTR
DJNZ R7,XDATALOOP
DJNZ R6,XDATALOOP
ENDIF
153
154 IF PPAGEENABLE <> 0
MOV PPAGE_SFR,#PPAGE
ENDIF
157
158 IF PDATALEN <> 0
MOV R0,#LOW (PDATASTART)
MOV R7,#LOW (PDATALEN)
CLR A
PDATALOOP: MOVX @R0,A
INC R0
DJNZ R7,PDATALOOP
ENDIF
166
167 IF IBPSTACK <> 0
EXTRN DATA (?C_IBP)
MOV ?C_IBP,#LOW IBPSTACKTOP
ENDIF
172
173 IF XBPSTACK <> 0
EXTRN DATA (?C_XBP)
MOV ?C_XBP,#HIGH XBPSTACKTOP
MOV ?C_XBP+1,#LOW XBPSTACKTOP
ENDIF
179
180 IF PBPSTACK <> 0
EXTRN DATA (?C_PBP)
MOV ?C_PBP,#LOW PBPSTACKTOP
ENDIF
184
0006 758100 F 185 MOV SP,#?STACK-1
186
187 ; This code is required if you use L51_BANK.A51 with Banking Mode 4
188 ;<h> Code Banking
189 ; <q> Select Bank 0 for L51_BANK.A51 Mode 4
A51 MACRO ASSEMBLER STARTUP 08/26/2024 15:14:23 PAGE 4
190
195 ;</h>
0009 020000 F 196 LJMP ?C_START
197
198 END
A51 MACRO ASSEMBLER STARTUP 08/26/2024 15:14:23 PAGE 5
SYMBOL TABLE LISTING
------ ----- -------
N A M E T Y P E V A L U E ATTRIBUTES
?C_C51STARTUP. . . C SEG 000CH REL=UNIT
?C_START . . . . . C ADDR ----- EXT
?C_STARTUP . . . . C ADDR 0000H A
?STACK . . . . . . I SEG 0001H REL=UNIT
ACC. . . . . . . . D ADDR 00E0H A
B. . . . . . . . . D ADDR 00F0H A
DPH. . . . . . . . D ADDR 0083H A
DPL. . . . . . . . D ADDR 0082H A
IBPSTACK . . . . . N NUMB 0000H A
IBPSTACKTOP. . . . N NUMB 0100H A
IDATALEN . . . . . N NUMB 0080H A
IDATALOOP. . . . . C ADDR 0003H R SEG=?C_C51STARTUP
PBPSTACK . . . . . N NUMB 0000H A
PBPSTACKTOP. . . . N NUMB 0100H A
PDATALEN . . . . . N NUMB 0000H A
PDATASTART . . . . N NUMB 0000H A
PPAGE. . . . . . . N NUMB 0000H A
PPAGEENABLE. . . . N NUMB 0000H A
PPAGE_SFR. . . . . D ADDR 00A0H A
SP . . . . . . . . D ADDR 0081H A
STARTUP1 . . . . . C ADDR 0000H R SEG=?C_C51STARTUP
XBPSTACK . . . . . N NUMB 0000H A
XBPSTACKTOP. . . . N NUMB 0000H A
XDATALEN . . . . . N NUMB 0000H A
XDATASTART . . . . N NUMB 0000H A
REGISTER BANK(S) USED: 0
ASSEMBLY COMPLETE. 0 WARNING(S), 0 ERROR(S)

View File

@@ -0,0 +1,246 @@
C51 COMPILER V9.60.7.0 UART 08/26/2024 15:14:23 PAGE 1
C51 COMPILER V9.60.7.0, COMPILATION OF MODULE UART
OBJECT MODULE PLACED IN .\Objects\UART.obj
COMPILER INVOKED BY: D:\Keil5\C51\BIN\C51.EXE ..\User\UART.C LARGE OMF2 OPTIMIZE(8,SPEED) BROWSE INCDIR(..\User) DEBUG P
-RINT(.\Listings\UART.lst) OBJECT(.\Objects\UART.obj)
line level source
1 #include "UART.h"
2 #include <string.h>
3 #include "oled.h"
4 #include <stdio.h>
5
6 // 用于存储接收数据的数组
7 unsigned char rxBuffer[ARRAY_SIZE];
8 unsigned int rxIndex = 0; // 接收数据的索引
9 unsigned int rx_flag=0;
10 extern unsigned int CONNECT_FLEG;//连接标志
11 // 初始化串口
12 void Serial_Init() {
13 1 SCON = 0x50; // 设置为模式18位数据可变波特率
14 1 TMOD &= 0x0F; // 清除定时器1模式位
15 1 TMOD |= 0x20; // 设置定时器1为8位自动重装模式
16 1 TH1 = TL1 = 256 - (11059200 / 12 / 32) / BAUDRATE; // 设置波特率
17 1 TR1 = 1; // 启动定时器1
18 1 ES = 1; // 开启串口中断
19 1 EA = 1; // 开启全局中断
20 1 }
21
22 void Delay(unsigned int xms)
23 {
24 1 unsigned char i, j;
25 1 while(xms--)
26 1 {
27 2 i = 2;
28 2 j = 239;
29 2 do
30 2 {
31 3 while (--j);
32 3 } while (--i);
33 2 }
34 1 }
35
36 void buff_memset(void)
37 {
38 1 memset(rxBuffer,0,64);
39 1 rxIndex=0;
40 1 rx_flag = 0;
41 1 }
42 unsigned int WIFI_CheckAck(char* src, char* dest, int timeout)
43 {
44 1 char *check = NULL;
45 1 //清空缓冲
46 1 buff_memset();
47 1
48 1 UART_sentString(src);
49 1 timeout=timeout/10;//10ms处理一次
50 1 while(timeout--)
51 1 {
52 2 Delay(10);//延时1ms
53 2 if(rx_flag==1)
54 2 {
C51 COMPILER V9.60.7.0 UART 08/26/2024 15:14:23 PAGE 2
55 3 check = strstr(rxBuffer,dest);
56 3 if(check != NULL)
57 3 {
58 4 buff_memset();//数据有误 清空
59 4 return 1;
60 4 }
61 3 }
62 2 }
63 1 buff_memset();//数据有误 清空
64 1 return 0;//超时
65 1 }
66
67 sbit LED = P2^5;
68 sbit motor1 = P2^6;
69 sbit motor2 = P2^7;
70
71 void CONNECT_TX_Control(void)
72 {
73 1 char *ptr = NULL;
74 1 int number;
75 1 if (CONNECT_FLEG)
76 1 {
77 2 if(rx_flag)
78 2 {
79 3 if(strstr(rxBuffer,"192.168.0")!=NULL)
80 3 {
81 4 ptr = strrchr((char*)rxBuffer,','); // 以最后一个,为准后面为数据
82 4
83 4 if(strlen(ptr)-3==1) //判断接收到为一位数据 ,*\r\n
84 4 {
85 5 number = ptr[1]-'0';
86 5 switch(number)
87 5 {
88 6 case 1: LED = 0 ; break;
89 6 case 2: LED = 1; break;
90 6 case 3:OLED_Show(); break;
91 6 case 4:OLED_Clear(); break;
92 6 case 5:motor1=0;motor2=1; break;
93 6 case 6:motor1=1;motor2=0; break;
94 6 case 7:motor1=0;motor2=0 ; break;
95 6 default: return;
96 6 }
97 5 }
98 4 }
99 3 else if(strstr((char *)rxBuffer,"RECV:test-app")!=NULL)
100 3 {
101 4 ptr = strrchr((char*)rxBuffer,','); // 以最后一个,为准后面为数据
102 4
103 4 if(strlen(ptr)-3==1) //判断接收到为一位数据 ,*\r\n
104 4 {
105 5 number = ptr[1]-'0';
106 5 switch(number)
107 5 {
108 6 case 1: LED = 0 ; break;
109 6 case 2: LED = 1; break;
110 6 case 3:OLED_Show(); break;
111 6 case 4:OLED_Clear(); break;
112 6 case 5:motor1=0;motor2=1; break;
113 6 case 6:motor1=1;motor2=0; break;
114 6 case 7:motor1=0;motor2=0 ; break;
115 6 default: return;
116 6 }
C51 COMPILER V9.60.7.0 UART 08/26/2024 15:14:23 PAGE 3
117 5 }
118 4 }
119 3 }
120 2 buff_memset();//数据有误 清空
121 2 }
122 1 }
123 void CONNECT_TO_TCP(unsigned char* id,unsigned char *password)
124 {
125 1 unsigned char buf[50];
126 1 WIFI_CheckAck("+++",id,1500); //确保其退出透传
127 1 //while(!WIFI_CheckAck("AT+RESTORE\r\n","OK",5000));
128 1 while(!WIFI_CheckAck("AT\r\n","OK",1000));
129 1 while(!WIFI_CheckAck("AT+CWMODE=0\r\n","OK",2000));
130 1 sprintf((char *)buf,"AT+CWJAP=%s,%s\r\n",id,password);
131 1 while(!WIFI_CheckAck((char *)buf,"+CWJAP:1,",5000));
132 1 while(!WIFI_CheckAck("AT+CIPMODE=1\r\n","OK",1000)!=0);
133 1 while(!WIFI_CheckAck("AT+CIPSTART=TCP,192.168.0.146,2347\r\n","+CIPSTART:1",3000));
134 1 while(!WIFI_CheckAck("AT+CIPSEND\r\n","OK",1000));
135 1 UART_sentString(":Connected\r\n");
136 1 CONNECT_FLEG = 1;
137 1 }
138 void CONNECT_TO_UDP(unsigned char* id,unsigned char *password)
139 {
140 1 unsigned char buf[50];
141 1
142 1 WIFI_CheckAck("+++",id,1500); //确保其退出透传
143 1 //while(!WIFI_CheckAck("AT+RESTORE\r\n","OK",5000));
144 1 while(!WIFI_CheckAck("AT\r\n","OK",1000));
145 1 while(!WIFI_CheckAck("AT+CWMODE=0\r\n","OK",2000));
146 1 sprintf((char *)buf,"AT+CWJAP=%s,%s\r\n",id,password);
147 1 while(!WIFI_CheckAck((char *)buf,"+CWJAP:1,",5000));
148 1 while(!WIFI_CheckAck("AT+CIPMODE=1\r\n","OK",1000)!=0);
149 1 while(!WIFI_CheckAck("AT+CIPSTART=UDP,192.168.0.72,2345,1112,0\r\n","+CIPSTART:1",3000)); //192.168.0.150
-,2345为IP地址 2345 端口号1112 是模块设置的端口号 0 UDP固定目标模式
150 1 while(!WIFI_CheckAck("AT+CIPSEND\r\n","OK",1000));
151 1 UART_sentString(":Connected\r\n");
152 1 CONNECT_FLEG = 1;
153 1 }
154 void CONNECT_TO_MQTT(unsigned char* id,unsigned char *password)
155 {
156 1 unsigned char buf[50];
157 1 while(!WIFI_CheckAck("AT+MQTTCLEAN\r\n","OK",1000));
158 1 //while(!WIFI_CheckAck("AT+RESTORE\r\n","OK",5000));
159 1 while(!WIFI_CheckAck("AT\r\n","OK",1000));
160 1 while(!WIFI_CheckAck("AT+CWMODE=0\r\n","OK",2000)); //STA模式
161 1 sprintf((char *)buf,"AT+CWJAP=%s,%s\r\n",id,password);
162 1 while(!WIFI_CheckAck((char *)buf,"+CWJAP:1,",5000));//连接WIFI
163 1 while(!WIFI_CheckAck("AT+MQTTLONGCLIENTID=WF-TEST2\r\n","OK",1000)!=0);//配置 MQTT 客户端所需的客户端 ID<49>
-⒂没<E29282><E6B2A1>兔苈<E58594>
164 1 while(!WIFI_CheckAck("AT+MQTTCONN=broker.emqx.io,1883,0\r\n","MQTTCONNECTED:",2000)!=0);//连接 MQTT 服务<E69C8D>
-<2D>
165 1 while(!WIFI_CheckAck("AT+MQTTSUB=test-app,0\r\n","OK",2000)!=0);//订阅主题 test-app
166 1 while(!WIFI_CheckAck("AT+MQTTPUBRAW=test-w,32,0,0\r\n","OK",2000)!=0);
167 1 UART_sentString("MQTT_Connected\r\n");
168 1 buff_memset();
169 1 CONNECT_FLEG = 1;
170 1 }
171
172 void UART_SendByte(unsigned char Byte)
173 {
174 1 SBUF=Byte;
175 1 while(!TI);
C51 COMPILER V9.60.7.0 UART 08/26/2024 15:14:23 PAGE 4
176 1 TI=0;
177 1 }
178
179 void UART_sentString(char *str)
180 {
181 1
182 1 while(*str){
183 2 UART_SendByte(*str);
184 2 str++;
185 2 }
186 1 }
187 // 串口接收中断服务程序
188 void Serial_ISR() interrupt 4 {
189 1 if (RI) {
190 2 RI = 0; // 清除接收中断标志
191 2
192 2
193 2 rxBuffer[rxIndex++] = SBUF; // 存储接收到的数据
194 2 if(rxBuffer[rxIndex-1]=='\n')
195 2 {
196 3 rx_flag=1;
197 3 }
198 2 if(rxIndex==64)
199 2 {
200 3 rxIndex=0;
201 3 rx_flag=1;
202 3 }
203 2
204 2 }
205 1 }
206
207
208
209
MODULE INFORMATION: STATIC OVERLAYABLE
CODE SIZE = 1827 ----
CONSTANT SIZE = 378 ----
XDATA SIZE = 68 184
PDATA SIZE = ---- ----
DATA SIZE = ---- ----
IDATA SIZE = ---- ----
BIT SIZE = ---- ----
EDATA SIZE = ---- ----
HDATA SIZE = ---- ----
XDATA CONST SIZE = ---- ----
FAR CONST SIZE = ---- ----
END OF MODULE INFORMATION.
C51 COMPILATION COMPLETE. 0 WARNING(S), 0 ERROR(S)

View File

@@ -0,0 +1,107 @@
C51 COMPILER V9.60.7.0 MAIN 08/26/2024 15:14:23 PAGE 1
C51 COMPILER V9.60.7.0, COMPILATION OF MODULE MAIN
OBJECT MODULE PLACED IN .\Objects\main.obj
COMPILER INVOKED BY: D:\Keil5\C51\BIN\C51.EXE ..\User\main.c LARGE OMF2 OPTIMIZE(8,SPEED) BROWSE INCDIR(..\User) DEBUG P
-RINT(.\Listings\main.lst) OBJECT(.\Objects\main.obj)
line level source
1 //**** 声明 ********************************************************************
2 /*******************************************************************************
3 * 下面来自互联开源程序,由深圳市大夏龙雀科技有限公司收集
4 * 方便用户参考学习,本公司不提供任何技术支持
5 * 程序仅供测试参考,不能应用在实际工程中,不一定能通过编译
6 * 公司网站 http://www.szdx-smart.com/
7 * 淘宝网址 https://shop184598174.taobao.com/?spm=a1z10.5-c-s.w12096189-21564973333.3.547b1176WCCDxR&scene
-=taobao_shop
8 *******************************************************************************/
9 /********************************************************************
10 * 文件名 WF24-UDP协议应用
11 * 描述 : 该文件实现通过利用WF24给单片机发数据控制LED+OLED+电机。
12 ***********************************************************************/
13 /*
14 Name: UDP
15 Created: 2024/8/21
16 Author: WAM
17 */
18 #include <REGX52.H> // STC89C52RC的寄存器定义
19 #include "UART.h"
20 #include "string.h"
21 #include "stdio.h"
22 #include "oled.h"
23 extern unsigned int rxIndex;
24 extern unsigned char rxBuffer[ARRAY_SIZE];
25 extern unsigned int rx_flag;
26 unsigned int CONNECT_FLEG;//连接标志
27 // 主函数
28 unsigned char conver[64];
29 char *ptr = NULL;
30 void MQTT_CONVER(void);
31 void TCP_UDP_CONVER(void);
32 void main() {
33 1 Serial_Init(); // 初始化串口
34 1 OLED_Init();
35 1 CONNECT_TO_UDP("DX-SMART","SMART@601");
36 1 while (1) {
37 2
38 2 // 主循环,可以添加其他任务
39 2 TCP_UDP_CONVER();
40 2 }
41 1 }
42
43 void TCP_UDP_CONVER(void)
44 {
45 1 if (rx_flag)
46 1 {
47 2 UART_sentString(rxBuffer);
48 2 CONNECT_TX_Control();
49 2 rxIndex = 0; // 重置索引,准备下一次接收
50 2 memset(rxBuffer,0,ARRAY_SIZE); //清空缓冲区
51 2 }
52 1 }
53 void MQTT_CONVER(void)
C51 COMPILER V9.60.7.0 MAIN 08/26/2024 15:14:23 PAGE 2
54 {
55 1 if (rx_flag)
56 1 {
57 2 if(strstr(rxBuffer,"RECV:test-app")!=NULL)
58 2 {
59 3 ptr = strrchr(rxBuffer,',');
60 3 memcpy(conver,ptr,*(ptr-1));
61 3 while(!WIFI_CheckAck("AT+MQTTPUBRAW=test-w,32,0,0\r\n","OK",2000)!=0);
62 3 buff_memset();//数据有误 清空
*** WARNING C206 IN LINE 62 OF ..\User\main.c: 'buff_memset': missing function-prototype
63 3 UART_sentString(conver);
64 3
65 3 }
66 2
67 2 }
68 1 }
69 void MQTT_CONTROL(void)
70 {
71 1 if (rx_flag)
72 1 {
73 2 CONNECT_TX_Control();
74 2 }
75 1 }
MODULE INFORMATION: STATIC OVERLAYABLE
CODE SIZE = 240 ----
CONSTANT SIZE = 66 ----
XDATA SIZE = 69 ----
PDATA SIZE = ---- ----
DATA SIZE = ---- ----
IDATA SIZE = ---- ----
BIT SIZE = ---- ----
EDATA SIZE = ---- ----
HDATA SIZE = ---- ----
XDATA CONST SIZE = ---- ----
FAR CONST SIZE = ---- ----
END OF MODULE INFORMATION.
C51 COMPILATION COMPLETE. 1 WARNING(S), 0 ERROR(S)

View File

@@ -0,0 +1,287 @@
C51 COMPILER V9.60.7.0 OLED 08/26/2024 15:14:23 PAGE 1
C51 COMPILER V9.60.7.0, COMPILATION OF MODULE OLED
OBJECT MODULE PLACED IN .\Objects\oled.obj
COMPILER INVOKED BY: D:\Keil5\C51\BIN\C51.EXE ..\User\oled.c LARGE OMF2 OPTIMIZE(8,SPEED) BROWSE INCDIR(..\User) DEBUG P
-RINT(.\Listings\oled.lst) OBJECT(.\Objects\oled.obj)
line level source
1 #include "oled.h"
2 #include "oledfont.h"
3
4 void delay_ms(unsigned int ms)
5 {
6 1 unsigned int a;
7 1 while(ms)
8 1 {
9 2 a=1800;
10 2 while(a--);
11 2 ms--;
12 2 }
13 1 return;
14 1 }
15 void OLED_Show()
16 {
17 1 OLED_ShowCHinese(16,0,0);
18 1 OLED_ShowCHinese(32,0,1);
19 1 OLED_ShowCHinese(48,0,2);
20 1 OLED_ShowCHinese(64,0,3);
21 1 OLED_ShowCHinese(80,0,4);
22 1 OLED_ShowCHinese(96,0,5);
23 1 OLED_ShowString(32,2,"WF24");
24 1
25 1 }
26 #if OLED_MODE==1
//向SSD1106写入一个字节。
//dat:要写入的数据/命令
//cmd:数据/命令标志 0,表示命令;1,表示数据;
void OLED_WR_Byte(u8 dat,u8 cmd)
{
DATAOUT(dat);
if(cmd)
OLED_DC_Set();
else
OLED_DC_Clr();
OLED_CS_Clr();
OLED_WR_Clr();
OLED_WR_Set();
OLED_CS_Set();
OLED_DC_Set();
}
#else
44 //向SSD1306写入一个字节。
45 //dat:要写入的数据/命令
46 //cmd:数据/命令标志 0,表示命令;1,表示数据;
47 void OLED_WR_Byte(u8 dat,u8 cmd)
48 {
49 1 u8 i;
50 1 if(cmd)
51 1 OLED_DC_Set();
52 1 else
53 1 OLED_DC_Clr();
54 1 OLED_CS_Clr();
C51 COMPILER V9.60.7.0 OLED 08/26/2024 15:14:23 PAGE 2
55 1 for(i=0;i<8;i++)
56 1 {
57 2 OLED_SCLK_Clr();
58 2 if(dat&0x80)
59 2 {
60 3 OLED_SDIN_Set();
61 3 }
62 2 else
63 2 OLED_SDIN_Clr();
64 2 OLED_SCLK_Set();
65 2 dat<<=1;
66 2 }
67 1 OLED_CS_Set();
68 1 OLED_DC_Set();
69 1 }
70 #endif
71 void OLED_Set_Pos(unsigned char x, unsigned char y)
72 {
73 1 OLED_WR_Byte(0xb0+y,OLED_CMD);
74 1 OLED_WR_Byte(((x&0xf0)>>4)|0x10,OLED_CMD);
75 1 OLED_WR_Byte((x&0x0f)|0x01,OLED_CMD);
76 1 }
77 //开启OLED显示
78 void OLED_Display_On(void)
79 {
80 1 OLED_WR_Byte(0X8D,OLED_CMD); //SET DCDC命令
81 1 OLED_WR_Byte(0X14,OLED_CMD); //DCDC ON
82 1 OLED_WR_Byte(0XAF,OLED_CMD); //DISPLAY ON
83 1 }
84 //关闭OLED显示
85 void OLED_Display_Off(void)
86 {
87 1 OLED_WR_Byte(0X8D,OLED_CMD); //SET DCDC命令
88 1 OLED_WR_Byte(0X10,OLED_CMD); //DCDC OFF
89 1 OLED_WR_Byte(0XAE,OLED_CMD); //DISPLAY OFF
90 1 }
91 //清屏函数,清完屏,整个屏幕是黑色的!和没点亮一样!!!
92 void OLED_Clear(void)
93 {
94 1 u8 i,n;
95 1 for(i=0;i<8;i++)
96 1 {
97 2 OLED_WR_Byte (0xb0+i,OLED_CMD); //设置页地址0~7
98 2 OLED_WR_Byte (0x00,OLED_CMD); //设置显示位置—列低地址
99 2 OLED_WR_Byte (0x10,OLED_CMD); //设置显示位置—列高地址
100 2 for(n=0;n<128;n++)OLED_WR_Byte(0,OLED_DATA);
101 2 } //更新显示
102 1 }
103
104
105 //在指定位置显示一个字符,包括部分字符
106 //x:0~127
107 //y:0~63
108 //mode:0,反白显示;1,正常显示
109 //size:选择字体 16/12
110 void OLED_ShowChar(u8 x,u8 y,u8 chr)
111 {
112 1 unsigned char c=0,i=0;
113 1 c=chr-' ';//得到偏移后的值
114 1 if(x>Max_Column-1){x=0;y=y+2;}
115 1 if(SIZE ==16)
116 1 {
C51 COMPILER V9.60.7.0 OLED 08/26/2024 15:14:23 PAGE 3
117 2 OLED_Set_Pos(x,y);
118 2 for(i=0;i<8;i++)
119 2 OLED_WR_Byte(F8X16[c*16+i],OLED_DATA);
120 2 OLED_Set_Pos(x,y+1);
121 2 for(i=0;i<8;i++)
122 2 OLED_WR_Byte(F8X16[c*16+i+8],OLED_DATA);
123 2 }
124 1
125 1 }
126 //m^n函数
127 u32 oled_pow(u8 m,u8 n)
128 {
129 1 u32 result=1;
130 1 while(n--)result*=m;
131 1 return result;
132 1 }
133 //显示2个数字
134 //x,y :起点坐标
135 //len :数字的位数
136 //size:字体大小
137 //mode:模式 0,填充模式;1,叠加模式
138 //num:数值(0~4294967295);
139 void OLED_ShowNum(u8 x,u8 y,u32 num,u8 len,u8 size2)
140 {
141 1 u8 t,temp;
142 1 u8 enshow=0;
143 1 for(t=0;t<len;t++)
144 1 {
145 2 temp=(num/oled_pow(10,len-t-1))%10;
146 2 if(enshow==0&&t<(len-1))
147 2 {
148 3 if(temp==0)
149 3 {
150 4 OLED_ShowChar(x+(size2/2)*t,y,' ');
151 4 continue;
152 4 }else enshow=1;
153 3
154 3 }
155 2 OLED_ShowChar(x+(size2/2)*t,y,temp+'0');
156 2 }
157 1 }
158 //显示一个字符号串
159 void OLED_ShowString(u8 x,u8 y,u8 *chr)
160 {
161 1 unsigned char j=0;
162 1 while (chr[j]!='\0')
163 1 { OLED_ShowChar(x,y,chr[j]);
164 2 x+=8;
165 2 if(x>120){x=0;y+=2;}
166 2 j++;
167 2 }
168 1 }
169 //显示汉字
170 void OLED_ShowCHinese(u8 x,u8 y,u8 no)
171 {
172 1 u8 t,adder=0;
173 1 OLED_Set_Pos(x,y);
174 1 for(t=0;t<16;t++)
175 1 {
176 2 OLED_WR_Byte(Hzk[2*no][t],OLED_DATA);
177 2 adder+=1;
178 2 }
C51 COMPILER V9.60.7.0 OLED 08/26/2024 15:14:23 PAGE 4
179 1 OLED_Set_Pos(x,y+1);
180 1 for(t=0;t<16;t++)
181 1 {
182 2 OLED_WR_Byte(Hzk[2*no+1][t],OLED_DATA);
183 2 adder+=1;
184 2 }
185 1 }
186 /***********功能描述显示显示BMP图片128×64起始点坐标(x,y),x的范围0127y为页的范围07****************
-*/
187 void OLED_DrawBMP(unsigned char x0, unsigned char y0,unsigned char x1, unsigned char y1,unsigned char BMP[
-])
188 {
189 1 unsigned int j=0;
190 1 unsigned char x,y;
191 1
192 1 if(y1%8==0) y=y1/8;
193 1 else y=y1/8+1;
194 1 for(y=y0;y<y1;y++)
195 1 {
196 2 OLED_Set_Pos(x0,y);
197 2 for(x=x0;x<x1;x++)
198 2 {
199 3 OLED_WR_Byte(BMP[j++],OLED_DATA);
200 3 }
201 2 }
202 1 }
203
204
205 //初始化SSD1306
206 void OLED_Init(void)
207 {
208 1
209 1
210 1
211 1 OLED_RST_Set();
212 1 delay_ms(100);
213 1 OLED_RST_Clr();
214 1 delay_ms(100);
215 1 OLED_RST_Set();
216 1 OLED_WR_Byte(0xAE,OLED_CMD);//--turn off oled panel
217 1 OLED_WR_Byte(0x00,OLED_CMD);//---set low column address
218 1 OLED_WR_Byte(0x10,OLED_CMD);//---set high column address
219 1 OLED_WR_Byte(0x40,OLED_CMD);//--set start line address Set Mapping RAM Display Start Line (0x00~0x3F)
220 1 OLED_WR_Byte(0x81,OLED_CMD);//--set contrast control register
221 1 OLED_WR_Byte(0xCF,OLED_CMD); // Set SEG Output Current Brightness
222 1 OLED_WR_Byte(0xA1,OLED_CMD);//--Set SEG/Column Mapping 0xa0左右反置 0xa1正常
223 1 OLED_WR_Byte(0xC8,OLED_CMD);//Set COM/Row Scan Direction 0xc0上下反置 0xc8正常
224 1 OLED_WR_Byte(0xA6,OLED_CMD);//--set normal display
225 1 OLED_WR_Byte(0xA8,OLED_CMD);//--set multiplex ratio(1 to 64)
226 1 OLED_WR_Byte(0x3f,OLED_CMD);//--1/64 duty
227 1 OLED_WR_Byte(0xD3,OLED_CMD);//-set display offset Shift Mapping RAM Counter (0x00~0x3F)
228 1 OLED_WR_Byte(0x00,OLED_CMD);//-not offset
229 1 OLED_WR_Byte(0xd5,OLED_CMD);//--set display clock divide ratio/oscillator frequency
230 1 OLED_WR_Byte(0x80,OLED_CMD);//--set divide ratio, Set Clock as 100 Frames/Sec
231 1 OLED_WR_Byte(0xD9,OLED_CMD);//--set pre-charge period
232 1 OLED_WR_Byte(0xF1,OLED_CMD);//Set Pre-Charge as 15 Clocks & Discharge as 1 Clock
233 1 OLED_WR_Byte(0xDA,OLED_CMD);//--set com pins hardware configuration
234 1 OLED_WR_Byte(0x12,OLED_CMD);
235 1 OLED_WR_Byte(0xDB,OLED_CMD);//--set vcomh
236 1 OLED_WR_Byte(0x40,OLED_CMD);//Set VCOM Deselect Level
237 1 OLED_WR_Byte(0x20,OLED_CMD);//-Set Page Addressing Mode (0x00/0x01/0x02)
238 1 OLED_WR_Byte(0x02,OLED_CMD);//
C51 COMPILER V9.60.7.0 OLED 08/26/2024 15:14:23 PAGE 5
239 1 OLED_WR_Byte(0x8D,OLED_CMD);//--set Charge Pump enable/disable
240 1 OLED_WR_Byte(0x14,OLED_CMD);//--set(0x10) disable
241 1 OLED_WR_Byte(0xA4,OLED_CMD);// Disable Entire Display On (0xa4/0xa5)
242 1 OLED_WR_Byte(0xA6,OLED_CMD);// Disable Inverse Display On (0xa6/a7)
243 1 OLED_WR_Byte(0xAF,OLED_CMD);//--turn on oled panel
244 1
245 1 OLED_WR_Byte(0xAF,OLED_CMD); /*display ON*/
246 1 OLED_Clear();
247 1 OLED_Set_Pos(0,0);
248 1 }
249
MODULE INFORMATION: STATIC OVERLAYABLE
CODE SIZE = 1037 ----
CONSTANT SIZE = 2461 ----
XDATA SIZE = ---- 27
PDATA SIZE = ---- ----
DATA SIZE = ---- ----
IDATA SIZE = ---- ----
BIT SIZE = ---- ----
EDATA SIZE = ---- ----
HDATA SIZE = ---- ----
XDATA CONST SIZE = ---- ----
FAR CONST SIZE = ---- ----
END OF MODULE INFORMATION.
C51 COMPILATION COMPLETE. 0 WARNING(S), 0 ERROR(S)

View File

@@ -0,0 +1,58 @@
<html>
<body>
<pre>
<h1>礦ision Build Log</h1>
<h2>Tool Versions:</h2>
IDE-Version: μVision V5.38.0.0
Copyright (C) 2022 ARM Ltd and ARM Germany GmbH. All rights reserved.
License Information: 1 1, 21, LIC=TI4EI-T6WYP-WQ90S-LZLT9-S04QZ-NNNW4
Tool Versions:
Toolchain: PK51 Prof. Developers Kit Version: 9.60.7.0
Toolchain Path: D:\Keil5\C51\BIN
C Compiler: C51.exe V9.60.7.0
Assembler: A51.exe V8.2.7.0
Linker/Locator: LX51.exe V4.66.100.0
Library Manager: LIBX51.exe V4.30.1.0
Hex Converter: OHX51.exe V1.47.0.0
CPU DLL: S8051.DLL V3.125.1.0
Dialog DLL: DP51.DLL V2.69.0.0
<h2>Project:</h2>
F:\WF24DEMO\单片机应用资料\单片机实验例程\1.WF24通过单片机控制LED+OLED+电机例程(TCP-UDP-MQTT)\2.STC89C52\例程\UDP\C52\Project\51Project.uvproj
Project File Date: 08/07/2024
<h2>Output:</h2>
Rebuild target 'Target 1'
assembling STARTUP.A51...
compiling main.c...
..\User\main.c(62): warning C206: 'buff_memset': missing function-prototype
compiling UART.C...
compiling oled.c...
linking...
*** WARNING L57: UNCALLED FUNCTION, IGNORED FOR OVERLAY PROCESS
NAME: MQTT_CONVER/MAIN
*** WARNING L57: UNCALLED FUNCTION, IGNORED FOR OVERLAY PROCESS
NAME: MQTT_CONTROL/MAIN
*** WARNING L57: UNCALLED FUNCTION, IGNORED FOR OVERLAY PROCESS
NAME: _CONNECT_TO_TCP/UART
*** WARNING L57: UNCALLED FUNCTION, IGNORED FOR OVERLAY PROCESS
NAME: _CONNECT_TO_MQTT/UART
*** WARNING L57: UNCALLED FUNCTION, IGNORED FOR OVERLAY PROCESS
NAME: OLED_DISPLAY_ON/OLED
*** WARNING L57: UNCALLED FUNCTION, IGNORED FOR OVERLAY PROCESS
NAME: OLED_DISPLAY_OFF/OLED
*** WARNING L57: UNCALLED FUNCTION, IGNORED FOR OVERLAY PROCESS
NAME: _OLED_SHOWNUM/OLED
*** WARNING L57: UNCALLED FUNCTION, IGNORED FOR OVERLAY PROCESS
NAME: _OLED_DRAWBMP/OLED
*** WARNING L25: DATA TYPES DIFFERENT
SYMBOL: buff_memset
MODULE: .\Objects\main.obj (MAIN)
DEFINED: .\Objects\UART.obj (UART)
Program Size: data=15.1 xdata=365 const=2905 code=5155
creating hex file from ".\Objects\51Project"...
".\Objects\51Project" - 0 Error(s), 10 Warning(s).
Build Time Elapsed: 00:00:01
</pre>
</body>
</html>

View File

@@ -0,0 +1,505 @@
:10000000020F10AC07ED24B0FFE4FD121268EC54AF
:10001000F0C4540F4410FF121268EC540F4401FF57
:1000200002126802109AE508243BF582E43400F5D8
:1000300083E005082290003830070390003BE47508
:10004000F0011205CE0204812000E97F2ED200804B
:1000500018EF540F2490D43440D4FF30040BEF2415
:10006000BFB41A0050032461FFE5096002150905B9
:100070000CE50C7002050B30070E900038E475F0AB
:10008000011205CEEF0205A60212E57403D2078025
:1000900003E4C207F5089000381205E5E4F509F518
:1000A0000BF50CE50960077F2012006980F5750AE1
:1000B000FFC201C200C202C203C205C206C20812C8
:1000C0000035FF700D3007057F0012007AAF0CAECF
:1000D0000B22B4255FC2D5C204120035FF24D0B470
:1000E0000A00501A75F00A780930D50508B6FF01E4
:1000F00006C6A426F620D5047002D20380D924CFE8
:10010000B41A00EF5004C2E5D20402027BD201808F
:10011000C6D20080C0D20280BCD2D580BAD20580BF
:10012000B47F201200692002077401B5090040F174
:10013000120026FF1200690200A3D208D2068095A1
:10014000120026FB120026FA120026F94A4B70060E
:10015000794C7A037BFF20022EE509602A7E008E0F
:100160008275830012049A60060EEE650A70F0C272
:10017000D5EBC0E0EAC0E0E9C0E0EE1202C2D0E098
:10018000F9D0E0FAD0E0FB120481FF60AAEBC0E0F6
:10019000EAC0E0E9C0E0120069D0E02401F9D0E053
:1001A0003400FAD0E0FBE50A0460DCD50AD9808788
:1001B0007BFF7A0279BED202809C79108002790896
:1001C000C206C2088008D2D5790A8004790AC2D54D
:1001D000E50A047002F50AE4FAFDFEFF120026FCAF
:1001E0007B08200113120026FD7B1030000A12004C
:1001F00026FE120026FF7B20EC3382D592D55013C9
:10020000C3E43000069FFFE49EFEE42001039DFD51
:10021000E49CFCE4CBF8C201EC700CCFCECDCCE872
:1002200024F8F870F38017C3EF33FFEE33FEED339D
:10023000FDEC33FCEB33FB994002FB0FD8E9EB30CC
:100240000105F8D0E0C448B201C0E00AEC4D4E4FC1
:1002500078207B0070C2EAB50A0040BCC0E0120200
:10026000C4D0F0D0E0200104C4C0E0C4B201C0F0AA
:10027000120052D0F0D5F0EB0200A31205EE0140BF
:100280005301BA5801114C010D4201BE4F01C64441
:1002900001C64901264301CC5501B04601B04501D4
:1002A000B047036C5001152D01192E013C2B011D87
:1002B00023013A2003552A00D548000001343F3F6E
:1002C0003F00790AA2D5200314300509B9100204B1
:1002D00004B9080104A2D5200602500104200268D6
:1002E0009202B509005034C0E07F203003197F30FE
:1002F000A20272067205500F12031BC202C206C28E
:1003000005C2087F30800F300503E9C0E0120069A4
:10031000300503D0E0F9D0E0B509CC3005177F30C7
:10032000B9100C1200697F583004077F788003B938
:1003300008031200693002057F2D0200697F20202A
:1003400008F87F2B2006F322920280CF286E756C6E
:100350006C2900D2011200263001F8C20178093060
:10036000D50108F60200D52D504349581200262425
:1003700003B405004001E49003679312005A743AF5
:1003800012005AD2037509040201BAE709F608DF20
:10039000FA8046E709F208DFFA803E88828C83E71C
:1003A00009F0A3DFFA8032E309F608DFFA8078E388
:1003B00009F208DFFA807088828C83E309F0A3DFFA
:1003C000FA806489828A83E0A3F608DFFA8058897C
:1003D000828A83E0A3F208DFFA804C80D280FA8020
:1003E000C680D4806980F28033801080A680EA8045
:1003F0009A80A880DA80E280CA803389828A83EC7E
:10040000FAE493A3C8C582C8CCC583CCF0A3C8C501
:1004100082C8CCC583CCDFE9DEE7800D89828A8380
:10042000E493A3F608DFF9ECFAA9F0EDFB22898248
:100430008A83ECFAE0A3C8C582C8CCC583CCF0A3FC
:10044000C8C582C8CCC583CCDFEADEE880DB898200
:100450008A83E493A3F208DFF980CC88F0EF60018F
:100460000E4E60C388F0ED2402B4040050B9F5824A
:10047000EB2402B4040050AF23234582239003DB16
:1004800073BB010689828A83E0225002E722BBFE09
:1004900002E32289828A83E49322BB010CE582294C
:1004A000F582E5833AF583E0225006E92582F8E6F5
:1004B00022BBFE06E92582F8E222E58229F582E5E3
:1004C000833AF583E49322EF8DF0A4A8F0CF8CF06B
:1004D000A428CE8DF0A42EFE22BC000BBE0029EF76
:1004E0008DF084FFADF022E4CCF875F008EF2FFF1B
:1004F000EE33FEEC33FCEE9DEC984005FCEE9DFEE9
:100500000FD5F0E9E4CEFD22EDF8F5F0EE8420D22F
:100510001CFEADF075F008EF2FFFED33FD4007989E
:100520005006D5F0F222C398FD0FD5F0EA22C2D5CD
:10053000EC30E709B2D5E4C39DFDE49CFCEE30E766
:1005400015B2D5E4C39FFFE49EFE1204D9C3E49D17
:10055000FDE49CFC80031204D930D507C3E49FFF5F
:10056000E49EFE22A3F8E0C5F025F0F0E5821582B6
:1005700070021583E0C838F0E822EF4E6012EF6099
:10058000010EEDBB010B89828A83F0A3DFFCDEFA4A
:100590002289F05007F709DFFCA9F022BBFEFCF32B
:1005A00009DFFCA9F022BB010689828A83F0225070
:1005B00002F722BBFE01F322C5F0F8A3E028F0C544
:1005C000F0F8E582158270021583E038F022F8E039
:1005D000FBA3A3E0F925F0F0E582158270021583F4
:1005E000E0FA38F022EBF0A3EAF0A3E9F022D0839E
:1005F000D082F8E4937012740193700DA3A393F862
:10060000740193F5828883E4737402936860EFA3A6
:10061000A3A380DF900000E4F0A3F0A3F0900060BB
:10062000E07002A3E070030207AE9000E7E0700202
:10063000A3E070030207AB90004674FFF0A3741DA3
:10064000F0A374C0F07B017A0079A5120C5DE94A31
:100650004B70030206F17B017A0079A57D2C121004
:1006600020900000EBF0A3EAF0A3E9F01213C5EF2D
:1006700024FDFFEE34FFFEEF64014E60030207AB82
:10068000900000E0FBA3E0FAA3E0F990000112045F
:100690009AFF3395E0FEEF24D0FFEE34FFFE90008A
:1006A00003F0A3EFF0EE60030207AEEF14B407000F
:1006B00040030207AE9006C375F003A4C58325F07E
:1006C000C583730206D80206DD0206E20206E502D1
:1006D00006E80206EB0206EEC2A50207ABD2A502AF
:1006E00007AB02079102079602079B0207A10207C8
:1006F000A790004674FFF0A3741DF0A374CAF07BAA
:10070000017A0079A5120C5DE94A4B70030207AB30
:100710007B017A0079A57D2C121020900000EBF06F
:10072000A3EAF0A3E9F01213C5EF24FDFFEE34FFB6
:10073000FEEF64014E7074900000E0FBA3E0FAA3AA
:10074000E0F990000112049AFF3395E0FEEF24D007
:10075000FFEE34FFFE900003F0A3EFF0EE704FEFDA
:1007600014B40700504890077475F003A4C583259E
:10077000F0C5837302078902078D0207910207966D
:1007800002079B0207A10207A7C2A5801ED2A5806F
:100790001A12121580151212BC8010C2A6D2A780A0
:1007A0000AD2A6C2A78004C2A6C2A712134C2290E6
:1007B0000121EBF0A3EAF0A3E9F090003B74FFF015
:1007C000A3741DF0A374E1F0A37403F0A374E8F024
:1007D0007BFF7A1E7992120BBAEF4E60DD120B9EF0
:1007E000EF4E60F990003B74FFF0A3741DF0A3740A
:1007F000E1F0A37407F0A374D0F07BFF7A1D79E4D5
:10080000120BBAEF4E60DD90003B74FFF0A3741D35
:10081000F0A374F2F0900121E0F9A3E0FAA3E090D4
:10082000003EC9F0A3EAF0A3E9F0900124E0F9A3A7
:10083000E0FAA3E0900041C9F0A3EAF0A3E9F07B5D
:10084000017A01792712008B90003B74FFF0A374AA
:100850001EF0A37403F0A37413F0A37488F07B015B
:100860007A017927120BBAEF4E60DD90003B74FFDE
:10087000F0A3741DF0A374E1F0A37403F0A374E873
:10088000F07BFF7A1E79A1120BBAEF4E7F00700247
:100890007F01EF70D690003B74FFF0A3741EF0A3AD
:1008A00074E4F0A37407F0A374D0F07BFF7A1E7990
:1008B000C0120BBAEF4E7F0070027F01EF70D6902E
:1008C000003B74FFF0A3741DF0A374E1F0A3740760
:1008D000F0A374D0F07BFF7A1E79F3120BBAEF4EBF
:1008E0007F0070027F01EF70D690003B74FFF0A391
:1008F000741DF0A374E1F0A37407F0A374D0F07B2F
:10090000FF7A1F790B120BBAEF4E7F0070027F0146
:10091000EF70D67BFF7A1F792912138712134C9040
:100920000060E4F0A304F0229000E9EBF0A3EAF009
:10093000A3E9F09000E9E0F9A3E0FAA3E090003B1E
:10094000C9F0A3EAF0A3E9F0A37405F0A374DCF006
:100950007BFF7A1D79D8120BBA120B9EEF4E60F90D
:1009600090003B74FFF0A3741DF0A374E1F0A37436
:1009700007F0A374D0F07BFF7A1D79E4120BBAEF75
:100980004E60DD90003B74FFF0A3741DF0A374F281
:10099000F09000E9E0F9A3E0FAA3E090003EC9F08E
:1009A000A3EAF0A3E9F09000ECE0F9A3E0FAA3E0F9
:1009B000900041C9F0A3EAF0A3E9F07B017A007945
:1009C000EF12008B90003B74FFF0A3741EF0A37431
:1009D00003F0A37413F0A37488F07B017A0079EF1D
:1009E000120BBAEF4E60DD90003B74FFF0A3741D54
:1009F000F0A374E1F0A37403F0A374E8F07BFF7A32
:100A00001E790D120BBAEF4E7F0070027F01EF705E
:100A1000D690003B74FFF0A3741EF0A37441F0A3C2
:100A2000740BF0A374B8F07BFF7A1E791C120BBA1A
:100A3000EF4E60DD90003B74FFF0A3741DF0A374D3
:100A4000E1F0A37403F0A374E8F07BFF7A1E794D04
:100A5000120BBAEF4E60DD121381900060E4F0A338
:100A600004F022900000EBF0A3EAF0A3E9F090007C
:100A700000E0F9A3E0FAA3E090003BC9F0A3EAF09C
:100A8000A3E9F0A37405F0A374DCF07BFF7A1D7971
:100A9000D8120BBA120B9EEF4E60F990003B74FF18
:100AA000F0A3741DF0A374E1F0A37407F0A374D055
:100AB000F07BFF7A1D79E4120BBAEF4E60DD9000F7
:100AC0003B74FFF0A3741DF0A374F2F0900000E0FB
:100AD000F9A3E0FAA3E090003EC9F0A3EAF0A3E98D
:100AE000F0900003E0F9A3E0FAA3E0900041C9F020
:100AF000A3EAF0A3E9F07B017A00790612008B905B
:100B0000003B74FFF0A3741EF0A37403F0A37413EE
:100B1000F0A37488F07B017A007906120BBAEF4ECD
:100B200060DD90003B74FFF0A3741DF0A374E1F04E
:100B3000A37403F0A374E8F07BFF7A1E790D120B07
:100B4000BAEF4E7F0070027F01EF70D690003B74C9
:100B5000FFF0A3741EF0A37441F0A3740BF0A37410
:100B6000B8F07BFF7A1E7967120BBAEF4E60DD900A
:100B7000003B74FFF0A3741DF0A374E1F0A37403B1
:100B8000F0A374E8F07BFF7A1E794D120BBAEF4E9A
:100B900060DD121381900060E4F0A304F022900065
:100BA0003B74FFF0A3741DF0A374E1F0A37403F091
:100BB000A374E8F07BFF7A1D79DC900038EBF0A39A
:100BC000EAF0A3E9F0900040E4F0A3F0A3F01213E0
:100BD0004C900038E0FBA3E0FAA3E0F912138790F1
:100BE000003EE0FEA3E0FF7C007D0A12052E90008F
:100BF0003EEEF0A3EFF090003E74FFF5F0120564B6
:100C000045F060527F0A7E001213B09000E7E0705A
:100C100004A3E0640170DF90003BE0F9A3E0FAA3D5
:100C2000E0900046C9F0A3EAF0A3E9F07B017A0066
:100C300079A5120C5D900040EBF0A3EAF0A3E9F077
:100C4000900040E0FBA3E0FAA3E04A4B60A8121337
:100C50004C7E007F012212134CE4FEFF22900043E1
:100C6000EBF0A3EAF0A3E9F0A3E0FBA3E0FAA3E032
:100C7000F91204817003020D09900043E0FBA3E028
:100C8000FAA3E0F91204817003020D15900046E00A
:100C9000F9A3E0FAA3E0A3C9F0A3EAF0A3E9F09076
:100CA0000043A3E0FAA3E0F990004CEBF0A3EAF0D4
:100CB000A3E9F0900049E0FBA3E0FAA3E0F91204F5
:100CC00081FF602690004CE0FBA3E0FAA3E0F9125C
:100CD00004816F701590004A75F0011205B89000FC
:100CE0004DE475F0011205B880C9900049E0FBA3FE
:100CF000E0FAA3E0F91204817002800D900044E450
:100D000075F0011205B8020C79900043E0FBA3E0F6
:100D1000FAA3E0F9227B007A00790022D2A27F6454
:100D20007E00121367C2A27F647E00121367D2A2F4
:100D3000E4FD7FAE121268E4FF1212687F101212F7
:100D4000687F401212687F811212687FCF1212688A
:100D50007FA11212687FC81212687FA61212687FE4
:100D6000A81212687F3F1212687FD3121268E4FF44
:100D70001212687FD51212687F801212687FD91212
:100D800012687FF11212687FDA1212687F12121253
:100D9000687FDB1212687F401212687F201212688F
:100DA0007F021212687F8D1212687F141212687F00
:100DB000A41212687FA61212687FAF1212687FAF6A
:100DC0001212681212BCE4FDFF020003900163EFEF
:100DD000F0A3EDF0A3EAF0A3EBF0E490016BF09048
:100DE0000169F0900167E0FF900169E0FEC39F4058
:100DF00003020E7AC3EF9E14FD7F0A12132E900198
:100E000065E0FCA3E0FDCFCDCFCECCCE1204D97CE3
:100E1000007D0A1204D990016AEDF0A3E0703090D1
:100E20000167E014FF900169E0FEC39F5021A3E039
:100E30007017900168E0C3138EF0A4FF900163E087
:100E40002FFFA3E0FD7B20802590016B7401F090C3
:100E50000168E0C313FFA3E0FEEF8EF0A4FF900152
:100E600063E02FFFA3E0FD90016AE02430FB121144
:100E70000A900169E004F0020DE3229000E7E070BF
:100E800002A3E07003020F0F90004674FFF0A374FA
:100E90001FF0A3744DF07B017A0079A5120C5DE977
:100EA0004A4B606B7B017A0079A57D2C1210209053
:100EB00000A2EBF0A3EAF0A3E9F090FFFF12049A7E
:100EC000FF3395E0FE78627C007D019000A2E0FB9C
:100ED000A3E0FAA3E0F912045B90003B74FFF0A3D7
:100EE000741FF0A37479F0A37407F0A374D0F07B9F
:100EF000FF7A1F795B120BBAEF4E7F0070027F0101
:100F0000EF70D612134C7B017A007962121387229C
:100F1000787FE4F6D8FD758121020F5702130CE4A7
:100F200093A3F8E493A34003F68001F208DFF48072
:100F300029E493A3F85407240CC8C333C4540F44C2
:100F400020C8834004F456800146F6DFE4800B019C
:100F5000020408102040809013DAE47E019360BC04
:100F6000A3FF543F30E509541FFEE493A360010E34
:100F7000CF54C025E060A840B8E493A3FAE493A35B
:100F8000F8E493A3C8C582C8CAC583CAF0A3C8C57C
:100F900082C8CAC583CADFE9DEE780BE900159EF87
:100FA000F090015BEBF0E4900160F0A3F090015C45
:100FB000E0FF54077008EF131313541F800A9001C9
:100FC0005CE0131313541F04900162F0900162ED72
:100FD000F090015CE0FF900162E0FDC39F50409003
:100FE0000159E0FF120003E0FC90015BE0FFECC35D
:100FF0009F502490015DE0FBA3E0FAA3E0F9A3E495
:1010000075F00112056485F082F58312049AFF7D64
:10101000011212680C80D2900162E004F080B222CA
:10102000900005EBF0A3EAF0A3E9F0A3EBF0A3EA4C
:10103000F0A3E9F0900008E0FBA3E0FAA3E0F912C6
:101040000481600C900009E475F0011205B880E499
:10105000900008E0FBA3E0FAA3E0F91204816D70B0
:101060000122900005E0FBA3E0FAA3E0F9EBC0E069
:10107000EAC0E0E9C0E0A3E0FBA374FFF5F01205CD
:1010800064FAD082D083D0E06B7009E5F06582709D
:1010900003EA658370BAFBFAF922C0E0C0F0C083AE
:1010A000C082C0D075D000C000C006C007309849CB
:1010B000C2989000E5E475F001120564FE74A52560
:1010C000F0F58274003EF583E599F09000E5E0FECE
:1010D000A3E0FF24A4F58274003EF583E0B40A087F
:1010E0009000E7E4F0A304F0EF64404E700B900032
:1010F000E5F0A3F0A3F0A304F0D007D006D000D011
:10110000D0D082D083D0F0D0E032AA07A905AF03B7
:10111000E4FCEF24E0FBEAD3947F4004E4FA0909FD
:10112000AF02AD01120003E4FC75F010EBA42CF546
:1011300082E435F0F583E5822450F582E5833416A8
:101140001212610CECB408E1AF02E904FD120003D5
:10115000E4FC75F010EBA42CF582E435F0F583E5A2
:10116000822458F582E58334161212610CECB4081F
:10117000E122900005EFF0A3EDF0A3EBF0A3EAF07D
:10118000A3E9F0E4A3F0900007E0FBA3E0FAA3E0FA
:10119000F9A3E0F58275830012049AFB60279000A2
:1011A00005E0FFA3E0FD12110A900005E02408F01D
:1011B000E0D394784007E4F0A3E02402F090000A22
:1011C000E004F080C122A907AA05E4900005F0120E
:1011D0000003E4FC75F040EBA42440F582E5F03414
:1011E0001C121257900005E004F00CECB410E5AFAF
:1011F00001EA04FD120003E4FC75F040EBA4246056
:10120000F582E5F0341C121257900005E004F00C52
:10121000ECB410E522E4FBFD7F101211C67B01E463
:10122000FD7F201211C67B02E4FD7F301211C67BC8
:1012300003E4FD7F401211C67B04E4FD7F501211D0
:10124000C67B05E4FD7F601211C67BFF7A1479230B
:101250007D027F20021172F583E5822CF582E43550
:1012600083F583E493FF7D01ED6004D2A38002C285
:10127000A3C2A4E4FEC2A0EF30E704D2A18002C260
:10128000A1D2A0EF25E0FF0EEEB408E9D2A4D2A3CC
:10129000229000E7E07002A3E060207B017A0079F1
:1012A000A5121387120614E49000E5F0A3F0FE7F68
:1012B00040FD7B017A0079A512057A22E4FCEC243A
:1012C000B0FFE4FD121268E4FF1212687F101212E0
:1012D00068E4FB7D01E4FF1212680BEBB480F40CB0
:1012E000ECB408DA22EFB40A07740D1212F0740A93
:1012F000309811A899B8130CC2983098FDA899C2DB
:1013000098B811F63099FDC299F5992212139A12E4
:101310000D1C90000374FFF0A3741FF0A37443F03E
:101320007BFF7A1F793A120A6312129180FB9001B7
:101330006CEFF0A9057F017E00AD0119ED600C9006
:10134000016CE0FD7C001204C780EE227E007F402D
:101350007D007B017A0079A512057AE49000E5F022
:10136000A3F0A3F0A3F022EF4E60157D087C07EDFB
:101370001DAA0470011C4A70F6EF1F70EA1E80E778
:10138000227BFF7A1E795A120481FF600C12141B13
:10139000740129F9E43AFA80EE2275985053890FC6
:1013A000438920758BFD758DFDD28ED2ACD2AF22D4
:1013B000EF1FAC0670011E4C600A7D027CEFDCFE64
:1013C000DDFC80EC22E4FFFE120481600C0FEF7064
:1013D000010E09E970F20A80EF224300A20000002A
:1013E0004200E500004200E7000000E4FD7F8D12AE
:1013F00012687F141212687FAF021268E4FD7F8DBD
:101400001212687F101212687FAE0212689000E715
:10141000E07002A3E06003120614228F993099FD58
:10142000C29922574632340000000000000000003C
:10143000002F000000000700070000147F147F1435
:1014400000242A7F2A1200626408132300364955BB
:10145000225000000503000000001C224100000093
:1014600041221C000014083E08140008083E080829
:10147000000000A060000008080808080000606084
:101480000000002010080402003E5149453E0000C3
:10149000427F4000004261514946002141454B31A5
:1014A000001814127F10002745454539003C4A4971
:1014B00049300001710905030036494949360006E3
:1014C0004949291E0000363600000000563600004B
:1014D00000081422410000141414141400004122C6
:1014E000140800020151090600324959513E007C9E
:1014F0001211127C007F49494936003E4141412288
:10150000007F4141221C007F49494941007F090970
:101510000901003E4149497A007F0808087F000020
:10152000417F4100002040413F01007F08142241DB
:10153000007F40404040007F020C027F007F040893
:10154000107F003E4141413E007F09090906003EEF
:101550004151215E007F0919294600464949493118
:101560000001017F0101003F4040403F001F20403B
:10157000201F003F4038403F0063140814630007F9
:101580000870080700615149454300007F41410050
:1015900000552A552A55000041417F0000040201F0
:1015A00002040040404040400000010204000020CE
:1015B00054545478007F484444380038444444200C
:1015C00000384444487F00385454541800087E09B9
:1015D00001020018A4A4A47C007F08040478000081
:1015E000447D4000004080847D00007F102844003E
:1015F0000000417F4000007C04180478007C08044F
:10160000047800384444443800FC2424241800188A
:10161000242418FC007C0804040800485454542076
:1016200000043F444020003C4040207C001C2040FF
:10163000201C003C4030403C004428102844001C42
:10164000A0A0A07C004464544C441414141414143A
:10165000000000000000000000000000000000008A
:10166000000000F80000000000000033300000001F
:1016700000100C06100C0600000000000000000026
:1016800040C07840C0784000043F04043F04040098
:10169000007088FC08300000001820FF211E0000A8
:1016A000F008F000E018000000211C031E211E00BD
:1016B00000F00888700000001E2123241927211043
:1016C00010160E00000000000000000000000000E6
:1016D000000000E01804020000000007182040008D
:1016E00000020418E000000000402018070000007D
:1016F000404080F0804040000202010F01020200E1
:10170000000000F0000000000101011F01010100C4
:10171000000000000000000080B070000000000029
:1017200000000000000000000001010101010101B2
:101730000000000000000000003030000000000049
:10174000000000008060180400601806010000001E
:1017500000E010080810E000000F102020100F001B
:10176000001010F8000000000020203F20200000A2
:1017700000700808088870000030282422213000FA
:1017800000300888884830000018202020110E0002
:101790000000C02010F8000000070424243F2400AB
:1017A00000F80888880808000019212020110E0080
:1017B00000E0108888180000000F112020110E0092
:1017C00000380808C83808000000003F000000008A
:1017D0000070880808887000001C222121221C004B
:1017E00000E010080810E0000000312222110F0074
:1017F000000000C0C0000000000000303000000009
:101800000000008000000000000080600000000078
:101810000000804020100800000102040810200091
:1018200040404040404040000404040404040400DC
:101830000008102040800000002010080402010071
:10184000007048080808F000000000303601000071
:10185000C030C828E810E0000718272423140B0024
:101860000000C038E0000000203C2302022738209E
:1018700008F8888888700000203F202020110E0082
:10188000C030080808083800071820202010080079
:1018900008F808080810E000203F202020100F0062
:1018A00008F88888E8081000203F2020232018002E
:1018B00008F88888E8081000203F20000300000096
:1018C000C03008080838000007182020221E020037
:1018D00008F808000008F808203F210101213F20F6
:1018E000000808F8080800000020203F2020000021
:1018F00000000808F8080800C08080807F00000011
:1019000008F888C028180800203F20012638200049
:1019100008F8080000000000203F202020203000B0
:1019200008F8F800F8F80800203F003F003F2000CA
:1019300008F830C00008F808203F200007183F00D2
:10194000E01008080810E0000F10202020100F0001
:1019500008F808080808F000203F210101010000F4
:10196000E01008080810E0000F18242438504F0039
:1019700008F8888888887000203F2000030C3020F9
:1019800000708808080838000038202121221C0037
:10199000180808F8080818000000203F2000000080
:1019A00008F808000008F808001F202020201F0069
:1019B0000878880000C83808000007380E010000C9
:1019C000F80800F80008F800033C0700073C030093
:1019D000081868808068180820302C03032C3020F9
:1019E0000838C800C83808000000203F2000000068
:1019F00010080808C83808002038262120201800C0
:101A0000000000FE020202000000007F4040400093
:101A1000000C30C000000000000000010638C000CB
:101A200000020202FE000000004040407F00000073
:101A30000000040202020400000000000000000098
:101A40000000000000000000808080808080808096
:101A5000000202040000000000000000000000007E
:101A600000008080808000000019242222223F2074
:101A700008F8008080000000003F112020110E00B7
:101A80000000008080800000000E11202020110046
:101A9000000000808088F800000E112020103F20F8
:101AA0000000808080800000001F2222222213007C
:101AB000008080F0888888180020203F20200000C7
:101AC0000000808080808000006B9494949360007C
:101AD00008F8008080800000203F210000203F2087
:101AE00000809898000000000020203F2020000087
:101AF000000000809898000000C08080807F000077
:101B000008F8000080808000203F24022D30200053
:101B1000000808F8000000000020203F20200000FE
:101B20008080808080808000203F20003F20003F18
:101B30008080008080800000203F210000203F2026
:101B40000000808080800000001F202020201F00D7
:101B5000808000808000000080FFA12020110E0006
:101B60000000008080808000000E112020A0FF80F7
:101B7000808080008080800020203F2120000100A4
:101B800000008080808080000033242424241900F9
:101B9000008080E0808000000000001F2020000006
:101BA0008080000000808000001F202020103F2047
:101BB000808080000080808000010E3008060100D7
:101BC00080800080008080800F300C030C300F007C
:101BD00000808000808080000020312E0E312000A7
:101BE000808080000080808080818E7018060100D7
:101BF00000808080808080000021302C22213000F5
:101C000000000000807C020200000000003F404015
:101C100000000000FF00000000000000FF000000C6
:101C20000002027C800000000040403F00000000F5
:101C30000006010102020404000000000000000090
:101C400020202020202020FF2020202020202000D5
:101C50000000000000000000000000000000000084
:101C600080804020100C0300030C10204080800076
:101C70000000000000000000000000000000000064
:101C8000000101FD55555755555555FD0101000001
:101C90000000000000000000000000000000000044
:101CA000809088454F55252525554D4580808000DD
:101CB0000000000000000000000000000000000024
:101CC0001010101010FF1010F0101116D01010008E
:101CD0000000000000000000000000000000000004
:101CE00080402018064120103F4442414040780087
:101CF00000000000000000000000000000000000E4
:101D0000001088864040202F5090080204080000F0
:101D100000000000000000000000000000000000C3
:101D2000010100FF555555557F555555554100004A
:101D300000000000000000000000000000000000A3
:101D40002424A4FEA3220022CC0000FF00000000F7
:101D50000000000000000000000000000000000083
:101D6000080601FF00010404040404FF020202004B
:101D70000000000000000000000000000000000063
:101D8000101010FF109008888888FF888888080045
:101D90000000000000000000000000000000000043
:101DA0000444827F01808040432C102846818000BB
:101DB0000000000000000000000000000000000023
:101DC0003139322E3136382E3000524543563A746E
:101DD0006573742D617070002B2B2B0041540D0A1C
:101DE000004F4B0041542B43574D4F44453D300D60
:101DF0000A0041542B43574A41503D25732C25730B
:101E00000D0A002B43574A41503A312C0041542BC4
:101E10004349504D4F44453D310D0A0041542B4339
:101E2000495053544152543D5443502C3139322E71
:101E30003136382E302E3134362C323334370D0AC9
:101E4000002B43495053544152543A310041542BD2
:101E500043495053454E440D0A003A436F6E6E6538
:101E6000637465640D0A0041542B43495053544137
:101E700052543D5544502C3139322E3136382E30A3
:101E80002E37322C323334352C313131322C300D67
:101E90000A0041542B4D515454434C45414E0D0AB8
:101EA0000041542B4D5154544C4F4E47434C4945DF
:101EB0004E5449443D57462D54455354320D0A0063
:101EC00041542B4D515454434F4E4E3D62726F6BF3
:101ED00065722E656D71782E696F2C313838332C10
:101EE000300D0A004D515454434F4E4E4543544516
:101EF000443A0041542B4D5154545355423D74655E
:101F000073742D6170702C300D0A0041542B4D51AB
:101F100054545055425241573D746573742D772C7B
:101F200033322C302C300D0A004D5154545F436F26
:101F30006E6E65637465640D0A0044582D534D41FF
:101F4000525400534D4152544036303100524543B3
:101F5000563A746573742D6170700041542B4D5165
:101F600054545055425241573D746573742D772C2B
:0C1F700033322C302C300D0A004F4B0097
:00000001FF

View File

@@ -0,0 +1,7 @@
".\Objects\STARTUP.obj",
".\Objects\main.obj",
".\Objects\UART.obj",
".\Objects\oled.obj"
TO ".\Objects\51Project"
PRINT(".\Listings\51Project.map")

View File

@@ -0,0 +1,198 @@
$NOMOD51
;------------------------------------------------------------------------------
; This file is part of the C51 Compiler package
; Copyright (c) 1988-2005 Keil Elektronik GmbH and Keil Software, Inc.
; Version 8.01
;
; *** <<< Use Configuration Wizard in Context Menu >>> ***
;------------------------------------------------------------------------------
; STARTUP.A51: This code is executed after processor reset.
;
; To translate this file use A51 with the following invocation:
;
; A51 STARTUP.A51
;
; To link the modified STARTUP.OBJ file to your application use the following
; Lx51 invocation:
;
; Lx51 your object file list, STARTUP.OBJ controls
;
;------------------------------------------------------------------------------
;
; User-defined <h> Power-On Initialization of Memory
;
; With the following EQU statements the initialization of memory
; at processor reset can be defined:
;
; <o> IDATALEN: IDATA memory size <0x0-0x100>
; <i> Note: The absolute start-address of IDATA memory is always 0
; <i> The IDATA space overlaps physically the DATA and BIT areas.
IDATALEN EQU 80H
;
; <o> XDATASTART: XDATA memory start address <0x0-0xFFFF>
; <i> The absolute start address of XDATA memory
XDATASTART EQU 0
;
; <o> XDATALEN: XDATA memory size <0x0-0xFFFF>
; <i> The length of XDATA memory in bytes.
XDATALEN EQU 0
;
; <o> PDATASTART: PDATA memory start address <0x0-0xFFFF>
; <i> The absolute start address of PDATA memory
PDATASTART EQU 0H
;
; <o> PDATALEN: PDATA memory size <0x0-0xFF>
; <i> The length of PDATA memory in bytes.
PDATALEN EQU 0H
;
;</h>
;------------------------------------------------------------------------------
;
;<h> Reentrant Stack Initialization
;
; The following EQU statements define the stack pointer for reentrant
; functions and initialized it:
;
; <h> Stack Space for reentrant functions in the SMALL model.
; <q> IBPSTACK: Enable SMALL model reentrant stack
; <i> Stack space for reentrant functions in the SMALL model.
IBPSTACK EQU 0 ; set to 1 if small reentrant is used.
; <o> IBPSTACKTOP: End address of SMALL model stack <0x0-0xFF>
; <i> Set the top of the stack to the highest location.
IBPSTACKTOP EQU 0xFF +1 ; default 0FFH+1
; </h>
;
; <h> Stack Space for reentrant functions in the LARGE model.
; <q> XBPSTACK: Enable LARGE model reentrant stack
; <i> Stack space for reentrant functions in the LARGE model.
XBPSTACK EQU 0 ; set to 1 if large reentrant is used.
; <o> XBPSTACKTOP: End address of LARGE model stack <0x0-0xFFFF>
; <i> Set the top of the stack to the highest location.
XBPSTACKTOP EQU 0xFFFF +1 ; default 0FFFFH+1
; </h>
;
; <h> Stack Space for reentrant functions in the COMPACT model.
; <q> PBPSTACK: Enable COMPACT model reentrant stack
; <i> Stack space for reentrant functions in the COMPACT model.
PBPSTACK EQU 0 ; set to 1 if compact reentrant is used.
;
; <o> PBPSTACKTOP: End address of COMPACT model stack <0x0-0xFFFF>
; <i> Set the top of the stack to the highest location.
PBPSTACKTOP EQU 0xFF +1 ; default 0FFH+1
; </h>
;</h>
;------------------------------------------------------------------------------
;
; Memory Page for Using the Compact Model with 64 KByte xdata RAM
; <e>Compact Model Page Definition
;
; <i>Define the XDATA page used for PDATA variables.
; <i>PPAGE must conform with the PPAGE set in the linker invocation.
;
; Enable pdata memory page initalization
PPAGEENABLE EQU 0 ; set to 1 if pdata object are used.
;
; <o> PPAGE number <0x0-0xFF>
; <i> uppermost 256-byte address of the page used for PDATA variables.
PPAGE EQU 0
;
; <o> SFR address which supplies uppermost address byte <0x0-0xFF>
; <i> most 8051 variants use P2 as uppermost address byte
PPAGE_SFR DATA 0A0H
;
; </e>
;------------------------------------------------------------------------------
; Standard SFR Symbols
ACC DATA 0E0H
B DATA 0F0H
SP DATA 81H
DPL DATA 82H
DPH DATA 83H
NAME ?C_STARTUP
?C_C51STARTUP SEGMENT CODE
?STACK SEGMENT IDATA
RSEG ?STACK
DS 1
EXTRN CODE (?C_START)
PUBLIC ?C_STARTUP
CSEG AT 0
?C_STARTUP: LJMP STARTUP1
RSEG ?C_C51STARTUP
STARTUP1:
IF IDATALEN <> 0
MOV R0,#IDATALEN - 1
CLR A
IDATALOOP: MOV @R0,A
DJNZ R0,IDATALOOP
ENDIF
IF XDATALEN <> 0
MOV DPTR,#XDATASTART
MOV R7,#LOW (XDATALEN)
IF (LOW (XDATALEN)) <> 0
MOV R6,#(HIGH (XDATALEN)) +1
ELSE
MOV R6,#HIGH (XDATALEN)
ENDIF
CLR A
XDATALOOP: MOVX @DPTR,A
INC DPTR
DJNZ R7,XDATALOOP
DJNZ R6,XDATALOOP
ENDIF
IF PPAGEENABLE <> 0
MOV PPAGE_SFR,#PPAGE
ENDIF
IF PDATALEN <> 0
MOV R0,#LOW (PDATASTART)
MOV R7,#LOW (PDATALEN)
CLR A
PDATALOOP: MOVX @R0,A
INC R0
DJNZ R7,PDATALOOP
ENDIF
IF IBPSTACK <> 0
EXTRN DATA (?C_IBP)
MOV ?C_IBP,#LOW IBPSTACKTOP
ENDIF
IF XBPSTACK <> 0
EXTRN DATA (?C_XBP)
MOV ?C_XBP,#HIGH XBPSTACKTOP
MOV ?C_XBP+1,#LOW XBPSTACKTOP
ENDIF
IF PBPSTACK <> 0
EXTRN DATA (?C_PBP)
MOV ?C_PBP,#LOW PBPSTACKTOP
ENDIF
MOV SP,#?STACK-1
; This code is required if you use L51_BANK.A51 with Banking Mode 4
;<h> Code Banking
; <q> Select Bank 0 for L51_BANK.A51 Mode 4
#if 0
; <i> Initialize bank mechanism to code bank 0 when using L51_BANK.A51 with Banking Mode 4.
EXTRN CODE (?B_SWITCH0)
CALL ?B_SWITCH0 ; init bank mechanism to code bank 0
#endif
;</h>
LJMP ?C_START
END

View File

@@ -0,0 +1,209 @@
#include "UART.h"
#include <string.h>
#include "oled.h"
#include <stdio.h>
// 用于存储接收数据的数组
unsigned char rxBuffer[ARRAY_SIZE];
unsigned int rxIndex = 0; // 接收数据的索引
unsigned int rx_flag=0;
extern unsigned int CONNECT_FLEG;//连接标志
// 初始化串口
void Serial_Init() {
SCON = 0x50; // 设置为模式18位数据可变波特率
TMOD &= 0x0F; // 清除定时器1模式位
TMOD |= 0x20; // 设置定时器1为8位自动重装模式
TH1 = TL1 = 256 - (11059200 / 12 / 32) / BAUDRATE; // 设置波特率
TR1 = 1; // 启动定时器1
ES = 1; // 开启串口中断
EA = 1; // 开启全局中断
}
void Delay(unsigned int xms)
{
unsigned char i, j;
while(xms--)
{
i = 2;
j = 239;
do
{
while (--j);
} while (--i);
}
}
void buff_memset(void)
{
memset(rxBuffer,0,64);
rxIndex=0;
rx_flag = 0;
}
unsigned int WIFI_CheckAck(char* src, char* dest, int timeout)
{
char *check = NULL;
//清空缓冲
buff_memset();
UART_sentString(src);
timeout=timeout/10;//10ms处理一次
while(timeout--)
{
Delay(10);//延时1ms
if(rx_flag==1)
{
check = strstr(rxBuffer,dest);
if(check != NULL)
{
buff_memset();//数据有误 清空
return 1;
}
}
}
buff_memset();//数据有误 清空
return 0;//超时
}
sbit LED = P2^5;
sbit motor1 = P2^6;
sbit motor2 = P2^7;
void CONNECT_TX_Control(void)
{
char *ptr = NULL;
int number;
if (CONNECT_FLEG)
{
if(rx_flag)
{
if(strstr(rxBuffer,"192.168.0")!=NULL)
{
ptr = strrchr((char*)rxBuffer,','); // 以最后一个,为准后面为数据
if(strlen(ptr)-3==1) //判断接收到为一位数据 ,*\r\n
{
number = ptr[1]-'0';
switch(number)
{
case 1: LED = 0 ; break;
case 2: LED = 1; break;
case 3:OLED_Show(); break;
case 4:OLED_Clear(); break;
case 5:motor1=0;motor2=1; break;
case 6:motor1=1;motor2=0; break;
case 7:motor1=0;motor2=0 ; break;
default: return;
}
}
}
else if(strstr((char *)rxBuffer,"RECV:test-app")!=NULL)
{
ptr = strrchr((char*)rxBuffer,','); // 以最后一个,为准后面为数据
if(strlen(ptr)-3==1) //判断接收到为一位数据 ,*\r\n
{
number = ptr[1]-'0';
switch(number)
{
case 1: LED = 0 ; break;
case 2: LED = 1; break;
case 3:OLED_Show(); break;
case 4:OLED_Clear(); break;
case 5:motor1=0;motor2=1; break;
case 6:motor1=1;motor2=0; break;
case 7:motor1=0;motor2=0 ; break;
default: return;
}
}
}
}
buff_memset();//数据有误 清空
}
}
void CONNECT_TO_TCP(unsigned char* id,unsigned char *password)
{
unsigned char buf[50];
WIFI_CheckAck("+++",id,1500); //确保其退出透传
//while(!WIFI_CheckAck("AT+RESTORE\r\n","OK",5000));
while(!WIFI_CheckAck("AT\r\n","OK",1000));
while(!WIFI_CheckAck("AT+CWMODE=0\r\n","OK",2000));
sprintf((char *)buf,"AT+CWJAP=%s,%s\r\n",id,password);
while(!WIFI_CheckAck((char *)buf,"+CWJAP:1,",5000));
while(!WIFI_CheckAck("AT+CIPMODE=1\r\n","OK",1000)!=0);
while(!WIFI_CheckAck("AT+CIPSTART=TCP,192.168.0.146,2347\r\n","+CIPSTART:1",3000));
while(!WIFI_CheckAck("AT+CIPSEND\r\n","OK",1000));
UART_sentString(":Connected\r\n");
CONNECT_FLEG = 1;
}
void CONNECT_TO_UDP(unsigned char* id,unsigned char *password)
{
unsigned char buf[50];
WIFI_CheckAck("+++",id,1500); //确保其退出透传
//while(!WIFI_CheckAck("AT+RESTORE\r\n","OK",5000));
while(!WIFI_CheckAck("AT\r\n","OK",1000));
while(!WIFI_CheckAck("AT+CWMODE=0\r\n","OK",2000));
sprintf((char *)buf,"AT+CWJAP=%s,%s\r\n",id,password);
while(!WIFI_CheckAck((char *)buf,"+CWJAP:1,",5000));
while(!WIFI_CheckAck("AT+CIPMODE=1\r\n","OK",1000)!=0);
while(!WIFI_CheckAck("AT+CIPSTART=UDP,192.168.0.72,2345,1112,0\r\n","+CIPSTART:1",3000)); //192.168.0.150,2345为IP地址 2345 端口号1112 是模块设置的端口号 0 UDP固定目标模式
while(!WIFI_CheckAck("AT+CIPSEND\r\n","OK",1000));
UART_sentString(":Connected\r\n");
CONNECT_FLEG = 1;
}
void CONNECT_TO_MQTT(unsigned char* id,unsigned char *password)
{
unsigned char buf[50];
while(!WIFI_CheckAck("AT+MQTTCLEAN\r\n","OK",1000));
//while(!WIFI_CheckAck("AT+RESTORE\r\n","OK",5000));
while(!WIFI_CheckAck("AT\r\n","OK",1000));
while(!WIFI_CheckAck("AT+CWMODE=0\r\n","OK",2000)); //STA模式
sprintf((char *)buf,"AT+CWJAP=%s,%s\r\n",id,password);
while(!WIFI_CheckAck((char *)buf,"+CWJAP:1,",5000));//连接WIFI
while(!WIFI_CheckAck("AT+MQTTLONGCLIENTID=WF-TEST2\r\n","OK",1000)!=0);//配置 MQTT 客户端所需的客户端 ID、用户名和密码
while(!WIFI_CheckAck("AT+MQTTCONN=broker.emqx.io,1883,0\r\n","MQTTCONNECTED:",2000)!=0);//连接 MQTT 服务器
while(!WIFI_CheckAck("AT+MQTTSUB=test-app,0\r\n","OK",2000)!=0);//订阅主题 test-app
while(!WIFI_CheckAck("AT+MQTTPUBRAW=test-w,32,0,0\r\n","OK",2000)!=0);
UART_sentString("MQTT_Connected\r\n");
buff_memset();
CONNECT_FLEG = 1;
}
void UART_SendByte(unsigned char Byte)
{
SBUF=Byte;
while(!TI);
TI=0;
}
void UART_sentString(char *str)
{
while(*str){
UART_SendByte(*str);
str++;
}
}
// 串口接收中断服务程序
void Serial_ISR() interrupt 4 {
if (RI) {
RI = 0; // 清除接收中断标志
rxBuffer[rxIndex++] = SBUF; // 存储接收到的数据
if(rxBuffer[rxIndex-1]=='\n')
{
rx_flag=1;
}
if(rxIndex==64)
{
rxIndex=0;
rx_flag=1;
}
}
}

View File

@@ -0,0 +1,16 @@
#ifndef _UART_H_
#define _UART_H_
#include <REGX52.H> // STC89C52RC的寄存器定义
#define BAUDRATE 9600 // 波特率
#define ARRAY_SIZE 64 // 数组大小
void Serial_Init();
void Uart_send_String();
void UART_SendByte(unsigned char Byte);
void UART_sentString(char *str);
void Delay(unsigned int xms);
unsigned int WIFI_CheckAck(char* src, char* dest, int timeout);
void CONNECT_TO_TCP(unsigned char* id,unsigned char *password);
void CONNECT_TO_UDP(unsigned char* id,unsigned char *password);
void CONNECT_TO_MQTT(unsigned char* id,unsigned char *password);
void CONNECT_TX_Control(void);
#endif

View File

@@ -0,0 +1,75 @@
//**** 声明 ********************************************************************
/*******************************************************************************
* 下面来自互联开源程序,由深圳市大夏龙雀科技有限公司收集
* 方便用户参考学习,本公司不提供任何技术支持
* 程序仅供测试参考,不能应用在实际工程中,不一定能通过编译
* 公司网站 http://www.szdx-smart.com/
* 淘宝网址 https://shop184598174.taobao.com/?spm=a1z10.5-c-s.w12096189-21564973333.3.547b1176WCCDxR&scene=taobao_shop
*******************************************************************************/
/********************************************************************
* 文件名 WF24-UDP协议应用
* 描述 : 该文件实现通过利用WF24给单片机发数据控制LED+OLED+电机。
***********************************************************************/
/*
Name: UDP
Created: 2024/8/21
Author: WAM
*/
#include <REGX52.H> // STC89C52RC的寄存器定义
#include "UART.h"
#include "string.h"
#include "stdio.h"
#include "oled.h"
extern unsigned int rxIndex;
extern unsigned char rxBuffer[ARRAY_SIZE];
extern unsigned int rx_flag;
unsigned int CONNECT_FLEG;//连接标志
// 主函数
unsigned char conver[64];
char *ptr = NULL;
void MQTT_CONVER(void);
void TCP_UDP_CONVER(void);
void main() {
Serial_Init(); // 初始化串口
OLED_Init();
CONNECT_TO_UDP("DX-SMART","SMART@601");
while (1) {
// 主循环,可以添加其他任务
TCP_UDP_CONVER();
}
}
void TCP_UDP_CONVER(void)
{
if (rx_flag)
{
UART_sentString(rxBuffer);
CONNECT_TX_Control();
rxIndex = 0; // 重置索引,准备下一次接收
memset(rxBuffer,0,ARRAY_SIZE); //清空缓冲区
}
}
void MQTT_CONVER(void)
{
if (rx_flag)
{
if(strstr(rxBuffer,"RECV:test-app")!=NULL)
{
ptr = strrchr(rxBuffer,',');
memcpy(conver,ptr,*(ptr-1));
while(!WIFI_CheckAck("AT+MQTTPUBRAW=test-w,32,0,0\r\n","OK",2000)!=0);
buff_memset();//数据有误 清空
UART_sentString(conver);
}
}
}
void MQTT_CONTROL(void)
{
if (rx_flag)
{
CONNECT_TX_Control();
}
}

View File

@@ -0,0 +1,249 @@
#include "oled.h"
#include "oledfont.h"
void delay_ms(unsigned int ms)
{
unsigned int a;
while(ms)
{
a=1800;
while(a--);
ms--;
}
return;
}
void OLED_Show()
{
OLED_ShowCHinese(16,0,0);
OLED_ShowCHinese(32,0,1);
OLED_ShowCHinese(48,0,2);
OLED_ShowCHinese(64,0,3);
OLED_ShowCHinese(80,0,4);
OLED_ShowCHinese(96,0,5);
OLED_ShowString(32,2,"WF24");
}
#if OLED_MODE==1
//向SSD1106写入一个字节。
//dat:要写入的数据/命令
//cmd:数据/命令标志 0,表示命令;1,表示数据;
void OLED_WR_Byte(u8 dat,u8 cmd)
{
DATAOUT(dat);
if(cmd)
OLED_DC_Set();
else
OLED_DC_Clr();
OLED_CS_Clr();
OLED_WR_Clr();
OLED_WR_Set();
OLED_CS_Set();
OLED_DC_Set();
}
#else
//向SSD1306写入一个字节。
//dat:要写入的数据/命令
//cmd:数据/命令标志 0,表示命令;1,表示数据;
void OLED_WR_Byte(u8 dat,u8 cmd)
{
u8 i;
if(cmd)
OLED_DC_Set();
else
OLED_DC_Clr();
OLED_CS_Clr();
for(i=0;i<8;i++)
{
OLED_SCLK_Clr();
if(dat&0x80)
{
OLED_SDIN_Set();
}
else
OLED_SDIN_Clr();
OLED_SCLK_Set();
dat<<=1;
}
OLED_CS_Set();
OLED_DC_Set();
}
#endif
void OLED_Set_Pos(unsigned char x, unsigned char y)
{
OLED_WR_Byte(0xb0+y,OLED_CMD);
OLED_WR_Byte(((x&0xf0)>>4)|0x10,OLED_CMD);
OLED_WR_Byte((x&0x0f)|0x01,OLED_CMD);
}
//开启OLED显示
void OLED_Display_On(void)
{
OLED_WR_Byte(0X8D,OLED_CMD); //SET DCDC命令
OLED_WR_Byte(0X14,OLED_CMD); //DCDC ON
OLED_WR_Byte(0XAF,OLED_CMD); //DISPLAY ON
}
//关闭OLED显示
void OLED_Display_Off(void)
{
OLED_WR_Byte(0X8D,OLED_CMD); //SET DCDC命令
OLED_WR_Byte(0X10,OLED_CMD); //DCDC OFF
OLED_WR_Byte(0XAE,OLED_CMD); //DISPLAY OFF
}
//清屏函数,清完屏,整个屏幕是黑色的!和没点亮一样!!!
void OLED_Clear(void)
{
u8 i,n;
for(i=0;i<8;i++)
{
OLED_WR_Byte (0xb0+i,OLED_CMD); //设置页地址0~7
OLED_WR_Byte (0x00,OLED_CMD); //设置显示位置—列低地址
OLED_WR_Byte (0x10,OLED_CMD); //设置显示位置—列高地址
for(n=0;n<128;n++)OLED_WR_Byte(0,OLED_DATA);
} //更新显示
}
//在指定位置显示一个字符,包括部分字符
//x:0~127
//y:0~63
//mode:0,反白显示;1,正常显示
//size:选择字体 16/12
void OLED_ShowChar(u8 x,u8 y,u8 chr)
{
unsigned char c=0,i=0;
c=chr-' ';//得到偏移后的值
if(x>Max_Column-1){x=0;y=y+2;}
if(SIZE ==16)
{
OLED_Set_Pos(x,y);
for(i=0;i<8;i++)
OLED_WR_Byte(F8X16[c*16+i],OLED_DATA);
OLED_Set_Pos(x,y+1);
for(i=0;i<8;i++)
OLED_WR_Byte(F8X16[c*16+i+8],OLED_DATA);
}
}
//m^n函数
u32 oled_pow(u8 m,u8 n)
{
u32 result=1;
while(n--)result*=m;
return result;
}
//显示2个数字
//x,y :起点坐标
//len :数字的位数
//size:字体大小
//mode:模式 0,填充模式;1,叠加模式
//num:数值(0~4294967295);
void OLED_ShowNum(u8 x,u8 y,u32 num,u8 len,u8 size2)
{
u8 t,temp;
u8 enshow=0;
for(t=0;t<len;t++)
{
temp=(num/oled_pow(10,len-t-1))%10;
if(enshow==0&&t<(len-1))
{
if(temp==0)
{
OLED_ShowChar(x+(size2/2)*t,y,' ');
continue;
}else enshow=1;
}
OLED_ShowChar(x+(size2/2)*t,y,temp+'0');
}
}
//显示一个字符号串
void OLED_ShowString(u8 x,u8 y,u8 *chr)
{
unsigned char j=0;
while (chr[j]!='\0')
{ OLED_ShowChar(x,y,chr[j]);
x+=8;
if(x>120){x=0;y+=2;}
j++;
}
}
//显示汉字
void OLED_ShowCHinese(u8 x,u8 y,u8 no)
{
u8 t,adder=0;
OLED_Set_Pos(x,y);
for(t=0;t<16;t++)
{
OLED_WR_Byte(Hzk[2*no][t],OLED_DATA);
adder+=1;
}
OLED_Set_Pos(x,y+1);
for(t=0;t<16;t++)
{
OLED_WR_Byte(Hzk[2*no+1][t],OLED_DATA);
adder+=1;
}
}
/***********功能描述显示显示BMP图片128×64起始点坐标(x,y),x的范围0127y为页的范围07*****************/
void OLED_DrawBMP(unsigned char x0, unsigned char y0,unsigned char x1, unsigned char y1,unsigned char BMP[])
{
unsigned int j=0;
unsigned char x,y;
if(y1%8==0) y=y1/8;
else y=y1/8+1;
for(y=y0;y<y1;y++)
{
OLED_Set_Pos(x0,y);
for(x=x0;x<x1;x++)
{
OLED_WR_Byte(BMP[j++],OLED_DATA);
}
}
}
//初始化SSD1306
void OLED_Init(void)
{
OLED_RST_Set();
delay_ms(100);
OLED_RST_Clr();
delay_ms(100);
OLED_RST_Set();
OLED_WR_Byte(0xAE,OLED_CMD);//--turn off oled panel
OLED_WR_Byte(0x00,OLED_CMD);//---set low column address
OLED_WR_Byte(0x10,OLED_CMD);//---set high column address
OLED_WR_Byte(0x40,OLED_CMD);//--set start line address Set Mapping RAM Display Start Line (0x00~0x3F)
OLED_WR_Byte(0x81,OLED_CMD);//--set contrast control register
OLED_WR_Byte(0xCF,OLED_CMD); // Set SEG Output Current Brightness
OLED_WR_Byte(0xA1,OLED_CMD);//--Set SEG/Column Mapping 0xa0左右反置 0xa1正常
OLED_WR_Byte(0xC8,OLED_CMD);//Set COM/Row Scan Direction 0xc0上下反置 0xc8正常
OLED_WR_Byte(0xA6,OLED_CMD);//--set normal display
OLED_WR_Byte(0xA8,OLED_CMD);//--set multiplex ratio(1 to 64)
OLED_WR_Byte(0x3f,OLED_CMD);//--1/64 duty
OLED_WR_Byte(0xD3,OLED_CMD);//-set display offset Shift Mapping RAM Counter (0x00~0x3F)
OLED_WR_Byte(0x00,OLED_CMD);//-not offset
OLED_WR_Byte(0xd5,OLED_CMD);//--set display clock divide ratio/oscillator frequency
OLED_WR_Byte(0x80,OLED_CMD);//--set divide ratio, Set Clock as 100 Frames/Sec
OLED_WR_Byte(0xD9,OLED_CMD);//--set pre-charge period
OLED_WR_Byte(0xF1,OLED_CMD);//Set Pre-Charge as 15 Clocks & Discharge as 1 Clock
OLED_WR_Byte(0xDA,OLED_CMD);//--set com pins hardware configuration
OLED_WR_Byte(0x12,OLED_CMD);
OLED_WR_Byte(0xDB,OLED_CMD);//--set vcomh
OLED_WR_Byte(0x40,OLED_CMD);//Set VCOM Deselect Level
OLED_WR_Byte(0x20,OLED_CMD);//-Set Page Addressing Mode (0x00/0x01/0x02)
OLED_WR_Byte(0x02,OLED_CMD);//
OLED_WR_Byte(0x8D,OLED_CMD);//--set Charge Pump enable/disable
OLED_WR_Byte(0x14,OLED_CMD);//--set(0x10) disable
OLED_WR_Byte(0xA4,OLED_CMD);// Disable Entire Display On (0xa4/0xa5)
OLED_WR_Byte(0xA6,OLED_CMD);// Disable Inverse Display On (0xa6/a7)
OLED_WR_Byte(0xAF,OLED_CMD);//--turn on oled panel
OLED_WR_Byte(0xAF,OLED_CMD); /*display ON*/
OLED_Clear();
OLED_Set_Pos(0,0);
}

View File

@@ -0,0 +1,73 @@
#ifndef _OLED_H_
#define _OLED_H_
#include <REGX52.H>
#define u8 unsigned char
#define u32 unsigned int
#define OLED_CMD 0 //写命令
#define OLED_DATA 1 //写数据
#define OLED_MODE 0
sbit OLED_CS=P2^4; //片选
sbit OLED_RST =P2^2;//复位
sbit OLED_DC =P2^3;//数据/命令控制
sbit OLED_SCL=P2^0;//时钟 D0SCLK
sbit OLED_SDIN=P2^1;//D1MOSI 数据
#define OLED_CS_Clr() OLED_CS=0
#define OLED_CS_Set() OLED_CS=1
#define OLED_RST_Clr() OLED_RST=0
#define OLED_RST_Set() OLED_RST=1
#define OLED_DC_Clr() OLED_DC=0
#define OLED_DC_Set() OLED_DC=1
#define OLED_SCLK_Clr() OLED_SCL=0
#define OLED_SCLK_Set() OLED_SCL=1
#define OLED_SDIN_Clr() OLED_SDIN=0
#define OLED_SDIN_Set() OLED_SDIN=1
//OLED模式设置
//0:4线串行模式
//1:并行8080模式
#define SIZE 16
#define XLevelL 0x02
#define XLevelH 0x10
#define Max_Column 128
#define Max_Row 64
#define Brightness 0xFF
#define X_WIDTH 128
#define Y_WIDTH 64
//-----------------OLED端口定义----------------
void delay_ms(unsigned int ms);
void OLED_Show();
//OLED控制用函数
void OLED_WR_Byte(u8 dat,u8 cmd);
void OLED_Display_On(void);
void OLED_Display_Off(void);
void OLED_Init(void);
void OLED_Clear(void);
void OLED_DrawPoint(u8 x,u8 y,u8 t);
void OLED_Fill(u8 x1,u8 y1,u8 x2,u8 y2,u8 dot);
void OLED_ShowChar(u8 x,u8 y,u8 chr);
void OLED_ShowNum(u8 x,u8 y,u32 num,u8 len,u8 size2);
void OLED_ShowString(u8 x,u8 y, u8 *p);
void OLED_Set_Pos(unsigned char x, unsigned char y);
void OLED_ShowCHinese(u8 x,u8 y,u8 no);
void OLED_DrawBMP(unsigned char x0, unsigned char y0,unsigned char x1, unsigned char y1,unsigned char BMP[]);
#endif

View File

@@ -0,0 +1,225 @@
//#endif /*_OLEDFONT_H*/
#ifndef __OLEDFONT_H
#define __OLEDFONT_H
//常用ASCII表
//偏移量32
//ASCII字符集
//偏移量32
//大小:12*6
/************************************6*8的点阵************************************/
const unsigned char code 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
};
/****************************************8*16的点阵************************************/
const unsigned char code F8X16[]=
{
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,// 0
0x00,0x00,0x00,0xF8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x33,0x30,0x00,0x00,0x00,//! 1
0x00,0x10,0x0C,0x06,0x10,0x0C,0x06,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//" 2
0x40,0xC0,0x78,0x40,0xC0,0x78,0x40,0x00,0x04,0x3F,0x04,0x04,0x3F,0x04,0x04,0x00,//# 3
0x00,0x70,0x88,0xFC,0x08,0x30,0x00,0x00,0x00,0x18,0x20,0xFF,0x21,0x1E,0x00,0x00,//$ 4
0xF0,0x08,0xF0,0x00,0xE0,0x18,0x00,0x00,0x00,0x21,0x1C,0x03,0x1E,0x21,0x1E,0x00,//% 5
0x00,0xF0,0x08,0x88,0x70,0x00,0x00,0x00,0x1E,0x21,0x23,0x24,0x19,0x27,0x21,0x10,//& 6
0x10,0x16,0x0E,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//' 7
0x00,0x00,0x00,0xE0,0x18,0x04,0x02,0x00,0x00,0x00,0x00,0x07,0x18,0x20,0x40,0x00,//( 8
0x00,0x02,0x04,0x18,0xE0,0x00,0x00,0x00,0x00,0x40,0x20,0x18,0x07,0x00,0x00,0x00,//) 9
0x40,0x40,0x80,0xF0,0x80,0x40,0x40,0x00,0x02,0x02,0x01,0x0F,0x01,0x02,0x02,0x00,//* 10
0x00,0x00,0x00,0xF0,0x00,0x00,0x00,0x00,0x01,0x01,0x01,0x1F,0x01,0x01,0x01,0x00,//+ 11
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xB0,0x70,0x00,0x00,0x00,0x00,0x00,//, 12
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x01,0x01,0x01,0x01,0x01,//- 13
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x30,0x00,0x00,0x00,0x00,0x00,//. 14
0x00,0x00,0x00,0x00,0x80,0x60,0x18,0x04,0x00,0x60,0x18,0x06,0x01,0x00,0x00,0x00,/// 15
0x00,0xE0,0x10,0x08,0x08,0x10,0xE0,0x00,0x00,0x0F,0x10,0x20,0x20,0x10,0x0F,0x00,//0 16
0x00,0x10,0x10,0xF8,0x00,0x00,0x00,0x00,0x00,0x20,0x20,0x3F,0x20,0x20,0x00,0x00,//1 17
0x00,0x70,0x08,0x08,0x08,0x88,0x70,0x00,0x00,0x30,0x28,0x24,0x22,0x21,0x30,0x00,//2 18
0x00,0x30,0x08,0x88,0x88,0x48,0x30,0x00,0x00,0x18,0x20,0x20,0x20,0x11,0x0E,0x00,//3 19
0x00,0x00,0xC0,0x20,0x10,0xF8,0x00,0x00,0x00,0x07,0x04,0x24,0x24,0x3F,0x24,0x00,//4 20
0x00,0xF8,0x08,0x88,0x88,0x08,0x08,0x00,0x00,0x19,0x21,0x20,0x20,0x11,0x0E,0x00,//5 21
0x00,0xE0,0x10,0x88,0x88,0x18,0x00,0x00,0x00,0x0F,0x11,0x20,0x20,0x11,0x0E,0x00,//6 22
0x00,0x38,0x08,0x08,0xC8,0x38,0x08,0x00,0x00,0x00,0x00,0x3F,0x00,0x00,0x00,0x00,//7 23
0x00,0x70,0x88,0x08,0x08,0x88,0x70,0x00,0x00,0x1C,0x22,0x21,0x21,0x22,0x1C,0x00,//8 24
0x00,0xE0,0x10,0x08,0x08,0x10,0xE0,0x00,0x00,0x00,0x31,0x22,0x22,0x11,0x0F,0x00,//9 25
0x00,0x00,0x00,0xC0,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x30,0x00,0x00,0x00,//: 26
0x00,0x00,0x00,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x60,0x00,0x00,0x00,0x00,//; 27
0x00,0x00,0x80,0x40,0x20,0x10,0x08,0x00,0x00,0x01,0x02,0x04,0x08,0x10,0x20,0x00,//< 28
0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x00,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x00,//= 29
0x00,0x08,0x10,0x20,0x40,0x80,0x00,0x00,0x00,0x20,0x10,0x08,0x04,0x02,0x01,0x00,//> 30
0x00,0x70,0x48,0x08,0x08,0x08,0xF0,0x00,0x00,0x00,0x00,0x30,0x36,0x01,0x00,0x00,//? 31
0xC0,0x30,0xC8,0x28,0xE8,0x10,0xE0,0x00,0x07,0x18,0x27,0x24,0x23,0x14,0x0B,0x00,//@ 32
0x00,0x00,0xC0,0x38,0xE0,0x00,0x00,0x00,0x20,0x3C,0x23,0x02,0x02,0x27,0x38,0x20,//A 33
0x08,0xF8,0x88,0x88,0x88,0x70,0x00,0x00,0x20,0x3F,0x20,0x20,0x20,0x11,0x0E,0x00,//B 34
0xC0,0x30,0x08,0x08,0x08,0x08,0x38,0x00,0x07,0x18,0x20,0x20,0x20,0x10,0x08,0x00,//C 35
0x08,0xF8,0x08,0x08,0x08,0x10,0xE0,0x00,0x20,0x3F,0x20,0x20,0x20,0x10,0x0F,0x00,//D 36
0x08,0xF8,0x88,0x88,0xE8,0x08,0x10,0x00,0x20,0x3F,0x20,0x20,0x23,0x20,0x18,0x00,//E 37
0x08,0xF8,0x88,0x88,0xE8,0x08,0x10,0x00,0x20,0x3F,0x20,0x00,0x03,0x00,0x00,0x00,//F 38
0xC0,0x30,0x08,0x08,0x08,0x38,0x00,0x00,0x07,0x18,0x20,0x20,0x22,0x1E,0x02,0x00,//G 39
0x08,0xF8,0x08,0x00,0x00,0x08,0xF8,0x08,0x20,0x3F,0x21,0x01,0x01,0x21,0x3F,0x20,//H 40
0x00,0x08,0x08,0xF8,0x08,0x08,0x00,0x00,0x00,0x20,0x20,0x3F,0x20,0x20,0x00,0x00,//I 41
0x00,0x00,0x08,0x08,0xF8,0x08,0x08,0x00,0xC0,0x80,0x80,0x80,0x7F,0x00,0x00,0x00,//J 42
0x08,0xF8,0x88,0xC0,0x28,0x18,0x08,0x00,0x20,0x3F,0x20,0x01,0x26,0x38,0x20,0x00,//K 43
0x08,0xF8,0x08,0x00,0x00,0x00,0x00,0x00,0x20,0x3F,0x20,0x20,0x20,0x20,0x30,0x00,//L 44
0x08,0xF8,0xF8,0x00,0xF8,0xF8,0x08,0x00,0x20,0x3F,0x00,0x3F,0x00,0x3F,0x20,0x00,//M 45
0x08,0xF8,0x30,0xC0,0x00,0x08,0xF8,0x08,0x20,0x3F,0x20,0x00,0x07,0x18,0x3F,0x00,//N 46
0xE0,0x10,0x08,0x08,0x08,0x10,0xE0,0x00,0x0F,0x10,0x20,0x20,0x20,0x10,0x0F,0x00,//O 47
0x08,0xF8,0x08,0x08,0x08,0x08,0xF0,0x00,0x20,0x3F,0x21,0x01,0x01,0x01,0x00,0x00,//P 48
0xE0,0x10,0x08,0x08,0x08,0x10,0xE0,0x00,0x0F,0x18,0x24,0x24,0x38,0x50,0x4F,0x00,//Q 49
0x08,0xF8,0x88,0x88,0x88,0x88,0x70,0x00,0x20,0x3F,0x20,0x00,0x03,0x0C,0x30,0x20,//R 50
0x00,0x70,0x88,0x08,0x08,0x08,0x38,0x00,0x00,0x38,0x20,0x21,0x21,0x22,0x1C,0x00,//S 51
0x18,0x08,0x08,0xF8,0x08,0x08,0x18,0x00,0x00,0x00,0x20,0x3F,0x20,0x00,0x00,0x00,//T 52
0x08,0xF8,0x08,0x00,0x00,0x08,0xF8,0x08,0x00,0x1F,0x20,0x20,0x20,0x20,0x1F,0x00,//U 53
0x08,0x78,0x88,0x00,0x00,0xC8,0x38,0x08,0x00,0x00,0x07,0x38,0x0E,0x01,0x00,0x00,//V 54
0xF8,0x08,0x00,0xF8,0x00,0x08,0xF8,0x00,0x03,0x3C,0x07,0x00,0x07,0x3C,0x03,0x00,//W 55
0x08,0x18,0x68,0x80,0x80,0x68,0x18,0x08,0x20,0x30,0x2C,0x03,0x03,0x2C,0x30,0x20,//X 56
0x08,0x38,0xC8,0x00,0xC8,0x38,0x08,0x00,0x00,0x00,0x20,0x3F,0x20,0x00,0x00,0x00,//Y 57
0x10,0x08,0x08,0x08,0xC8,0x38,0x08,0x00,0x20,0x38,0x26,0x21,0x20,0x20,0x18,0x00,//Z 58
0x00,0x00,0x00,0xFE,0x02,0x02,0x02,0x00,0x00,0x00,0x00,0x7F,0x40,0x40,0x40,0x00,//[ 59
0x00,0x0C,0x30,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x06,0x38,0xC0,0x00,//\ 60
0x00,0x02,0x02,0x02,0xFE,0x00,0x00,0x00,0x00,0x40,0x40,0x40,0x7F,0x00,0x00,0x00,//] 61
0x00,0x00,0x04,0x02,0x02,0x02,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//^ 62
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,//_ 63
0x00,0x02,0x02,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//` 64
0x00,0x00,0x80,0x80,0x80,0x80,0x00,0x00,0x00,0x19,0x24,0x22,0x22,0x22,0x3F,0x20,//a 65
0x08,0xF8,0x00,0x80,0x80,0x00,0x00,0x00,0x00,0x3F,0x11,0x20,0x20,0x11,0x0E,0x00,//b 66
0x00,0x00,0x00,0x80,0x80,0x80,0x00,0x00,0x00,0x0E,0x11,0x20,0x20,0x20,0x11,0x00,//c 67
0x00,0x00,0x00,0x80,0x80,0x88,0xF8,0x00,0x00,0x0E,0x11,0x20,0x20,0x10,0x3F,0x20,//d 68
0x00,0x00,0x80,0x80,0x80,0x80,0x00,0x00,0x00,0x1F,0x22,0x22,0x22,0x22,0x13,0x00,//e 69
0x00,0x80,0x80,0xF0,0x88,0x88,0x88,0x18,0x00,0x20,0x20,0x3F,0x20,0x20,0x00,0x00,//f 70
0x00,0x00,0x80,0x80,0x80,0x80,0x80,0x00,0x00,0x6B,0x94,0x94,0x94,0x93,0x60,0x00,//g 71
0x08,0xF8,0x00,0x80,0x80,0x80,0x00,0x00,0x20,0x3F,0x21,0x00,0x00,0x20,0x3F,0x20,//h 72
0x00,0x80,0x98,0x98,0x00,0x00,0x00,0x00,0x00,0x20,0x20,0x3F,0x20,0x20,0x00,0x00,//i 73
0x00,0x00,0x00,0x80,0x98,0x98,0x00,0x00,0x00,0xC0,0x80,0x80,0x80,0x7F,0x00,0x00,//j 74
0x08,0xF8,0x00,0x00,0x80,0x80,0x80,0x00,0x20,0x3F,0x24,0x02,0x2D,0x30,0x20,0x00,//k 75
0x00,0x08,0x08,0xF8,0x00,0x00,0x00,0x00,0x00,0x20,0x20,0x3F,0x20,0x20,0x00,0x00,//l 76
0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x00,0x20,0x3F,0x20,0x00,0x3F,0x20,0x00,0x3F,//m 77
0x80,0x80,0x00,0x80,0x80,0x80,0x00,0x00,0x20,0x3F,0x21,0x00,0x00,0x20,0x3F,0x20,//n 78
0x00,0x00,0x80,0x80,0x80,0x80,0x00,0x00,0x00,0x1F,0x20,0x20,0x20,0x20,0x1F,0x00,//o 79
0x80,0x80,0x00,0x80,0x80,0x00,0x00,0x00,0x80,0xFF,0xA1,0x20,0x20,0x11,0x0E,0x00,//p 80
0x00,0x00,0x00,0x80,0x80,0x80,0x80,0x00,0x00,0x0E,0x11,0x20,0x20,0xA0,0xFF,0x80,//q 81
0x80,0x80,0x80,0x00,0x80,0x80,0x80,0x00,0x20,0x20,0x3F,0x21,0x20,0x00,0x01,0x00,//r 82
0x00,0x00,0x80,0x80,0x80,0x80,0x80,0x00,0x00,0x33,0x24,0x24,0x24,0x24,0x19,0x00,//s 83
0x00,0x80,0x80,0xE0,0x80,0x80,0x00,0x00,0x00,0x00,0x00,0x1F,0x20,0x20,0x00,0x00,//t 84
0x80,0x80,0x00,0x00,0x00,0x80,0x80,0x00,0x00,0x1F,0x20,0x20,0x20,0x10,0x3F,0x20,//u 85
0x80,0x80,0x80,0x00,0x00,0x80,0x80,0x80,0x00,0x01,0x0E,0x30,0x08,0x06,0x01,0x00,//v 86
0x80,0x80,0x00,0x80,0x00,0x80,0x80,0x80,0x0F,0x30,0x0C,0x03,0x0C,0x30,0x0F,0x00,//w 87
0x00,0x80,0x80,0x00,0x80,0x80,0x80,0x00,0x00,0x20,0x31,0x2E,0x0E,0x31,0x20,0x00,//x 88
0x80,0x80,0x80,0x00,0x00,0x80,0x80,0x80,0x80,0x81,0x8E,0x70,0x18,0x06,0x01,0x00,//y 89
0x00,0x80,0x80,0x80,0x80,0x80,0x80,0x00,0x00,0x21,0x30,0x2C,0x22,0x21,0x30,0x00,//z 90
0x00,0x00,0x00,0x00,0x80,0x7C,0x02,0x02,0x00,0x00,0x00,0x00,0x00,0x3F,0x40,0x40,//{ 91
0x00,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,//| 92
0x00,0x02,0x02,0x7C,0x80,0x00,0x00,0x00,0x00,0x40,0x40,0x3F,0x00,0x00,0x00,0x00,//} 93
0x00,0x06,0x01,0x01,0x02,0x02,0x04,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//~ 94
};
const char code Hzk[][32]={
{0x20,0x20,0x20,0x20,0x20,0x20,0x20,0xFF,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x00},
{0x80,0x80,0x40,0x20,0x10,0x0C,0x03,0x00,0x03,0x0C,0x10,0x20,0x40,0x80,0x80,0x00},/*"大",0*/
{0x00,0x01,0x01,0xFD,0x55,0x55,0x57,0x55,0x55,0x55,0x55,0xFD,0x01,0x01,0x00,0x00},
{0x80,0x90,0x88,0x45,0x4F,0x55,0x25,0x25,0x25,0x55,0x4D,0x45,0x80,0x80,0x80,0x00},/*"夏",1*/
{0x10,0x10,0x10,0x10,0x10,0xFF,0x10,0x10,0xF0,0x10,0x11,0x16,0xD0,0x10,0x10,0x00},
{0x80,0x40,0x20,0x18,0x06,0x41,0x20,0x10,0x3F,0x44,0x42,0x41,0x40,0x40,0x78,0x00},/*"龙",2*/
{0x00,0x10,0x88,0x86,0x40,0x40,0x20,0x2F,0x50,0x90,0x08,0x02,0x04,0x08,0x00,0x00},
{0x01,0x01,0x00,0xFF,0x55,0x55,0x55,0x55,0x7F,0x55,0x55,0x55,0x55,0x41,0x00,0x00},/*"雀",3*/
{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*/
};
#endif

View File

@@ -0,0 +1,4 @@
1.打开烧录.exe
2.选择 单片机型号STC89C52RC/LE52RC
3.点击打开程序文件选择keil4生成的.hex文件
4.点击下载/编程然后STC89C52RC芯片断电重启即可读取芯片并烧录.hex文件

View File

@@ -0,0 +1,218 @@
/**
******************************************************************************
* @file misc.h
* @author MCD Application Team
* @version V3.6.2
* @date 17-September-2021
* @brief This file contains all the functions prototypes for the miscellaneous
* firmware library functions (add-on to CMSIS functions).
******************************************************************************
* @attention
*
* Copyright (c) 2012 STMicroelectronics.
* All rights reserved.
*
* This software is licensed under terms that can be found in the LICENSE file
* in the root directory of this software component.
* If no LICENSE file comes with this software, it is provided AS-IS.
*
******************************************************************************
*/
/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef __MISC_H
#define __MISC_H
#ifdef __cplusplus
extern "C" {
#endif
/* Includes ------------------------------------------------------------------*/
#include "stm32f10x.h"
/** @addtogroup STM32F10x_StdPeriph_Driver
* @{
*/
/** @addtogroup MISC
* @{
*/
/** @defgroup MISC_Exported_Types
* @{
*/
/**
* @brief NVIC Init Structure definition
*/
typedef struct
{
uint8_t NVIC_IRQChannel; /*!< Specifies the IRQ channel to be enabled or disabled.
This parameter can be a value of @ref IRQn_Type
(For the complete STM32 Devices IRQ Channels list, please
refer to stm32f10x.h file) */
uint8_t NVIC_IRQChannelPreemptionPriority; /*!< Specifies the pre-emption priority for the IRQ channel
specified in NVIC_IRQChannel. This parameter can be a value
between 0 and 15 as described in the table @ref NVIC_Priority_Table */
uint8_t NVIC_IRQChannelSubPriority; /*!< Specifies the subpriority level for the IRQ channel specified
in NVIC_IRQChannel. This parameter can be a value
between 0 and 15 as described in the table @ref NVIC_Priority_Table */
FunctionalState NVIC_IRQChannelCmd; /*!< Specifies whether the IRQ channel defined in NVIC_IRQChannel
will be enabled or disabled.
This parameter can be set either to ENABLE or DISABLE */
} NVIC_InitTypeDef;
/**
* @}
*/
/** @defgroup NVIC_Priority_Table
* @{
*/
/**
@code
The table below gives the allowed values of the pre-emption priority and subpriority according
to the Priority Grouping configuration performed by NVIC_PriorityGroupConfig function
============================================================================================================================
NVIC_PriorityGroup | NVIC_IRQChannelPreemptionPriority | NVIC_IRQChannelSubPriority | Description
============================================================================================================================
NVIC_PriorityGroup_0 | 0 | 0-15 | 0 bits for pre-emption priority
| | | 4 bits for subpriority
----------------------------------------------------------------------------------------------------------------------------
NVIC_PriorityGroup_1 | 0-1 | 0-7 | 1 bits for pre-emption priority
| | | 3 bits for subpriority
----------------------------------------------------------------------------------------------------------------------------
NVIC_PriorityGroup_2 | 0-3 | 0-3 | 2 bits for pre-emption priority
| | | 2 bits for subpriority
----------------------------------------------------------------------------------------------------------------------------
NVIC_PriorityGroup_3 | 0-7 | 0-1 | 3 bits for pre-emption priority
| | | 1 bits for subpriority
----------------------------------------------------------------------------------------------------------------------------
NVIC_PriorityGroup_4 | 0-15 | 0 | 4 bits for pre-emption priority
| | | 0 bits for subpriority
============================================================================================================================
@endcode
*/
/**
* @}
*/
/** @defgroup MISC_Exported_Constants
* @{
*/
/** @defgroup Vector_Table_Base
* @{
*/
#define NVIC_VectTab_RAM ((uint32_t)0x20000000)
#define NVIC_VectTab_FLASH ((uint32_t)0x08000000)
#define IS_NVIC_VECTTAB(VECTTAB) (((VECTTAB) == NVIC_VectTab_RAM) || \
((VECTTAB) == NVIC_VectTab_FLASH))
/**
* @}
*/
/** @defgroup System_Low_Power
* @{
*/
#define NVIC_LP_SEVONPEND ((uint8_t)0x10)
#define NVIC_LP_SLEEPDEEP ((uint8_t)0x04)
#define NVIC_LP_SLEEPONEXIT ((uint8_t)0x02)
#define IS_NVIC_LP(LP) (((LP) == NVIC_LP_SEVONPEND) || \
((LP) == NVIC_LP_SLEEPDEEP) || \
((LP) == NVIC_LP_SLEEPONEXIT))
/**
* @}
*/
/** @defgroup Preemption_Priority_Group
* @{
*/
#define NVIC_PriorityGroup_0 ((uint32_t)0x700) /*!< 0 bits for pre-emption priority
4 bits for subpriority */
#define NVIC_PriorityGroup_1 ((uint32_t)0x600) /*!< 1 bits for pre-emption priority
3 bits for subpriority */
#define NVIC_PriorityGroup_2 ((uint32_t)0x500) /*!< 2 bits for pre-emption priority
2 bits for subpriority */
#define NVIC_PriorityGroup_3 ((uint32_t)0x400) /*!< 3 bits for pre-emption priority
1 bits for subpriority */
#define NVIC_PriorityGroup_4 ((uint32_t)0x300) /*!< 4 bits for pre-emption priority
0 bits for subpriority */
#define IS_NVIC_PRIORITY_GROUP(GROUP) (((GROUP) == NVIC_PriorityGroup_0) || \
((GROUP) == NVIC_PriorityGroup_1) || \
((GROUP) == NVIC_PriorityGroup_2) || \
((GROUP) == NVIC_PriorityGroup_3) || \
((GROUP) == NVIC_PriorityGroup_4))
#define IS_NVIC_PREEMPTION_PRIORITY(PRIORITY) ((PRIORITY) < 0x10)
#define IS_NVIC_SUB_PRIORITY(PRIORITY) ((PRIORITY) < 0x10)
#define IS_NVIC_OFFSET(OFFSET) ((OFFSET) < 0x000FFFFF)
/**
* @}
*/
/** @defgroup SysTick_clock_source
* @{
*/
#define SysTick_CLKSource_HCLK_Div8 ((uint32_t)0xFFFFFFFB)
#define SysTick_CLKSource_HCLK ((uint32_t)0x00000004)
#define IS_SYSTICK_CLK_SOURCE(SOURCE) (((SOURCE) == SysTick_CLKSource_HCLK) || \
((SOURCE) == SysTick_CLKSource_HCLK_Div8))
/**
* @}
*/
/**
* @}
*/
/** @defgroup MISC_Exported_Macros
* @{
*/
/**
* @}
*/
/** @defgroup MISC_Exported_Functions
* @{
*/
void NVIC_PriorityGroupConfig(uint32_t NVIC_PriorityGroup);
void NVIC_Init(NVIC_InitTypeDef* NVIC_InitStruct);
void NVIC_SetVectorTable(uint32_t NVIC_VectTab, uint32_t Offset);
void NVIC_SystemLPConfig(uint8_t LowPowerMode, FunctionalState NewState);
void SysTick_CLKSourceConfig(uint32_t SysTick_CLKSource);
#ifdef __cplusplus
}
#endif
#endif /* __MISC_H */
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/

View File

@@ -0,0 +1,481 @@
/**
******************************************************************************
* @file stm32f10x_adc.h
* @author MCD Application Team
* @version V3.6.2
* @date 17-September-2021
* @brief This file contains all the functions prototypes for the ADC firmware
* library.
******************************************************************************
* @attention
*
* Copyright (c) 2012 STMicroelectronics.
* All rights reserved.
*
* This software is licensed under terms that can be found in the LICENSE file
* in the root directory of this software component.
* If no LICENSE file comes with this software, it is provided AS-IS.
*
******************************************************************************
*/
/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef __STM32F10x_ADC_H
#define __STM32F10x_ADC_H
#ifdef __cplusplus
extern "C" {
#endif
/* Includes ------------------------------------------------------------------*/
#include "stm32f10x.h"
/** @addtogroup STM32F10x_StdPeriph_Driver
* @{
*/
/** @addtogroup ADC
* @{
*/
/** @defgroup ADC_Exported_Types
* @{
*/
/**
* @brief ADC Init structure definition
*/
typedef struct
{
uint32_t ADC_Mode; /*!< Configures the ADC to operate in independent or
dual mode.
This parameter can be a value of @ref ADC_mode */
FunctionalState ADC_ScanConvMode; /*!< Specifies whether the conversion is performed in
Scan (multichannels) or Single (one channel) mode.
This parameter can be set to ENABLE or DISABLE */
FunctionalState ADC_ContinuousConvMode; /*!< Specifies whether the conversion is performed in
Continuous or Single mode.
This parameter can be set to ENABLE or DISABLE. */
uint32_t ADC_ExternalTrigConv; /*!< Defines the external trigger used to start the analog
to digital conversion of regular channels. This parameter
can be a value of @ref ADC_external_trigger_sources_for_regular_channels_conversion */
uint32_t ADC_DataAlign; /*!< Specifies whether the ADC data alignment is left or right.
This parameter can be a value of @ref ADC_data_align */
uint8_t ADC_NbrOfChannel; /*!< Specifies the number of ADC channels that will be converted
using the sequencer for regular channel group.
This parameter must range from 1 to 16. */
}ADC_InitTypeDef;
/**
* @}
*/
/** @defgroup ADC_Exported_Constants
* @{
*/
#define IS_ADC_ALL_PERIPH(PERIPH) (((PERIPH) == ADC1) || \
((PERIPH) == ADC2) || \
((PERIPH) == ADC3))
#define IS_ADC_DMA_PERIPH(PERIPH) (((PERIPH) == ADC1) || \
((PERIPH) == ADC3))
/** @defgroup ADC_mode
* @{
*/
#define ADC_Mode_Independent ((uint32_t)0x00000000)
#define ADC_Mode_RegInjecSimult ((uint32_t)0x00010000)
#define ADC_Mode_RegSimult_AlterTrig ((uint32_t)0x00020000)
#define ADC_Mode_InjecSimult_FastInterl ((uint32_t)0x00030000)
#define ADC_Mode_InjecSimult_SlowInterl ((uint32_t)0x00040000)
#define ADC_Mode_InjecSimult ((uint32_t)0x00050000)
#define ADC_Mode_RegSimult ((uint32_t)0x00060000)
#define ADC_Mode_FastInterl ((uint32_t)0x00070000)
#define ADC_Mode_SlowInterl ((uint32_t)0x00080000)
#define ADC_Mode_AlterTrig ((uint32_t)0x00090000)
#define IS_ADC_MODE(MODE) (((MODE) == ADC_Mode_Independent) || \
((MODE) == ADC_Mode_RegInjecSimult) || \
((MODE) == ADC_Mode_RegSimult_AlterTrig) || \
((MODE) == ADC_Mode_InjecSimult_FastInterl) || \
((MODE) == ADC_Mode_InjecSimult_SlowInterl) || \
((MODE) == ADC_Mode_InjecSimult) || \
((MODE) == ADC_Mode_RegSimult) || \
((MODE) == ADC_Mode_FastInterl) || \
((MODE) == ADC_Mode_SlowInterl) || \
((MODE) == ADC_Mode_AlterTrig))
/**
* @}
*/
/** @defgroup ADC_external_trigger_sources_for_regular_channels_conversion
* @{
*/
#define ADC_ExternalTrigConv_T1_CC1 ((uint32_t)0x00000000) /*!< For ADC1 and ADC2 */
#define ADC_ExternalTrigConv_T1_CC2 ((uint32_t)0x00020000) /*!< For ADC1 and ADC2 */
#define ADC_ExternalTrigConv_T2_CC2 ((uint32_t)0x00060000) /*!< For ADC1 and ADC2 */
#define ADC_ExternalTrigConv_T3_TRGO ((uint32_t)0x00080000) /*!< For ADC1 and ADC2 */
#define ADC_ExternalTrigConv_T4_CC4 ((uint32_t)0x000A0000) /*!< For ADC1 and ADC2 */
#define ADC_ExternalTrigConv_Ext_IT11_TIM8_TRGO ((uint32_t)0x000C0000) /*!< For ADC1 and ADC2 */
#define ADC_ExternalTrigConv_T1_CC3 ((uint32_t)0x00040000) /*!< For ADC1, ADC2 and ADC3 */
#define ADC_ExternalTrigConv_None ((uint32_t)0x000E0000) /*!< For ADC1, ADC2 and ADC3 */
#define ADC_ExternalTrigConv_T3_CC1 ((uint32_t)0x00000000) /*!< For ADC3 only */
#define ADC_ExternalTrigConv_T2_CC3 ((uint32_t)0x00020000) /*!< For ADC3 only */
#define ADC_ExternalTrigConv_T8_CC1 ((uint32_t)0x00060000) /*!< For ADC3 only */
#define ADC_ExternalTrigConv_T8_TRGO ((uint32_t)0x00080000) /*!< For ADC3 only */
#define ADC_ExternalTrigConv_T5_CC1 ((uint32_t)0x000A0000) /*!< For ADC3 only */
#define ADC_ExternalTrigConv_T5_CC3 ((uint32_t)0x000C0000) /*!< For ADC3 only */
#define IS_ADC_EXT_TRIG(REGTRIG) (((REGTRIG) == ADC_ExternalTrigConv_T1_CC1) || \
((REGTRIG) == ADC_ExternalTrigConv_T1_CC2) || \
((REGTRIG) == ADC_ExternalTrigConv_T1_CC3) || \
((REGTRIG) == ADC_ExternalTrigConv_T2_CC2) || \
((REGTRIG) == ADC_ExternalTrigConv_T3_TRGO) || \
((REGTRIG) == ADC_ExternalTrigConv_T4_CC4) || \
((REGTRIG) == ADC_ExternalTrigConv_Ext_IT11_TIM8_TRGO) || \
((REGTRIG) == ADC_ExternalTrigConv_None) || \
((REGTRIG) == ADC_ExternalTrigConv_T3_CC1) || \
((REGTRIG) == ADC_ExternalTrigConv_T2_CC3) || \
((REGTRIG) == ADC_ExternalTrigConv_T8_CC1) || \
((REGTRIG) == ADC_ExternalTrigConv_T8_TRGO) || \
((REGTRIG) == ADC_ExternalTrigConv_T5_CC1) || \
((REGTRIG) == ADC_ExternalTrigConv_T5_CC3))
/**
* @}
*/
/** @defgroup ADC_data_align
* @{
*/
#define ADC_DataAlign_Right ((uint32_t)0x00000000)
#define ADC_DataAlign_Left ((uint32_t)0x00000800)
#define IS_ADC_DATA_ALIGN(ALIGN) (((ALIGN) == ADC_DataAlign_Right) || \
((ALIGN) == ADC_DataAlign_Left))
/**
* @}
*/
/** @defgroup ADC_channels
* @{
*/
#define ADC_Channel_0 ((uint8_t)0x00)
#define ADC_Channel_1 ((uint8_t)0x01)
#define ADC_Channel_2 ((uint8_t)0x02)
#define ADC_Channel_3 ((uint8_t)0x03)
#define ADC_Channel_4 ((uint8_t)0x04)
#define ADC_Channel_5 ((uint8_t)0x05)
#define ADC_Channel_6 ((uint8_t)0x06)
#define ADC_Channel_7 ((uint8_t)0x07)
#define ADC_Channel_8 ((uint8_t)0x08)
#define ADC_Channel_9 ((uint8_t)0x09)
#define ADC_Channel_10 ((uint8_t)0x0A)
#define ADC_Channel_11 ((uint8_t)0x0B)
#define ADC_Channel_12 ((uint8_t)0x0C)
#define ADC_Channel_13 ((uint8_t)0x0D)
#define ADC_Channel_14 ((uint8_t)0x0E)
#define ADC_Channel_15 ((uint8_t)0x0F)
#define ADC_Channel_16 ((uint8_t)0x10)
#define ADC_Channel_17 ((uint8_t)0x11)
#define ADC_Channel_TempSensor ((uint8_t)ADC_Channel_16)
#define ADC_Channel_Vrefint ((uint8_t)ADC_Channel_17)
#define IS_ADC_CHANNEL(CHANNEL) (((CHANNEL) == ADC_Channel_0) || ((CHANNEL) == ADC_Channel_1) || \
((CHANNEL) == ADC_Channel_2) || ((CHANNEL) == ADC_Channel_3) || \
((CHANNEL) == ADC_Channel_4) || ((CHANNEL) == ADC_Channel_5) || \
((CHANNEL) == ADC_Channel_6) || ((CHANNEL) == ADC_Channel_7) || \
((CHANNEL) == ADC_Channel_8) || ((CHANNEL) == ADC_Channel_9) || \
((CHANNEL) == ADC_Channel_10) || ((CHANNEL) == ADC_Channel_11) || \
((CHANNEL) == ADC_Channel_12) || ((CHANNEL) == ADC_Channel_13) || \
((CHANNEL) == ADC_Channel_14) || ((CHANNEL) == ADC_Channel_15) || \
((CHANNEL) == ADC_Channel_16) || ((CHANNEL) == ADC_Channel_17))
/**
* @}
*/
/** @defgroup ADC_sampling_time
* @{
*/
#define ADC_SampleTime_1Cycles5 ((uint8_t)0x00)
#define ADC_SampleTime_7Cycles5 ((uint8_t)0x01)
#define ADC_SampleTime_13Cycles5 ((uint8_t)0x02)
#define ADC_SampleTime_28Cycles5 ((uint8_t)0x03)
#define ADC_SampleTime_41Cycles5 ((uint8_t)0x04)
#define ADC_SampleTime_55Cycles5 ((uint8_t)0x05)
#define ADC_SampleTime_71Cycles5 ((uint8_t)0x06)
#define ADC_SampleTime_239Cycles5 ((uint8_t)0x07)
#define IS_ADC_SAMPLE_TIME(TIME) (((TIME) == ADC_SampleTime_1Cycles5) || \
((TIME) == ADC_SampleTime_7Cycles5) || \
((TIME) == ADC_SampleTime_13Cycles5) || \
((TIME) == ADC_SampleTime_28Cycles5) || \
((TIME) == ADC_SampleTime_41Cycles5) || \
((TIME) == ADC_SampleTime_55Cycles5) || \
((TIME) == ADC_SampleTime_71Cycles5) || \
((TIME) == ADC_SampleTime_239Cycles5))
/**
* @}
*/
/** @defgroup ADC_external_trigger_sources_for_injected_channels_conversion
* @{
*/
#define ADC_ExternalTrigInjecConv_T2_TRGO ((uint32_t)0x00002000) /*!< For ADC1 and ADC2 */
#define ADC_ExternalTrigInjecConv_T2_CC1 ((uint32_t)0x00003000) /*!< For ADC1 and ADC2 */
#define ADC_ExternalTrigInjecConv_T3_CC4 ((uint32_t)0x00004000) /*!< For ADC1 and ADC2 */
#define ADC_ExternalTrigInjecConv_T4_TRGO ((uint32_t)0x00005000) /*!< For ADC1 and ADC2 */
#define ADC_ExternalTrigInjecConv_Ext_IT15_TIM8_CC4 ((uint32_t)0x00006000) /*!< For ADC1 and ADC2 */
#define ADC_ExternalTrigInjecConv_T1_TRGO ((uint32_t)0x00000000) /*!< For ADC1, ADC2 and ADC3 */
#define ADC_ExternalTrigInjecConv_T1_CC4 ((uint32_t)0x00001000) /*!< For ADC1, ADC2 and ADC3 */
#define ADC_ExternalTrigInjecConv_None ((uint32_t)0x00007000) /*!< For ADC1, ADC2 and ADC3 */
#define ADC_ExternalTrigInjecConv_T4_CC3 ((uint32_t)0x00002000) /*!< For ADC3 only */
#define ADC_ExternalTrigInjecConv_T8_CC2 ((uint32_t)0x00003000) /*!< For ADC3 only */
#define ADC_ExternalTrigInjecConv_T8_CC4 ((uint32_t)0x00004000) /*!< For ADC3 only */
#define ADC_ExternalTrigInjecConv_T5_TRGO ((uint32_t)0x00005000) /*!< For ADC3 only */
#define ADC_ExternalTrigInjecConv_T5_CC4 ((uint32_t)0x00006000) /*!< For ADC3 only */
#define IS_ADC_EXT_INJEC_TRIG(INJTRIG) (((INJTRIG) == ADC_ExternalTrigInjecConv_T1_TRGO) || \
((INJTRIG) == ADC_ExternalTrigInjecConv_T1_CC4) || \
((INJTRIG) == ADC_ExternalTrigInjecConv_T2_TRGO) || \
((INJTRIG) == ADC_ExternalTrigInjecConv_T2_CC1) || \
((INJTRIG) == ADC_ExternalTrigInjecConv_T3_CC4) || \
((INJTRIG) == ADC_ExternalTrigInjecConv_T4_TRGO) || \
((INJTRIG) == ADC_ExternalTrigInjecConv_Ext_IT15_TIM8_CC4) || \
((INJTRIG) == ADC_ExternalTrigInjecConv_None) || \
((INJTRIG) == ADC_ExternalTrigInjecConv_T4_CC3) || \
((INJTRIG) == ADC_ExternalTrigInjecConv_T8_CC2) || \
((INJTRIG) == ADC_ExternalTrigInjecConv_T8_CC4) || \
((INJTRIG) == ADC_ExternalTrigInjecConv_T5_TRGO) || \
((INJTRIG) == ADC_ExternalTrigInjecConv_T5_CC4))
/**
* @}
*/
/** @defgroup ADC_injected_channel_selection
* @{
*/
#define ADC_InjectedChannel_1 ((uint8_t)0x14)
#define ADC_InjectedChannel_2 ((uint8_t)0x18)
#define ADC_InjectedChannel_3 ((uint8_t)0x1C)
#define ADC_InjectedChannel_4 ((uint8_t)0x20)
#define IS_ADC_INJECTED_CHANNEL(CHANNEL) (((CHANNEL) == ADC_InjectedChannel_1) || \
((CHANNEL) == ADC_InjectedChannel_2) || \
((CHANNEL) == ADC_InjectedChannel_3) || \
((CHANNEL) == ADC_InjectedChannel_4))
/**
* @}
*/
/** @defgroup ADC_analog_watchdog_selection
* @{
*/
#define ADC_AnalogWatchdog_SingleRegEnable ((uint32_t)0x00800200)
#define ADC_AnalogWatchdog_SingleInjecEnable ((uint32_t)0x00400200)
#define ADC_AnalogWatchdog_SingleRegOrInjecEnable ((uint32_t)0x00C00200)
#define ADC_AnalogWatchdog_AllRegEnable ((uint32_t)0x00800000)
#define ADC_AnalogWatchdog_AllInjecEnable ((uint32_t)0x00400000)
#define ADC_AnalogWatchdog_AllRegAllInjecEnable ((uint32_t)0x00C00000)
#define ADC_AnalogWatchdog_None ((uint32_t)0x00000000)
#define IS_ADC_ANALOG_WATCHDOG(WATCHDOG) (((WATCHDOG) == ADC_AnalogWatchdog_SingleRegEnable) || \
((WATCHDOG) == ADC_AnalogWatchdog_SingleInjecEnable) || \
((WATCHDOG) == ADC_AnalogWatchdog_SingleRegOrInjecEnable) || \
((WATCHDOG) == ADC_AnalogWatchdog_AllRegEnable) || \
((WATCHDOG) == ADC_AnalogWatchdog_AllInjecEnable) || \
((WATCHDOG) == ADC_AnalogWatchdog_AllRegAllInjecEnable) || \
((WATCHDOG) == ADC_AnalogWatchdog_None))
/**
* @}
*/
/** @defgroup ADC_interrupts_definition
* @{
*/
#define ADC_IT_EOC ((uint16_t)0x0220)
#define ADC_IT_AWD ((uint16_t)0x0140)
#define ADC_IT_JEOC ((uint16_t)0x0480)
#define IS_ADC_IT(IT) ((((IT) & (uint16_t)0xF81F) == 0x00) && ((IT) != 0x00))
#define IS_ADC_GET_IT(IT) (((IT) == ADC_IT_EOC) || ((IT) == ADC_IT_AWD) || \
((IT) == ADC_IT_JEOC))
/**
* @}
*/
/** @defgroup ADC_flags_definition
* @{
*/
#define ADC_FLAG_AWD ((uint8_t)0x01)
#define ADC_FLAG_EOC ((uint8_t)0x02)
#define ADC_FLAG_JEOC ((uint8_t)0x04)
#define ADC_FLAG_JSTRT ((uint8_t)0x08)
#define ADC_FLAG_STRT ((uint8_t)0x10)
#define IS_ADC_CLEAR_FLAG(FLAG) ((((FLAG) & (uint8_t)0xE0) == 0x00) && ((FLAG) != 0x00))
#define IS_ADC_GET_FLAG(FLAG) (((FLAG) == ADC_FLAG_AWD) || ((FLAG) == ADC_FLAG_EOC) || \
((FLAG) == ADC_FLAG_JEOC) || ((FLAG)== ADC_FLAG_JSTRT) || \
((FLAG) == ADC_FLAG_STRT))
/**
* @}
*/
/** @defgroup ADC_thresholds
* @{
*/
#define IS_ADC_THRESHOLD(THRESHOLD) ((THRESHOLD) <= 0xFFF)
/**
* @}
*/
/** @defgroup ADC_injected_offset
* @{
*/
#define IS_ADC_OFFSET(OFFSET) ((OFFSET) <= 0xFFF)
/**
* @}
*/
/** @defgroup ADC_injected_length
* @{
*/
#define IS_ADC_INJECTED_LENGTH(LENGTH) (((LENGTH) >= 0x1) && ((LENGTH) <= 0x4))
/**
* @}
*/
/** @defgroup ADC_injected_rank
* @{
*/
#define IS_ADC_INJECTED_RANK(RANK) (((RANK) >= 0x1) && ((RANK) <= 0x4))
/**
* @}
*/
/** @defgroup ADC_regular_length
* @{
*/
#define IS_ADC_REGULAR_LENGTH(LENGTH) (((LENGTH) >= 0x1) && ((LENGTH) <= 0x10))
/**
* @}
*/
/** @defgroup ADC_regular_rank
* @{
*/
#define IS_ADC_REGULAR_RANK(RANK) (((RANK) >= 0x1) && ((RANK) <= 0x10))
/**
* @}
*/
/** @defgroup ADC_regular_discontinuous_mode_number
* @{
*/
#define IS_ADC_REGULAR_DISC_NUMBER(NUMBER) (((NUMBER) >= 0x1) && ((NUMBER) <= 0x8))
/**
* @}
*/
/**
* @}
*/
/** @defgroup ADC_Exported_Macros
* @{
*/
/**
* @}
*/
/** @defgroup ADC_Exported_Functions
* @{
*/
void ADC_DeInit(ADC_TypeDef* ADCx);
void ADC_Init(ADC_TypeDef* ADCx, ADC_InitTypeDef* ADC_InitStruct);
void ADC_StructInit(ADC_InitTypeDef* ADC_InitStruct);
void ADC_Cmd(ADC_TypeDef* ADCx, FunctionalState NewState);
void ADC_DMACmd(ADC_TypeDef* ADCx, FunctionalState NewState);
void ADC_ITConfig(ADC_TypeDef* ADCx, uint16_t ADC_IT, FunctionalState NewState);
void ADC_ResetCalibration(ADC_TypeDef* ADCx);
FlagStatus ADC_GetResetCalibrationStatus(ADC_TypeDef* ADCx);
void ADC_StartCalibration(ADC_TypeDef* ADCx);
FlagStatus ADC_GetCalibrationStatus(ADC_TypeDef* ADCx);
void ADC_SoftwareStartConvCmd(ADC_TypeDef* ADCx, FunctionalState NewState);
FlagStatus ADC_GetSoftwareStartConvStatus(ADC_TypeDef* ADCx);
void ADC_DiscModeChannelCountConfig(ADC_TypeDef* ADCx, uint8_t Number);
void ADC_DiscModeCmd(ADC_TypeDef* ADCx, FunctionalState NewState);
void ADC_RegularChannelConfig(ADC_TypeDef* ADCx, uint8_t ADC_Channel, uint8_t Rank, uint8_t ADC_SampleTime);
void ADC_ExternalTrigConvCmd(ADC_TypeDef* ADCx, FunctionalState NewState);
uint16_t ADC_GetConversionValue(ADC_TypeDef* ADCx);
uint32_t ADC_GetDualModeConversionValue(void);
void ADC_AutoInjectedConvCmd(ADC_TypeDef* ADCx, FunctionalState NewState);
void ADC_InjectedDiscModeCmd(ADC_TypeDef* ADCx, FunctionalState NewState);
void ADC_ExternalTrigInjectedConvConfig(ADC_TypeDef* ADCx, uint32_t ADC_ExternalTrigInjecConv);
void ADC_ExternalTrigInjectedConvCmd(ADC_TypeDef* ADCx, FunctionalState NewState);
void ADC_SoftwareStartInjectedConvCmd(ADC_TypeDef* ADCx, FunctionalState NewState);
FlagStatus ADC_GetSoftwareStartInjectedConvCmdStatus(ADC_TypeDef* ADCx);
void ADC_InjectedChannelConfig(ADC_TypeDef* ADCx, uint8_t ADC_Channel, uint8_t Rank, uint8_t ADC_SampleTime);
void ADC_InjectedSequencerLengthConfig(ADC_TypeDef* ADCx, uint8_t Length);
void ADC_SetInjectedOffset(ADC_TypeDef* ADCx, uint8_t ADC_InjectedChannel, uint16_t Offset);
uint16_t ADC_GetInjectedConversionValue(ADC_TypeDef* ADCx, uint8_t ADC_InjectedChannel);
void ADC_AnalogWatchdogCmd(ADC_TypeDef* ADCx, uint32_t ADC_AnalogWatchdog);
void ADC_AnalogWatchdogThresholdsConfig(ADC_TypeDef* ADCx, uint16_t HighThreshold, uint16_t LowThreshold);
void ADC_AnalogWatchdogSingleChannelConfig(ADC_TypeDef* ADCx, uint8_t ADC_Channel);
void ADC_TempSensorVrefintCmd(FunctionalState NewState);
FlagStatus ADC_GetFlagStatus(ADC_TypeDef* ADCx, uint8_t ADC_FLAG);
void ADC_ClearFlag(ADC_TypeDef* ADCx, uint8_t ADC_FLAG);
ITStatus ADC_GetITStatus(ADC_TypeDef* ADCx, uint16_t ADC_IT);
void ADC_ClearITPendingBit(ADC_TypeDef* ADCx, uint16_t ADC_IT);
#ifdef __cplusplus
}
#endif
#endif /*__STM32F10x_ADC_H */
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/

View File

@@ -0,0 +1,193 @@
/**
******************************************************************************
* @file stm32f10x_bkp.h
* @author MCD Application Team
* @version V3.6.2
* @date 17-September-2021
* @brief This file contains all the functions prototypes for the BKP firmware
* library.
******************************************************************************
* @attention
*
* Copyright (c) 2012 STMicroelectronics.
* All rights reserved.
*
* This software is licensed under terms that can be found in the LICENSE file
* in the root directory of this software component.
* If no LICENSE file comes with this software, it is provided AS-IS.
*
******************************************************************************
*/
/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef __STM32F10x_BKP_H
#define __STM32F10x_BKP_H
#ifdef __cplusplus
extern "C" {
#endif
/* Includes ------------------------------------------------------------------*/
#include "stm32f10x.h"
/** @addtogroup STM32F10x_StdPeriph_Driver
* @{
*/
/** @addtogroup BKP
* @{
*/
/** @defgroup BKP_Exported_Types
* @{
*/
/**
* @}
*/
/** @defgroup BKP_Exported_Constants
* @{
*/
/** @defgroup Tamper_Pin_active_level
* @{
*/
#define BKP_TamperPinLevel_High ((uint16_t)0x0000)
#define BKP_TamperPinLevel_Low ((uint16_t)0x0001)
#define IS_BKP_TAMPER_PIN_LEVEL(LEVEL) (((LEVEL) == BKP_TamperPinLevel_High) || \
((LEVEL) == BKP_TamperPinLevel_Low))
/**
* @}
*/
/** @defgroup RTC_output_source_to_output_on_the_Tamper_pin
* @{
*/
#define BKP_RTCOutputSource_None ((uint16_t)0x0000)
#define BKP_RTCOutputSource_CalibClock ((uint16_t)0x0080)
#define BKP_RTCOutputSource_Alarm ((uint16_t)0x0100)
#define BKP_RTCOutputSource_Second ((uint16_t)0x0300)
#define IS_BKP_RTC_OUTPUT_SOURCE(SOURCE) (((SOURCE) == BKP_RTCOutputSource_None) || \
((SOURCE) == BKP_RTCOutputSource_CalibClock) || \
((SOURCE) == BKP_RTCOutputSource_Alarm) || \
((SOURCE) == BKP_RTCOutputSource_Second))
/**
* @}
*/
/** @defgroup Data_Backup_Register
* @{
*/
#define BKP_DR1 ((uint16_t)0x0004)
#define BKP_DR2 ((uint16_t)0x0008)
#define BKP_DR3 ((uint16_t)0x000C)
#define BKP_DR4 ((uint16_t)0x0010)
#define BKP_DR5 ((uint16_t)0x0014)
#define BKP_DR6 ((uint16_t)0x0018)
#define BKP_DR7 ((uint16_t)0x001C)
#define BKP_DR8 ((uint16_t)0x0020)
#define BKP_DR9 ((uint16_t)0x0024)
#define BKP_DR10 ((uint16_t)0x0028)
#define BKP_DR11 ((uint16_t)0x0040)
#define BKP_DR12 ((uint16_t)0x0044)
#define BKP_DR13 ((uint16_t)0x0048)
#define BKP_DR14 ((uint16_t)0x004C)
#define BKP_DR15 ((uint16_t)0x0050)
#define BKP_DR16 ((uint16_t)0x0054)
#define BKP_DR17 ((uint16_t)0x0058)
#define BKP_DR18 ((uint16_t)0x005C)
#define BKP_DR19 ((uint16_t)0x0060)
#define BKP_DR20 ((uint16_t)0x0064)
#define BKP_DR21 ((uint16_t)0x0068)
#define BKP_DR22 ((uint16_t)0x006C)
#define BKP_DR23 ((uint16_t)0x0070)
#define BKP_DR24 ((uint16_t)0x0074)
#define BKP_DR25 ((uint16_t)0x0078)
#define BKP_DR26 ((uint16_t)0x007C)
#define BKP_DR27 ((uint16_t)0x0080)
#define BKP_DR28 ((uint16_t)0x0084)
#define BKP_DR29 ((uint16_t)0x0088)
#define BKP_DR30 ((uint16_t)0x008C)
#define BKP_DR31 ((uint16_t)0x0090)
#define BKP_DR32 ((uint16_t)0x0094)
#define BKP_DR33 ((uint16_t)0x0098)
#define BKP_DR34 ((uint16_t)0x009C)
#define BKP_DR35 ((uint16_t)0x00A0)
#define BKP_DR36 ((uint16_t)0x00A4)
#define BKP_DR37 ((uint16_t)0x00A8)
#define BKP_DR38 ((uint16_t)0x00AC)
#define BKP_DR39 ((uint16_t)0x00B0)
#define BKP_DR40 ((uint16_t)0x00B4)
#define BKP_DR41 ((uint16_t)0x00B8)
#define BKP_DR42 ((uint16_t)0x00BC)
#define IS_BKP_DR(DR) (((DR) == BKP_DR1) || ((DR) == BKP_DR2) || ((DR) == BKP_DR3) || \
((DR) == BKP_DR4) || ((DR) == BKP_DR5) || ((DR) == BKP_DR6) || \
((DR) == BKP_DR7) || ((DR) == BKP_DR8) || ((DR) == BKP_DR9) || \
((DR) == BKP_DR10) || ((DR) == BKP_DR11) || ((DR) == BKP_DR12) || \
((DR) == BKP_DR13) || ((DR) == BKP_DR14) || ((DR) == BKP_DR15) || \
((DR) == BKP_DR16) || ((DR) == BKP_DR17) || ((DR) == BKP_DR18) || \
((DR) == BKP_DR19) || ((DR) == BKP_DR20) || ((DR) == BKP_DR21) || \
((DR) == BKP_DR22) || ((DR) == BKP_DR23) || ((DR) == BKP_DR24) || \
((DR) == BKP_DR25) || ((DR) == BKP_DR26) || ((DR) == BKP_DR27) || \
((DR) == BKP_DR28) || ((DR) == BKP_DR29) || ((DR) == BKP_DR30) || \
((DR) == BKP_DR31) || ((DR) == BKP_DR32) || ((DR) == BKP_DR33) || \
((DR) == BKP_DR34) || ((DR) == BKP_DR35) || ((DR) == BKP_DR36) || \
((DR) == BKP_DR37) || ((DR) == BKP_DR38) || ((DR) == BKP_DR39) || \
((DR) == BKP_DR40) || ((DR) == BKP_DR41) || ((DR) == BKP_DR42))
#define IS_BKP_CALIBRATION_VALUE(VALUE) ((VALUE) <= 0x7F)
/**
* @}
*/
/**
* @}
*/
/** @defgroup BKP_Exported_Macros
* @{
*/
/**
* @}
*/
/** @defgroup BKP_Exported_Functions
* @{
*/
void BKP_DeInit(void);
void BKP_TamperPinLevelConfig(uint16_t BKP_TamperPinLevel);
void BKP_TamperPinCmd(FunctionalState NewState);
void BKP_ITConfig(FunctionalState NewState);
void BKP_RTCOutputConfig(uint16_t BKP_RTCOutputSource);
void BKP_SetRTCCalibrationValue(uint8_t CalibrationValue);
void BKP_WriteBackupRegister(uint16_t BKP_DR, uint16_t Data);
uint16_t BKP_ReadBackupRegister(uint16_t BKP_DR);
FlagStatus BKP_GetFlagStatus(void);
void BKP_ClearFlag(void);
ITStatus BKP_GetITStatus(void);
void BKP_ClearITPendingBit(void);
#ifdef __cplusplus
}
#endif
#endif /* __STM32F10x_BKP_H */
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/

View File

@@ -0,0 +1,695 @@
/**
******************************************************************************
* @file stm32f10x_can.h
* @author MCD Application Team
* @version V3.6.2
* @date 17-September-2021
* @brief This file contains all the functions prototypes for the CAN firmware
* library.
******************************************************************************
* @attention
*
* Copyright (c) 2012 STMicroelectronics.
* All rights reserved.
*
* This software is licensed under terms that can be found in the LICENSE file
* in the root directory of this software component.
* If no LICENSE file comes with this software, it is provided AS-IS.
*
******************************************************************************
*/
/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef __STM32F10x_CAN_H
#define __STM32F10x_CAN_H
#ifdef __cplusplus
extern "C" {
#endif
/* Includes ------------------------------------------------------------------*/
#include "stm32f10x.h"
/** @addtogroup STM32F10x_StdPeriph_Driver
* @{
*/
/** @addtogroup CAN
* @{
*/
/** @defgroup CAN_Exported_Types
* @{
*/
#define IS_CAN_ALL_PERIPH(PERIPH) (((PERIPH) == CAN1) || \
((PERIPH) == CAN2))
/**
* @brief CAN init structure definition
*/
typedef struct
{
uint16_t CAN_Prescaler; /*!< Specifies the length of a time quantum.
It ranges from 1 to 1024. */
uint8_t CAN_Mode; /*!< Specifies the CAN operating mode.
This parameter can be a value of
@ref CAN_operating_mode */
uint8_t CAN_SJW; /*!< Specifies the maximum number of time quanta
the CAN hardware is allowed to lengthen or
shorten a bit to perform resynchronization.
This parameter can be a value of
@ref CAN_synchronisation_jump_width */
uint8_t CAN_BS1; /*!< Specifies the number of time quanta in Bit
Segment 1. This parameter can be a value of
@ref CAN_time_quantum_in_bit_segment_1 */
uint8_t CAN_BS2; /*!< Specifies the number of time quanta in Bit
Segment 2.
This parameter can be a value of
@ref CAN_time_quantum_in_bit_segment_2 */
FunctionalState CAN_TTCM; /*!< Enable or disable the time triggered
communication mode. This parameter can be set
either to ENABLE or DISABLE. */
FunctionalState CAN_ABOM; /*!< Enable or disable the automatic bus-off
management. This parameter can be set either
to ENABLE or DISABLE. */
FunctionalState CAN_AWUM; /*!< Enable or disable the automatic wake-up mode.
This parameter can be set either to ENABLE or
DISABLE. */
FunctionalState CAN_NART; /*!< Enable or disable the no-automatic
retransmission mode. This parameter can be
set either to ENABLE or DISABLE. */
FunctionalState CAN_RFLM; /*!< Enable or disable the Receive FIFO Locked mode.
This parameter can be set either to ENABLE
or DISABLE. */
FunctionalState CAN_TXFP; /*!< Enable or disable the transmit FIFO priority.
This parameter can be set either to ENABLE
or DISABLE. */
} CAN_InitTypeDef;
/**
* @brief CAN filter init structure definition
*/
typedef struct
{
uint16_t CAN_FilterIdHigh; /*!< Specifies the filter identification number (MSBs for a 32-bit
configuration, first one for a 16-bit configuration).
This parameter can be a value between 0x0000 and 0xFFFF */
uint16_t CAN_FilterIdLow; /*!< Specifies the filter identification number (LSBs for a 32-bit
configuration, second one for a 16-bit configuration).
This parameter can be a value between 0x0000 and 0xFFFF */
uint16_t CAN_FilterMaskIdHigh; /*!< Specifies the filter mask number or identification number,
according to the mode (MSBs for a 32-bit configuration,
first one for a 16-bit configuration).
This parameter can be a value between 0x0000 and 0xFFFF */
uint16_t CAN_FilterMaskIdLow; /*!< Specifies the filter mask number or identification number,
according to the mode (LSBs for a 32-bit configuration,
second one for a 16-bit configuration).
This parameter can be a value between 0x0000 and 0xFFFF */
uint16_t CAN_FilterFIFOAssignment; /*!< Specifies the FIFO (0 or 1) which will be assigned to the filter.
This parameter can be a value of @ref CAN_filter_FIFO */
uint8_t CAN_FilterNumber; /*!< Specifies the filter which will be initialized. It ranges from 0 to 13. */
uint8_t CAN_FilterMode; /*!< Specifies the filter mode to be initialized.
This parameter can be a value of @ref CAN_filter_mode */
uint8_t CAN_FilterScale; /*!< Specifies the filter scale.
This parameter can be a value of @ref CAN_filter_scale */
FunctionalState CAN_FilterActivation; /*!< Enable or disable the filter.
This parameter can be set either to ENABLE or DISABLE. */
} CAN_FilterInitTypeDef;
/**
* @brief CAN Tx message structure definition
*/
typedef struct
{
uint32_t StdId; /*!< Specifies the standard identifier.
This parameter can be a value between 0 to 0x7FF. */
uint32_t ExtId; /*!< Specifies the extended identifier.
This parameter can be a value between 0 to 0x1FFFFFFF. */
uint8_t IDE; /*!< Specifies the type of identifier for the message that
will be transmitted. This parameter can be a value
of @ref CAN_identifier_type */
uint8_t RTR; /*!< Specifies the type of frame for the message that will
be transmitted. This parameter can be a value of
@ref CAN_remote_transmission_request */
uint8_t DLC; /*!< Specifies the length of the frame that will be
transmitted. This parameter can be a value between
0 to 8 */
uint8_t Data[8]; /*!< Contains the data to be transmitted. It ranges from 0
to 0xFF. */
} CanTxMsg;
/**
* @brief CAN Rx message structure definition
*/
typedef struct
{
uint32_t StdId; /*!< Specifies the standard identifier.
This parameter can be a value between 0 to 0x7FF. */
uint32_t ExtId; /*!< Specifies the extended identifier.
This parameter can be a value between 0 to 0x1FFFFFFF. */
uint8_t IDE; /*!< Specifies the type of identifier for the message that
will be received. This parameter can be a value of
@ref CAN_identifier_type */
uint8_t RTR; /*!< Specifies the type of frame for the received message.
This parameter can be a value of
@ref CAN_remote_transmission_request */
uint8_t DLC; /*!< Specifies the length of the frame that will be received.
This parameter can be a value between 0 to 8 */
uint8_t Data[8]; /*!< Contains the data to be received. It ranges from 0 to
0xFF. */
uint8_t FMI; /*!< Specifies the index of the filter the message stored in
the mailbox passes through. This parameter can be a
value between 0 to 0xFF */
} CanRxMsg;
/**
* @}
*/
/** @defgroup CAN_Exported_Constants
* @{
*/
/** @defgroup CAN_sleep_constants
* @{
*/
#define CAN_InitStatus_Failed ((uint8_t)0x00) /*!< CAN initialization failed */
#define CAN_InitStatus_Success ((uint8_t)0x01) /*!< CAN initialization OK */
/**
* @}
*/
/** @defgroup CAN_Mode
* @{
*/
#define CAN_Mode_Normal ((uint8_t)0x00) /*!< normal mode */
#define CAN_Mode_LoopBack ((uint8_t)0x01) /*!< loopback mode */
#define CAN_Mode_Silent ((uint8_t)0x02) /*!< silent mode */
#define CAN_Mode_Silent_LoopBack ((uint8_t)0x03) /*!< loopback combined with silent mode */
#define IS_CAN_MODE(MODE) (((MODE) == CAN_Mode_Normal) || \
((MODE) == CAN_Mode_LoopBack)|| \
((MODE) == CAN_Mode_Silent) || \
((MODE) == CAN_Mode_Silent_LoopBack))
/**
* @}
*/
/**
* @defgroup CAN_Operating_Mode
* @{
*/
#define CAN_OperatingMode_Initialization ((uint8_t)0x00) /*!< Initialization mode */
#define CAN_OperatingMode_Normal ((uint8_t)0x01) /*!< Normal mode */
#define CAN_OperatingMode_Sleep ((uint8_t)0x02) /*!< sleep mode */
#define IS_CAN_OPERATING_MODE(MODE) (((MODE) == CAN_OperatingMode_Initialization) ||\
((MODE) == CAN_OperatingMode_Normal)|| \
((MODE) == CAN_OperatingMode_Sleep))
/**
* @}
*/
/**
* @defgroup CAN_Mode_Status
* @{
*/
#define CAN_ModeStatus_Failed ((uint8_t)0x00) /*!< CAN entering the specific mode failed */
#define CAN_ModeStatus_Success ((uint8_t)!CAN_ModeStatus_Failed) /*!< CAN entering the specific mode Succeed */
/**
* @}
*/
/** @defgroup CAN_synchronisation_jump_width
* @{
*/
#define CAN_SJW_1tq ((uint8_t)0x00) /*!< 1 time quantum */
#define CAN_SJW_2tq ((uint8_t)0x01) /*!< 2 time quantum */
#define CAN_SJW_3tq ((uint8_t)0x02) /*!< 3 time quantum */
#define CAN_SJW_4tq ((uint8_t)0x03) /*!< 4 time quantum */
#define IS_CAN_SJW(SJW) (((SJW) == CAN_SJW_1tq) || ((SJW) == CAN_SJW_2tq)|| \
((SJW) == CAN_SJW_3tq) || ((SJW) == CAN_SJW_4tq))
/**
* @}
*/
/** @defgroup CAN_time_quantum_in_bit_segment_1
* @{
*/
#define CAN_BS1_1tq ((uint8_t)0x00) /*!< 1 time quantum */
#define CAN_BS1_2tq ((uint8_t)0x01) /*!< 2 time quantum */
#define CAN_BS1_3tq ((uint8_t)0x02) /*!< 3 time quantum */
#define CAN_BS1_4tq ((uint8_t)0x03) /*!< 4 time quantum */
#define CAN_BS1_5tq ((uint8_t)0x04) /*!< 5 time quantum */
#define CAN_BS1_6tq ((uint8_t)0x05) /*!< 6 time quantum */
#define CAN_BS1_7tq ((uint8_t)0x06) /*!< 7 time quantum */
#define CAN_BS1_8tq ((uint8_t)0x07) /*!< 8 time quantum */
#define CAN_BS1_9tq ((uint8_t)0x08) /*!< 9 time quantum */
#define CAN_BS1_10tq ((uint8_t)0x09) /*!< 10 time quantum */
#define CAN_BS1_11tq ((uint8_t)0x0A) /*!< 11 time quantum */
#define CAN_BS1_12tq ((uint8_t)0x0B) /*!< 12 time quantum */
#define CAN_BS1_13tq ((uint8_t)0x0C) /*!< 13 time quantum */
#define CAN_BS1_14tq ((uint8_t)0x0D) /*!< 14 time quantum */
#define CAN_BS1_15tq ((uint8_t)0x0E) /*!< 15 time quantum */
#define CAN_BS1_16tq ((uint8_t)0x0F) /*!< 16 time quantum */
#define IS_CAN_BS1(BS1) ((BS1) <= CAN_BS1_16tq)
/**
* @}
*/
/** @defgroup CAN_time_quantum_in_bit_segment_2
* @{
*/
#define CAN_BS2_1tq ((uint8_t)0x00) /*!< 1 time quantum */
#define CAN_BS2_2tq ((uint8_t)0x01) /*!< 2 time quantum */
#define CAN_BS2_3tq ((uint8_t)0x02) /*!< 3 time quantum */
#define CAN_BS2_4tq ((uint8_t)0x03) /*!< 4 time quantum */
#define CAN_BS2_5tq ((uint8_t)0x04) /*!< 5 time quantum */
#define CAN_BS2_6tq ((uint8_t)0x05) /*!< 6 time quantum */
#define CAN_BS2_7tq ((uint8_t)0x06) /*!< 7 time quantum */
#define CAN_BS2_8tq ((uint8_t)0x07) /*!< 8 time quantum */
#define IS_CAN_BS2(BS2) ((BS2) <= CAN_BS2_8tq)
/**
* @}
*/
/** @defgroup CAN_clock_prescaler
* @{
*/
#define IS_CAN_PRESCALER(PRESCALER) (((PRESCALER) >= 1) && ((PRESCALER) <= 1024))
/**
* @}
*/
/** @defgroup CAN_filter_number
* @{
*/
#ifndef STM32F10X_CL
#define IS_CAN_FILTER_NUMBER(NUMBER) ((NUMBER) <= 13)
#else
#define IS_CAN_FILTER_NUMBER(NUMBER) ((NUMBER) <= 27)
#endif /* STM32F10X_CL */
/**
* @}
*/
/** @defgroup CAN_filter_mode
* @{
*/
#define CAN_FilterMode_IdMask ((uint8_t)0x00) /*!< identifier/mask mode */
#define CAN_FilterMode_IdList ((uint8_t)0x01) /*!< identifier list mode */
#define IS_CAN_FILTER_MODE(MODE) (((MODE) == CAN_FilterMode_IdMask) || \
((MODE) == CAN_FilterMode_IdList))
/**
* @}
*/
/** @defgroup CAN_filter_scale
* @{
*/
#define CAN_FilterScale_16bit ((uint8_t)0x00) /*!< Two 16-bit filters */
#define CAN_FilterScale_32bit ((uint8_t)0x01) /*!< One 32-bit filter */
#define IS_CAN_FILTER_SCALE(SCALE) (((SCALE) == CAN_FilterScale_16bit) || \
((SCALE) == CAN_FilterScale_32bit))
/**
* @}
*/
/** @defgroup CAN_filter_FIFO
* @{
*/
#define CAN_Filter_FIFO0 ((uint8_t)0x00) /*!< Filter FIFO 0 assignment for filter x */
#define CAN_Filter_FIFO1 ((uint8_t)0x01) /*!< Filter FIFO 1 assignment for filter x */
#define IS_CAN_FILTER_FIFO(FIFO) (((FIFO) == CAN_FilterFIFO0) || \
((FIFO) == CAN_FilterFIFO1))
/**
* @}
*/
/** @defgroup Start_bank_filter_for_slave_CAN
* @{
*/
#define IS_CAN_BANKNUMBER(BANKNUMBER) (((BANKNUMBER) >= 1) && ((BANKNUMBER) <= 27))
/**
* @}
*/
/** @defgroup CAN_Tx
* @{
*/
#define IS_CAN_TRANSMITMAILBOX(TRANSMITMAILBOX) ((TRANSMITMAILBOX) <= ((uint8_t)0x02))
#define IS_CAN_STDID(STDID) ((STDID) <= ((uint32_t)0x7FF))
#define IS_CAN_EXTID(EXTID) ((EXTID) <= ((uint32_t)0x1FFFFFFF))
#define IS_CAN_DLC(DLC) ((DLC) <= ((uint8_t)0x08))
/**
* @}
*/
/** @defgroup CAN_identifier_type
* @{
*/
#define CAN_Id_Standard ((uint32_t)0x00000000) /*!< Standard Id */
#define CAN_Id_Extended ((uint32_t)0x00000004) /*!< Extended Id */
#define IS_CAN_IDTYPE(IDTYPE) (((IDTYPE) == CAN_Id_Standard) || \
((IDTYPE) == CAN_Id_Extended))
/**
* @}
*/
/** @defgroup CAN_remote_transmission_request
* @{
*/
#define CAN_RTR_Data ((uint32_t)0x00000000) /*!< Data frame */
#define CAN_RTR_Remote ((uint32_t)0x00000002) /*!< Remote frame */
#define IS_CAN_RTR(RTR) (((RTR) == CAN_RTR_Data) || ((RTR) == CAN_RTR_Remote))
/**
* @}
*/
/** @defgroup CAN_transmit_constants
* @{
*/
#define CAN_TxStatus_Failed ((uint8_t)0x00)/*!< CAN transmission failed */
#define CAN_TxStatus_Ok ((uint8_t)0x01) /*!< CAN transmission succeeded */
#define CAN_TxStatus_Pending ((uint8_t)0x02) /*!< CAN transmission pending */
#define CAN_TxStatus_NoMailBox ((uint8_t)0x04) /*!< CAN cell did not provide an empty mailbox */
/**
* @}
*/
/** @defgroup CAN_receive_FIFO_number_constants
* @{
*/
#define CAN_FIFO0 ((uint8_t)0x00) /*!< CAN FIFO 0 used to receive */
#define CAN_FIFO1 ((uint8_t)0x01) /*!< CAN FIFO 1 used to receive */
#define IS_CAN_FIFO(FIFO) (((FIFO) == CAN_FIFO0) || ((FIFO) == CAN_FIFO1))
/**
* @}
*/
/** @defgroup CAN_sleep_constants
* @{
*/
#define CAN_Sleep_Failed ((uint8_t)0x00) /*!< CAN did not enter the sleep mode */
#define CAN_Sleep_Ok ((uint8_t)0x01) /*!< CAN entered the sleep mode */
/**
* @}
*/
/** @defgroup CAN_wake_up_constants
* @{
*/
#define CAN_WakeUp_Failed ((uint8_t)0x00) /*!< CAN did not leave the sleep mode */
#define CAN_WakeUp_Ok ((uint8_t)0x01) /*!< CAN leaved the sleep mode */
/**
* @}
*/
/**
* @defgroup CAN_Error_Code_constants
* @{
*/
#define CAN_ErrorCode_NoErr ((uint8_t)0x00) /*!< No Error */
#define CAN_ErrorCode_StuffErr ((uint8_t)0x10) /*!< Stuff Error */
#define CAN_ErrorCode_FormErr ((uint8_t)0x20) /*!< Form Error */
#define CAN_ErrorCode_ACKErr ((uint8_t)0x30) /*!< Acknowledgment Error */
#define CAN_ErrorCode_BitRecessiveErr ((uint8_t)0x40) /*!< Bit Recessive Error */
#define CAN_ErrorCode_BitDominantErr ((uint8_t)0x50) /*!< Bit Dominant Error */
#define CAN_ErrorCode_CRCErr ((uint8_t)0x60) /*!< CRC Error */
#define CAN_ErrorCode_SoftwareSetErr ((uint8_t)0x70) /*!< Software Set Error */
/**
* @}
*/
/** @defgroup CAN_flags
* @{
*/
/* If the flag is 0x3XXXXXXX, it means that it can be used with CAN_GetFlagStatus()
and CAN_ClearFlag() functions. */
/* If the flag is 0x1XXXXXXX, it means that it can only be used with CAN_GetFlagStatus() function. */
/* Transmit Flags */
#define CAN_FLAG_RQCP0 ((uint32_t)0x38000001) /*!< Request MailBox0 Flag */
#define CAN_FLAG_RQCP1 ((uint32_t)0x38000100) /*!< Request MailBox1 Flag */
#define CAN_FLAG_RQCP2 ((uint32_t)0x38010000) /*!< Request MailBox2 Flag */
/* Receive Flags */
#define CAN_FLAG_FMP0 ((uint32_t)0x12000003) /*!< FIFO 0 Message Pending Flag */
#define CAN_FLAG_FF0 ((uint32_t)0x32000008) /*!< FIFO 0 Full Flag */
#define CAN_FLAG_FOV0 ((uint32_t)0x32000010) /*!< FIFO 0 Overrun Flag */
#define CAN_FLAG_FMP1 ((uint32_t)0x14000003) /*!< FIFO 1 Message Pending Flag */
#define CAN_FLAG_FF1 ((uint32_t)0x34000008) /*!< FIFO 1 Full Flag */
#define CAN_FLAG_FOV1 ((uint32_t)0x34000010) /*!< FIFO 1 Overrun Flag */
/* Operating Mode Flags */
#define CAN_FLAG_WKU ((uint32_t)0x31000008) /*!< Wake up Flag */
#define CAN_FLAG_SLAK ((uint32_t)0x31000012) /*!< Sleep acknowledge Flag */
/* Note: When SLAK intterupt is disabled (SLKIE=0), no polling on SLAKI is possible.
In this case the SLAK bit can be polled.*/
/* Error Flags */
#define CAN_FLAG_EWG ((uint32_t)0x10F00001) /*!< Error Warning Flag */
#define CAN_FLAG_EPV ((uint32_t)0x10F00002) /*!< Error Passive Flag */
#define CAN_FLAG_BOF ((uint32_t)0x10F00004) /*!< Bus-Off Flag */
#define CAN_FLAG_LEC ((uint32_t)0x30F00070) /*!< Last error code Flag */
#define IS_CAN_GET_FLAG(FLAG) (((FLAG) == CAN_FLAG_LEC) || ((FLAG) == CAN_FLAG_BOF) || \
((FLAG) == CAN_FLAG_EPV) || ((FLAG) == CAN_FLAG_EWG) || \
((FLAG) == CAN_FLAG_WKU) || ((FLAG) == CAN_FLAG_FOV0) || \
((FLAG) == CAN_FLAG_FF0) || ((FLAG) == CAN_FLAG_FMP0) || \
((FLAG) == CAN_FLAG_FOV1) || ((FLAG) == CAN_FLAG_FF1) || \
((FLAG) == CAN_FLAG_FMP1) || ((FLAG) == CAN_FLAG_RQCP2) || \
((FLAG) == CAN_FLAG_RQCP1)|| ((FLAG) == CAN_FLAG_RQCP0) || \
((FLAG) == CAN_FLAG_SLAK ))
#define IS_CAN_CLEAR_FLAG(FLAG)(((FLAG) == CAN_FLAG_LEC) || ((FLAG) == CAN_FLAG_RQCP2) || \
((FLAG) == CAN_FLAG_RQCP1) || ((FLAG) == CAN_FLAG_RQCP0) || \
((FLAG) == CAN_FLAG_FF0) || ((FLAG) == CAN_FLAG_FOV0) ||\
((FLAG) == CAN_FLAG_FF1) || ((FLAG) == CAN_FLAG_FOV1) || \
((FLAG) == CAN_FLAG_WKU) || ((FLAG) == CAN_FLAG_SLAK))
/**
* @}
*/
/** @defgroup CAN_interrupts
* @{
*/
#define CAN_IT_TME ((uint32_t)0x00000001) /*!< Transmit mailbox empty Interrupt*/
/* Receive Interrupts */
#define CAN_IT_FMP0 ((uint32_t)0x00000002) /*!< FIFO 0 message pending Interrupt*/
#define CAN_IT_FF0 ((uint32_t)0x00000004) /*!< FIFO 0 full Interrupt*/
#define CAN_IT_FOV0 ((uint32_t)0x00000008) /*!< FIFO 0 overrun Interrupt*/
#define CAN_IT_FMP1 ((uint32_t)0x00000010) /*!< FIFO 1 message pending Interrupt*/
#define CAN_IT_FF1 ((uint32_t)0x00000020) /*!< FIFO 1 full Interrupt*/
#define CAN_IT_FOV1 ((uint32_t)0x00000040) /*!< FIFO 1 overrun Interrupt*/
/* Operating Mode Interrupts */
#define CAN_IT_WKU ((uint32_t)0x00010000) /*!< Wake-up Interrupt*/
#define CAN_IT_SLK ((uint32_t)0x00020000) /*!< Sleep acknowledge Interrupt*/
/* Error Interrupts */
#define CAN_IT_EWG ((uint32_t)0x00000100) /*!< Error warning Interrupt*/
#define CAN_IT_EPV ((uint32_t)0x00000200) /*!< Error passive Interrupt*/
#define CAN_IT_BOF ((uint32_t)0x00000400) /*!< Bus-off Interrupt*/
#define CAN_IT_LEC ((uint32_t)0x00000800) /*!< Last error code Interrupt*/
#define CAN_IT_ERR ((uint32_t)0x00008000) /*!< Error Interrupt*/
/* Flags named as Interrupts : kept only for FW compatibility */
#define CAN_IT_RQCP0 CAN_IT_TME
#define CAN_IT_RQCP1 CAN_IT_TME
#define CAN_IT_RQCP2 CAN_IT_TME
#define IS_CAN_IT(IT) (((IT) == CAN_IT_TME) || ((IT) == CAN_IT_FMP0) ||\
((IT) == CAN_IT_FF0) || ((IT) == CAN_IT_FOV0) ||\
((IT) == CAN_IT_FMP1) || ((IT) == CAN_IT_FF1) ||\
((IT) == CAN_IT_FOV1) || ((IT) == CAN_IT_EWG) ||\
((IT) == CAN_IT_EPV) || ((IT) == CAN_IT_BOF) ||\
((IT) == CAN_IT_LEC) || ((IT) == CAN_IT_ERR) ||\
((IT) == CAN_IT_WKU) || ((IT) == CAN_IT_SLK))
#define IS_CAN_CLEAR_IT(IT) (((IT) == CAN_IT_TME) || ((IT) == CAN_IT_FF0) ||\
((IT) == CAN_IT_FOV0)|| ((IT) == CAN_IT_FF1) ||\
((IT) == CAN_IT_FOV1)|| ((IT) == CAN_IT_EWG) ||\
((IT) == CAN_IT_EPV) || ((IT) == CAN_IT_BOF) ||\
((IT) == CAN_IT_LEC) || ((IT) == CAN_IT_ERR) ||\
((IT) == CAN_IT_WKU) || ((IT) == CAN_IT_SLK))
/**
* @}
*/
/** @defgroup CAN_Legacy
* @{
*/
#define CANINITFAILED CAN_InitStatus_Failed
#define CANINITOK CAN_InitStatus_Success
#define CAN_FilterFIFO0 CAN_Filter_FIFO0
#define CAN_FilterFIFO1 CAN_Filter_FIFO1
#define CAN_ID_STD CAN_Id_Standard
#define CAN_ID_EXT CAN_Id_Extended
#define CAN_RTR_DATA CAN_RTR_Data
#define CAN_RTR_REMOTE CAN_RTR_Remote
#define CANTXFAILE CAN_TxStatus_Failed
#define CANTXOK CAN_TxStatus_Ok
#define CANTXPENDING CAN_TxStatus_Pending
#define CAN_NO_MB CAN_TxStatus_NoMailBox
#define CANSLEEPFAILED CAN_Sleep_Failed
#define CANSLEEPOK CAN_Sleep_Ok
#define CANWAKEUPFAILED CAN_WakeUp_Failed
#define CANWAKEUPOK CAN_WakeUp_Ok
/**
* @}
*/
/**
* @}
*/
/** @defgroup CAN_Exported_Macros
* @{
*/
/**
* @}
*/
/** @defgroup CAN_Exported_Functions
* @{
*/
/* Function used to set the CAN configuration to the default reset state *****/
void CAN_DeInit(CAN_TypeDef* CANx);
/* Initialization and Configuration functions *********************************/
uint8_t CAN_Init(CAN_TypeDef* CANx, CAN_InitTypeDef* CAN_InitStruct);
void CAN_FilterInit(CAN_FilterInitTypeDef* CAN_FilterInitStruct);
void CAN_StructInit(CAN_InitTypeDef* CAN_InitStruct);
void CAN_SlaveStartBank(uint8_t CAN_BankNumber);
void CAN_DBGFreeze(CAN_TypeDef* CANx, FunctionalState NewState);
void CAN_TTComModeCmd(CAN_TypeDef* CANx, FunctionalState NewState);
/* Transmit functions *********************************************************/
uint8_t CAN_Transmit(CAN_TypeDef* CANx, CanTxMsg* TxMessage);
uint8_t CAN_TransmitStatus(CAN_TypeDef* CANx, uint8_t TransmitMailbox);
void CAN_CancelTransmit(CAN_TypeDef* CANx, uint8_t Mailbox);
/* Receive functions **********************************************************/
void CAN_Receive(CAN_TypeDef* CANx, uint8_t FIFONumber, CanRxMsg* RxMessage);
void CAN_FIFORelease(CAN_TypeDef* CANx, uint8_t FIFONumber);
uint8_t CAN_MessagePending(CAN_TypeDef* CANx, uint8_t FIFONumber);
/* Operation modes functions **************************************************/
uint8_t CAN_OperatingModeRequest(CAN_TypeDef* CANx, uint8_t CAN_OperatingMode);
uint8_t CAN_Sleep(CAN_TypeDef* CANx);
uint8_t CAN_WakeUp(CAN_TypeDef* CANx);
/* Error management functions *************************************************/
uint8_t CAN_GetLastErrorCode(CAN_TypeDef* CANx);
uint8_t CAN_GetReceiveErrorCounter(CAN_TypeDef* CANx);
uint8_t CAN_GetLSBTransmitErrorCounter(CAN_TypeDef* CANx);
/* Interrupts and flags management functions **********************************/
void CAN_ITConfig(CAN_TypeDef* CANx, uint32_t CAN_IT, FunctionalState NewState);
FlagStatus CAN_GetFlagStatus(CAN_TypeDef* CANx, uint32_t CAN_FLAG);
void CAN_ClearFlag(CAN_TypeDef* CANx, uint32_t CAN_FLAG);
ITStatus CAN_GetITStatus(CAN_TypeDef* CANx, uint32_t CAN_IT);
void CAN_ClearITPendingBit(CAN_TypeDef* CANx, uint32_t CAN_IT);
#ifdef __cplusplus
}
#endif
#endif /* __STM32F10x_CAN_H */
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/

View File

@@ -0,0 +1,208 @@
/**
******************************************************************************
* @file stm32f10x_cec.h
* @author MCD Application Team
* @version V3.6.2
* @date 17-September-2021
* @brief This file contains all the functions prototypes for the CEC firmware
* library.
******************************************************************************
* @attention
*
* Copyright (c) 2012 STMicroelectronics.
* All rights reserved.
*
* This software is licensed under terms that can be found in the LICENSE file
* in the root directory of this software component.
* If no LICENSE file comes with this software, it is provided AS-IS.
*
******************************************************************************
*/
/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef __STM32F10x_CEC_H
#define __STM32F10x_CEC_H
#ifdef __cplusplus
extern "C" {
#endif
/* Includes ------------------------------------------------------------------*/
#include "stm32f10x.h"
/** @addtogroup STM32F10x_StdPeriph_Driver
* @{
*/
/** @addtogroup CEC
* @{
*/
/** @defgroup CEC_Exported_Types
* @{
*/
/**
* @brief CEC Init structure definition
*/
typedef struct
{
uint16_t CEC_BitTimingMode; /*!< Configures the CEC Bit Timing Error Mode.
This parameter can be a value of @ref CEC_BitTiming_Mode */
uint16_t CEC_BitPeriodMode; /*!< Configures the CEC Bit Period Error Mode.
This parameter can be a value of @ref CEC_BitPeriod_Mode */
}CEC_InitTypeDef;
/**
* @}
*/
/** @defgroup CEC_Exported_Constants
* @{
*/
/** @defgroup CEC_BitTiming_Mode
* @{
*/
#define CEC_BitTimingStdMode ((uint16_t)0x00) /*!< Bit timing error Standard Mode */
#define CEC_BitTimingErrFreeMode CEC_CFGR_BTEM /*!< Bit timing error Free Mode */
#define IS_CEC_BIT_TIMING_ERROR_MODE(MODE) (((MODE) == CEC_BitTimingStdMode) || \
((MODE) == CEC_BitTimingErrFreeMode))
/**
* @}
*/
/** @defgroup CEC_BitPeriod_Mode
* @{
*/
#define CEC_BitPeriodStdMode ((uint16_t)0x00) /*!< Bit period error Standard Mode */
#define CEC_BitPeriodFlexibleMode CEC_CFGR_BPEM /*!< Bit period error Flexible Mode */
#define IS_CEC_BIT_PERIOD_ERROR_MODE(MODE) (((MODE) == CEC_BitPeriodStdMode) || \
((MODE) == CEC_BitPeriodFlexibleMode))
/**
* @}
*/
/** @defgroup CEC_interrupts_definition
* @{
*/
#define CEC_IT_TERR CEC_CSR_TERR
#define CEC_IT_TBTRF CEC_CSR_TBTRF
#define CEC_IT_RERR CEC_CSR_RERR
#define CEC_IT_RBTF CEC_CSR_RBTF
#define IS_CEC_GET_IT(IT) (((IT) == CEC_IT_TERR) || ((IT) == CEC_IT_TBTRF) || \
((IT) == CEC_IT_RERR) || ((IT) == CEC_IT_RBTF))
/**
* @}
*/
/** @defgroup CEC_Own_Address
* @{
*/
#define IS_CEC_ADDRESS(ADDRESS) ((ADDRESS) < 0x10)
/**
* @}
*/
/** @defgroup CEC_Prescaler
* @{
*/
#define IS_CEC_PRESCALER(PRESCALER) ((PRESCALER) <= 0x3FFF)
/**
* @}
*/
/** @defgroup CEC_flags_definition
* @{
*/
/**
* @brief ESR register flags
*/
#define CEC_FLAG_BTE ((uint32_t)0x10010000)
#define CEC_FLAG_BPE ((uint32_t)0x10020000)
#define CEC_FLAG_RBTFE ((uint32_t)0x10040000)
#define CEC_FLAG_SBE ((uint32_t)0x10080000)
#define CEC_FLAG_ACKE ((uint32_t)0x10100000)
#define CEC_FLAG_LINE ((uint32_t)0x10200000)
#define CEC_FLAG_TBTFE ((uint32_t)0x10400000)
/**
* @brief CSR register flags
*/
#define CEC_FLAG_TEOM ((uint32_t)0x00000002)
#define CEC_FLAG_TERR ((uint32_t)0x00000004)
#define CEC_FLAG_TBTRF ((uint32_t)0x00000008)
#define CEC_FLAG_RSOM ((uint32_t)0x00000010)
#define CEC_FLAG_REOM ((uint32_t)0x00000020)
#define CEC_FLAG_RERR ((uint32_t)0x00000040)
#define CEC_FLAG_RBTF ((uint32_t)0x00000080)
#define IS_CEC_CLEAR_FLAG(FLAG) ((((FLAG) & (uint32_t)0xFFFFFF03) == 0x00) && ((FLAG) != 0x00))
#define IS_CEC_GET_FLAG(FLAG) (((FLAG) == CEC_FLAG_BTE) || ((FLAG) == CEC_FLAG_BPE) || \
((FLAG) == CEC_FLAG_RBTFE) || ((FLAG)== CEC_FLAG_SBE) || \
((FLAG) == CEC_FLAG_ACKE) || ((FLAG) == CEC_FLAG_LINE) || \
((FLAG) == CEC_FLAG_TBTFE) || ((FLAG) == CEC_FLAG_TEOM) || \
((FLAG) == CEC_FLAG_TERR) || ((FLAG) == CEC_FLAG_TBTRF) || \
((FLAG) == CEC_FLAG_RSOM) || ((FLAG) == CEC_FLAG_REOM) || \
((FLAG) == CEC_FLAG_RERR) || ((FLAG) == CEC_FLAG_RBTF))
/**
* @}
*/
/**
* @}
*/
/** @defgroup CEC_Exported_Macros
* @{
*/
/**
* @}
*/
/** @defgroup CEC_Exported_Functions
* @{
*/
void CEC_DeInit(void);
void CEC_Init(CEC_InitTypeDef* CEC_InitStruct);
void CEC_Cmd(FunctionalState NewState);
void CEC_ITConfig(FunctionalState NewState);
void CEC_OwnAddressConfig(uint8_t CEC_OwnAddress);
void CEC_SetPrescaler(uint16_t CEC_Prescaler);
void CEC_SendDataByte(uint8_t Data);
uint8_t CEC_ReceiveDataByte(void);
void CEC_StartOfMessage(void);
void CEC_EndOfMessageCmd(FunctionalState NewState);
FlagStatus CEC_GetFlagStatus(uint32_t CEC_FLAG);
void CEC_ClearFlag(uint32_t CEC_FLAG);
ITStatus CEC_GetITStatus(uint8_t CEC_IT);
void CEC_ClearITPendingBit(uint16_t CEC_IT);
#ifdef __cplusplus
}
#endif
#endif /* __STM32F10x_CEC_H */
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/

View File

@@ -0,0 +1,92 @@
/**
******************************************************************************
* @file stm32f10x_crc.h
* @author MCD Application Team
* @version V3.6.2
* @date 17-September-2021
* @brief This file contains all the functions prototypes for the CRC firmware
* library.
******************************************************************************
* @attention
*
* Copyright (c) 2012 STMicroelectronics.
* All rights reserved.
*
* This software is licensed under terms that can be found in the LICENSE file
* in the root directory of this software component.
* If no LICENSE file comes with this software, it is provided AS-IS.
*
******************************************************************************
*/
/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef __STM32F10x_CRC_H
#define __STM32F10x_CRC_H
#ifdef __cplusplus
extern "C" {
#endif
/* Includes ------------------------------------------------------------------*/
#include "stm32f10x.h"
/** @addtogroup STM32F10x_StdPeriph_Driver
* @{
*/
/** @addtogroup CRC
* @{
*/
/** @defgroup CRC_Exported_Types
* @{
*/
/**
* @}
*/
/** @defgroup CRC_Exported_Constants
* @{
*/
/**
* @}
*/
/** @defgroup CRC_Exported_Macros
* @{
*/
/**
* @}
*/
/** @defgroup CRC_Exported_Functions
* @{
*/
void CRC_ResetDR(void);
uint32_t CRC_CalcCRC(uint32_t Data);
uint32_t CRC_CalcBlockCRC(uint32_t pBuffer[], uint32_t BufferLength);
uint32_t CRC_GetCRC(void);
void CRC_SetIDRegister(uint8_t IDValue);
uint8_t CRC_GetIDRegister(void);
#ifdef __cplusplus
}
#endif
#endif /* __STM32F10x_CRC_H */
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/

View File

@@ -0,0 +1,315 @@
/**
******************************************************************************
* @file stm32f10x_dac.h
* @author MCD Application Team
* @version V3.6.2
* @date 17-September-2021
* @brief This file contains all the functions prototypes for the DAC firmware
* library.
******************************************************************************
* @attention
*
* Copyright (c) 2012 STMicroelectronics.
* All rights reserved.
*
* This software is licensed under terms that can be found in the LICENSE file
* in the root directory of this software component.
* If no LICENSE file comes with this software, it is provided AS-IS.
*
******************************************************************************
*/
/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef __STM32F10x_DAC_H
#define __STM32F10x_DAC_H
#ifdef __cplusplus
extern "C" {
#endif
/* Includes ------------------------------------------------------------------*/
#include "stm32f10x.h"
/** @addtogroup STM32F10x_StdPeriph_Driver
* @{
*/
/** @addtogroup DAC
* @{
*/
/** @defgroup DAC_Exported_Types
* @{
*/
/**
* @brief DAC Init structure definition
*/
typedef struct
{
uint32_t DAC_Trigger; /*!< Specifies the external trigger for the selected DAC channel.
This parameter can be a value of @ref DAC_trigger_selection */
uint32_t DAC_WaveGeneration; /*!< Specifies whether DAC channel noise waves or triangle waves
are generated, or whether no wave is generated.
This parameter can be a value of @ref DAC_wave_generation */
uint32_t DAC_LFSRUnmask_TriangleAmplitude; /*!< Specifies the LFSR mask for noise wave generation or
the maximum amplitude triangle generation for the DAC channel.
This parameter can be a value of @ref DAC_lfsrunmask_triangleamplitude */
uint32_t DAC_OutputBuffer; /*!< Specifies whether the DAC channel output buffer is enabled or disabled.
This parameter can be a value of @ref DAC_output_buffer */
}DAC_InitTypeDef;
/**
* @}
*/
/** @defgroup DAC_Exported_Constants
* @{
*/
/** @defgroup DAC_trigger_selection
* @{
*/
#define DAC_Trigger_None ((uint32_t)0x00000000) /*!< Conversion is automatic once the DAC1_DHRxxxx register
has been loaded, and not by external trigger */
#define DAC_Trigger_T6_TRGO ((uint32_t)0x00000004) /*!< TIM6 TRGO selected as external conversion trigger for DAC channel */
#define DAC_Trigger_T8_TRGO ((uint32_t)0x0000000C) /*!< TIM8 TRGO selected as external conversion trigger for DAC channel
only in High-density devices*/
#define DAC_Trigger_T3_TRGO ((uint32_t)0x0000000C) /*!< TIM8 TRGO selected as external conversion trigger for DAC channel
only in Connectivity line, Medium-density and Low-density Value Line devices */
#define DAC_Trigger_T7_TRGO ((uint32_t)0x00000014) /*!< TIM7 TRGO selected as external conversion trigger for DAC channel */
#define DAC_Trigger_T5_TRGO ((uint32_t)0x0000001C) /*!< TIM5 TRGO selected as external conversion trigger for DAC channel */
#define DAC_Trigger_T15_TRGO ((uint32_t)0x0000001C) /*!< TIM15 TRGO selected as external conversion trigger for DAC channel
only in Medium-density and Low-density Value Line devices*/
#define DAC_Trigger_T2_TRGO ((uint32_t)0x00000024) /*!< TIM2 TRGO selected as external conversion trigger for DAC channel */
#define DAC_Trigger_T4_TRGO ((uint32_t)0x0000002C) /*!< TIM4 TRGO selected as external conversion trigger for DAC channel */
#define DAC_Trigger_Ext_IT9 ((uint32_t)0x00000034) /*!< EXTI Line9 event selected as external conversion trigger for DAC channel */
#define DAC_Trigger_Software ((uint32_t)0x0000003C) /*!< Conversion started by software trigger for DAC channel */
#define IS_DAC_TRIGGER(TRIGGER) (((TRIGGER) == DAC_Trigger_None) || \
((TRIGGER) == DAC_Trigger_T6_TRGO) || \
((TRIGGER) == DAC_Trigger_T8_TRGO) || \
((TRIGGER) == DAC_Trigger_T7_TRGO) || \
((TRIGGER) == DAC_Trigger_T5_TRGO) || \
((TRIGGER) == DAC_Trigger_T2_TRGO) || \
((TRIGGER) == DAC_Trigger_T4_TRGO) || \
((TRIGGER) == DAC_Trigger_Ext_IT9) || \
((TRIGGER) == DAC_Trigger_Software))
/**
* @}
*/
/** @defgroup DAC_wave_generation
* @{
*/
#define DAC_WaveGeneration_None ((uint32_t)0x00000000)
#define DAC_WaveGeneration_Noise ((uint32_t)0x00000040)
#define DAC_WaveGeneration_Triangle ((uint32_t)0x00000080)
#define IS_DAC_GENERATE_WAVE(WAVE) (((WAVE) == DAC_WaveGeneration_None) || \
((WAVE) == DAC_WaveGeneration_Noise) || \
((WAVE) == DAC_WaveGeneration_Triangle))
/**
* @}
*/
/** @defgroup DAC_lfsrunmask_triangleamplitude
* @{
*/
#define DAC_LFSRUnmask_Bit0 ((uint32_t)0x00000000) /*!< Unmask DAC channel LFSR bit0 for noise wave generation */
#define DAC_LFSRUnmask_Bits1_0 ((uint32_t)0x00000100) /*!< Unmask DAC channel LFSR bit[1:0] for noise wave generation */
#define DAC_LFSRUnmask_Bits2_0 ((uint32_t)0x00000200) /*!< Unmask DAC channel LFSR bit[2:0] for noise wave generation */
#define DAC_LFSRUnmask_Bits3_0 ((uint32_t)0x00000300) /*!< Unmask DAC channel LFSR bit[3:0] for noise wave generation */
#define DAC_LFSRUnmask_Bits4_0 ((uint32_t)0x00000400) /*!< Unmask DAC channel LFSR bit[4:0] for noise wave generation */
#define DAC_LFSRUnmask_Bits5_0 ((uint32_t)0x00000500) /*!< Unmask DAC channel LFSR bit[5:0] for noise wave generation */
#define DAC_LFSRUnmask_Bits6_0 ((uint32_t)0x00000600) /*!< Unmask DAC channel LFSR bit[6:0] for noise wave generation */
#define DAC_LFSRUnmask_Bits7_0 ((uint32_t)0x00000700) /*!< Unmask DAC channel LFSR bit[7:0] for noise wave generation */
#define DAC_LFSRUnmask_Bits8_0 ((uint32_t)0x00000800) /*!< Unmask DAC channel LFSR bit[8:0] for noise wave generation */
#define DAC_LFSRUnmask_Bits9_0 ((uint32_t)0x00000900) /*!< Unmask DAC channel LFSR bit[9:0] for noise wave generation */
#define DAC_LFSRUnmask_Bits10_0 ((uint32_t)0x00000A00) /*!< Unmask DAC channel LFSR bit[10:0] for noise wave generation */
#define DAC_LFSRUnmask_Bits11_0 ((uint32_t)0x00000B00) /*!< Unmask DAC channel LFSR bit[11:0] for noise wave generation */
#define DAC_TriangleAmplitude_1 ((uint32_t)0x00000000) /*!< Select max triangle amplitude of 1 */
#define DAC_TriangleAmplitude_3 ((uint32_t)0x00000100) /*!< Select max triangle amplitude of 3 */
#define DAC_TriangleAmplitude_7 ((uint32_t)0x00000200) /*!< Select max triangle amplitude of 7 */
#define DAC_TriangleAmplitude_15 ((uint32_t)0x00000300) /*!< Select max triangle amplitude of 15 */
#define DAC_TriangleAmplitude_31 ((uint32_t)0x00000400) /*!< Select max triangle amplitude of 31 */
#define DAC_TriangleAmplitude_63 ((uint32_t)0x00000500) /*!< Select max triangle amplitude of 63 */
#define DAC_TriangleAmplitude_127 ((uint32_t)0x00000600) /*!< Select max triangle amplitude of 127 */
#define DAC_TriangleAmplitude_255 ((uint32_t)0x00000700) /*!< Select max triangle amplitude of 255 */
#define DAC_TriangleAmplitude_511 ((uint32_t)0x00000800) /*!< Select max triangle amplitude of 511 */
#define DAC_TriangleAmplitude_1023 ((uint32_t)0x00000900) /*!< Select max triangle amplitude of 1023 */
#define DAC_TriangleAmplitude_2047 ((uint32_t)0x00000A00) /*!< Select max triangle amplitude of 2047 */
#define DAC_TriangleAmplitude_4095 ((uint32_t)0x00000B00) /*!< Select max triangle amplitude of 4095 */
#define IS_DAC_LFSR_UNMASK_TRIANGLE_AMPLITUDE(VALUE) (((VALUE) == DAC_LFSRUnmask_Bit0) || \
((VALUE) == DAC_LFSRUnmask_Bits1_0) || \
((VALUE) == DAC_LFSRUnmask_Bits2_0) || \
((VALUE) == DAC_LFSRUnmask_Bits3_0) || \
((VALUE) == DAC_LFSRUnmask_Bits4_0) || \
((VALUE) == DAC_LFSRUnmask_Bits5_0) || \
((VALUE) == DAC_LFSRUnmask_Bits6_0) || \
((VALUE) == DAC_LFSRUnmask_Bits7_0) || \
((VALUE) == DAC_LFSRUnmask_Bits8_0) || \
((VALUE) == DAC_LFSRUnmask_Bits9_0) || \
((VALUE) == DAC_LFSRUnmask_Bits10_0) || \
((VALUE) == DAC_LFSRUnmask_Bits11_0) || \
((VALUE) == DAC_TriangleAmplitude_1) || \
((VALUE) == DAC_TriangleAmplitude_3) || \
((VALUE) == DAC_TriangleAmplitude_7) || \
((VALUE) == DAC_TriangleAmplitude_15) || \
((VALUE) == DAC_TriangleAmplitude_31) || \
((VALUE) == DAC_TriangleAmplitude_63) || \
((VALUE) == DAC_TriangleAmplitude_127) || \
((VALUE) == DAC_TriangleAmplitude_255) || \
((VALUE) == DAC_TriangleAmplitude_511) || \
((VALUE) == DAC_TriangleAmplitude_1023) || \
((VALUE) == DAC_TriangleAmplitude_2047) || \
((VALUE) == DAC_TriangleAmplitude_4095))
/**
* @}
*/
/** @defgroup DAC_output_buffer
* @{
*/
#define DAC_OutputBuffer_Enable ((uint32_t)0x00000000)
#define DAC_OutputBuffer_Disable ((uint32_t)0x00000002)
#define IS_DAC_OUTPUT_BUFFER_STATE(STATE) (((STATE) == DAC_OutputBuffer_Enable) || \
((STATE) == DAC_OutputBuffer_Disable))
/**
* @}
*/
/** @defgroup DAC_Channel_selection
* @{
*/
#define DAC_Channel_1 ((uint32_t)0x00000000)
#define DAC_Channel_2 ((uint32_t)0x00000010)
#define IS_DAC_CHANNEL(CHANNEL) (((CHANNEL) == DAC_Channel_1) || \
((CHANNEL) == DAC_Channel_2))
/**
* @}
*/
/** @defgroup DAC_data_alignment
* @{
*/
#define DAC_Align_12b_R ((uint32_t)0x00000000)
#define DAC_Align_12b_L ((uint32_t)0x00000004)
#define DAC_Align_8b_R ((uint32_t)0x00000008)
#define IS_DAC_ALIGN(ALIGN) (((ALIGN) == DAC_Align_12b_R) || \
((ALIGN) == DAC_Align_12b_L) || \
((ALIGN) == DAC_Align_8b_R))
/**
* @}
*/
/** @defgroup DAC_wave_generation
* @{
*/
#define DAC_Wave_Noise ((uint32_t)0x00000040)
#define DAC_Wave_Triangle ((uint32_t)0x00000080)
#define IS_DAC_WAVE(WAVE) (((WAVE) == DAC_Wave_Noise) || \
((WAVE) == DAC_Wave_Triangle))
/**
* @}
*/
/** @defgroup DAC_data
* @{
*/
#define IS_DAC_DATA(DATA) ((DATA) <= 0xFFF0)
/**
* @}
*/
#if defined (STM32F10X_LD_VL) || defined (STM32F10X_MD_VL) || defined (STM32F10X_HD_VL)
/** @defgroup DAC_interrupts_definition
* @{
*/
#define DAC_IT_DMAUDR ((uint32_t)0x00002000)
#define IS_DAC_IT(IT) (((IT) == DAC_IT_DMAUDR))
/**
* @}
*/
/** @defgroup DAC_flags_definition
* @{
*/
#define DAC_FLAG_DMAUDR ((uint32_t)0x00002000)
#define IS_DAC_FLAG(FLAG) (((FLAG) == DAC_FLAG_DMAUDR))
/**
* @}
*/
#endif
/**
* @}
*/
/** @defgroup DAC_Exported_Macros
* @{
*/
/**
* @}
*/
/** @defgroup DAC_Exported_Functions
* @{
*/
void DAC_DeInit(void);
void DAC_Init(uint32_t DAC_Channel, DAC_InitTypeDef* DAC_InitStruct);
void DAC_StructInit(DAC_InitTypeDef* DAC_InitStruct);
void DAC_Cmd(uint32_t DAC_Channel, FunctionalState NewState);
#if defined (STM32F10X_LD_VL) || defined (STM32F10X_MD_VL) || defined (STM32F10X_HD_VL)
void DAC_ITConfig(uint32_t DAC_Channel, uint32_t DAC_IT, FunctionalState NewState);
#endif
void DAC_DMACmd(uint32_t DAC_Channel, FunctionalState NewState);
void DAC_SoftwareTriggerCmd(uint32_t DAC_Channel, FunctionalState NewState);
void DAC_DualSoftwareTriggerCmd(FunctionalState NewState);
void DAC_WaveGenerationCmd(uint32_t DAC_Channel, uint32_t DAC_Wave, FunctionalState NewState);
void DAC_SetChannel1Data(uint32_t DAC_Align, uint16_t Data);
void DAC_SetChannel2Data(uint32_t DAC_Align, uint16_t Data);
void DAC_SetDualChannelData(uint32_t DAC_Align, uint16_t Data2, uint16_t Data1);
uint16_t DAC_GetDataOutputValue(uint32_t DAC_Channel);
#if defined (STM32F10X_LD_VL) || defined (STM32F10X_MD_VL) || defined (STM32F10X_HD_VL)
FlagStatus DAC_GetFlagStatus(uint32_t DAC_Channel, uint32_t DAC_FLAG);
void DAC_ClearFlag(uint32_t DAC_Channel, uint32_t DAC_FLAG);
ITStatus DAC_GetITStatus(uint32_t DAC_Channel, uint32_t DAC_IT);
void DAC_ClearITPendingBit(uint32_t DAC_Channel, uint32_t DAC_IT);
#endif
#ifdef __cplusplus
}
#endif
#endif /*__STM32F10x_DAC_H */
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/

View File

@@ -0,0 +1,117 @@
/**
******************************************************************************
* @file stm32f10x_dbgmcu.h
* @author MCD Application Team
* @version V3.6.2
* @date 17-September-2021
* @brief This file contains all the functions prototypes for the DBGMCU
* firmware library.
******************************************************************************
* @attention
*
* Copyright (c) 2012 STMicroelectronics.
* All rights reserved.
*
* This software is licensed under terms that can be found in the LICENSE file
* in the root directory of this software component.
* If no LICENSE file comes with this software, it is provided AS-IS.
*
******************************************************************************
*/
/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef __STM32F10x_DBGMCU_H
#define __STM32F10x_DBGMCU_H
#ifdef __cplusplus
extern "C" {
#endif
/* Includes ------------------------------------------------------------------*/
#include "stm32f10x.h"
/** @addtogroup STM32F10x_StdPeriph_Driver
* @{
*/
/** @addtogroup DBGMCU
* @{
*/
/** @defgroup DBGMCU_Exported_Types
* @{
*/
/**
* @}
*/
/** @defgroup DBGMCU_Exported_Constants
* @{
*/
#define DBGMCU_SLEEP ((uint32_t)0x00000001)
#define DBGMCU_STOP ((uint32_t)0x00000002)
#define DBGMCU_STANDBY ((uint32_t)0x00000004)
#define DBGMCU_IWDG_STOP ((uint32_t)0x00000100)
#define DBGMCU_WWDG_STOP ((uint32_t)0x00000200)
#define DBGMCU_TIM1_STOP ((uint32_t)0x00000400)
#define DBGMCU_TIM2_STOP ((uint32_t)0x00000800)
#define DBGMCU_TIM3_STOP ((uint32_t)0x00001000)
#define DBGMCU_TIM4_STOP ((uint32_t)0x00002000)
#define DBGMCU_CAN1_STOP ((uint32_t)0x00004000)
#define DBGMCU_I2C1_SMBUS_TIMEOUT ((uint32_t)0x00008000)
#define DBGMCU_I2C2_SMBUS_TIMEOUT ((uint32_t)0x00010000)
#define DBGMCU_TIM8_STOP ((uint32_t)0x00020000)
#define DBGMCU_TIM5_STOP ((uint32_t)0x00040000)
#define DBGMCU_TIM6_STOP ((uint32_t)0x00080000)
#define DBGMCU_TIM7_STOP ((uint32_t)0x00100000)
#define DBGMCU_CAN2_STOP ((uint32_t)0x00200000)
#define DBGMCU_TIM15_STOP ((uint32_t)0x00400000)
#define DBGMCU_TIM16_STOP ((uint32_t)0x00800000)
#define DBGMCU_TIM17_STOP ((uint32_t)0x01000000)
#define DBGMCU_TIM12_STOP ((uint32_t)0x02000000)
#define DBGMCU_TIM13_STOP ((uint32_t)0x04000000)
#define DBGMCU_TIM14_STOP ((uint32_t)0x08000000)
#define DBGMCU_TIM9_STOP ((uint32_t)0x10000000)
#define DBGMCU_TIM10_STOP ((uint32_t)0x20000000)
#define DBGMCU_TIM11_STOP ((uint32_t)0x40000000)
#define IS_DBGMCU_PERIPH(PERIPH) ((((PERIPH) & 0x800000F8) == 0x00) && ((PERIPH) != 0x00))
/**
* @}
*/
/** @defgroup DBGMCU_Exported_Macros
* @{
*/
/**
* @}
*/
/** @defgroup DBGMCU_Exported_Functions
* @{
*/
uint32_t DBGMCU_GetREVID(void);
uint32_t DBGMCU_GetDEVID(void);
void DBGMCU_Config(uint32_t DBGMCU_Periph, FunctionalState NewState);
#ifdef __cplusplus
}
#endif
#endif /* __STM32F10x_DBGMCU_H */
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/

Some files were not shown because too many files have changed in this diff Show More