根据提供的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,166 @@
//**** 声明 ********************************************************************
/*******************************************************************************
* 下面来自互联开源程序,由深圳市大夏龙雀科技有限公司收集
* 方便用户参考学习,本公司不提供任何技术支持
* 程序仅供测试参考,不能应用在实际工程中,不一定能通过编译
* 公司网站 http://www.szdx-smart.com/
* 淘宝网址 https://shop184598174.taobao.com/?spm=a1z10.5-c-s.w12096189-21564973333.3.547b1176WCCDxR&scene=taobao_shop
*******************************************************************************/
/********************************************************************
* 文件名 WF24-MQTT协议应用
* 描述 : 该文件实现WF24和单片机数据透传。
***********************************************************************/
/*
Name: MQTT
Created: 2024/8/21
Author: WAM
*/
#include <Arduino.h>
#include <SPI.h>
#include <SoftwareSerial.h>
#include <stdio.h>
#include <string.h>
#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.146,2347\r\n"//连接服务器 192.168.0.150为IP地址 2347为端口号 应和热点保持一致
#define CONNECT_TO_UDP "AT+CIPSTART=UDP,192.168.0.146,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连接
SoftwareSerial WIFI(10, 11); // RX, TX 软件串口的波特率在Arduino会有一定限制 最好不要超过9600
int ledPin=3;//定义数字10接口
void setup() //初始化部分
{
Serial.begin(115200);//WF24使用硬件串口
WIFI.begin(9600);//作为调试
WIFI.listen();
Connect_MQTT();
pinMode(ledPin,OUTPUT);//定义小灯接口为输出接口
digitalWrite(ledPin,HIGH);
}
String arr;
void loop() //主循环
{
// 从WF24读取数据并发送到PC串口
while(WIFI.available()>0)
{
char c = WIFI.read();
Serial.write(c);
}
//WF24接收到消息进行打印
while (Serial.available() > 0) {
arr = Serial.readStringUntil('\0');
if(AT_CMD(PUB_RAM,"OK\r\n"))
{
Serial.print(arr);
delay(200);
while (Serial.available()) Serial.read();
}
}
}
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(1000);//等待连接TCP成功
if(strstr(data,"MQTTCONN")!=NULL)
delay(1000);//等待连接服务器成功
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");
}

View File

@@ -0,0 +1,163 @@
//**** 声明 ********************************************************************
/*******************************************************************************
* 下面来自互联开源程序,由深圳市大夏龙雀科技有限公司收集
* 方便用户参考学习,本公司不提供任何技术支持
* 程序仅供测试参考,不能应用在实际工程中,不一定能通过编译
* 公司网站 http://www.szdx-smart.com/
* 淘宝网址 https://shop184598174.taobao.com/?spm=a1z10.5-c-s.w12096189-21564973333.3.547b1176WCCDxR&scene=taobao_shop
*******************************************************************************/
/********************************************************************
* 文件名 WF24-TCP协议应用
* 描述 : 该文件实现WF24和单片机数据透传。
***********************************************************************/
/*
Name: TCP
Created: 2024/8/21
Author: WAM
*/
#include <Arduino.h>
#include <SPI.h>
#include <SoftwareSerial.h>
#include <stdio.h>
#include <string.h>
#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.146,2347\r\n"//连接服务器 192.168.0.150为IP地址 2347为端口号 应和热点保持一致
#define CONNECT_TO_UDP "AT+CIPSTART=UDP,192.168.0.146,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连接
SoftwareSerial WIFI(10, 11); // RX, TX 软件串口的波特率在Arduino会有一定限制 最好不要超过9600
int ledPin=3;//定义数字10接口
void setup() //初始化部分
{
Serial.begin(115200);//WF24使用硬件串口
WIFI.begin(9600);//作为调试
WIFI.listen();
Connect_TCP();
pinMode(ledPin,OUTPUT);//定义小灯接口为输出接口
digitalWrite(ledPin,HIGH);
}
String arr;
void loop() //主循环
{
// 从WF24读取数据并发送到PC串口
while(WIFI.available()>0)
{
char c = WIFI.read();
Serial.write(c);
}
//WF24接收到消息进行打印
while (Serial.available() > 0) {
arr = Serial.readStringUntil('\0');
Serial.print(arr);
}
}
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(1000);//等待连接TCP成功
if(strstr(data,"MQTTCONN")!=NULL)
delay(1000);//等待连接服务器成功
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");
}

View File

@@ -0,0 +1,165 @@
//**** 声明 ********************************************************************
/*******************************************************************************
* 下面来自互联开源程序,由深圳市大夏龙雀科技有限公司收集
* 方便用户参考学习,本公司不提供任何技术支持
* 程序仅供测试参考,不能应用在实际工程中,不一定能通过编译
* 公司网站 http://www.szdx-smart.com/
* 淘宝网址 https://shop184598174.taobao.com/?spm=a1z10.5-c-s.w12096189-21564973333.3.547b1176WCCDxR&scene=taobao_shop
*******************************************************************************/
/********************************************************************
* 文件名 WF24-UDP协议应用
* 描述 : 该文件实现WF24和单片机数据透传。
***********************************************************************/
/*
Name: UDP
Created: 2024/8/21
Author: WAM
*/
#include <Arduino.h>
#include <SPI.h>
#include <SoftwareSerial.h>
#include <stdio.h>
#include <string.h>
#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.146,2347\r\n"//连接服务器 192.168.0.150为IP地址 2347为端口号 应和热点保持一致
#define CONNECT_TO_UDP "AT+CIPSTART=UDP,192.168.0.146,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连接
SoftwareSerial WIFI(10, 11); // RX, TX 软件串口的波特率在Arduino会有一定限制 最好不要超过9600
int ledPin=3;//定义数字10接口
void setup() //初始化部分
{
Serial.begin(115200);//WF24使用硬件串口
WIFI.begin(9600);//作为调试
WIFI.listen();
Connect_UDP();
pinMode(ledPin,OUTPUT);//定义小灯接口为输出接口
digitalWrite(ledPin,HIGH);
}
String arr;
void loop() //主循环
{
// 从WF24读取数据并发送到PC串口
while(WIFI.available()>0)
{
char c = WIFI.read();
Serial.write(c);
}
//WF24接收到消息进行打印
while (Serial.available() > 0) {
arr = Serial.readStringUntil('\0');
Serial.print(arr);
while (Serial.available()) Serial.read();
}
}
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(1000);//等待连接TCP成功
if(strstr(data,"MQTTCONN")!=NULL)
delay(1000);//等待连接服务器成功
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('+');
}
delay(1000);
}
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");
}

View File

@@ -0,0 +1 @@
开始使用教程https://www.arduino.cn/thread-17239-1-1.html

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/13/2024 16:08:25 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/13/2024 16:08:25 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/13/2024 16:08:25 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/13/2024 16:08:25 PAGE 4
190
195 ;</h>
0009 020000 F 196 LJMP ?C_START
197
198 END
A51 MACRO ASSEMBLER STARTUP 08/13/2024 16:08:25 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/13/2024 16:08:25 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/13/2024 16:08:25 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/13/2024 16:08:25 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.146,2345,1112,0\r\n","+CIPSTART:1",3000)); //192.168.0.15
-0,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/13/2024 16:08:25 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 = 379 ----
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,88 @@
C51 COMPILER V9.60.7.0 MAIN 08/13/2024 16:08:25 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 #include <REGX52.H> // STC89C52RC的寄存器定义
2 #include "UART.h"
3 #include "string.h"
4 #include "stdio.h"
5 #include "oled.h"
6 extern unsigned int rxIndex;
7 extern unsigned char rxBuffer[ARRAY_SIZE];
8 extern unsigned int rx_flag;
9 unsigned int CONNECT_FLEG;//连接标志
10 // 主函数
11 unsigned char conver[64];
12 char *ptr = NULL;
13 void MQTT_CONVER(void);
14 void main() {
15 1 Serial_Init(); // 初始化串口
16 1 OLED_Init();
17 1 CONNECT_TO_MQTT("DX-SMART","SMART@601");
18 1 while (1) {
19 2
20 2 // 主循环,可以添加其他任务
21 2 MQTT_CONVER();
22 2 }
23 1 }
24
25 void TCP_UDP_CONVER(void)
26 {
27 1 if (rx_flag)
28 1 {
29 2 UART_sentString(rxBuffer);
30 2 CONNECT_TX_Control();
31 2 rxIndex = 0; // 重置索引,准备下一次接收
32 2 memset(rxBuffer,0,ARRAY_SIZE); //清空缓冲区
33 2 }
34 1 }
35 void MQTT_CONVER(void)
36 {
37 1 if (rx_flag)
38 1 {
39 2 if(strstr(rxBuffer,"RECV:test-app")!=NULL)
40 2 {
41 3 ptr = strrchr(rxBuffer,',');
42 3 memcpy(conver,ptr,*(ptr-1));
43 3 while(!WIFI_CheckAck("AT+MQTTPUBRAW=test-w,32,0,0\r\n","OK",2000)!=0);
44 3 buff_memset();//数据有误 清空
*** WARNING C206 IN LINE 44 OF ..\User\main.c: 'buff_memset': missing function-prototype
45 3 UART_sentString(conver);
46 3
47 3 }
48 2
49 2 }
50 1 }
51 void MQTT_CONTROL(void)
52 {
53 1 if (rx_flag)
C51 COMPILER V9.60.7.0 MAIN 08/13/2024 16:08:25 PAGE 2
54 1 {
55 2 CONNECT_TX_Control();
56 2 }
57 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/13/2024 16:08:25 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/13/2024 16:08:25 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/13/2024 16:08:25 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/13/2024 16:08:25 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/13/2024 16:08:25 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>µVision 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\C52_TO_WF24\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(44): 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_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_UDP/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=377 const=2906 code=5155
creating hex file from ".\Objects\51Project"...
".\Objects\51Project" - 0 Error(s), 10 Warning(s).
Build Time Elapsed: 00:00:00
</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
:10061000A3A380DF900172E4F0A3F0A3F090006048
:10062000E07002A3E070030207AE9000E7E0700202
:10063000A3E070030207AB90004674FFF0A3741DA3
:10064000F0A374C0F07B017A0079A5120C5DE94A31
:100650004B70030206F17B017A0079A57D2C121004
:1006600020900172EBF0A3EAF0A3E9F01213C5EFBA
:1006700024FDFFEE34FFFEEF64014E60030207AB82
:10068000900172E0FBA3E0FAA3E0F99000011204EC
:100690009AFF3395E0FEEF24D0FFEE34FFFE900189
:1006A00075F0A3EFF0EE60030207AEEF14B407009D
:1006B00040030207AE9006C375F003A4C58325F07E
:1006C000C583730206D80206DD0206E20206E502D1
:1006D00006E80206EB0206EEC2A50207ABD2A502AF
:1006E00007AB02079102079602079B0207A10207C8
:1006F000A790004674FFF0A3741DF0A374CAF07BAA
:10070000017A0079A5120C5DE94A4B70030207AB30
:100710007B017A0079A57D2C121020900172EBF0FC
:10072000A3EAF0A3E9F01213C5EF24FDFFEE34FFB6
:10073000FEEF64014E7074900172E0FBA3E0FAA337
:10074000E0F990000112049AFF3395E0FEEF24D007
:10075000FFEE34FFFE900175F0A3EFF0EE704FEF67
:1007600014B40700504890077475F003A4C583259E
:10077000F0C5837302078902078D0207910207966D
:1007800002079B0207A10207A7C2A5801ED2A5806F
:100790001A12121580151212BC8010C2A6D2A780A0
:1007A0000AD2A6C2A78004C2A6C2A712134C2290E6
:1007B0000000EBF0A3EAF0A3E9F090003B74FFF037
:1007C000A3741DF0A374E1F0A37403F0A374E8F024
:1007D0007BFF7A1E7993120BBAEF4E60DD120B9EEF
:1007E000EF4E60F990003B74FFF0A3741DF0A3740A
:1007F000E1F0A37407F0A374D0F07BFF7A1D79E4D5
:10080000120BBAEF4E60DD90003B74FFF0A3741D35
:10081000F0A374F2F0900000E0F9A3E0FAA3E090F6
:10082000003EC9F0A3EAF0A3E9F0900003E0F9A3C9
:10083000E0FAA3E0900041C9F0A3EAF0A3E9F07B5D
:10084000017A00790612008B90003B74FFF0A374CC
:100850001EF0A37403F0A37413F0A37488F07B015B
:100860007A007906120BBAEF4E60DD90003B74FF00
:10087000F0A3741DF0A374E1F0A37403F0A374E873
:10088000F07BFF7A1E79A2120BBAEF4E7F00700246
:100890007F01EF70D690003B74FFF0A3741EF0A3AD
:1008A00074E5F0A37407F0A374D0F07BFF7A1E798F
:1008B000C1120BBAEF4E7F0070027F01EF70D6902D
:1008C000003B74FFF0A3741DF0A374E1F0A3740760
:1008D000F0A374D0F07BFF7A1E79F4120BBAEF4EBE
:1008E0007F0070027F01EF70D690003B74FFF0A391
:1008F000741DF0A374E1F0A37407F0A374D0F07B2F
:10090000FF7A1F790C120BBAEF4E7F0070027F0145
:10091000EF70D67BFF7A1F792A12138712134C903F
:100920000060E4F0A304F0229000E9EBF0A3EAF009
:10093000A3E9F09000E9E0F9A3E0FAA3E090003B1E
:10094000C9F0A3EAF0A3E9F0A37405F0A374DCF006
:100950007BFF7A1D79D8120BBA120B9EEF4E60F90D
:1009600090003B74FFF0A3741DF0A374E1F0A37436
:1009700007F0A374D0F07BFF7A1D79E4120BBAEF75
:100980004E60DD90003B74FFF0A3741DF0A374F281
:10099000F09000E9E0F9A3E0FAA3E090003EC9F08E
:1009A000A3EAF0A3E9F09000ECE0F9A3E0FAA3E0F9
:1009B000900041C9F0A3EAF0A3E9F07B017A007945
:1009C000EF12008B90003B74FFF0A3741EF0A37431
:1009D00003F0A37413F0A37488F07B017A0079EF1D
:1009E000120BBAEF4E60DD90003B74FFF0A3741D54
:1009F000F0A374E1F0A37403F0A374E8F07BFF7A32
:100A00001E790D120BBAEF4E7F0070027F01EF705E
:100A1000D690003B74FFF0A3741EF0A37441F0A3C2
:100A2000740BF0A374B8F07BFF7A1E791C120BBA1A
:100A3000EF4E60DD90003B74FFF0A3741DF0A374D3
:100A4000E1F0A37403F0A374E8F07BFF7A1E794D04
:100A5000120BBAEF4E60DD121381900060E4F0A338
:100A600004F022900121EBF0A3EAF0A3E9F0900159
:100A700021E0F9A3E0FAA3E090003BC9F0A3EAF07B
:100A8000A3E9F0A37405F0A374DCF07BFF7A1D7971
:100A9000D8120BBA120B9EEF4E60F990003B74FF18
:100AA000F0A3741DF0A374E1F0A37407F0A374D055
:100AB000F07BFF7A1D79E4120BBAEF4E60DD9000F7
:100AC0003B74FFF0A3741DF0A374F2F0900121E0D9
:100AD000F9A3E0FAA3E090003EC9F0A3EAF0A3E98D
:100AE000F0900124E0F9A3E0FAA3E0900041C9F0FE
:100AF000A3EAF0A3E9F07B017A01792712008B9039
:100B0000003B74FFF0A3741EF0A37403F0A37413EE
:100B1000F0A37488F07B017A017927120BBAEF4EAB
: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
:100E90001FF0A3744EF07B017A0079A5120C5DE976
:100EA0004A4B606B7B017A0079A57D2C1210209053
:100EB00000A2EBF0A3EAF0A3E9F090FFFF12049A7E
:100EC000FF3395E0FE78627C007D019000A2E0FB9C
:100ED000A3E0FAA3E0F912045B90003B74FFF0A3D7
:100EE000741FF0A3747AF0A37407F0A374D0F07B9E
:100EF000FF7A1F795C120BBAEF4E7F0070027F0100
:100F0000EF70D612134C7B017A007962121387229C
:100F1000787FE4F6D8FD758121020F5702130CE4A7
:100F200093A3F8E493A34003F68001F208DFF48072
:100F300029E493A3F85407240CC8C333C4540F44C2
:100F400020C8834004F456800146F6DFE4800B019C
:100F5000020408102040809013DAE47E019360BC04
:100F6000A3FF543F30E509541FFEE493A360010E34
:100F7000CF54C025E060A840B8E493A3FAE493A35B
:100F8000F8E493A3C8C582C8CAC583CAF0A3C8C57C
:100F900082C8CAC583CADFE9DEE780BE900159EF87
:100FA000F090015BEBF0E4900160F0A3F090015C45
:100FB000E0FF54077008EF131313541F800A9001C9
:100FC0005CE0131313541F04900162F0900162ED72
:100FD000F090015CE0FF900162E0FDC39F50409003
:100FE0000159E0FF120003E0FC90015BE0FFECC35D
:100FF0009F502490015DE0FBA3E0FAA3E0F9A3E495
:1010000075F00112056485F082F58312049AFF7D64
:10101000011212680C80D2900162E004F080B222CA
:10102000900000EBF0A3EAF0A3E9F0A3EBF0A3EA51
:10103000F0A3E9F0900003E0FBA3E0FAA3E0F912CB
:101040000481600C900004E475F0011205B880E49E
:10105000900003E0FBA3E0FAA3E0F91204816D70B5
:101060000122900000E0FBA3E0FAA3E0F9EBC0E06E
:10107000EAC0E0E9C0E0A3E0FBA374FFF5F01205CD
:1010800064FAD082D083D0E06B7009E5F06582709D
:1010900003EA658370BAFBFAF922C0E0C0F0C083AE
:1010A000C082C0D075D000C000C006C007309849CB
:1010B000C2989000E5E475F001120564FE74A52560
:1010C000F0F58274003EF583E599F09000E5E0FECE
:1010D000A3E0FF24A4F58274003EF583E0B40A087F
:1010E0009000E7E4F0A304F0EF64404E700B900032
:1010F000E5F0A3F0A3F0A304F0D007D006D000D011
:10110000D0D082D083D0F0D0E032AA07A905AF03B7
:10111000E4FCEF24E0FBEAD3947F4004E4FA0909FD
:10112000AF02AD01120003E4FC75F010EBA42CF546
:1011300082E435F0F583E5822450F582E5833416A8
:101140001212610CECB408E1AF02E904FD120003D5
:10115000E4FC75F010EBA42CF582E435F0F583E5A2
:10116000822458F582E58334161212610CECB4081F
:10117000E12290016CEFF0A3EDF0A3EBF0A3EAF015
:10118000A3E9F0E4A3F090016EE0FBA3E0FAA3E092
:10119000F9A3E0F58275830012049AFB60279001A1
:1011A0006CE0FFA3E0FD12110A90016CE02408F04E
:1011B000E0D394784007E4F0A3E02402F0900171BA
:1011C000E004F080C122A907AA05E4900178F0129A
:1011D0000003E4FC75F040EBA42440F582E5F03414
:1011E0001C121257900178E004F00CECB410E5AF3B
:1011F00001EA04FD120003E4FC75F040EBA4246056
:10120000F582E5F0341C121257900178E004F00CDE
:10121000ECB410E522E4FBFD7F101211C67B01E463
:10122000FD7F201211C67B02E4FD7F301211C67BC8
:1012300003E4FD7F401211C67B04E4FD7F501211D0
:10124000C67B05E4FD7F601211C67BFF7A1479230B
:101250007D027F20021172F583E5822CF582E43550
:1012600083F583E493FF7D01ED6004D2A38002C285
:10127000A3C2A4E4FEC2A0EF30E704D2A18002C260
:10128000A1D2A0EF25E0FF0EEEB408E9D2A4D2A3CC
:10129000229000E7E07002A3E060207B017A0079F1
:1012A000A5121387120614E49000E5F0A3F0FE7F68
:1012B00040FD7B017A0079A512057A22E4FCEC243A
:1012C000B0FFE4FD121268E4FF1212687F101212E0
:1012D00068E4FB7D01E4FF1212680BEBB480F40CB0
:1012E000ECB408DA22EFB40A07740D1212F0740A93
:1012F000309811A899B8130CC2983098FDA899C2DB
:1013000098B811F63099FDC299F5992212139A12E4
:101310000D1C90000374FFF0A3741FF0A37444F03D
:101320007BFF7A1F793B1207AF120E7B80FB900187
:1013300077EFF0A9057F017E00AD0119ED600C90FB
:101340000177E0FD7C001204C780EE227E007F4022
: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
:101E80002E3134362C323334352C313131322C3042
:101E90000D0A0041542B4D515454434C45414E0DB5
:101EA0000A0041542B4D5154544C4F4E47434C491A
:101EB000454E5449443D57462D54455354320D0A1E
:101EC0000041542B4D515454434F4E4E3D62726F5E
:101ED0006B65722E656D71782E696F2C31383833D1
:101EE0002C300D0A004D515454434F4E4E4543542F
:101EF00045443A0041542B4D5154545355423D747E
:101F00006573742D6170702C300D0A0041542B4D97
:101F10005154545055425241573D746573742D7756
:101F20002C33322C302C300D0A004D5154545F4369
:101F30006F6E6E65637465640D0A0044582D534DD1
:101F400041525400534D41525440363031005245B5
:101F500043563A746573742D6170700041542B4D73
:101F60005154545055425241573D746573742D7706
:0D1F70002C33322C302C300D0A004F4B006A
: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.146,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,74 @@
//**** 声明 ********************************************************************
/*******************************************************************************
* 下面来自互联开源程序,由深圳市大夏龙雀科技有限公司收集
* 方便用户参考学习,本公司不提供任何技术支持
* 程序仅供测试参考,不能应用在实际工程中,不一定能通过编译
* 公司网站 http://www.szdx-smart.com/
* 淘宝网址 https://shop184598174.taobao.com/?spm=a1z10.5-c-s.w12096189-21564973333.3.547b1176WCCDxR&scene=taobao_shop
*******************************************************************************/
/********************************************************************
* 文件名 WF24-MQTT协议应用
* 描述 : 该文件实现WF24和单片机数据透传。
***********************************************************************/
/*
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 main() {
Serial_Init(); // 初始化串口
OLED_Init();
CONNECT_TO_MQTT("DX-SMART","SMART@601");
while (1) {
// 主循环,可以添加其他任务
MQTT_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/20/2024 11:07:29 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/20/2024 11:07:29 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/20/2024 11:07:29 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/20/2024 11:07:29 PAGE 4
190
195 ;</h>
0009 020000 F 196 LJMP ?C_START
197
198 END
A51 MACRO ASSEMBLER STARTUP 08/20/2024 11:07:29 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/20/2024 11:07:30 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/20/2024 11:07:30 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/20/2024 11:07:30 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.223,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.146,2345,1112,0\r\n","+CIPSTART:1",3000)); //192.168.0.15
-0,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/20/2024 11:07:30 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 = 379 ----
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,89 @@
C51 COMPILER V9.60.7.0 MAIN 08/20/2024 11:07:30 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 #include <REGX52.H> // STC89C52RC的寄存器定义
2 #include "UART.h"
3 #include "string.h"
4 #include "stdio.h"
5 #include "oled.h"
6 extern unsigned int rxIndex;
7 extern unsigned char rxBuffer[ARRAY_SIZE];
8 extern unsigned int rx_flag;
9 unsigned int CONNECT_FLEG;//连接标志
10 // 主函数
11 unsigned char conver[64];
12 char *ptr = NULL;
13 void MQTT_CONVER(void);
14 void TCP_UDP_CONVER(void);
15 void main() {
16 1 Serial_Init(); // 初始化串口
17 1 OLED_Init();
18 1 CONNECT_TO_TCP("DX-SMART","SMART@601");
19 1 while (1) {
20 2
21 2 // 主循环,可以添加其他任务
22 2 TCP_UDP_CONVER();
23 2 }
24 1 }
25
26 void TCP_UDP_CONVER(void)
27 {
28 1 if (rx_flag)
29 1 {
30 2 UART_sentString(rxBuffer);
31 2 // CONNECT_TX_Control();
32 2 rxIndex = 0; // 重置索引,准备下一次接收
33 2 memset(rxBuffer,0,ARRAY_SIZE); //清空缓冲区
34 2 }
35 1 }
36 void MQTT_CONVER(void)
37 {
38 1 if (rx_flag)
39 1 {
40 2 if(strstr(rxBuffer,"RECV:test-app")!=NULL)
41 2 {
42 3 ptr = strrchr(rxBuffer,',');
43 3 memcpy(conver,ptr,*(ptr-1));
44 3 while(!WIFI_CheckAck("AT+MQTTPUBRAW=test-w,32,0,0\r\n","OK",2000)!=0);
45 3 buff_memset();//数据有误 清空
*** WARNING C206 IN LINE 45 OF ..\User\main.c: 'buff_memset': missing function-prototype
46 3 UART_sentString(conver);
47 3
48 3 }
49 2
50 2 }
51 1 }
52 void MQTT_CONTROL(void)
53 {
C51 COMPILER V9.60.7.0 MAIN 08/20/2024 11:07:30 PAGE 2
54 1 if (rx_flag)
55 1 {
56 2 CONNECT_TX_Control();
57 2 }
58 1 }
MODULE INFORMATION: STATIC OVERLAYABLE
CODE SIZE = 237 ----
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/20/2024 11:07:30 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/20/2024 11:07:30 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/20/2024 11:07:30 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/20/2024 11:07:30 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/20/2024 11:07:30 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串口通信资料\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(45): 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_UDP/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=383 const=2906 code=5152
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
:10008000011205CEEF0205A60212E27403D2078028
: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
:10061000A3A380DF900178E4F0A3F0A3F090006042
:10062000E07002A3E070030207AE9000E7E0700202
:10063000A3E070030207AB90004674FFF0A3741DA3
:10064000F0A374BDF07B017A0079A5120C5DE94A34
:100650004B70030206F17B017A0079A57D2C121004
:1006600020900178EBF0A3EAF0A3E9F01213C2EFB7
:1006700024FDFFEE34FFFEEF64014E60030207AB82
:10068000900178E0FBA3E0FAA3E0F99000011204E6
:100690009AFF3395E0FEEF24D0FFEE34FFFE900189
:1006A0007BF0A3EFF0EE60030207AEEF14B4070097
:1006B00040030207AE9006C375F003A4C58325F07E
:1006C000C583730206D80206DD0206E20206E502D1
:1006D00006E80206EB0206EEC2A50207ABD2A502AF
:1006E00007AB02079102079602079B0207A10207C8
:1006F000A790004674FFF0A3741DF0A374C7F07BAD
:10070000017A0079A5120C5DE94A4B70030207AB30
:100710007B017A0079A57D2C121020900178EBF0F6
:10072000A3EAF0A3E9F01213C2EF24FDFFEE34FFB9
:10073000FEEF64014E7074900178E0FBA3E0FAA331
:10074000E0F990000112049AFF3395E0FEEF24D007
:10075000FFEE34FFFE90017BF0A3EFF0EE704FEF61
:1007600014B40700504890077475F003A4C583259E
:10077000F0C5837302078902078D0207910207966D
:1007800002079B0207A10207A7C2A5801ED2A5806F
:100790001A12121580151212918010C2A6D2A780CB
:1007A0000AD2A6C2A78004C2A6C2A71213492290E9
:1007B0000121EBF0A3EAF0A3E9F090003B74FFF015
:1007C000A3741DF0A374DEF0A37403F0A374E8F027
:1007D0007BFF7A1E7990120BBAEF4E60DD120B9EF2
:1007E000EF4E60F990003B74FFF0A3741DF0A3740A
:1007F000DEF0A37407F0A374D0F07BFF7A1D79E1DB
:10080000120BBAEF4E60DD90003B74FFF0A3741D35
:10081000F0A374EFF0900121E0F9A3E0FAA3E090D7
:10082000003EC9F0A3EAF0A3E9F0900124E0F9A3A7
:10083000E0FAA3E0900041C9F0A3EAF0A3E9F07B5D
:10084000017A01792712008B90003B74FFF0A374AA
:100850001EF0A37400F0A37413F0A37488F07B015E
:100860007A017927120BBAEF4E60DD90003B74FFDE
:10087000F0A3741DF0A374DEF0A37403F0A374E876
:10088000F07BFF7A1E799F120BBAEF4E7F00700249
:100890007F01EF70D690003B74FFF0A3741EF0A3AD
:1008A00074E2F0A37407F0A374D0F07BFF7A1E7992
:1008B000BE120BBAEF4E7F0070027F01EF70D69030
:1008C000003B74FFF0A3741DF0A374DEF0A3740763
:1008D000F0A374D0F07BFF7A1E79F1120BBAEF4EC1
:1008E0007F0070027F01EF70D690003B74FFF0A391
:1008F000741DF0A374DEF0A37407F0A374D0F07B32
:10090000FF7A1F7909120BBAEF4E7F0070027F0148
:10091000EF70D67BFF7A1F79271213841213499048
:100920000060E4F0A304F022900000EBF0A3EAF0F2
:10093000A3E9F0900000E0F9A3E0FAA3E090003B07
:10094000C9F0A3EAF0A3E9F0A37405F0A374DCF006
:100950007BFF7A1D79D5120BBA120B9EEF4E60F910
:1009600090003B74FFF0A3741DF0A374DEF0A37439
:1009700007F0A374D0F07BFF7A1D79E1120BBAEF78
:100980004E60DD90003B74FFF0A3741DF0A374EF84
:10099000F0900000E0F9A3E0FAA3E090003EC9F077
:1009A000A3EAF0A3E9F0900003E0F9A3E0FAA3E0E2
:1009B000900041C9F0A3EAF0A3E9F07B017A007945
:1009C0000612008B90003B74FFF0A3741EF0A3741A
:1009D00000F0A37413F0A37488F07B017A00790609
:1009E000120BBAEF4E60DD90003B74FFF0A3741D54
:1009F000F0A374DEF0A37403F0A374E8F07BFF7A35
:100A00001E790A120BBAEF4E7F0070027F01EF7061
:100A1000D690003B74FFF0A3741EF0A3743EF0A3C5
:100A2000740BF0A374B8F07BFF7A1E7919120BBA1D
:100A3000EF4E60DD90003B74FFF0A3741DF0A374D3
:100A4000DEF0A37403F0A374E8F07BFF7A1E794A0A
:100A5000120BBAEF4E60DD12137E900060E4F0A33B
:100A600004F0229000E9EBF0A3EAF0A3E9F0900093
:100A7000E9E0F9A3E0FAA3E090003BC9F0A3EAF0B3
:100A8000A3E9F0A37405F0A374DCF07BFF7A1D7971
:100A9000D5120BBA120B9EEF4E60F990003B74FF1B
:100AA000F0A3741DF0A374DEF0A37407F0A374D058
:100AB000F07BFF7A1D79E1120BBAEF4E60DD9000FA
:100AC0003B74FFF0A3741DF0A374EFF09000E9E015
:100AD000F9A3E0FAA3E090003EC9F0A3EAF0A3E98D
:100AE000F09000ECE0F9A3E0FAA3E0900041C9F037
:100AF000A3EAF0A3E9F07B017A0079EF12008B9072
:100B0000003B74FFF0A3741EF0A37400F0A37413F1
:100B1000F0A37488F07B017A0079EF120BBAEF4EE4
:100B200060DD90003B74FFF0A3741DF0A374DEF051
:100B3000A37403F0A374E8F07BFF7A1E790A120B0A
:100B4000BAEF4E7F0070027F01EF70D690003B74C9
:100B5000FFF0A3741EF0A3743EF0A3740BF0A37413
:100B6000B8F07BFF7A1E7964120BBAEF4E60DD900D
:100B7000003B74FFF0A3741DF0A374DEF0A37403B4
:100B8000F0A374E8F07BFF7A1E794A120BBAEF4E9D
:100B900060DD12137E900060E4F0A304F022900068
:100BA0003B74FFF0A3741DF0A374DEF0A37403F094
:100BB000A374E8F07BFF7A1D79D9900038EBF0A39D
:100BC000EAF0A3E9F0900040E4F0A3F0A3F01213E0
:100BD00049900038E0FBA3E0FAA3E0F912138490F7
:100BE000003EE0FEA3E0FF7C007D0A12052E90008F
:100BF0003EEEF0A3EFF090003E74FFF5F0120564B6
:100C000045F060527F0A7E001213AD9000E7E0705D
:100C100004A3E0640170DF90003BE0F9A3E0FAA3D5
:100C2000E0900046C9F0A3EAF0A3E9F07B017A0066
:100C300079A5120C5D900040EBF0A3EAF0A3E9F077
:100C4000900040E0FBA3E0FAA3E04A4B60A8121337
:100C5000497E007F0122121349E4FEFF22900043E7
:100C6000EBF0A3EAF0A3E9F0A3E0FBA3E0FAA3E032
:100C7000F91204817003020D09900043E0FBA3E028
:100C8000FAA3E0F91204817003020D15900046E00A
:100C9000F9A3E0FAA3E0A3C9F0A3EAF0A3E9F09076
:100CA0000043A3E0FAA3E0F990004CEBF0A3EAF0D4
:100CB000A3E9F0900049E0FBA3E0FAA3E0F91204F5
:100CC00081FF602690004CE0FBA3E0FAA3E0F9125C
:100CD00004816F701590004A75F0011205B89000FC
:100CE0004DE475F0011205B880C9900049E0FBA3FE
:100CF000E0FAA3E0F91204817002800D900044E450
:100D000075F0011205B8020C79900043E0FBA3E0F6
:100D1000FAA3E0F9227B007A00790022D2A27F6454
:100D20007E00121364C2A27F647E00121364D2A2FA
:100D3000E4FD7FAE121268E4FF1212687F101212F7
:100D4000687F401212687F811212687FCF1212688A
:100D50007FA11212687FC81212687FA61212687FE4
:100D6000A81212687F3F1212687FD3121268E4FF44
:100D70001212687FD51212687F801212687FD91212
:100D800012687FF11212687FDA1212687F12121253
:100D9000687FDB1212687F401212687F201212688F
:100DA0007F021212687F8D1212687F141212687F00
:100DB000A41212687FA61212687FAF1212687FAF6A
:100DC000121268121291E4FDFF020003900163EF1A
:100DD000F0A3EDF0A3EAF0A3EBF0E490016BF09048
:100DE0000169F0900167E0FF900169E0FEC39F4058
:100DF00003020E7AC3EF9E14FD7F0A12132B90019B
:100E000065E0FCA3E0FDCFCDCFCECCCE1204D97CE3
:100E1000007D0A1204D990016AEDF0A3E0703090D1
:100E20000167E014FF900169E0FEC39F5021A3E039
:100E30007017900168E0C3138EF0A4FF900163E087
:100E40002FFFA3E0FD7B20802590016B7401F090C3
:100E50000168E0C313FFA3E0FEEF8EF0A4FF900152
:100E600063E02FFFA3E0FD90016AE02430FB121144
:100E70000A900169E004F0020DE3229000E7E070BF
:100E800002A3E07003020F0F90004674FFF0A374FA
:100E90001FF0A3744BF07B017A0079A5120C5DE979
:100EA0004A4B606B7B017A0079A57D2C1210209053
:100EB00000A2EBF0A3EAF0A3E9F090FFFF12049A7E
:100EC000FF3395E0FE78627C007D019000A2E0FB9C
:100ED000A3E0FAA3E0F912045B90003B74FFF0A3D7
:100EE000741FF0A37477F0A37407F0A374D0F07BA1
:100EF000FF7A1F7959120BBAEF4E7F0070027F0103
:100F0000EF70D61213497B017A00796212138422A2
:100F1000787FE4F6D8FD758121020F57021309E4AA
:100F200093A3F8E493A34003F68001F208DFF48072
:100F300029E493A3F85407240CC8C333C4540F44C2
:100F400020C8834004F456800146F6DFE4800B019C
:100F5000020408102040809013D7E47E019360BC07
:100F6000A3FF543F30E509541FFEE493A360010E34
:100F7000CF54C025E060A840B8E493A3FAE493A35B
:100F8000F8E493A3C8C582C8CAC583CAF0A3C8C57C
:100F900082C8CAC583CADFE9DEE780BE900159EF87
:100FA000F090015BEBF0E4900160F0A3F090015C45
:100FB000E0FF54077008EF131313541F800A9001C9
:100FC0005CE0131313541F04900162F0900162ED72
:100FD000F090015CE0FF900162E0FDC39F50409003
:100FE0000159E0FF120003E0FC90015BE0FFECC35D
:100FF0009F502490015DE0FBA3E0FAA3E0F9A3E495
:1010000075F00112056485F082F58312049AFF7D64
:10101000011212680C80D2900162E004F080B222CA
:10102000900172EBF0A3EAF0A3E9F0A3EBF0A3EADE
:10103000F0A3E9F0900175E0FBA3E0FAA3E0F91258
:101040000481600C900176E475F0011205B880E42B
:10105000900175E0FBA3E0FAA3E0F91204816D7042
:101060000122900172E0FBA3E0FAA3E0F9EBC0E0FB
:10107000EAC0E0E9C0E0A3E0FBA374FFF5F01205CD
:1010800064FAD082D083D0E06B7009E5F06582709D
:1010900003EA658370BAFBFAF922C0E0C0F0C083AE
:1010A000C082C0D075D000C000C006C007309849CB
:1010B000C2989000E5E475F001120564FE74A52560
:1010C000F0F58274003EF583E599F09000E5E0FECE
:1010D000A3E0FF24A4F58274003EF583E0B40A087F
:1010E0009000E7E4F0A304F0EF64404E700B900032
:1010F000E5F0A3F0A3F0A304F0D007D006D000D011
:10110000D0D082D083D0F0D0E032AA07A905AF03B7
:10111000E4FCEF24E0FBEAD3947F4004E4FA0909FD
:10112000AF02AD01120003E4FC75F010EBA42CF546
:1011300082E435F0F583E582244DF582E5833416AB
:101140001212610CECB408E1AF02E904FD120003D5
:10115000E4FC75F010EBA42CF582E435F0F583E5A2
:10116000822455F582E58334161212610CECB40822
:10117000E12290016CEFF0A3EDF0A3EBF0A3EAF015
:10118000A3E9F0E4A3F090016EE0FBA3E0FAA3E092
:10119000F9A3E0F58275830012049AFB60279001A1
:1011A0006CE0FFA3E0FD12110A90016CE02408F04E
:1011B000E0D394784007E4F0A3E02402F0900171BA
:1011C000E004F080C122A907AA05E490017EF01294
:1011D0000003E4FC75F040EBA4243DF582E5F03417
:1011E0001C12125790017EE004F00CECB410E5AF35
:1011F00001EA04FD120003E4FC75F040EBA4245D59
:10120000F582E5F0341C12125790017EE004F00CD8
:10121000ECB410E522E4FBFD7F101211C67B01E463
:10122000FD7F201211C67B02E4FD7F301211C67BC8
:1012300003E4FD7F401211C67B04E4FD7F501211D0
:10124000C67B05E4FD7F601211C67BFF7A1479200E
:101250007D027F20021172F583E5822CF582E43550
:1012600083F583E493FF7D01ED6004D2A38002C285
:10127000A3C2A4E4FEC2A0EF30E704D2A18002C260
:10128000A1D2A0EF25E0FF0EEEB408E9D2A4D2A3CC
:1012900022E4FCEC24B0FFE4FD121268E4FF121219
:1012A000687F10121268E4FB7D01E4FF1212680BE4
:1012B000EBB480F40CECB408DA229000E7E07002A2
:1012C000A3E0601D7B017A0079A5121384E49000ED
:1012D000E5F0A3F0FE7F40FD7B017A0079A51205C1
:1012E0007A22EFB40A07740D1212ED740A309811C5
:1012F000A899B8130CC2983098FDA899C298B81153
:10130000F63099FDC299F59922121397120D1C908F
:10131000000374FFF0A3741FF0A37441F07BFF7A05
:101320001F79381209281212BA80FB90017DEFF064
:10133000A9057F017E00AD0119ED600C90017DE0F3
:10134000FD7C001204C780EE227E007F407D007B82
:10135000017A0079A512057AE49000E5F0A3F0A3E4
:10136000F0A3F022EF4E60157D087C07ED1DAA0466
:1013700070011C4A70F6EF1F70EA1E80E7227BFFA7
:101380007A1E7957120481FF600C12141874012917
:10139000F9E43AFA80EE2275985053890F43892078
:1013A000758BFD758DFDD28ED2ACD2AF22EF1FAC06
:1013B0000670011E4C600A7D027CEFDCFEDDFC80C5
:1013C000EC22E4FFFE120481600C0FEF70010E09A5
:1013D000E970F20A80EF224300A20000004200E51B
:1013E00000004200E7000000E4FD7F8D1212687FDC
:1013F000141212687FAF021268E4FD7F8D1212682A
:101400007F101212687FAE0212689000E7E070024F
:10141000A3E06003120614228F993099FDC299222D
:1014200057463234000000000000000000002F008A
:101430000000000700070000147F147F1400242A16
:101440007F2A120062640813230036495522500097
:10145000000503000000001C224100000041221C86
:10146000000014083E08140008083E0808000000A8
:10147000A060000008080808080000606000000084
:101480002010080402003E5149453E0000427F40C2
:1014900000004261514946002141454B310018147A
:1014A000127F10002745454539003C4A4949300024
:1014B00001710905030036494949360006494929A1
:1014C0001E000036360000000056360000000814EA
:1014D00022410000141414141400004122140800C6
:1014E000020151090600324959513E007C12111285
:1014F0007C007F49494936003E41414122007F41FD
:1015000041221C007F49494941007F090909010026
:101510003E4149497A007F0808087F0000417F4129
:1015200000002040413F01007F08142241007F401D
:10153000404040007F020C027F007F0408107F00C3
:101540003E4141413E007F09090906003E415121CB
:101550005E007F09192946004649494931000101C9
:101560007F0101003F4040403F001F2040201F00FE
:101570003F4038403F0063140814630007087008B8
:101580000700615149454300007F41410000552A51
:10159000552A55000041417F000004020102040069
:1015A00040404040400000010204000020545454D8
:1015B00078007F484444380038444444200038448C
:1015C00044487F00385454541800087E0901020032
:1015D00018A4A4A47C007F080404780000447D4083
:1015E00000004080847D00007F10284400000041FE
:1015F0007F4000007C04180478007C080404780014
:10160000384444443800FC242424180018242418A6
:10161000FC007C0804040800485454542000043F93
:10162000444020003C4040207C001C2040201C0006
:101630003C4030403C004428102844001CA0A0A09E
:101640007C004464544C441414141414140000001A
:10165000000000000000000000000000000000008A
:10166000F800000000000000333000000000100C03
:1016700006100C0600000000000000000040C078CA
:1016800040C0784000043F04043F04040000708818
:10169000FC08300000001820FF211E0000F008F0B8
:1016A00000E018000000211C031E211E0000F008AD
:1016B00088700000001E2123241927211010160E07
:1016C000000000000000000000000000000000001A
:1016D000E018040200000000071820400000020487
:1016E00018E0000000004020180700000040408083
:1016F000F0804040000202010F01020200000000E1
:10170000F0000000000101011F01010100000000C4
:10171000000000000080B070000000000000000029
:1017200000000000000001010101010101000000B2
:101730000000000000003030000000000000000049
:101740000080601804006018060100000000E0102E
:10175000080810E000000F102020100F00001010EB
:10176000F8000000000020203F202000000070084A
:10177000080888700000302824222130000030083A
:1017800088884830000018202020110E000000C07A
:101790002010F8000000070424243F240000F8086B
:1017A00088880808000019212020110E0000E01090
:1017B0008888180000000F112020110E0000380842
:1017C00008C83808000000003F00000000007088D2
:1017D0000808887000001C222121221C0000E01053
:1017E000080810E0000000312222110F0000000064
:1017F000C0C0000000000000303000000000000009
:1018000080000000000000806000000000000080F8
:101810004020100800000102040810200040404051
:101820004040404000040404040404040000081084
:1018300020408000000020100804020100007048D1
:10184000080808F0000000003036010000C030C871
:1018500028E810E0000718272423140B000000C01C
:1018600038E0000000203C23020227382008F888D6
:101870008888700000203F202020110E00C0300812
:101880000808083800071820202010080008F80869
:10189000080810E000203F202020100F0008F888E2
:1018A00088E8081000203F20202320180008F8882E
:1018B00088E8081000203F200003000000C0300826
:1018C000080838000007182020221E020008F80827
:1018D000000008F808203F210101213F20000808EE
:1018E000F8080800000020203F2020000000000829
:1018F00008F8080800C08080807F00000008F88891
:10190000C028180800203F20012638200008F808C9
:101910000000000000203F20202020300008F8F8C0
:1019200000F8F80800203F003F003F200008F83092
:10193000C00008F808203F200007183F00E010080A
:10194000080810E0000F10202020100F0008F808F1
:10195000080808F000203F210101010000E0100804
:10196000080810E0000F18242438504F0008F888A9
:101970008888887000203F2000030C302000708889
:1019800008080838000038202121221C0018080807
:10199000F8080818000000203F2000000008F808A0
:1019A000000008F808001F202020201F0008788869
:1019B0000000C83808000007380E010000F80800D1
:1019C000F80008F800033C0700073C03000818680B
:1019D000808068180820302C03032C30200838C879
:1019E00000C83808000000203F2000000010080850
:1019F00008C83808002038262120201800000000E0
:101A0000FE020202000000007F40404000000C3057
:101A1000C000000000000000010638C00000020203
:101A200002FE000000004040407F00000000000473
:101A3000020202040000000000000000000000009C
:101A40000000000000808080808080808000020292
:101A50000400000000000000000000000000008002
:101A600080808000000019242222223F2008F800F4
:101A70008080000000003F112020110E00000000B7
:101A80008080800000000E11202020110000000046
:101A9000808088F800000E112020103F2000008078
:101AA0008080800000001F222222221300008080FC
:101AB000F0888888180020203F2020000000008047
:101AC0008080808000006B94949493600008F800FC
:101AD0008080800000203F210000203F200080986F
:101AE00098000000000020203F202000000000009F
:101AF000809898000000C08080807F000008F80077
:101B00000080808000203F24022D30200000080843
:101B1000F8000000000020203F202000008080808E
:101B20008080808000203F20003F20003F80800098
:101B30008080800000203F210000203F20000080A6
:101B40008080800000001F202020201F0080800057
:101B5000808000000080FFA12020110E0000000006
:101B60008080808000000E112020A0FF8080808077
:101B7000008080800020203F2120000100000080A4
:101B80008080808000003324242424190000808079
:101B9000E0808000000000001F2020000080800006
:101BA0000000808000001F202020103F20808080C7
:101BB000000080808000010E300806010080800057
:101BC00080008080800F300C030C300F000080807C
:101BD00000808080000020312E0E31200080808027
:101BE000000080808080818E701806010000808057
:101BF00080808080000021302C22213000000000F5
:101C000000807C020200000000003F404000000015
:101C100000FF00000000000000FF000000000202C2
:101C20007C800000000040403F00000000000601F2
:101C30000102020404000000000000000020202037
:101C400020202020FF202020202020200000000035
:101C50000000000000000000000000000080804044
:101C600020100C0300030C102040808000000000B6
:101C70000000000000000000000000000000010162
:101C8000FD55555755555555FD0101000000000003
:101C900000000000000000000000000000809088AC
:101CA000454F55252525554D458080800000000075
:101CB00000000000000000000000000000101010F4
:101CC0001010FF1010F0101116D0101000000000BE
:101CD0000000000000000000000000000080402024
:101CE00018064120103F4442414040780000000067
:101CF000000000000000000000000000000010884C
:101D0000864040202F509008020408000000000088
:101D100000000000000000000000000000010100C1
:101D2000FF555555557F555555554100000000004C
:101D3000000000000000000000000000002424A4B7
:101D4000FEA3220022CC0000FF00000000000000E3
:101D50000000000000000000000000000008060174
:101D6000FF00010404040404FF020202000000005A
:101D70000000000000000000000000000010101033
:101D8000FF109008888888FF888888080000000075
:101D90000000000000000000000000000004448279
:101DA0007F01808040432C10284681800000000085
:101DB0000000000000000000000000000031393287
:101DC0002E3136382E3000524543563A74657374BE
:101DD0002D617070002B2B2B0041540D0A004F4BCE
:101DE0000041542B43574D4F44453D300D0A0041AF
:101DF000542B43574A41503D25732C25730D0A003F
:101E00002B43574A41503A312C0041542B434950FF
:101E10004D4F44453D310D0A0041542B4349505329
:101E2000544152543D5443502C3139322E313638BE
:101E30002E302E3232332C323334370D0A002B43FE
:101E4000495053544152543A310041542B43495064
:101E500053454E440D0A003A436F6E6E65637465D8
:101E6000640D0A0041542B43495053544152543D90
:101E70005544502C3139322E3136382E302E3134F3
:101E8000362C323334352C313131322C300D0A00BE
:101E900041542B4D515454434C45414E0D0A004181
:101EA000542B4D5154544C4F4E47434C49454E547E
:101EB00049443D57462D54455354320D0A00415470
:101EC0002B4D515454434F4E4E3D62726F6B6572B1
:101ED0002E656D71782E696F2C313838332C300DAA
:101EE0000A004D515454434F4E4E45435445443AD5
:101EF0000041542B4D5154545355423D74657374F5
:101F00002D6170702C300D0A0041542B4D515454EA
:101F10005055425241573D746573742D772C3332BE
:101F20002C302C300D0A004D5154545F436F6E6EAF
:101F300065637465640D0A0044582D534D41525435
:101F400000534D4152544036303100524543563AC9
:101F5000746573742D6170700041542B4D5154544D
:101F60005055425241573D746573742D772C33326E
:0A1F70002C302C300D0A004F4B00FE
: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.223,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.146,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-TCP协议应用
* 描述 : 该文件实现WF24和单片机数据透传。
***********************************************************************/
/*
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/13/2024 16:12:46 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/13/2024 16:12:46 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/13/2024 16:12:46 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/13/2024 16:12:46 PAGE 4
190
195 ;</h>
0009 020000 F 196 LJMP ?C_START
197
198 END
A51 MACRO ASSEMBLER STARTUP 08/13/2024 16:12:46 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/13/2024 16:12:46 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/13/2024 16:12:46 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/13/2024 16:12:46 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.146,2345,1112,0\r\n","+CIPSTART:1",3000)); //192.168.0.15
-0,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/13/2024 16:12:46 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 = 379 ----
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,89 @@
C51 COMPILER V9.60.7.0 MAIN 08/13/2024 16:12:46 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 #include <REGX52.H> // STC89C52RC的寄存器定义
2 #include "UART.h"
3 #include "string.h"
4 #include "stdio.h"
5 #include "oled.h"
6 extern unsigned int rxIndex;
7 extern unsigned char rxBuffer[ARRAY_SIZE];
8 extern unsigned int rx_flag;
9 unsigned int CONNECT_FLEG;//连接标志
10 // 主函数
11 unsigned char conver[64];
12 char *ptr = NULL;
13 void MQTT_CONVER(void);
14 void TCP_UDP_CONVER(void);
15 void main() {
16 1 Serial_Init(); // 初始化串口
17 1 OLED_Init();
18 1 CONNECT_TO_UDP("DX-SMART","SMART@601");
19 1 while (1) {
20 2
21 2 // 主循环,可以添加其他任务
22 2 TCP_UDP_CONVER();
23 2 }
24 1 }
25
26 void TCP_UDP_CONVER(void)
27 {
28 1 if (rx_flag)
29 1 {
30 2 UART_sentString(rxBuffer);
31 2 // CONNECT_TX_Control();
32 2 rxIndex = 0; // 重置索引,准备下一次接收
33 2 memset(rxBuffer,0,ARRAY_SIZE); //清空缓冲区
34 2 }
35 1 }
36 void MQTT_CONVER(void)
37 {
38 1 if (rx_flag)
39 1 {
40 2 if(strstr(rxBuffer,"RECV:test-app")!=NULL)
41 2 {
42 3 ptr = strrchr(rxBuffer,',');
43 3 memcpy(conver,ptr,*(ptr-1));
44 3 while(!WIFI_CheckAck("AT+MQTTPUBRAW=test-w,32,0,0\r\n","OK",2000)!=0);
45 3 buff_memset();//数据有误 清空
*** WARNING C206 IN LINE 45 OF ..\User\main.c: 'buff_memset': missing function-prototype
46 3 UART_sentString(conver);
47 3
48 3 }
49 2
50 2 }
51 1 }
52 void MQTT_CONTROL(void)
53 {
C51 COMPILER V9.60.7.0 MAIN 08/13/2024 16:12:46 PAGE 2
54 1 if (rx_flag)
55 1 {
56 2 CONNECT_TX_Control();
57 2 }
58 1 }
MODULE INFORMATION: STATIC OVERLAYABLE
CODE SIZE = 237 ----
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/13/2024 16:12:46 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/13/2024 16:12:46 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/13/2024 16:12:46 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/13/2024 16:12:46 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/13/2024 16:12:46 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>µVision 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\C52_TO_WF24\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(45): 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=383 const=2906 code=5152
creating hex file from ".\Objects\51Project"...
".\Objects\51Project" - 0 Error(s), 10 Warning(s).
Build Time Elapsed: 00:00:00
</pre>
</body>
</html>

View File

@@ -0,0 +1,505 @@
:10000000020F10AC07ED24B0FFE4FD121268EC54AF
:10001000F0C4540F4410FF121268EC540F4401FF57
:1000200002126802109AE508243BF582E43400F5D8
:1000300083E005082290003830070390003BE47508
:10004000F0011205CE0204812000E97F2ED200804B
:1000500018EF540F2490D43440D4FF30040BEF2415
:10006000BFB41A0050032461FFE5096002150905B9
:100070000CE50C7002050B30070E900038E475F0AB
:10008000011205CEEF0205A60212E27403D2078028
: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
:10061000A3A380DF900178E4F0A3F0A3F090006042
:10062000E07002A3E070030207AE9000E7E0700202
:10063000A3E070030207AB90004674FFF0A3741DA3
:10064000F0A374BDF07B017A0079A5120C5DE94A34
:100650004B70030206F17B017A0079A57D2C121004
:1006600020900178EBF0A3EAF0A3E9F01213C2EFB7
:1006700024FDFFEE34FFFEEF64014E60030207AB82
:10068000900178E0FBA3E0FAA3E0F99000011204E6
:100690009AFF3395E0FEEF24D0FFEE34FFFE900189
:1006A0007BF0A3EFF0EE60030207AEEF14B4070097
:1006B00040030207AE9006C375F003A4C58325F07E
:1006C000C583730206D80206DD0206E20206E502D1
:1006D00006E80206EB0206EEC2A50207ABD2A502AF
:1006E00007AB02079102079602079B0207A10207C8
:1006F000A790004674FFF0A3741DF0A374C7F07BAD
:10070000017A0079A5120C5DE94A4B70030207AB30
:100710007B017A0079A57D2C121020900178EBF0F6
:10072000A3EAF0A3E9F01213C2EF24FDFFEE34FFB9
:10073000FEEF64014E7074900178E0FBA3E0FAA331
:10074000E0F990000112049AFF3395E0FEEF24D007
:10075000FFEE34FFFE90017BF0A3EFF0EE704FEF61
:1007600014B40700504890077475F003A4C583259E
:10077000F0C5837302078902078D0207910207966D
:1007800002079B0207A10207A7C2A5801ED2A5806F
:100790001A12121580151212918010C2A6D2A780CB
:1007A0000AD2A6C2A78004C2A6C2A71213492290E9
:1007B0000121EBF0A3EAF0A3E9F090003B74FFF015
:1007C000A3741DF0A374DEF0A37403F0A374E8F027
:1007D0007BFF7A1E7990120BBAEF4E60DD120B9EF2
:1007E000EF4E60F990003B74FFF0A3741DF0A3740A
:1007F000DEF0A37407F0A374D0F07BFF7A1D79E1DB
:10080000120BBAEF4E60DD90003B74FFF0A3741D35
:10081000F0A374EFF0900121E0F9A3E0FAA3E090D7
:10082000003EC9F0A3EAF0A3E9F0900124E0F9A3A7
:10083000E0FAA3E0900041C9F0A3EAF0A3E9F07B5D
:10084000017A01792712008B90003B74FFF0A374AA
:100850001EF0A37400F0A37413F0A37488F07B015E
:100860007A017927120BBAEF4E60DD90003B74FFDE
:10087000F0A3741DF0A374DEF0A37403F0A374E876
:10088000F07BFF7A1E799F120BBAEF4E7F00700249
:100890007F01EF70D690003B74FFF0A3741EF0A3AD
:1008A00074E2F0A37407F0A374D0F07BFF7A1E7992
:1008B000BE120BBAEF4E7F0070027F01EF70D69030
:1008C000003B74FFF0A3741DF0A374DEF0A3740763
:1008D000F0A374D0F07BFF7A1E79F1120BBAEF4EC1
:1008E0007F0070027F01EF70D690003B74FFF0A391
:1008F000741DF0A374DEF0A37407F0A374D0F07B32
:10090000FF7A1F7909120BBAEF4E7F0070027F0148
:10091000EF70D67BFF7A1F79271213841213499048
:100920000060E4F0A304F0229000E9EBF0A3EAF009
:10093000A3E9F09000E9E0F9A3E0FAA3E090003B1E
:10094000C9F0A3EAF0A3E9F0A37405F0A374DCF006
:100950007BFF7A1D79D5120BBA120B9EEF4E60F910
:1009600090003B74FFF0A3741DF0A374DEF0A37439
:1009700007F0A374D0F07BFF7A1D79E1120BBAEF78
:100980004E60DD90003B74FFF0A3741DF0A374EF84
:10099000F09000E9E0F9A3E0FAA3E090003EC9F08E
:1009A000A3EAF0A3E9F09000ECE0F9A3E0FAA3E0F9
:1009B000900041C9F0A3EAF0A3E9F07B017A007945
:1009C000EF12008B90003B74FFF0A3741EF0A37431
:1009D00000F0A37413F0A37488F07B017A0079EF20
:1009E000120BBAEF4E60DD90003B74FFF0A3741D54
:1009F000F0A374DEF0A37403F0A374E8F07BFF7A35
:100A00001E790A120BBAEF4E7F0070027F01EF7061
:100A1000D690003B74FFF0A3741EF0A3743EF0A3C5
:100A2000740BF0A374B8F07BFF7A1E7919120BBA1D
:100A3000EF4E60DD90003B74FFF0A3741DF0A374D3
:100A4000DEF0A37403F0A374E8F07BFF7A1E794A0A
:100A5000120BBAEF4E60DD12137E900060E4F0A33B
:100A600004F022900000EBF0A3EAF0A3E9F090007C
:100A700000E0F9A3E0FAA3E090003BC9F0A3EAF09C
:100A8000A3E9F0A37405F0A374DCF07BFF7A1D7971
:100A9000D5120BBA120B9EEF4E60F990003B74FF1B
:100AA000F0A3741DF0A374DEF0A37407F0A374D058
:100AB000F07BFF7A1D79E1120BBAEF4E60DD9000FA
:100AC0003B74FFF0A3741DF0A374EFF0900000E0FE
:100AD000F9A3E0FAA3E090003EC9F0A3EAF0A3E98D
:100AE000F0900003E0F9A3E0FAA3E0900041C9F020
:100AF000A3EAF0A3E9F07B017A00790612008B905B
:100B0000003B74FFF0A3741EF0A37400F0A37413F1
:100B1000F0A37488F07B017A007906120BBAEF4ECD
:100B200060DD90003B74FFF0A3741DF0A374DEF051
:100B3000A37403F0A374E8F07BFF7A1E790A120B0A
:100B4000BAEF4E7F0070027F01EF70D690003B74C9
:100B5000FFF0A3741EF0A3743EF0A3740BF0A37413
:100B6000B8F07BFF7A1E7964120BBAEF4E60DD900D
:100B7000003B74FFF0A3741DF0A374DEF0A37403B4
:100B8000F0A374E8F07BFF7A1E794A120BBAEF4E9D
:100B900060DD12137E900060E4F0A304F022900068
:100BA0003B74FFF0A3741DF0A374DEF0A37403F094
:100BB000A374E8F07BFF7A1D79D9900038EBF0A39D
:100BC000EAF0A3E9F0900040E4F0A3F0A3F01213E0
:100BD00049900038E0FBA3E0FAA3E0F912138490F7
:100BE000003EE0FEA3E0FF7C007D0A12052E90008F
:100BF0003EEEF0A3EFF090003E74FFF5F0120564B6
:100C000045F060527F0A7E001213AD9000E7E0705D
:100C100004A3E0640170DF90003BE0F9A3E0FAA3D5
:100C2000E0900046C9F0A3EAF0A3E9F07B017A0066
:100C300079A5120C5D900040EBF0A3EAF0A3E9F077
:100C4000900040E0FBA3E0FAA3E04A4B60A8121337
:100C5000497E007F0122121349E4FEFF22900043E7
:100C6000EBF0A3EAF0A3E9F0A3E0FBA3E0FAA3E032
:100C7000F91204817003020D09900043E0FBA3E028
:100C8000FAA3E0F91204817003020D15900046E00A
:100C9000F9A3E0FAA3E0A3C9F0A3EAF0A3E9F09076
:100CA0000043A3E0FAA3E0F990004CEBF0A3EAF0D4
:100CB000A3E9F0900049E0FBA3E0FAA3E0F91204F5
:100CC00081FF602690004CE0FBA3E0FAA3E0F9125C
:100CD00004816F701590004A75F0011205B89000FC
:100CE0004DE475F0011205B880C9900049E0FBA3FE
:100CF000E0FAA3E0F91204817002800D900044E450
:100D000075F0011205B8020C79900043E0FBA3E0F6
:100D1000FAA3E0F9227B007A00790022D2A27F6454
:100D20007E00121364C2A27F647E00121364D2A2FA
:100D3000E4FD7FAE121268E4FF1212687F101212F7
:100D4000687F401212687F811212687FCF1212688A
:100D50007FA11212687FC81212687FA61212687FE4
:100D6000A81212687F3F1212687FD3121268E4FF44
:100D70001212687FD51212687F801212687FD91212
:100D800012687FF11212687FDA1212687F12121253
:100D9000687FDB1212687F401212687F201212688F
:100DA0007F021212687F8D1212687F141212687F00
:100DB000A41212687FA61212687FAF1212687FAF6A
:100DC000121268121291E4FDFF020003900163EF1A
:100DD000F0A3EDF0A3EAF0A3EBF0E490016BF09048
:100DE0000169F0900167E0FF900169E0FEC39F4058
:100DF00003020E7AC3EF9E14FD7F0A12132B90019B
:100E000065E0FCA3E0FDCFCDCFCECCCE1204D97CE3
:100E1000007D0A1204D990016AEDF0A3E0703090D1
:100E20000167E014FF900169E0FEC39F5021A3E039
:100E30007017900168E0C3138EF0A4FF900163E087
:100E40002FFFA3E0FD7B20802590016B7401F090C3
:100E50000168E0C313FFA3E0FEEF8EF0A4FF900152
:100E600063E02FFFA3E0FD90016AE02430FB121144
:100E70000A900169E004F0020DE3229000E7E070BF
:100E800002A3E07003020F0F90004674FFF0A374FA
:100E90001FF0A3744BF07B017A0079A5120C5DE979
:100EA0004A4B606B7B017A0079A57D2C1210209053
:100EB00000A2EBF0A3EAF0A3E9F090FFFF12049A7E
:100EC000FF3395E0FE78627C007D019000A2E0FB9C
:100ED000A3E0FAA3E0F912045B90003B74FFF0A3D7
:100EE000741FF0A37477F0A37407F0A374D0F07BA1
:100EF000FF7A1F7959120BBAEF4E7F0070027F0103
:100F0000EF70D61213497B017A00796212138422A2
:100F1000787FE4F6D8FD758121020F57021309E4AA
:100F200093A3F8E493A34003F68001F208DFF48072
:100F300029E493A3F85407240CC8C333C4540F44C2
:100F400020C8834004F456800146F6DFE4800B019C
:100F5000020408102040809013D7E47E019360BC07
:100F6000A3FF543F30E509541FFEE493A360010E34
:100F7000CF54C025E060A840B8E493A3FAE493A35B
:100F8000F8E493A3C8C582C8CAC583CAF0A3C8C57C
:100F900082C8CAC583CADFE9DEE780BE900159EF87
:100FA000F090015BEBF0E4900160F0A3F090015C45
:100FB000E0FF54077008EF131313541F800A9001C9
:100FC0005CE0131313541F04900162F0900162ED72
:100FD000F090015CE0FF900162E0FDC39F50409003
:100FE0000159E0FF120003E0FC90015BE0FFECC35D
:100FF0009F502490015DE0FBA3E0FAA3E0F9A3E495
:1010000075F00112056485F082F58312049AFF7D64
:10101000011212680C80D2900162E004F080B222CA
:10102000900172EBF0A3EAF0A3E9F0A3EBF0A3EADE
:10103000F0A3E9F0900175E0FBA3E0FAA3E0F91258
:101040000481600C900176E475F0011205B880E42B
:10105000900175E0FBA3E0FAA3E0F91204816D7042
:101060000122900172E0FBA3E0FAA3E0F9EBC0E0FB
:10107000EAC0E0E9C0E0A3E0FBA374FFF5F01205CD
:1010800064FAD082D083D0E06B7009E5F06582709D
:1010900003EA658370BAFBFAF922C0E0C0F0C083AE
:1010A000C082C0D075D000C000C006C007309849CB
:1010B000C2989000E5E475F001120564FE74A52560
:1010C000F0F58274003EF583E599F09000E5E0FECE
:1010D000A3E0FF24A4F58274003EF583E0B40A087F
:1010E0009000E7E4F0A304F0EF64404E700B900032
:1010F000E5F0A3F0A3F0A304F0D007D006D000D011
:10110000D0D082D083D0F0D0E032AA07A905AF03B7
:10111000E4FCEF24E0FBEAD3947F4004E4FA0909FD
:10112000AF02AD01120003E4FC75F010EBA42CF546
:1011300082E435F0F583E582244DF582E5833416AB
:101140001212610CECB408E1AF02E904FD120003D5
:10115000E4FC75F010EBA42CF582E435F0F583E5A2
:10116000822455F582E58334161212610CECB40822
:10117000E12290016CEFF0A3EDF0A3EBF0A3EAF015
:10118000A3E9F0E4A3F090016EE0FBA3E0FAA3E092
:10119000F9A3E0F58275830012049AFB60279001A1
:1011A0006CE0FFA3E0FD12110A90016CE02408F04E
:1011B000E0D394784007E4F0A3E02402F0900171BA
:1011C000E004F080C122A907AA05E490017EF01294
:1011D0000003E4FC75F040EBA4243DF582E5F03417
:1011E0001C12125790017EE004F00CECB410E5AF35
:1011F00001EA04FD120003E4FC75F040EBA4245D59
:10120000F582E5F0341C12125790017EE004F00CD8
:10121000ECB410E522E4FBFD7F101211C67B01E463
:10122000FD7F201211C67B02E4FD7F301211C67BC8
:1012300003E4FD7F401211C67B04E4FD7F501211D0
:10124000C67B05E4FD7F601211C67BFF7A1479200E
:101250007D027F20021172F583E5822CF582E43550
:1012600083F583E493FF7D01ED6004D2A38002C285
:10127000A3C2A4E4FEC2A0EF30E704D2A18002C260
:10128000A1D2A0EF25E0FF0EEEB408E9D2A4D2A3CC
:1012900022E4FCEC24B0FFE4FD121268E4FF121219
:1012A000687F10121268E4FB7D01E4FF1212680BE4
:1012B000EBB480F40CECB408DA229000E7E07002A2
:1012C000A3E0601D7B017A0079A5121384E49000ED
:1012D000E5F0A3F0FE7F40FD7B017A0079A51205C1
:1012E0007A22EFB40A07740D1212ED740A309811C5
:1012F000A899B8130CC2983098FDA899C298B81153
:10130000F63099FDC299F59922121397120D1C908F
:10131000000374FFF0A3741FF0A37441F07BFF7A05
:101320001F7938120A631212BA80FB90017DEFF028
:10133000A9057F017E00AD0119ED600C90017DE0F3
:10134000FD7C001204C780EE227E007F407D007B82
:10135000017A0079A512057AE49000E5F0A3F0A3E4
:10136000F0A3F022EF4E60157D087C07ED1DAA0466
:1013700070011C4A70F6EF1F70EA1E80E7227BFFA7
:101380007A1E7957120481FF600C12141874012917
:10139000F9E43AFA80EE2275985053890F43892078
:1013A000758BFD758DFDD28ED2ACD2AF22EF1FAC06
:1013B0000670011E4C600A7D027CEFDCFEDDFC80C5
:1013C000EC22E4FFFE120481600C0FEF70010E09A5
:1013D000E970F20A80EF224300A20000004200E51B
:1013E00000004200E7000000E4FD7F8D1212687FDC
:1013F000141212687FAF021268E4FD7F8D1212682A
:101400007F101212687FAE0212689000E7E070024F
:10141000A3E06003120614228F993099FDC299222D
:1014200057463234000000000000000000002F008A
:101430000000000700070000147F147F1400242A16
:101440007F2A120062640813230036495522500097
:10145000000503000000001C224100000041221C86
:10146000000014083E08140008083E0808000000A8
:10147000A060000008080808080000606000000084
:101480002010080402003E5149453E0000427F40C2
:1014900000004261514946002141454B310018147A
:1014A000127F10002745454539003C4A4949300024
:1014B00001710905030036494949360006494929A1
:1014C0001E000036360000000056360000000814EA
:1014D00022410000141414141400004122140800C6
:1014E000020151090600324959513E007C12111285
:1014F0007C007F49494936003E41414122007F41FD
:1015000041221C007F49494941007F090909010026
:101510003E4149497A007F0808087F0000417F4129
:1015200000002040413F01007F08142241007F401D
:10153000404040007F020C027F007F0408107F00C3
:101540003E4141413E007F09090906003E415121CB
:101550005E007F09192946004649494931000101C9
:101560007F0101003F4040403F001F2040201F00FE
:101570003F4038403F0063140814630007087008B8
:101580000700615149454300007F41410000552A51
:10159000552A55000041417F000004020102040069
:1015A00040404040400000010204000020545454D8
:1015B00078007F484444380038444444200038448C
:1015C00044487F00385454541800087E0901020032
:1015D00018A4A4A47C007F080404780000447D4083
:1015E00000004080847D00007F10284400000041FE
:1015F0007F4000007C04180478007C080404780014
:10160000384444443800FC242424180018242418A6
:10161000FC007C0804040800485454542000043F93
:10162000444020003C4040207C001C2040201C0006
:101630003C4030403C004428102844001CA0A0A09E
:101640007C004464544C441414141414140000001A
:10165000000000000000000000000000000000008A
:10166000F800000000000000333000000000100C03
:1016700006100C0600000000000000000040C078CA
:1016800040C0784000043F04043F04040000708818
:10169000FC08300000001820FF211E0000F008F0B8
:1016A00000E018000000211C031E211E0000F008AD
:1016B00088700000001E2123241927211010160E07
:1016C000000000000000000000000000000000001A
:1016D000E018040200000000071820400000020487
:1016E00018E0000000004020180700000040408083
:1016F000F0804040000202010F01020200000000E1
:10170000F0000000000101011F01010100000000C4
:10171000000000000080B070000000000000000029
:1017200000000000000001010101010101000000B2
:101730000000000000003030000000000000000049
:101740000080601804006018060100000000E0102E
:10175000080810E000000F102020100F00001010EB
:10176000F8000000000020203F202000000070084A
:10177000080888700000302824222130000030083A
:1017800088884830000018202020110E000000C07A
:101790002010F8000000070424243F240000F8086B
:1017A00088880808000019212020110E0000E01090
:1017B0008888180000000F112020110E0000380842
:1017C00008C83808000000003F00000000007088D2
:1017D0000808887000001C222121221C0000E01053
:1017E000080810E0000000312222110F0000000064
:1017F000C0C0000000000000303000000000000009
:1018000080000000000000806000000000000080F8
:101810004020100800000102040810200040404051
:101820004040404000040404040404040000081084
:1018300020408000000020100804020100007048D1
:10184000080808F0000000003036010000C030C871
:1018500028E810E0000718272423140B000000C01C
:1018600038E0000000203C23020227382008F888D6
:101870008888700000203F202020110E00C0300812
:101880000808083800071820202010080008F80869
:10189000080810E000203F202020100F0008F888E2
:1018A00088E8081000203F20202320180008F8882E
:1018B00088E8081000203F200003000000C0300826
:1018C000080838000007182020221E020008F80827
:1018D000000008F808203F210101213F20000808EE
:1018E000F8080800000020203F2020000000000829
:1018F00008F8080800C08080807F00000008F88891
:10190000C028180800203F20012638200008F808C9
:101910000000000000203F20202020300008F8F8C0
:1019200000F8F80800203F003F003F200008F83092
:10193000C00008F808203F200007183F00E010080A
:10194000080810E0000F10202020100F0008F808F1
:10195000080808F000203F210101010000E0100804
:10196000080810E0000F18242438504F0008F888A9
:101970008888887000203F2000030C302000708889
:1019800008080838000038202121221C0018080807
:10199000F8080818000000203F2000000008F808A0
:1019A000000008F808001F202020201F0008788869
:1019B0000000C83808000007380E010000F80800D1
:1019C000F80008F800033C0700073C03000818680B
:1019D000808068180820302C03032C30200838C879
:1019E00000C83808000000203F2000000010080850
:1019F00008C83808002038262120201800000000E0
:101A0000FE020202000000007F40404000000C3057
:101A1000C000000000000000010638C00000020203
:101A200002FE000000004040407F00000000000473
:101A3000020202040000000000000000000000009C
:101A40000000000000808080808080808000020292
:101A50000400000000000000000000000000008002
:101A600080808000000019242222223F2008F800F4
:101A70008080000000003F112020110E00000000B7
:101A80008080800000000E11202020110000000046
:101A9000808088F800000E112020103F2000008078
:101AA0008080800000001F222222221300008080FC
:101AB000F0888888180020203F2020000000008047
:101AC0008080808000006B94949493600008F800FC
:101AD0008080800000203F210000203F200080986F
:101AE00098000000000020203F202000000000009F
:101AF000809898000000C08080807F000008F80077
:101B00000080808000203F24022D30200000080843
:101B1000F8000000000020203F202000008080808E
:101B20008080808000203F20003F20003F80800098
:101B30008080800000203F210000203F20000080A6
:101B40008080800000001F202020201F0080800057
:101B5000808000000080FFA12020110E0000000006
:101B60008080808000000E112020A0FF8080808077
:101B7000008080800020203F2120000100000080A4
:101B80008080808000003324242424190000808079
:101B9000E0808000000000001F2020000080800006
:101BA0000000808000001F202020103F20808080C7
:101BB000000080808000010E300806010080800057
:101BC00080008080800F300C030C300F000080807C
:101BD00000808080000020312E0E31200080808027
:101BE000000080808080818E701806010000808057
:101BF00080808080000021302C22213000000000F5
:101C000000807C020200000000003F404000000015
:101C100000FF00000000000000FF000000000202C2
:101C20007C800000000040403F00000000000601F2
:101C30000102020404000000000000000020202037
:101C400020202020FF202020202020200000000035
:101C50000000000000000000000000000080804044
:101C600020100C0300030C102040808000000000B6
:101C70000000000000000000000000000000010162
:101C8000FD55555755555555FD0101000000000003
:101C900000000000000000000000000000809088AC
:101CA000454F55252525554D458080800000000075
:101CB00000000000000000000000000000101010F4
:101CC0001010FF1010F0101116D0101000000000BE
:101CD0000000000000000000000000000080402024
:101CE00018064120103F4442414040780000000067
:101CF000000000000000000000000000000010884C
:101D0000864040202F509008020408000000000088
:101D100000000000000000000000000000010100C1
:101D2000FF555555557F555555554100000000004C
:101D3000000000000000000000000000002424A4B7
:101D4000FEA3220022CC0000FF00000000000000E3
:101D50000000000000000000000000000008060174
:101D6000FF00010404040404FF020202000000005A
:101D70000000000000000000000000000010101033
:101D8000FF109008888888FF888888080000000075
:101D90000000000000000000000000000004448279
:101DA0007F01808040432C10284681800000000085
:101DB0000000000000000000000000000031393287
:101DC0002E3136382E3000524543563A74657374BE
:101DD0002D617070002B2B2B0041540D0A004F4BCE
:101DE0000041542B43574D4F44453D300D0A0041AF
:101DF000542B43574A41503D25732C25730D0A003F
:101E00002B43574A41503A312C0041542B434950FF
:101E10004D4F44453D310D0A0041542B4349505329
:101E2000544152543D5443502C3139322E313638BE
:101E30002E302E3134362C323334370D0A002B43FA
:101E4000495053544152543A310041542B43495064
:101E500053454E440D0A003A436F6E6E65637465D8
:101E6000640D0A0041542B43495053544152543D90
:101E70005544502C3139322E3136382E302E3134F3
:101E8000362C323334352C313131322C300D0A00BE
:101E900041542B4D515454434C45414E0D0A004181
:101EA000542B4D5154544C4F4E47434C49454E547E
:101EB00049443D57462D54455354320D0A00415470
:101EC0002B4D515454434F4E4E3D62726F6B6572B1
:101ED0002E656D71782E696F2C313838332C300DAA
:101EE0000A004D515454434F4E4E45435445443AD5
:101EF0000041542B4D5154545355423D74657374F5
:101F00002D6170702C300D0A0041542B4D515454EA
:101F10005055425241573D746573742D772C3332BE
:101F20002C302C300D0A004D5154545F436F6E6EAF
:101F300065637465640D0A0044582D534D41525435
:101F400000534D4152544036303100524543563AC9
:101F5000746573742D6170700041542B4D5154544D
:101F60005055425241573D746573742D772C33326E
:0A1F70002C302C300D0A004F4B00FE
: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.146,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和单片机数据透传。
***********************************************************************/
/*
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 */
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/

View File

@@ -0,0 +1,437 @@
/**
******************************************************************************
* @file stm32f10x_dma.h
* @author MCD Application Team
* @version V3.6.2
* @date 17-September-2021
* @brief This file contains all the functions prototypes for the DMA 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_DMA_H
#define __STM32F10x_DMA_H
#ifdef __cplusplus
extern "C" {
#endif
/* Includes ------------------------------------------------------------------*/
#include "stm32f10x.h"
/** @addtogroup STM32F10x_StdPeriph_Driver
* @{
*/
/** @addtogroup DMA
* @{
*/
/** @defgroup DMA_Exported_Types
* @{
*/
/**
* @brief DMA Init structure definition
*/
typedef struct
{
uint32_t DMA_PeripheralBaseAddr; /*!< Specifies the peripheral base address for DMAy Channelx. */
uint32_t DMA_MemoryBaseAddr; /*!< Specifies the memory base address for DMAy Channelx. */
uint32_t DMA_DIR; /*!< Specifies if the peripheral is the source or destination.
This parameter can be a value of @ref DMA_data_transfer_direction */
uint32_t DMA_BufferSize; /*!< Specifies the buffer size, in data unit, of the specified Channel.
The data unit is equal to the configuration set in DMA_PeripheralDataSize
or DMA_MemoryDataSize members depending in the transfer direction. */
uint32_t DMA_PeripheralInc; /*!< Specifies whether the Peripheral address register is incremented or not.
This parameter can be a value of @ref DMA_peripheral_incremented_mode */
uint32_t DMA_MemoryInc; /*!< Specifies whether the memory address register is incremented or not.
This parameter can be a value of @ref DMA_memory_incremented_mode */
uint32_t DMA_PeripheralDataSize; /*!< Specifies the Peripheral data width.
This parameter can be a value of @ref DMA_peripheral_data_size */
uint32_t DMA_MemoryDataSize; /*!< Specifies the Memory data width.
This parameter can be a value of @ref DMA_memory_data_size */
uint32_t DMA_Mode; /*!< Specifies the operation mode of the DMAy Channelx.
This parameter can be a value of @ref DMA_circular_normal_mode.
@note: The circular buffer mode cannot be used if the memory-to-memory
data transfer is configured on the selected Channel */
uint32_t DMA_Priority; /*!< Specifies the software priority for the DMAy Channelx.
This parameter can be a value of @ref DMA_priority_level */
uint32_t DMA_M2M; /*!< Specifies if the DMAy Channelx will be used in memory-to-memory transfer.
This parameter can be a value of @ref DMA_memory_to_memory */
}DMA_InitTypeDef;
/**
* @}
*/
/** @defgroup DMA_Exported_Constants
* @{
*/
#define IS_DMA_ALL_PERIPH(PERIPH) (((PERIPH) == DMA1_Channel1) || \
((PERIPH) == DMA1_Channel2) || \
((PERIPH) == DMA1_Channel3) || \
((PERIPH) == DMA1_Channel4) || \
((PERIPH) == DMA1_Channel5) || \
((PERIPH) == DMA1_Channel6) || \
((PERIPH) == DMA1_Channel7) || \
((PERIPH) == DMA2_Channel1) || \
((PERIPH) == DMA2_Channel2) || \
((PERIPH) == DMA2_Channel3) || \
((PERIPH) == DMA2_Channel4) || \
((PERIPH) == DMA2_Channel5))
/** @defgroup DMA_data_transfer_direction
* @{
*/
#define DMA_DIR_PeripheralDST ((uint32_t)0x00000010)
#define DMA_DIR_PeripheralSRC ((uint32_t)0x00000000)
#define IS_DMA_DIR(DIR) (((DIR) == DMA_DIR_PeripheralDST) || \
((DIR) == DMA_DIR_PeripheralSRC))
/**
* @}
*/
/** @defgroup DMA_peripheral_incremented_mode
* @{
*/
#define DMA_PeripheralInc_Enable ((uint32_t)0x00000040)
#define DMA_PeripheralInc_Disable ((uint32_t)0x00000000)
#define IS_DMA_PERIPHERAL_INC_STATE(STATE) (((STATE) == DMA_PeripheralInc_Enable) || \
((STATE) == DMA_PeripheralInc_Disable))
/**
* @}
*/
/** @defgroup DMA_memory_incremented_mode
* @{
*/
#define DMA_MemoryInc_Enable ((uint32_t)0x00000080)
#define DMA_MemoryInc_Disable ((uint32_t)0x00000000)
#define IS_DMA_MEMORY_INC_STATE(STATE) (((STATE) == DMA_MemoryInc_Enable) || \
((STATE) == DMA_MemoryInc_Disable))
/**
* @}
*/
/** @defgroup DMA_peripheral_data_size
* @{
*/
#define DMA_PeripheralDataSize_Byte ((uint32_t)0x00000000)
#define DMA_PeripheralDataSize_HalfWord ((uint32_t)0x00000100)
#define DMA_PeripheralDataSize_Word ((uint32_t)0x00000200)
#define IS_DMA_PERIPHERAL_DATA_SIZE(SIZE) (((SIZE) == DMA_PeripheralDataSize_Byte) || \
((SIZE) == DMA_PeripheralDataSize_HalfWord) || \
((SIZE) == DMA_PeripheralDataSize_Word))
/**
* @}
*/
/** @defgroup DMA_memory_data_size
* @{
*/
#define DMA_MemoryDataSize_Byte ((uint32_t)0x00000000)
#define DMA_MemoryDataSize_HalfWord ((uint32_t)0x00000400)
#define DMA_MemoryDataSize_Word ((uint32_t)0x00000800)
#define IS_DMA_MEMORY_DATA_SIZE(SIZE) (((SIZE) == DMA_MemoryDataSize_Byte) || \
((SIZE) == DMA_MemoryDataSize_HalfWord) || \
((SIZE) == DMA_MemoryDataSize_Word))
/**
* @}
*/
/** @defgroup DMA_circular_normal_mode
* @{
*/
#define DMA_Mode_Circular ((uint32_t)0x00000020)
#define DMA_Mode_Normal ((uint32_t)0x00000000)
#define IS_DMA_MODE(MODE) (((MODE) == DMA_Mode_Circular) || ((MODE) == DMA_Mode_Normal))
/**
* @}
*/
/** @defgroup DMA_priority_level
* @{
*/
#define DMA_Priority_VeryHigh ((uint32_t)0x00003000)
#define DMA_Priority_High ((uint32_t)0x00002000)
#define DMA_Priority_Medium ((uint32_t)0x00001000)
#define DMA_Priority_Low ((uint32_t)0x00000000)
#define IS_DMA_PRIORITY(PRIORITY) (((PRIORITY) == DMA_Priority_VeryHigh) || \
((PRIORITY) == DMA_Priority_High) || \
((PRIORITY) == DMA_Priority_Medium) || \
((PRIORITY) == DMA_Priority_Low))
/**
* @}
*/
/** @defgroup DMA_memory_to_memory
* @{
*/
#define DMA_M2M_Enable ((uint32_t)0x00004000)
#define DMA_M2M_Disable ((uint32_t)0x00000000)
#define IS_DMA_M2M_STATE(STATE) (((STATE) == DMA_M2M_Enable) || ((STATE) == DMA_M2M_Disable))
/**
* @}
*/
/** @defgroup DMA_interrupts_definition
* @{
*/
#define DMA_IT_TC ((uint32_t)0x00000002)
#define DMA_IT_HT ((uint32_t)0x00000004)
#define DMA_IT_TE ((uint32_t)0x00000008)
#define IS_DMA_CONFIG_IT(IT) ((((IT) & 0xFFFFFFF1) == 0x00) && ((IT) != 0x00))
#define DMA1_IT_GL1 ((uint32_t)0x00000001)
#define DMA1_IT_TC1 ((uint32_t)0x00000002)
#define DMA1_IT_HT1 ((uint32_t)0x00000004)
#define DMA1_IT_TE1 ((uint32_t)0x00000008)
#define DMA1_IT_GL2 ((uint32_t)0x00000010)
#define DMA1_IT_TC2 ((uint32_t)0x00000020)
#define DMA1_IT_HT2 ((uint32_t)0x00000040)
#define DMA1_IT_TE2 ((uint32_t)0x00000080)
#define DMA1_IT_GL3 ((uint32_t)0x00000100)
#define DMA1_IT_TC3 ((uint32_t)0x00000200)
#define DMA1_IT_HT3 ((uint32_t)0x00000400)
#define DMA1_IT_TE3 ((uint32_t)0x00000800)
#define DMA1_IT_GL4 ((uint32_t)0x00001000)
#define DMA1_IT_TC4 ((uint32_t)0x00002000)
#define DMA1_IT_HT4 ((uint32_t)0x00004000)
#define DMA1_IT_TE4 ((uint32_t)0x00008000)
#define DMA1_IT_GL5 ((uint32_t)0x00010000)
#define DMA1_IT_TC5 ((uint32_t)0x00020000)
#define DMA1_IT_HT5 ((uint32_t)0x00040000)
#define DMA1_IT_TE5 ((uint32_t)0x00080000)
#define DMA1_IT_GL6 ((uint32_t)0x00100000)
#define DMA1_IT_TC6 ((uint32_t)0x00200000)
#define DMA1_IT_HT6 ((uint32_t)0x00400000)
#define DMA1_IT_TE6 ((uint32_t)0x00800000)
#define DMA1_IT_GL7 ((uint32_t)0x01000000)
#define DMA1_IT_TC7 ((uint32_t)0x02000000)
#define DMA1_IT_HT7 ((uint32_t)0x04000000)
#define DMA1_IT_TE7 ((uint32_t)0x08000000)
#define DMA2_IT_GL1 ((uint32_t)0x10000001)
#define DMA2_IT_TC1 ((uint32_t)0x10000002)
#define DMA2_IT_HT1 ((uint32_t)0x10000004)
#define DMA2_IT_TE1 ((uint32_t)0x10000008)
#define DMA2_IT_GL2 ((uint32_t)0x10000010)
#define DMA2_IT_TC2 ((uint32_t)0x10000020)
#define DMA2_IT_HT2 ((uint32_t)0x10000040)
#define DMA2_IT_TE2 ((uint32_t)0x10000080)
#define DMA2_IT_GL3 ((uint32_t)0x10000100)
#define DMA2_IT_TC3 ((uint32_t)0x10000200)
#define DMA2_IT_HT3 ((uint32_t)0x10000400)
#define DMA2_IT_TE3 ((uint32_t)0x10000800)
#define DMA2_IT_GL4 ((uint32_t)0x10001000)
#define DMA2_IT_TC4 ((uint32_t)0x10002000)
#define DMA2_IT_HT4 ((uint32_t)0x10004000)
#define DMA2_IT_TE4 ((uint32_t)0x10008000)
#define DMA2_IT_GL5 ((uint32_t)0x10010000)
#define DMA2_IT_TC5 ((uint32_t)0x10020000)
#define DMA2_IT_HT5 ((uint32_t)0x10040000)
#define DMA2_IT_TE5 ((uint32_t)0x10080000)
#define IS_DMA_CLEAR_IT(IT) (((((IT) & 0xF0000000) == 0x00) || (((IT) & 0xEFF00000) == 0x00)) && ((IT) != 0x00))
#define IS_DMA_GET_IT(IT) (((IT) == DMA1_IT_GL1) || ((IT) == DMA1_IT_TC1) || \
((IT) == DMA1_IT_HT1) || ((IT) == DMA1_IT_TE1) || \
((IT) == DMA1_IT_GL2) || ((IT) == DMA1_IT_TC2) || \
((IT) == DMA1_IT_HT2) || ((IT) == DMA1_IT_TE2) || \
((IT) == DMA1_IT_GL3) || ((IT) == DMA1_IT_TC3) || \
((IT) == DMA1_IT_HT3) || ((IT) == DMA1_IT_TE3) || \
((IT) == DMA1_IT_GL4) || ((IT) == DMA1_IT_TC4) || \
((IT) == DMA1_IT_HT4) || ((IT) == DMA1_IT_TE4) || \
((IT) == DMA1_IT_GL5) || ((IT) == DMA1_IT_TC5) || \
((IT) == DMA1_IT_HT5) || ((IT) == DMA1_IT_TE5) || \
((IT) == DMA1_IT_GL6) || ((IT) == DMA1_IT_TC6) || \
((IT) == DMA1_IT_HT6) || ((IT) == DMA1_IT_TE6) || \
((IT) == DMA1_IT_GL7) || ((IT) == DMA1_IT_TC7) || \
((IT) == DMA1_IT_HT7) || ((IT) == DMA1_IT_TE7) || \
((IT) == DMA2_IT_GL1) || ((IT) == DMA2_IT_TC1) || \
((IT) == DMA2_IT_HT1) || ((IT) == DMA2_IT_TE1) || \
((IT) == DMA2_IT_GL2) || ((IT) == DMA2_IT_TC2) || \
((IT) == DMA2_IT_HT2) || ((IT) == DMA2_IT_TE2) || \
((IT) == DMA2_IT_GL3) || ((IT) == DMA2_IT_TC3) || \
((IT) == DMA2_IT_HT3) || ((IT) == DMA2_IT_TE3) || \
((IT) == DMA2_IT_GL4) || ((IT) == DMA2_IT_TC4) || \
((IT) == DMA2_IT_HT4) || ((IT) == DMA2_IT_TE4) || \
((IT) == DMA2_IT_GL5) || ((IT) == DMA2_IT_TC5) || \
((IT) == DMA2_IT_HT5) || ((IT) == DMA2_IT_TE5))
/**
* @}
*/
/** @defgroup DMA_flags_definition
* @{
*/
#define DMA1_FLAG_GL1 ((uint32_t)0x00000001)
#define DMA1_FLAG_TC1 ((uint32_t)0x00000002)
#define DMA1_FLAG_HT1 ((uint32_t)0x00000004)
#define DMA1_FLAG_TE1 ((uint32_t)0x00000008)
#define DMA1_FLAG_GL2 ((uint32_t)0x00000010)
#define DMA1_FLAG_TC2 ((uint32_t)0x00000020)
#define DMA1_FLAG_HT2 ((uint32_t)0x00000040)
#define DMA1_FLAG_TE2 ((uint32_t)0x00000080)
#define DMA1_FLAG_GL3 ((uint32_t)0x00000100)
#define DMA1_FLAG_TC3 ((uint32_t)0x00000200)
#define DMA1_FLAG_HT3 ((uint32_t)0x00000400)
#define DMA1_FLAG_TE3 ((uint32_t)0x00000800)
#define DMA1_FLAG_GL4 ((uint32_t)0x00001000)
#define DMA1_FLAG_TC4 ((uint32_t)0x00002000)
#define DMA1_FLAG_HT4 ((uint32_t)0x00004000)
#define DMA1_FLAG_TE4 ((uint32_t)0x00008000)
#define DMA1_FLAG_GL5 ((uint32_t)0x00010000)
#define DMA1_FLAG_TC5 ((uint32_t)0x00020000)
#define DMA1_FLAG_HT5 ((uint32_t)0x00040000)
#define DMA1_FLAG_TE5 ((uint32_t)0x00080000)
#define DMA1_FLAG_GL6 ((uint32_t)0x00100000)
#define DMA1_FLAG_TC6 ((uint32_t)0x00200000)
#define DMA1_FLAG_HT6 ((uint32_t)0x00400000)
#define DMA1_FLAG_TE6 ((uint32_t)0x00800000)
#define DMA1_FLAG_GL7 ((uint32_t)0x01000000)
#define DMA1_FLAG_TC7 ((uint32_t)0x02000000)
#define DMA1_FLAG_HT7 ((uint32_t)0x04000000)
#define DMA1_FLAG_TE7 ((uint32_t)0x08000000)
#define DMA2_FLAG_GL1 ((uint32_t)0x10000001)
#define DMA2_FLAG_TC1 ((uint32_t)0x10000002)
#define DMA2_FLAG_HT1 ((uint32_t)0x10000004)
#define DMA2_FLAG_TE1 ((uint32_t)0x10000008)
#define DMA2_FLAG_GL2 ((uint32_t)0x10000010)
#define DMA2_FLAG_TC2 ((uint32_t)0x10000020)
#define DMA2_FLAG_HT2 ((uint32_t)0x10000040)
#define DMA2_FLAG_TE2 ((uint32_t)0x10000080)
#define DMA2_FLAG_GL3 ((uint32_t)0x10000100)
#define DMA2_FLAG_TC3 ((uint32_t)0x10000200)
#define DMA2_FLAG_HT3 ((uint32_t)0x10000400)
#define DMA2_FLAG_TE3 ((uint32_t)0x10000800)
#define DMA2_FLAG_GL4 ((uint32_t)0x10001000)
#define DMA2_FLAG_TC4 ((uint32_t)0x10002000)
#define DMA2_FLAG_HT4 ((uint32_t)0x10004000)
#define DMA2_FLAG_TE4 ((uint32_t)0x10008000)
#define DMA2_FLAG_GL5 ((uint32_t)0x10010000)
#define DMA2_FLAG_TC5 ((uint32_t)0x10020000)
#define DMA2_FLAG_HT5 ((uint32_t)0x10040000)
#define DMA2_FLAG_TE5 ((uint32_t)0x10080000)
#define IS_DMA_CLEAR_FLAG(FLAG) (((((FLAG) & 0xF0000000) == 0x00) || (((FLAG) & 0xEFF00000) == 0x00)) && ((FLAG) != 0x00))
#define IS_DMA_GET_FLAG(FLAG) (((FLAG) == DMA1_FLAG_GL1) || ((FLAG) == DMA1_FLAG_TC1) || \
((FLAG) == DMA1_FLAG_HT1) || ((FLAG) == DMA1_FLAG_TE1) || \
((FLAG) == DMA1_FLAG_GL2) || ((FLAG) == DMA1_FLAG_TC2) || \
((FLAG) == DMA1_FLAG_HT2) || ((FLAG) == DMA1_FLAG_TE2) || \
((FLAG) == DMA1_FLAG_GL3) || ((FLAG) == DMA1_FLAG_TC3) || \
((FLAG) == DMA1_FLAG_HT3) || ((FLAG) == DMA1_FLAG_TE3) || \
((FLAG) == DMA1_FLAG_GL4) || ((FLAG) == DMA1_FLAG_TC4) || \
((FLAG) == DMA1_FLAG_HT4) || ((FLAG) == DMA1_FLAG_TE4) || \
((FLAG) == DMA1_FLAG_GL5) || ((FLAG) == DMA1_FLAG_TC5) || \
((FLAG) == DMA1_FLAG_HT5) || ((FLAG) == DMA1_FLAG_TE5) || \
((FLAG) == DMA1_FLAG_GL6) || ((FLAG) == DMA1_FLAG_TC6) || \
((FLAG) == DMA1_FLAG_HT6) || ((FLAG) == DMA1_FLAG_TE6) || \
((FLAG) == DMA1_FLAG_GL7) || ((FLAG) == DMA1_FLAG_TC7) || \
((FLAG) == DMA1_FLAG_HT7) || ((FLAG) == DMA1_FLAG_TE7) || \
((FLAG) == DMA2_FLAG_GL1) || ((FLAG) == DMA2_FLAG_TC1) || \
((FLAG) == DMA2_FLAG_HT1) || ((FLAG) == DMA2_FLAG_TE1) || \
((FLAG) == DMA2_FLAG_GL2) || ((FLAG) == DMA2_FLAG_TC2) || \
((FLAG) == DMA2_FLAG_HT2) || ((FLAG) == DMA2_FLAG_TE2) || \
((FLAG) == DMA2_FLAG_GL3) || ((FLAG) == DMA2_FLAG_TC3) || \
((FLAG) == DMA2_FLAG_HT3) || ((FLAG) == DMA2_FLAG_TE3) || \
((FLAG) == DMA2_FLAG_GL4) || ((FLAG) == DMA2_FLAG_TC4) || \
((FLAG) == DMA2_FLAG_HT4) || ((FLAG) == DMA2_FLAG_TE4) || \
((FLAG) == DMA2_FLAG_GL5) || ((FLAG) == DMA2_FLAG_TC5) || \
((FLAG) == DMA2_FLAG_HT5) || ((FLAG) == DMA2_FLAG_TE5))
/**
* @}
*/
/** @defgroup DMA_Buffer_Size
* @{
*/
#define IS_DMA_BUFFER_SIZE(SIZE) (((SIZE) >= 0x1) && ((SIZE) < 0x10000))
/**
* @}
*/
/**
* @}
*/
/** @defgroup DMA_Exported_Macros
* @{
*/
/**
* @}
*/
/** @defgroup DMA_Exported_Functions
* @{
*/
void DMA_DeInit(DMA_Channel_TypeDef* DMAy_Channelx);
void DMA_Init(DMA_Channel_TypeDef* DMAy_Channelx, DMA_InitTypeDef* DMA_InitStruct);
void DMA_StructInit(DMA_InitTypeDef* DMA_InitStruct);
void DMA_Cmd(DMA_Channel_TypeDef* DMAy_Channelx, FunctionalState NewState);
void DMA_ITConfig(DMA_Channel_TypeDef* DMAy_Channelx, uint32_t DMA_IT, FunctionalState NewState);
void DMA_SetCurrDataCounter(DMA_Channel_TypeDef* DMAy_Channelx, uint16_t DataNumber);
uint16_t DMA_GetCurrDataCounter(DMA_Channel_TypeDef* DMAy_Channelx);
FlagStatus DMA_GetFlagStatus(uint32_t DMAy_FLAG);
void DMA_ClearFlag(uint32_t DMAy_FLAG);
ITStatus DMA_GetITStatus(uint32_t DMAy_IT);
void DMA_ClearITPendingBit(uint32_t DMAy_IT);
#ifdef __cplusplus
}
#endif
#endif /*__STM32F10x_DMA_H */
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/

View File

@@ -0,0 +1,182 @@
/**
******************************************************************************
* @file stm32f10x_exti.h
* @author MCD Application Team
* @version V3.6.2
* @date 17-September-2021
* @brief This file contains all the functions prototypes for the EXTI 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_EXTI_H
#define __STM32F10x_EXTI_H
#ifdef __cplusplus
extern "C" {
#endif
/* Includes ------------------------------------------------------------------*/
#include "stm32f10x.h"
/** @addtogroup STM32F10x_StdPeriph_Driver
* @{
*/
/** @addtogroup EXTI
* @{
*/
/** @defgroup EXTI_Exported_Types
* @{
*/
/**
* @brief EXTI mode enumeration
*/
typedef enum
{
EXTI_Mode_Interrupt = 0x00,
EXTI_Mode_Event = 0x04
}EXTIMode_TypeDef;
#define IS_EXTI_MODE(MODE) (((MODE) == EXTI_Mode_Interrupt) || ((MODE) == EXTI_Mode_Event))
/**
* @brief EXTI Trigger enumeration
*/
typedef enum
{
EXTI_Trigger_Rising = 0x08,
EXTI_Trigger_Falling = 0x0C,
EXTI_Trigger_Rising_Falling = 0x10
}EXTITrigger_TypeDef;
#define IS_EXTI_TRIGGER(TRIGGER) (((TRIGGER) == EXTI_Trigger_Rising) || \
((TRIGGER) == EXTI_Trigger_Falling) || \
((TRIGGER) == EXTI_Trigger_Rising_Falling))
/**
* @brief EXTI Init Structure definition
*/
typedef struct
{
uint32_t EXTI_Line; /*!< Specifies the EXTI lines to be enabled or disabled.
This parameter can be any combination of @ref EXTI_Lines */
EXTIMode_TypeDef EXTI_Mode; /*!< Specifies the mode for the EXTI lines.
This parameter can be a value of @ref EXTIMode_TypeDef */
EXTITrigger_TypeDef EXTI_Trigger; /*!< Specifies the trigger signal active edge for the EXTI lines.
This parameter can be a value of @ref EXTITrigger_TypeDef */
FunctionalState EXTI_LineCmd; /*!< Specifies the new state of the selected EXTI lines.
This parameter can be set either to ENABLE or DISABLE */
}EXTI_InitTypeDef;
/**
* @}
*/
/** @defgroup EXTI_Exported_Constants
* @{
*/
/** @defgroup EXTI_Lines
* @{
*/
#define EXTI_Line0 ((uint32_t)0x00001) /*!< External interrupt line 0 */
#define EXTI_Line1 ((uint32_t)0x00002) /*!< External interrupt line 1 */
#define EXTI_Line2 ((uint32_t)0x00004) /*!< External interrupt line 2 */
#define EXTI_Line3 ((uint32_t)0x00008) /*!< External interrupt line 3 */
#define EXTI_Line4 ((uint32_t)0x00010) /*!< External interrupt line 4 */
#define EXTI_Line5 ((uint32_t)0x00020) /*!< External interrupt line 5 */
#define EXTI_Line6 ((uint32_t)0x00040) /*!< External interrupt line 6 */
#define EXTI_Line7 ((uint32_t)0x00080) /*!< External interrupt line 7 */
#define EXTI_Line8 ((uint32_t)0x00100) /*!< External interrupt line 8 */
#define EXTI_Line9 ((uint32_t)0x00200) /*!< External interrupt line 9 */
#define EXTI_Line10 ((uint32_t)0x00400) /*!< External interrupt line 10 */
#define EXTI_Line11 ((uint32_t)0x00800) /*!< External interrupt line 11 */
#define EXTI_Line12 ((uint32_t)0x01000) /*!< External interrupt line 12 */
#define EXTI_Line13 ((uint32_t)0x02000) /*!< External interrupt line 13 */
#define EXTI_Line14 ((uint32_t)0x04000) /*!< External interrupt line 14 */
#define EXTI_Line15 ((uint32_t)0x08000) /*!< External interrupt line 15 */
#define EXTI_Line16 ((uint32_t)0x10000) /*!< External interrupt line 16 Connected to the PVD Output */
#define EXTI_Line17 ((uint32_t)0x20000) /*!< External interrupt line 17 Connected to the RTC Alarm event */
#define EXTI_Line18 ((uint32_t)0x40000) /*!< External interrupt line 18 Connected to the USB Device/USB OTG FS
Wakeup from suspend event */
#define EXTI_Line19 ((uint32_t)0x80000) /*!< External interrupt line 19 Connected to the Ethernet Wakeup event */
#define IS_EXTI_LINE(LINE) ((((LINE) & (uint32_t)0xFFF00000) == 0x00) && ((LINE) != (uint16_t)0x00))
#define IS_GET_EXTI_LINE(LINE) (((LINE) == EXTI_Line0) || ((LINE) == EXTI_Line1) || \
((LINE) == EXTI_Line2) || ((LINE) == EXTI_Line3) || \
((LINE) == EXTI_Line4) || ((LINE) == EXTI_Line5) || \
((LINE) == EXTI_Line6) || ((LINE) == EXTI_Line7) || \
((LINE) == EXTI_Line8) || ((LINE) == EXTI_Line9) || \
((LINE) == EXTI_Line10) || ((LINE) == EXTI_Line11) || \
((LINE) == EXTI_Line12) || ((LINE) == EXTI_Line13) || \
((LINE) == EXTI_Line14) || ((LINE) == EXTI_Line15) || \
((LINE) == EXTI_Line16) || ((LINE) == EXTI_Line17) || \
((LINE) == EXTI_Line18) || ((LINE) == EXTI_Line19))
/**
* @}
*/
/**
* @}
*/
/** @defgroup EXTI_Exported_Macros
* @{
*/
/**
* @}
*/
/** @defgroup EXTI_Exported_Functions
* @{
*/
void EXTI_DeInit(void);
void EXTI_Init(EXTI_InitTypeDef* EXTI_InitStruct);
void EXTI_StructInit(EXTI_InitTypeDef* EXTI_InitStruct);
void EXTI_GenerateSWInterrupt(uint32_t EXTI_Line);
FlagStatus EXTI_GetFlagStatus(uint32_t EXTI_Line);
void EXTI_ClearFlag(uint32_t EXTI_Line);
ITStatus EXTI_GetITStatus(uint32_t EXTI_Line);
void EXTI_ClearITPendingBit(uint32_t EXTI_Line);
#ifdef __cplusplus
}
#endif
#endif /* __STM32F10x_EXTI_H */
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/

View File

@@ -0,0 +1,424 @@
/**
******************************************************************************
* @file stm32f10x_flash.h
* @author MCD Application Team
* @version V3.6.2
* @date 17-September-2021
* @brief This file contains all the functions prototypes for the FLASH
* 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_FLASH_H
#define __STM32F10x_FLASH_H
#ifdef __cplusplus
extern "C" {
#endif
/* Includes ------------------------------------------------------------------*/
#include "stm32f10x.h"
/** @addtogroup STM32F10x_StdPeriph_Driver
* @{
*/
/** @addtogroup FLASH
* @{
*/
/** @defgroup FLASH_Exported_Types
* @{
*/
/**
* @brief FLASH Status
*/
typedef enum
{
FLASH_BUSY = 1,
FLASH_ERROR_PG,
FLASH_ERROR_WRP,
FLASH_COMPLETE,
FLASH_TIMEOUT
}FLASH_Status;
/**
* @}
*/
/** @defgroup FLASH_Exported_Constants
* @{
*/
/** @defgroup Flash_Latency
* @{
*/
#define FLASH_Latency_0 ((uint32_t)0x00000000) /*!< FLASH Zero Latency cycle */
#define FLASH_Latency_1 ((uint32_t)0x00000001) /*!< FLASH One Latency cycle */
#define FLASH_Latency_2 ((uint32_t)0x00000002) /*!< FLASH Two Latency cycles */
#define IS_FLASH_LATENCY(LATENCY) (((LATENCY) == FLASH_Latency_0) || \
((LATENCY) == FLASH_Latency_1) || \
((LATENCY) == FLASH_Latency_2))
/**
* @}
*/
/** @defgroup Half_Cycle_Enable_Disable
* @{
*/
#define FLASH_HalfCycleAccess_Enable ((uint32_t)0x00000008) /*!< FLASH Half Cycle Enable */
#define FLASH_HalfCycleAccess_Disable ((uint32_t)0x00000000) /*!< FLASH Half Cycle Disable */
#define IS_FLASH_HALFCYCLEACCESS_STATE(STATE) (((STATE) == FLASH_HalfCycleAccess_Enable) || \
((STATE) == FLASH_HalfCycleAccess_Disable))
/**
* @}
*/
/** @defgroup Prefetch_Buffer_Enable_Disable
* @{
*/
#define FLASH_PrefetchBuffer_Enable ((uint32_t)0x00000010) /*!< FLASH Prefetch Buffer Enable */
#define FLASH_PrefetchBuffer_Disable ((uint32_t)0x00000000) /*!< FLASH Prefetch Buffer Disable */
#define IS_FLASH_PREFETCHBUFFER_STATE(STATE) (((STATE) == FLASH_PrefetchBuffer_Enable) || \
((STATE) == FLASH_PrefetchBuffer_Disable))
/**
* @}
*/
/** @defgroup Option_Bytes_Write_Protection
* @{
*/
/* Values to be used with STM32 Low and Medium density devices */
#define FLASH_WRProt_Pages0to3 ((uint32_t)0x00000001) /*!< STM32 Low and Medium density devices: Write protection of page 0 to 3 */
#define FLASH_WRProt_Pages4to7 ((uint32_t)0x00000002) /*!< STM32 Low and Medium density devices: Write protection of page 4 to 7 */
#define FLASH_WRProt_Pages8to11 ((uint32_t)0x00000004) /*!< STM32 Low and Medium density devices: Write protection of page 8 to 11 */
#define FLASH_WRProt_Pages12to15 ((uint32_t)0x00000008) /*!< STM32 Low and Medium density devices: Write protection of page 12 to 15 */
#define FLASH_WRProt_Pages16to19 ((uint32_t)0x00000010) /*!< STM32 Low and Medium density devices: Write protection of page 16 to 19 */
#define FLASH_WRProt_Pages20to23 ((uint32_t)0x00000020) /*!< STM32 Low and Medium density devices: Write protection of page 20 to 23 */
#define FLASH_WRProt_Pages24to27 ((uint32_t)0x00000040) /*!< STM32 Low and Medium density devices: Write protection of page 24 to 27 */
#define FLASH_WRProt_Pages28to31 ((uint32_t)0x00000080) /*!< STM32 Low and Medium density devices: Write protection of page 28 to 31 */
/* Values to be used with STM32 Medium-density devices */
#define FLASH_WRProt_Pages32to35 ((uint32_t)0x00000100) /*!< STM32 Medium-density devices: Write protection of page 32 to 35 */
#define FLASH_WRProt_Pages36to39 ((uint32_t)0x00000200) /*!< STM32 Medium-density devices: Write protection of page 36 to 39 */
#define FLASH_WRProt_Pages40to43 ((uint32_t)0x00000400) /*!< STM32 Medium-density devices: Write protection of page 40 to 43 */
#define FLASH_WRProt_Pages44to47 ((uint32_t)0x00000800) /*!< STM32 Medium-density devices: Write protection of page 44 to 47 */
#define FLASH_WRProt_Pages48to51 ((uint32_t)0x00001000) /*!< STM32 Medium-density devices: Write protection of page 48 to 51 */
#define FLASH_WRProt_Pages52to55 ((uint32_t)0x00002000) /*!< STM32 Medium-density devices: Write protection of page 52 to 55 */
#define FLASH_WRProt_Pages56to59 ((uint32_t)0x00004000) /*!< STM32 Medium-density devices: Write protection of page 56 to 59 */
#define FLASH_WRProt_Pages60to63 ((uint32_t)0x00008000) /*!< STM32 Medium-density devices: Write protection of page 60 to 63 */
#define FLASH_WRProt_Pages64to67 ((uint32_t)0x00010000) /*!< STM32 Medium-density devices: Write protection of page 64 to 67 */
#define FLASH_WRProt_Pages68to71 ((uint32_t)0x00020000) /*!< STM32 Medium-density devices: Write protection of page 68 to 71 */
#define FLASH_WRProt_Pages72to75 ((uint32_t)0x00040000) /*!< STM32 Medium-density devices: Write protection of page 72 to 75 */
#define FLASH_WRProt_Pages76to79 ((uint32_t)0x00080000) /*!< STM32 Medium-density devices: Write protection of page 76 to 79 */
#define FLASH_WRProt_Pages80to83 ((uint32_t)0x00100000) /*!< STM32 Medium-density devices: Write protection of page 80 to 83 */
#define FLASH_WRProt_Pages84to87 ((uint32_t)0x00200000) /*!< STM32 Medium-density devices: Write protection of page 84 to 87 */
#define FLASH_WRProt_Pages88to91 ((uint32_t)0x00400000) /*!< STM32 Medium-density devices: Write protection of page 88 to 91 */
#define FLASH_WRProt_Pages92to95 ((uint32_t)0x00800000) /*!< STM32 Medium-density devices: Write protection of page 92 to 95 */
#define FLASH_WRProt_Pages96to99 ((uint32_t)0x01000000) /*!< STM32 Medium-density devices: Write protection of page 96 to 99 */
#define FLASH_WRProt_Pages100to103 ((uint32_t)0x02000000) /*!< STM32 Medium-density devices: Write protection of page 100 to 103 */
#define FLASH_WRProt_Pages104to107 ((uint32_t)0x04000000) /*!< STM32 Medium-density devices: Write protection of page 104 to 107 */
#define FLASH_WRProt_Pages108to111 ((uint32_t)0x08000000) /*!< STM32 Medium-density devices: Write protection of page 108 to 111 */
#define FLASH_WRProt_Pages112to115 ((uint32_t)0x10000000) /*!< STM32 Medium-density devices: Write protection of page 112 to 115 */
#define FLASH_WRProt_Pages116to119 ((uint32_t)0x20000000) /*!< STM32 Medium-density devices: Write protection of page 115 to 119 */
#define FLASH_WRProt_Pages120to123 ((uint32_t)0x40000000) /*!< STM32 Medium-density devices: Write protection of page 120 to 123 */
#define FLASH_WRProt_Pages124to127 ((uint32_t)0x80000000) /*!< STM32 Medium-density devices: Write protection of page 124 to 127 */
/* Values to be used with STM32 High-density and STM32F10X Connectivity line devices */
#define FLASH_WRProt_Pages0to1 ((uint32_t)0x00000001) /*!< STM32 High-density, XL-density and Connectivity line devices:
Write protection of page 0 to 1 */
#define FLASH_WRProt_Pages2to3 ((uint32_t)0x00000002) /*!< STM32 High-density, XL-density and Connectivity line devices:
Write protection of page 2 to 3 */
#define FLASH_WRProt_Pages4to5 ((uint32_t)0x00000004) /*!< STM32 High-density, XL-density and Connectivity line devices:
Write protection of page 4 to 5 */
#define FLASH_WRProt_Pages6to7 ((uint32_t)0x00000008) /*!< STM32 High-density, XL-density and Connectivity line devices:
Write protection of page 6 to 7 */
#define FLASH_WRProt_Pages8to9 ((uint32_t)0x00000010) /*!< STM32 High-density, XL-density and Connectivity line devices:
Write protection of page 8 to 9 */
#define FLASH_WRProt_Pages10to11 ((uint32_t)0x00000020) /*!< STM32 High-density, XL-density and Connectivity line devices:
Write protection of page 10 to 11 */
#define FLASH_WRProt_Pages12to13 ((uint32_t)0x00000040) /*!< STM32 High-density, XL-density and Connectivity line devices:
Write protection of page 12 to 13 */
#define FLASH_WRProt_Pages14to15 ((uint32_t)0x00000080) /*!< STM32 High-density, XL-density and Connectivity line devices:
Write protection of page 14 to 15 */
#define FLASH_WRProt_Pages16to17 ((uint32_t)0x00000100) /*!< STM32 High-density, XL-density and Connectivity line devices:
Write protection of page 16 to 17 */
#define FLASH_WRProt_Pages18to19 ((uint32_t)0x00000200) /*!< STM32 High-density, XL-density and Connectivity line devices:
Write protection of page 18 to 19 */
#define FLASH_WRProt_Pages20to21 ((uint32_t)0x00000400) /*!< STM32 High-density, XL-density and Connectivity line devices:
Write protection of page 20 to 21 */
#define FLASH_WRProt_Pages22to23 ((uint32_t)0x00000800) /*!< STM32 High-density, XL-density and Connectivity line devices:
Write protection of page 22 to 23 */
#define FLASH_WRProt_Pages24to25 ((uint32_t)0x00001000) /*!< STM32 High-density, XL-density and Connectivity line devices:
Write protection of page 24 to 25 */
#define FLASH_WRProt_Pages26to27 ((uint32_t)0x00002000) /*!< STM32 High-density, XL-density and Connectivity line devices:
Write protection of page 26 to 27 */
#define FLASH_WRProt_Pages28to29 ((uint32_t)0x00004000) /*!< STM32 High-density, XL-density and Connectivity line devices:
Write protection of page 28 to 29 */
#define FLASH_WRProt_Pages30to31 ((uint32_t)0x00008000) /*!< STM32 High-density, XL-density and Connectivity line devices:
Write protection of page 30 to 31 */
#define FLASH_WRProt_Pages32to33 ((uint32_t)0x00010000) /*!< STM32 High-density, XL-density and Connectivity line devices:
Write protection of page 32 to 33 */
#define FLASH_WRProt_Pages34to35 ((uint32_t)0x00020000) /*!< STM32 High-density, XL-density and Connectivity line devices:
Write protection of page 34 to 35 */
#define FLASH_WRProt_Pages36to37 ((uint32_t)0x00040000) /*!< STM32 High-density, XL-density and Connectivity line devices:
Write protection of page 36 to 37 */
#define FLASH_WRProt_Pages38to39 ((uint32_t)0x00080000) /*!< STM32 High-density, XL-density and Connectivity line devices:
Write protection of page 38 to 39 */
#define FLASH_WRProt_Pages40to41 ((uint32_t)0x00100000) /*!< STM32 High-density, XL-density and Connectivity line devices:
Write protection of page 40 to 41 */
#define FLASH_WRProt_Pages42to43 ((uint32_t)0x00200000) /*!< STM32 High-density, XL-density and Connectivity line devices:
Write protection of page 42 to 43 */
#define FLASH_WRProt_Pages44to45 ((uint32_t)0x00400000) /*!< STM32 High-density, XL-density and Connectivity line devices:
Write protection of page 44 to 45 */
#define FLASH_WRProt_Pages46to47 ((uint32_t)0x00800000) /*!< STM32 High-density, XL-density and Connectivity line devices:
Write protection of page 46 to 47 */
#define FLASH_WRProt_Pages48to49 ((uint32_t)0x01000000) /*!< STM32 High-density, XL-density and Connectivity line devices:
Write protection of page 48 to 49 */
#define FLASH_WRProt_Pages50to51 ((uint32_t)0x02000000) /*!< STM32 High-density, XL-density and Connectivity line devices:
Write protection of page 50 to 51 */
#define FLASH_WRProt_Pages52to53 ((uint32_t)0x04000000) /*!< STM32 High-density, XL-density and Connectivity line devices:
Write protection of page 52 to 53 */
#define FLASH_WRProt_Pages54to55 ((uint32_t)0x08000000) /*!< STM32 High-density, XL-density and Connectivity line devices:
Write protection of page 54 to 55 */
#define FLASH_WRProt_Pages56to57 ((uint32_t)0x10000000) /*!< STM32 High-density, XL-density and Connectivity line devices:
Write protection of page 56 to 57 */
#define FLASH_WRProt_Pages58to59 ((uint32_t)0x20000000) /*!< STM32 High-density, XL-density and Connectivity line devices:
Write protection of page 58 to 59 */
#define FLASH_WRProt_Pages60to61 ((uint32_t)0x40000000) /*!< STM32 High-density, XL-density and Connectivity line devices:
Write protection of page 60 to 61 */
#define FLASH_WRProt_Pages62to127 ((uint32_t)0x80000000) /*!< STM32 Connectivity line devices: Write protection of page 62 to 127 */
#define FLASH_WRProt_Pages62to255 ((uint32_t)0x80000000) /*!< STM32 Medium-density devices: Write protection of page 62 to 255 */
#define FLASH_WRProt_Pages62to511 ((uint32_t)0x80000000) /*!< STM32 XL-density devices: Write protection of page 62 to 511 */
#define FLASH_WRProt_AllPages ((uint32_t)0xFFFFFFFF) /*!< Write protection of all Pages */
#define IS_FLASH_WRPROT_PAGE(PAGE) (((PAGE) != 0x00000000))
#define IS_FLASH_ADDRESS(ADDRESS) (((ADDRESS) >= 0x08000000) && ((ADDRESS) < 0x080FFFFF))
#define IS_OB_DATA_ADDRESS(ADDRESS) (((ADDRESS) == 0x1FFFF804) || ((ADDRESS) == 0x1FFFF806))
/**
* @}
*/
/** @defgroup Option_Bytes_IWatchdog
* @{
*/
#define OB_IWDG_SW ((uint16_t)0x0001) /*!< Software IWDG selected */
#define OB_IWDG_HW ((uint16_t)0x0000) /*!< Hardware IWDG selected */
#define IS_OB_IWDG_SOURCE(SOURCE) (((SOURCE) == OB_IWDG_SW) || ((SOURCE) == OB_IWDG_HW))
/**
* @}
*/
/** @defgroup Option_Bytes_nRST_STOP
* @{
*/
#define OB_STOP_NoRST ((uint16_t)0x0002) /*!< No reset generated when entering in STOP */
#define OB_STOP_RST ((uint16_t)0x0000) /*!< Reset generated when entering in STOP */
#define IS_OB_STOP_SOURCE(SOURCE) (((SOURCE) == OB_STOP_NoRST) || ((SOURCE) == OB_STOP_RST))
/**
* @}
*/
/** @defgroup Option_Bytes_nRST_STDBY
* @{
*/
#define OB_STDBY_NoRST ((uint16_t)0x0004) /*!< No reset generated when entering in STANDBY */
#define OB_STDBY_RST ((uint16_t)0x0000) /*!< Reset generated when entering in STANDBY */
#define IS_OB_STDBY_SOURCE(SOURCE) (((SOURCE) == OB_STDBY_NoRST) || ((SOURCE) == OB_STDBY_RST))
#ifdef STM32F10X_XL
/**
* @}
*/
/** @defgroup FLASH_Boot
* @{
*/
#define FLASH_BOOT_Bank1 ((uint16_t)0x0000) /*!< At startup, if boot pins are set in boot from user Flash position
and this parameter is selected the device will boot from Bank1(Default) */
#define FLASH_BOOT_Bank2 ((uint16_t)0x0001) /*!< At startup, if boot pins are set in boot from user Flash position
and this parameter is selected the device will boot from Bank 2 or Bank 1,
depending on the activation of the bank */
#define IS_FLASH_BOOT(BOOT) (((BOOT) == FLASH_BOOT_Bank1) || ((BOOT) == FLASH_BOOT_Bank2))
#endif
/**
* @}
*/
/** @defgroup FLASH_Interrupts
* @{
*/
#ifdef STM32F10X_XL
#define FLASH_IT_BANK2_ERROR ((uint32_t)0x80000400) /*!< FPEC BANK2 error interrupt source */
#define FLASH_IT_BANK2_EOP ((uint32_t)0x80001000) /*!< End of FLASH BANK2 Operation Interrupt source */
#define FLASH_IT_BANK1_ERROR FLASH_IT_ERROR /*!< FPEC BANK1 error interrupt source */
#define FLASH_IT_BANK1_EOP FLASH_IT_EOP /*!< End of FLASH BANK1 Operation Interrupt source */
#define FLASH_IT_ERROR ((uint32_t)0x00000400) /*!< FPEC BANK1 error interrupt source */
#define FLASH_IT_EOP ((uint32_t)0x00001000) /*!< End of FLASH BANK1 Operation Interrupt source */
#define IS_FLASH_IT(IT) ((((IT) & (uint32_t)0x7FFFEBFF) == 0x00000000) && (((IT) != 0x00000000)))
#else
#define FLASH_IT_ERROR ((uint32_t)0x00000400) /*!< FPEC error interrupt source */
#define FLASH_IT_EOP ((uint32_t)0x00001000) /*!< End of FLASH Operation Interrupt source */
#define FLASH_IT_BANK1_ERROR FLASH_IT_ERROR /*!< FPEC BANK1 error interrupt source */
#define FLASH_IT_BANK1_EOP FLASH_IT_EOP /*!< End of FLASH BANK1 Operation Interrupt source */
#define IS_FLASH_IT(IT) ((((IT) & (uint32_t)0xFFFFEBFF) == 0x00000000) && (((IT) != 0x00000000)))
#endif
/**
* @}
*/
/** @defgroup FLASH_Flags
* @{
*/
#ifdef STM32F10X_XL
#define FLASH_FLAG_BANK2_BSY ((uint32_t)0x80000001) /*!< FLASH BANK2 Busy flag */
#define FLASH_FLAG_BANK2_EOP ((uint32_t)0x80000020) /*!< FLASH BANK2 End of Operation flag */
#define FLASH_FLAG_BANK2_PGERR ((uint32_t)0x80000004) /*!< FLASH BANK2 Program error flag */
#define FLASH_FLAG_BANK2_WRPRTERR ((uint32_t)0x80000010) /*!< FLASH BANK2 Write protected error flag */
#define FLASH_FLAG_BANK1_BSY FLASH_FLAG_BSY /*!< FLASH BANK1 Busy flag*/
#define FLASH_FLAG_BANK1_EOP FLASH_FLAG_EOP /*!< FLASH BANK1 End of Operation flag */
#define FLASH_FLAG_BANK1_PGERR FLASH_FLAG_PGERR /*!< FLASH BANK1 Program error flag */
#define FLASH_FLAG_BANK1_WRPRTERR FLASH_FLAG_WRPRTERR /*!< FLASH BANK1 Write protected error flag */
#define FLASH_FLAG_BSY ((uint32_t)0x00000001) /*!< FLASH Busy flag */
#define FLASH_FLAG_EOP ((uint32_t)0x00000020) /*!< FLASH End of Operation flag */
#define FLASH_FLAG_PGERR ((uint32_t)0x00000004) /*!< FLASH Program error flag */
#define FLASH_FLAG_WRPRTERR ((uint32_t)0x00000010) /*!< FLASH Write protected error flag */
#define FLASH_FLAG_OPTERR ((uint32_t)0x00000001) /*!< FLASH Option Byte error flag */
#define IS_FLASH_CLEAR_FLAG(FLAG) ((((FLAG) & (uint32_t)0x7FFFFFCA) == 0x00000000) && ((FLAG) != 0x00000000))
#define IS_FLASH_GET_FLAG(FLAG) (((FLAG) == FLASH_FLAG_BSY) || ((FLAG) == FLASH_FLAG_EOP) || \
((FLAG) == FLASH_FLAG_PGERR) || ((FLAG) == FLASH_FLAG_WRPRTERR) || \
((FLAG) == FLASH_FLAG_OPTERR)|| \
((FLAG) == FLASH_FLAG_BANK1_BSY) || ((FLAG) == FLASH_FLAG_BANK1_EOP) || \
((FLAG) == FLASH_FLAG_BANK1_PGERR) || ((FLAG) == FLASH_FLAG_BANK1_WRPRTERR) || \
((FLAG) == FLASH_FLAG_BANK2_BSY) || ((FLAG) == FLASH_FLAG_BANK2_EOP) || \
((FLAG) == FLASH_FLAG_BANK2_PGERR) || ((FLAG) == FLASH_FLAG_BANK2_WRPRTERR))
#else
#define FLASH_FLAG_BSY ((uint32_t)0x00000001) /*!< FLASH Busy flag */
#define FLASH_FLAG_EOP ((uint32_t)0x00000020) /*!< FLASH End of Operation flag */
#define FLASH_FLAG_PGERR ((uint32_t)0x00000004) /*!< FLASH Program error flag */
#define FLASH_FLAG_WRPRTERR ((uint32_t)0x00000010) /*!< FLASH Write protected error flag */
#define FLASH_FLAG_OPTERR ((uint32_t)0x00000001) /*!< FLASH Option Byte error flag */
#define FLASH_FLAG_BANK1_BSY FLASH_FLAG_BSY /*!< FLASH BANK1 Busy flag*/
#define FLASH_FLAG_BANK1_EOP FLASH_FLAG_EOP /*!< FLASH BANK1 End of Operation flag */
#define FLASH_FLAG_BANK1_PGERR FLASH_FLAG_PGERR /*!< FLASH BANK1 Program error flag */
#define FLASH_FLAG_BANK1_WRPRTERR FLASH_FLAG_WRPRTERR /*!< FLASH BANK1 Write protected error flag */
#define IS_FLASH_CLEAR_FLAG(FLAG) ((((FLAG) & (uint32_t)0xFFFFFFCA) == 0x00000000) && ((FLAG) != 0x00000000))
#define IS_FLASH_GET_FLAG(FLAG) (((FLAG) == FLASH_FLAG_BSY) || ((FLAG) == FLASH_FLAG_EOP) || \
((FLAG) == FLASH_FLAG_PGERR) || ((FLAG) == FLASH_FLAG_WRPRTERR) || \
((FLAG) == FLASH_FLAG_BANK1_BSY) || ((FLAG) == FLASH_FLAG_BANK1_EOP) || \
((FLAG) == FLASH_FLAG_BANK1_PGERR) || ((FLAG) == FLASH_FLAG_BANK1_WRPRTERR) || \
((FLAG) == FLASH_FLAG_OPTERR))
#endif
/**
* @}
*/
/**
* @}
*/
/** @defgroup FLASH_Exported_Macros
* @{
*/
/**
* @}
*/
/** @defgroup FLASH_Exported_Functions
* @{
*/
/*------------ Functions used for all STM32F10x devices -----*/
void FLASH_SetLatency(uint32_t FLASH_Latency);
void FLASH_HalfCycleAccessCmd(uint32_t FLASH_HalfCycleAccess);
void FLASH_PrefetchBufferCmd(uint32_t FLASH_PrefetchBuffer);
void FLASH_Unlock(void);
void FLASH_Lock(void);
FLASH_Status FLASH_ErasePage(uint32_t Page_Address);
FLASH_Status FLASH_EraseAllPages(void);
FLASH_Status FLASH_EraseOptionBytes(void);
FLASH_Status FLASH_ProgramWord(uint32_t Address, uint32_t Data);
FLASH_Status FLASH_ProgramHalfWord(uint32_t Address, uint16_t Data);
FLASH_Status FLASH_ProgramOptionByteData(uint32_t Address, uint8_t Data);
FLASH_Status FLASH_EnableWriteProtection(uint32_t FLASH_Pages);
FLASH_Status FLASH_ReadOutProtection(FunctionalState NewState);
FLASH_Status FLASH_UserOptionByteConfig(uint16_t OB_IWDG, uint16_t OB_STOP, uint16_t OB_STDBY);
uint32_t FLASH_GetUserOptionByte(void);
uint32_t FLASH_GetWriteProtectionOptionByte(void);
FlagStatus FLASH_GetReadOutProtectionStatus(void);
FlagStatus FLASH_GetPrefetchBufferStatus(void);
void FLASH_ITConfig(uint32_t FLASH_IT, FunctionalState NewState);
FlagStatus FLASH_GetFlagStatus(uint32_t FLASH_FLAG);
void FLASH_ClearFlag(uint32_t FLASH_FLAG);
FLASH_Status FLASH_GetStatus(void);
FLASH_Status FLASH_WaitForLastOperation(uint32_t Timeout);
/*------------ New function used for all STM32F10x devices -----*/
void FLASH_UnlockBank1(void);
void FLASH_LockBank1(void);
FLASH_Status FLASH_EraseAllBank1Pages(void);
FLASH_Status FLASH_GetBank1Status(void);
FLASH_Status FLASH_WaitForLastBank1Operation(uint32_t Timeout);
#ifdef STM32F10X_XL
/*---- New Functions used only with STM32F10x_XL density devices -----*/
void FLASH_UnlockBank2(void);
void FLASH_LockBank2(void);
FLASH_Status FLASH_EraseAllBank2Pages(void);
FLASH_Status FLASH_GetBank2Status(void);
FLASH_Status FLASH_WaitForLastBank2Operation(uint32_t Timeout);
FLASH_Status FLASH_BootConfig(uint16_t FLASH_BOOT);
#endif
#ifdef __cplusplus
}
#endif
#endif /* __STM32F10x_FLASH_H */
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/

View File

@@ -0,0 +1,731 @@
/**
******************************************************************************
* @file stm32f10x_fsmc.h
* @author MCD Application Team
* @version V3.6.2
* @date 17-September-2021
* @brief This file contains all the functions prototypes for the FSMC 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_FSMC_H
#define __STM32F10x_FSMC_H
#ifdef __cplusplus
extern "C" {
#endif
/* Includes ------------------------------------------------------------------*/
#include "stm32f10x.h"
/** @addtogroup STM32F10x_StdPeriph_Driver
* @{
*/
/** @addtogroup FSMC
* @{
*/
/** @defgroup FSMC_Exported_Types
* @{
*/
/**
* @brief Timing parameters For NOR/SRAM Banks
*/
typedef struct
{
uint32_t FSMC_AddressSetupTime; /*!< Defines the number of HCLK cycles to configure
the duration of the address setup time.
This parameter can be a value between 0 and 0xF.
@note: It is not used with synchronous NOR Flash memories. */
uint32_t FSMC_AddressHoldTime; /*!< Defines the number of HCLK cycles to configure
the duration of the address hold time.
This parameter can be a value between 0 and 0xF.
@note: It is not used with synchronous NOR Flash memories.*/
uint32_t FSMC_DataSetupTime; /*!< Defines the number of HCLK cycles to configure
the duration of the data setup time.
This parameter can be a value between 0 and 0xFF.
@note: It is used for SRAMs, ROMs and asynchronous multiplexed NOR Flash memories. */
uint32_t FSMC_BusTurnAroundDuration; /*!< Defines the number of HCLK cycles to configure
the duration of the bus turnaround.
This parameter can be a value between 0 and 0xF.
@note: It is only used for multiplexed NOR Flash memories. */
uint32_t FSMC_CLKDivision; /*!< Defines the period of CLK clock output signal, expressed in number of HCLK cycles.
This parameter can be a value between 1 and 0xF.
@note: This parameter is not used for asynchronous NOR Flash, SRAM or ROM accesses. */
uint32_t FSMC_DataLatency; /*!< Defines the number of memory clock cycles to issue
to the memory before getting the first data.
The value of this parameter depends on the memory type as shown below:
- It must be set to 0 in case of a CRAM
- It is don't care in asynchronous NOR, SRAM or ROM accesses
- It may assume a value between 0 and 0xF in NOR Flash memories
with synchronous burst mode enable */
uint32_t FSMC_AccessMode; /*!< Specifies the asynchronous access mode.
This parameter can be a value of @ref FSMC_Access_Mode */
}FSMC_NORSRAMTimingInitTypeDef;
/**
* @brief FSMC NOR/SRAM Init structure definition
*/
typedef struct
{
uint32_t FSMC_Bank; /*!< Specifies the NOR/SRAM memory bank that will be used.
This parameter can be a value of @ref FSMC_NORSRAM_Bank */
uint32_t FSMC_DataAddressMux; /*!< Specifies whether the address and data values are
multiplexed on the databus or not.
This parameter can be a value of @ref FSMC_Data_Address_Bus_Multiplexing */
uint32_t FSMC_MemoryType; /*!< Specifies the type of external memory attached to
the corresponding memory bank.
This parameter can be a value of @ref FSMC_Memory_Type */
uint32_t FSMC_MemoryDataWidth; /*!< Specifies the external memory device width.
This parameter can be a value of @ref FSMC_Data_Width */
uint32_t FSMC_BurstAccessMode; /*!< Enables or disables the burst access mode for Flash memory,
valid only with synchronous burst Flash memories.
This parameter can be a value of @ref FSMC_Burst_Access_Mode */
uint32_t FSMC_AsynchronousWait; /*!< Enables or disables wait signal during asynchronous transfers,
valid only with asynchronous Flash memories.
This parameter can be a value of @ref FSMC_AsynchronousWait */
uint32_t FSMC_WaitSignalPolarity; /*!< Specifies the wait signal polarity, valid only when accessing
the Flash memory in burst mode.
This parameter can be a value of @ref FSMC_Wait_Signal_Polarity */
uint32_t FSMC_WrapMode; /*!< Enables or disables the Wrapped burst access mode for Flash
memory, valid only when accessing Flash memories in burst mode.
This parameter can be a value of @ref FSMC_Wrap_Mode */
uint32_t FSMC_WaitSignalActive; /*!< Specifies if the wait signal is asserted by the memory one
clock cycle before the wait state or during the wait state,
valid only when accessing memories in burst mode.
This parameter can be a value of @ref FSMC_Wait_Timing */
uint32_t FSMC_WriteOperation; /*!< Enables or disables the write operation in the selected bank by the FSMC.
This parameter can be a value of @ref FSMC_Write_Operation */
uint32_t FSMC_WaitSignal; /*!< Enables or disables the wait-state insertion via wait
signal, valid for Flash memory access in burst mode.
This parameter can be a value of @ref FSMC_Wait_Signal */
uint32_t FSMC_ExtendedMode; /*!< Enables or disables the extended mode.
This parameter can be a value of @ref FSMC_Extended_Mode */
uint32_t FSMC_WriteBurst; /*!< Enables or disables the write burst operation.
This parameter can be a value of @ref FSMC_Write_Burst */
FSMC_NORSRAMTimingInitTypeDef* FSMC_ReadWriteTimingStruct; /*!< Timing Parameters for write and read access if the ExtendedMode is not used*/
FSMC_NORSRAMTimingInitTypeDef* FSMC_WriteTimingStruct; /*!< Timing Parameters for write access if the ExtendedMode is used*/
}FSMC_NORSRAMInitTypeDef;
/**
* @brief Timing parameters For FSMC NAND and PCCARD Banks
*/
typedef struct
{
uint32_t FSMC_SetupTime; /*!< Defines the number of HCLK cycles to setup address before
the command assertion for NAND-Flash read or write access
to common/Attribute or I/O memory space (depending on
the memory space timing to be configured).
This parameter can be a value between 0 and 0xFF.*/
uint32_t FSMC_WaitSetupTime; /*!< Defines the minimum number of HCLK cycles to assert the
command for NAND-Flash read or write access to
common/Attribute or I/O memory space (depending on the
memory space timing to be configured).
This parameter can be a number between 0x00 and 0xFF */
uint32_t FSMC_HoldSetupTime; /*!< Defines the number of HCLK clock cycles to hold address
(and data for write access) after the command deassertion
for NAND-Flash read or write access to common/Attribute
or I/O memory space (depending on the memory space timing
to be configured).
This parameter can be a number between 0x00 and 0xFF */
uint32_t FSMC_HiZSetupTime; /*!< Defines the number of HCLK clock cycles during which the
databus is kept in HiZ after the start of a NAND-Flash
write access to common/Attribute or I/O memory space (depending
on the memory space timing to be configured).
This parameter can be a number between 0x00 and 0xFF */
}FSMC_NAND_PCCARDTimingInitTypeDef;
/**
* @brief FSMC NAND Init structure definition
*/
typedef struct
{
uint32_t FSMC_Bank; /*!< Specifies the NAND memory bank that will be used.
This parameter can be a value of @ref FSMC_NAND_Bank */
uint32_t FSMC_Waitfeature; /*!< Enables or disables the Wait feature for the NAND Memory Bank.
This parameter can be any value of @ref FSMC_Wait_feature */
uint32_t FSMC_MemoryDataWidth; /*!< Specifies the external memory device width.
This parameter can be any value of @ref FSMC_Data_Width */
uint32_t FSMC_ECC; /*!< Enables or disables the ECC computation.
This parameter can be any value of @ref FSMC_ECC */
uint32_t FSMC_ECCPageSize; /*!< Defines the page size for the extended ECC.
This parameter can be any value of @ref FSMC_ECC_Page_Size */
uint32_t FSMC_TCLRSetupTime; /*!< Defines the number of HCLK cycles to configure the
delay between CLE low and RE low.
This parameter can be a value between 0 and 0xFF. */
uint32_t FSMC_TARSetupTime; /*!< Defines the number of HCLK cycles to configure the
delay between ALE low and RE low.
This parameter can be a number between 0x0 and 0xFF */
FSMC_NAND_PCCARDTimingInitTypeDef* FSMC_CommonSpaceTimingStruct; /*!< FSMC Common Space Timing */
FSMC_NAND_PCCARDTimingInitTypeDef* FSMC_AttributeSpaceTimingStruct; /*!< FSMC Attribute Space Timing */
}FSMC_NANDInitTypeDef;
/**
* @brief FSMC PCCARD Init structure definition
*/
typedef struct
{
uint32_t FSMC_Waitfeature; /*!< Enables or disables the Wait feature for the Memory Bank.
This parameter can be any value of @ref FSMC_Wait_feature */
uint32_t FSMC_TCLRSetupTime; /*!< Defines the number of HCLK cycles to configure the
delay between CLE low and RE low.
This parameter can be a value between 0 and 0xFF. */
uint32_t FSMC_TARSetupTime; /*!< Defines the number of HCLK cycles to configure the
delay between ALE low and RE low.
This parameter can be a number between 0x0 and 0xFF */
FSMC_NAND_PCCARDTimingInitTypeDef* FSMC_CommonSpaceTimingStruct; /*!< FSMC Common Space Timing */
FSMC_NAND_PCCARDTimingInitTypeDef* FSMC_AttributeSpaceTimingStruct; /*!< FSMC Attribute Space Timing */
FSMC_NAND_PCCARDTimingInitTypeDef* FSMC_IOSpaceTimingStruct; /*!< FSMC IO Space Timing */
}FSMC_PCCARDInitTypeDef;
/**
* @}
*/
/** @defgroup FSMC_Exported_Constants
* @{
*/
/** @defgroup FSMC_NORSRAM_Bank
* @{
*/
#define FSMC_Bank1_NORSRAM1 ((uint32_t)0x00000000)
#define FSMC_Bank1_NORSRAM2 ((uint32_t)0x00000002)
#define FSMC_Bank1_NORSRAM3 ((uint32_t)0x00000004)
#define FSMC_Bank1_NORSRAM4 ((uint32_t)0x00000006)
/**
* @}
*/
/** @defgroup FSMC_NAND_Bank
* @{
*/
#define FSMC_Bank2_NAND ((uint32_t)0x00000010)
#define FSMC_Bank3_NAND ((uint32_t)0x00000100)
/**
* @}
*/
/** @defgroup FSMC_PCCARD_Bank
* @{
*/
#define FSMC_Bank4_PCCARD ((uint32_t)0x00001000)
/**
* @}
*/
#define IS_FSMC_NORSRAM_BANK(BANK) (((BANK) == FSMC_Bank1_NORSRAM1) || \
((BANK) == FSMC_Bank1_NORSRAM2) || \
((BANK) == FSMC_Bank1_NORSRAM3) || \
((BANK) == FSMC_Bank1_NORSRAM4))
#define IS_FSMC_NAND_BANK(BANK) (((BANK) == FSMC_Bank2_NAND) || \
((BANK) == FSMC_Bank3_NAND))
#define IS_FSMC_GETFLAG_BANK(BANK) (((BANK) == FSMC_Bank2_NAND) || \
((BANK) == FSMC_Bank3_NAND) || \
((BANK) == FSMC_Bank4_PCCARD))
#define IS_FSMC_IT_BANK(BANK) (((BANK) == FSMC_Bank2_NAND) || \
((BANK) == FSMC_Bank3_NAND) || \
((BANK) == FSMC_Bank4_PCCARD))
/** @defgroup NOR_SRAM_Controller
* @{
*/
/** @defgroup FSMC_Data_Address_Bus_Multiplexing
* @{
*/
#define FSMC_DataAddressMux_Disable ((uint32_t)0x00000000)
#define FSMC_DataAddressMux_Enable ((uint32_t)0x00000002)
#define IS_FSMC_MUX(MUX) (((MUX) == FSMC_DataAddressMux_Disable) || \
((MUX) == FSMC_DataAddressMux_Enable))
/**
* @}
*/
/** @defgroup FSMC_Memory_Type
* @{
*/
#define FSMC_MemoryType_SRAM ((uint32_t)0x00000000)
#define FSMC_MemoryType_PSRAM ((uint32_t)0x00000004)
#define FSMC_MemoryType_NOR ((uint32_t)0x00000008)
#define IS_FSMC_MEMORY(MEMORY) (((MEMORY) == FSMC_MemoryType_SRAM) || \
((MEMORY) == FSMC_MemoryType_PSRAM)|| \
((MEMORY) == FSMC_MemoryType_NOR))
/**
* @}
*/
/** @defgroup FSMC_Data_Width
* @{
*/
#define FSMC_MemoryDataWidth_8b ((uint32_t)0x00000000)
#define FSMC_MemoryDataWidth_16b ((uint32_t)0x00000010)
#define IS_FSMC_MEMORY_WIDTH(WIDTH) (((WIDTH) == FSMC_MemoryDataWidth_8b) || \
((WIDTH) == FSMC_MemoryDataWidth_16b))
/**
* @}
*/
/** @defgroup FSMC_Burst_Access_Mode
* @{
*/
#define FSMC_BurstAccessMode_Disable ((uint32_t)0x00000000)
#define FSMC_BurstAccessMode_Enable ((uint32_t)0x00000100)
#define IS_FSMC_BURSTMODE(STATE) (((STATE) == FSMC_BurstAccessMode_Disable) || \
((STATE) == FSMC_BurstAccessMode_Enable))
/**
* @}
*/
/** @defgroup FSMC_AsynchronousWait
* @{
*/
#define FSMC_AsynchronousWait_Disable ((uint32_t)0x00000000)
#define FSMC_AsynchronousWait_Enable ((uint32_t)0x00008000)
#define IS_FSMC_ASYNWAIT(STATE) (((STATE) == FSMC_AsynchronousWait_Disable) || \
((STATE) == FSMC_AsynchronousWait_Enable))
/**
* @}
*/
/** @defgroup FSMC_Wait_Signal_Polarity
* @{
*/
#define FSMC_WaitSignalPolarity_Low ((uint32_t)0x00000000)
#define FSMC_WaitSignalPolarity_High ((uint32_t)0x00000200)
#define IS_FSMC_WAIT_POLARITY(POLARITY) (((POLARITY) == FSMC_WaitSignalPolarity_Low) || \
((POLARITY) == FSMC_WaitSignalPolarity_High))
/**
* @}
*/
/** @defgroup FSMC_Wrap_Mode
* @{
*/
#define FSMC_WrapMode_Disable ((uint32_t)0x00000000)
#define FSMC_WrapMode_Enable ((uint32_t)0x00000400)
#define IS_FSMC_WRAP_MODE(MODE) (((MODE) == FSMC_WrapMode_Disable) || \
((MODE) == FSMC_WrapMode_Enable))
/**
* @}
*/
/** @defgroup FSMC_Wait_Timing
* @{
*/
#define FSMC_WaitSignalActive_BeforeWaitState ((uint32_t)0x00000000)
#define FSMC_WaitSignalActive_DuringWaitState ((uint32_t)0x00000800)
#define IS_FSMC_WAIT_SIGNAL_ACTIVE(ACTIVE) (((ACTIVE) == FSMC_WaitSignalActive_BeforeWaitState) || \
((ACTIVE) == FSMC_WaitSignalActive_DuringWaitState))
/**
* @}
*/
/** @defgroup FSMC_Write_Operation
* @{
*/
#define FSMC_WriteOperation_Disable ((uint32_t)0x00000000)
#define FSMC_WriteOperation_Enable ((uint32_t)0x00001000)
#define IS_FSMC_WRITE_OPERATION(OPERATION) (((OPERATION) == FSMC_WriteOperation_Disable) || \
((OPERATION) == FSMC_WriteOperation_Enable))
/**
* @}
*/
/** @defgroup FSMC_Wait_Signal
* @{
*/
#define FSMC_WaitSignal_Disable ((uint32_t)0x00000000)
#define FSMC_WaitSignal_Enable ((uint32_t)0x00002000)
#define IS_FSMC_WAITE_SIGNAL(SIGNAL) (((SIGNAL) == FSMC_WaitSignal_Disable) || \
((SIGNAL) == FSMC_WaitSignal_Enable))
/**
* @}
*/
/** @defgroup FSMC_Extended_Mode
* @{
*/
#define FSMC_ExtendedMode_Disable ((uint32_t)0x00000000)
#define FSMC_ExtendedMode_Enable ((uint32_t)0x00004000)
#define IS_FSMC_EXTENDED_MODE(MODE) (((MODE) == FSMC_ExtendedMode_Disable) || \
((MODE) == FSMC_ExtendedMode_Enable))
/**
* @}
*/
/** @defgroup FSMC_Write_Burst
* @{
*/
#define FSMC_WriteBurst_Disable ((uint32_t)0x00000000)
#define FSMC_WriteBurst_Enable ((uint32_t)0x00080000)
#define IS_FSMC_WRITE_BURST(BURST) (((BURST) == FSMC_WriteBurst_Disable) || \
((BURST) == FSMC_WriteBurst_Enable))
/**
* @}
*/
/** @defgroup FSMC_Address_Setup_Time
* @{
*/
#define IS_FSMC_ADDRESS_SETUP_TIME(TIME) ((TIME) <= 0xF)
/**
* @}
*/
/** @defgroup FSMC_Address_Hold_Time
* @{
*/
#define IS_FSMC_ADDRESS_HOLD_TIME(TIME) ((TIME) <= 0xF)
/**
* @}
*/
/** @defgroup FSMC_Data_Setup_Time
* @{
*/
#define IS_FSMC_DATASETUP_TIME(TIME) (((TIME) > 0) && ((TIME) <= 0xFF))
/**
* @}
*/
/** @defgroup FSMC_Bus_Turn_around_Duration
* @{
*/
#define IS_FSMC_TURNAROUND_TIME(TIME) ((TIME) <= 0xF)
/**
* @}
*/
/** @defgroup FSMC_CLK_Division
* @{
*/
#define IS_FSMC_CLK_DIV(DIV) ((DIV) <= 0xF)
/**
* @}
*/
/** @defgroup FSMC_Data_Latency
* @{
*/
#define IS_FSMC_DATA_LATENCY(LATENCY) ((LATENCY) <= 0xF)
/**
* @}
*/
/** @defgroup FSMC_Access_Mode
* @{
*/
#define FSMC_AccessMode_A ((uint32_t)0x00000000)
#define FSMC_AccessMode_B ((uint32_t)0x10000000)
#define FSMC_AccessMode_C ((uint32_t)0x20000000)
#define FSMC_AccessMode_D ((uint32_t)0x30000000)
#define IS_FSMC_ACCESS_MODE(MODE) (((MODE) == FSMC_AccessMode_A) || \
((MODE) == FSMC_AccessMode_B) || \
((MODE) == FSMC_AccessMode_C) || \
((MODE) == FSMC_AccessMode_D))
/**
* @}
*/
/**
* @}
*/
/** @defgroup NAND_PCCARD_Controller
* @{
*/
/** @defgroup FSMC_Wait_feature
* @{
*/
#define FSMC_Waitfeature_Disable ((uint32_t)0x00000000)
#define FSMC_Waitfeature_Enable ((uint32_t)0x00000002)
#define IS_FSMC_WAIT_FEATURE(FEATURE) (((FEATURE) == FSMC_Waitfeature_Disable) || \
((FEATURE) == FSMC_Waitfeature_Enable))
/**
* @}
*/
/** @defgroup FSMC_ECC
* @{
*/
#define FSMC_ECC_Disable ((uint32_t)0x00000000)
#define FSMC_ECC_Enable ((uint32_t)0x00000040)
#define IS_FSMC_ECC_STATE(STATE) (((STATE) == FSMC_ECC_Disable) || \
((STATE) == FSMC_ECC_Enable))
/**
* @}
*/
/** @defgroup FSMC_ECC_Page_Size
* @{
*/
#define FSMC_ECCPageSize_256Bytes ((uint32_t)0x00000000)
#define FSMC_ECCPageSize_512Bytes ((uint32_t)0x00020000)
#define FSMC_ECCPageSize_1024Bytes ((uint32_t)0x00040000)
#define FSMC_ECCPageSize_2048Bytes ((uint32_t)0x00060000)
#define FSMC_ECCPageSize_4096Bytes ((uint32_t)0x00080000)
#define FSMC_ECCPageSize_8192Bytes ((uint32_t)0x000A0000)
#define IS_FSMC_ECCPAGE_SIZE(SIZE) (((SIZE) == FSMC_ECCPageSize_256Bytes) || \
((SIZE) == FSMC_ECCPageSize_512Bytes) || \
((SIZE) == FSMC_ECCPageSize_1024Bytes) || \
((SIZE) == FSMC_ECCPageSize_2048Bytes) || \
((SIZE) == FSMC_ECCPageSize_4096Bytes) || \
((SIZE) == FSMC_ECCPageSize_8192Bytes))
/**
* @}
*/
/** @defgroup FSMC_TCLR_Setup_Time
* @{
*/
#define IS_FSMC_TCLR_TIME(TIME) ((TIME) <= 0xFF)
/**
* @}
*/
/** @defgroup FSMC_TAR_Setup_Time
* @{
*/
#define IS_FSMC_TAR_TIME(TIME) ((TIME) <= 0xFF)
/**
* @}
*/
/** @defgroup FSMC_Setup_Time
* @{
*/
#define IS_FSMC_SETUP_TIME(TIME) ((TIME) <= 0xFF)
/**
* @}
*/
/** @defgroup FSMC_Wait_Setup_Time
* @{
*/
#define IS_FSMC_WAIT_TIME(TIME) ((TIME) <= 0xFF)
/**
* @}
*/
/** @defgroup FSMC_Hold_Setup_Time
* @{
*/
#define IS_FSMC_HOLD_TIME(TIME) ((TIME) <= 0xFF)
/**
* @}
*/
/** @defgroup FSMC_HiZ_Setup_Time
* @{
*/
#define IS_FSMC_HIZ_TIME(TIME) ((TIME) <= 0xFF)
/**
* @}
*/
/** @defgroup FSMC_Interrupt_sources
* @{
*/
#define FSMC_IT_RisingEdge ((uint32_t)0x00000008)
#define FSMC_IT_Level ((uint32_t)0x00000010)
#define FSMC_IT_FallingEdge ((uint32_t)0x00000020)
#define IS_FSMC_IT(IT) ((((IT) & (uint32_t)0xFFFFFFC7) == 0x00000000) && ((IT) != 0x00000000))
#define IS_FSMC_GET_IT(IT) (((IT) == FSMC_IT_RisingEdge) || \
((IT) == FSMC_IT_Level) || \
((IT) == FSMC_IT_FallingEdge))
/**
* @}
*/
/** @defgroup FSMC_Flags
* @{
*/
#define FSMC_FLAG_RisingEdge ((uint32_t)0x00000001)
#define FSMC_FLAG_Level ((uint32_t)0x00000002)
#define FSMC_FLAG_FallingEdge ((uint32_t)0x00000004)
#define FSMC_FLAG_FEMPT ((uint32_t)0x00000040)
#define IS_FSMC_GET_FLAG(FLAG) (((FLAG) == FSMC_FLAG_RisingEdge) || \
((FLAG) == FSMC_FLAG_Level) || \
((FLAG) == FSMC_FLAG_FallingEdge) || \
((FLAG) == FSMC_FLAG_FEMPT))
#define IS_FSMC_CLEAR_FLAG(FLAG) ((((FLAG) & (uint32_t)0xFFFFFFF8) == 0x00000000) && ((FLAG) != 0x00000000))
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
/** @defgroup FSMC_Exported_Macros
* @{
*/
/**
* @}
*/
/** @defgroup FSMC_Exported_Functions
* @{
*/
void FSMC_NORSRAMDeInit(uint32_t FSMC_Bank);
void FSMC_NANDDeInit(uint32_t FSMC_Bank);
void FSMC_PCCARDDeInit(void);
void FSMC_NORSRAMInit(FSMC_NORSRAMInitTypeDef* FSMC_NORSRAMInitStruct);
void FSMC_NANDInit(FSMC_NANDInitTypeDef* FSMC_NANDInitStruct);
void FSMC_PCCARDInit(FSMC_PCCARDInitTypeDef* FSMC_PCCARDInitStruct);
void FSMC_NORSRAMStructInit(FSMC_NORSRAMInitTypeDef* FSMC_NORSRAMInitStruct);
void FSMC_NANDStructInit(FSMC_NANDInitTypeDef* FSMC_NANDInitStruct);
void FSMC_PCCARDStructInit(FSMC_PCCARDInitTypeDef* FSMC_PCCARDInitStruct);
void FSMC_NORSRAMCmd(uint32_t FSMC_Bank, FunctionalState NewState);
void FSMC_NANDCmd(uint32_t FSMC_Bank, FunctionalState NewState);
void FSMC_PCCARDCmd(FunctionalState NewState);
void FSMC_NANDECCCmd(uint32_t FSMC_Bank, FunctionalState NewState);
uint32_t FSMC_GetECC(uint32_t FSMC_Bank);
void FSMC_ITConfig(uint32_t FSMC_Bank, uint32_t FSMC_IT, FunctionalState NewState);
FlagStatus FSMC_GetFlagStatus(uint32_t FSMC_Bank, uint32_t FSMC_FLAG);
void FSMC_ClearFlag(uint32_t FSMC_Bank, uint32_t FSMC_FLAG);
ITStatus FSMC_GetITStatus(uint32_t FSMC_Bank, uint32_t FSMC_IT);
void FSMC_ClearITPendingBit(uint32_t FSMC_Bank, uint32_t FSMC_IT);
#ifdef __cplusplus
}
#endif
#endif /*__STM32F10x_FSMC_H */
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/

View File

@@ -0,0 +1,383 @@
/**
******************************************************************************
* @file stm32f10x_gpio.h
* @author MCD Application Team
* @version V3.6.2
* @date 17-September-2021
* @brief This file contains all the functions prototypes for the GPIO
* 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_GPIO_H
#define __STM32F10x_GPIO_H
#ifdef __cplusplus
extern "C" {
#endif
/* Includes ------------------------------------------------------------------*/
#include "stm32f10x.h"
/** @addtogroup STM32F10x_StdPeriph_Driver
* @{
*/
/** @addtogroup GPIO
* @{
*/
/** @defgroup GPIO_Exported_Types
* @{
*/
#define IS_GPIO_ALL_PERIPH(PERIPH) (((PERIPH) == GPIOA) || \
((PERIPH) == GPIOB) || \
((PERIPH) == GPIOC) || \
((PERIPH) == GPIOD) || \
((PERIPH) == GPIOE) || \
((PERIPH) == GPIOF) || \
((PERIPH) == GPIOG))
/**
* @brief Output Maximum frequency selection
*/
typedef enum
{
GPIO_Speed_10MHz = 1,
GPIO_Speed_2MHz,
GPIO_Speed_50MHz
}GPIOSpeed_TypeDef;
#define IS_GPIO_SPEED(SPEED) (((SPEED) == GPIO_Speed_10MHz) || ((SPEED) == GPIO_Speed_2MHz) || \
((SPEED) == GPIO_Speed_50MHz))
/**
* @brief Configuration Mode enumeration
*/
typedef enum
{ GPIO_Mode_AIN = 0x0,
GPIO_Mode_IN_FLOATING = 0x04,
GPIO_Mode_IPD = 0x28,
GPIO_Mode_IPU = 0x48,
GPIO_Mode_Out_OD = 0x14,
GPIO_Mode_Out_PP = 0x10,
GPIO_Mode_AF_OD = 0x1C,
GPIO_Mode_AF_PP = 0x18
}GPIOMode_TypeDef;
#define IS_GPIO_MODE(MODE) (((MODE) == GPIO_Mode_AIN) || ((MODE) == GPIO_Mode_IN_FLOATING) || \
((MODE) == GPIO_Mode_IPD) || ((MODE) == GPIO_Mode_IPU) || \
((MODE) == GPIO_Mode_Out_OD) || ((MODE) == GPIO_Mode_Out_PP) || \
((MODE) == GPIO_Mode_AF_OD) || ((MODE) == GPIO_Mode_AF_PP))
/**
* @brief GPIO Init structure definition
*/
typedef struct
{
uint16_t GPIO_Pin; /*!< Specifies the GPIO pins to be configured.
This parameter can be any value of @ref GPIO_pins_define */
GPIOSpeed_TypeDef GPIO_Speed; /*!< Specifies the speed for the selected pins.
This parameter can be a value of @ref GPIOSpeed_TypeDef */
GPIOMode_TypeDef GPIO_Mode; /*!< Specifies the operating mode for the selected pins.
This parameter can be a value of @ref GPIOMode_TypeDef */
}GPIO_InitTypeDef;
/**
* @brief Bit_SET and Bit_RESET enumeration
*/
typedef enum
{ Bit_RESET = 0,
Bit_SET
}BitAction;
#define IS_GPIO_BIT_ACTION(ACTION) (((ACTION) == Bit_RESET) || ((ACTION) == Bit_SET))
/**
* @}
*/
/** @defgroup GPIO_Exported_Constants
* @{
*/
/** @defgroup GPIO_pins_define
* @{
*/
#define GPIO_Pin_0 ((uint16_t)0x0001) /*!< Pin 0 selected */
#define GPIO_Pin_1 ((uint16_t)0x0002) /*!< Pin 1 selected */
#define GPIO_Pin_2 ((uint16_t)0x0004) /*!< Pin 2 selected */
#define GPIO_Pin_3 ((uint16_t)0x0008) /*!< Pin 3 selected */
#define GPIO_Pin_4 ((uint16_t)0x0010) /*!< Pin 4 selected */
#define GPIO_Pin_5 ((uint16_t)0x0020) /*!< Pin 5 selected */
#define GPIO_Pin_6 ((uint16_t)0x0040) /*!< Pin 6 selected */
#define GPIO_Pin_7 ((uint16_t)0x0080) /*!< Pin 7 selected */
#define GPIO_Pin_8 ((uint16_t)0x0100) /*!< Pin 8 selected */
#define GPIO_Pin_9 ((uint16_t)0x0200) /*!< Pin 9 selected */
#define GPIO_Pin_10 ((uint16_t)0x0400) /*!< Pin 10 selected */
#define GPIO_Pin_11 ((uint16_t)0x0800) /*!< Pin 11 selected */
#define GPIO_Pin_12 ((uint16_t)0x1000) /*!< Pin 12 selected */
#define GPIO_Pin_13 ((uint16_t)0x2000) /*!< Pin 13 selected */
#define GPIO_Pin_14 ((uint16_t)0x4000) /*!< Pin 14 selected */
#define GPIO_Pin_15 ((uint16_t)0x8000) /*!< Pin 15 selected */
#define GPIO_Pin_All ((uint16_t)0xFFFF) /*!< All pins selected */
#define IS_GPIO_PIN(PIN) ((((PIN) & (uint16_t)0x00) == 0x00) && ((PIN) != (uint16_t)0x00))
#define IS_GET_GPIO_PIN(PIN) (((PIN) == GPIO_Pin_0) || \
((PIN) == GPIO_Pin_1) || \
((PIN) == GPIO_Pin_2) || \
((PIN) == GPIO_Pin_3) || \
((PIN) == GPIO_Pin_4) || \
((PIN) == GPIO_Pin_5) || \
((PIN) == GPIO_Pin_6) || \
((PIN) == GPIO_Pin_7) || \
((PIN) == GPIO_Pin_8) || \
((PIN) == GPIO_Pin_9) || \
((PIN) == GPIO_Pin_10) || \
((PIN) == GPIO_Pin_11) || \
((PIN) == GPIO_Pin_12) || \
((PIN) == GPIO_Pin_13) || \
((PIN) == GPIO_Pin_14) || \
((PIN) == GPIO_Pin_15))
/**
* @}
*/
/** @defgroup GPIO_Remap_define
* @{
*/
#define GPIO_Remap_SPI1 ((uint32_t)0x00000001) /*!< SPI1 Alternate Function mapping */
#define GPIO_Remap_I2C1 ((uint32_t)0x00000002) /*!< I2C1 Alternate Function mapping */
#define GPIO_Remap_USART1 ((uint32_t)0x00000004) /*!< USART1 Alternate Function mapping */
#define GPIO_Remap_USART2 ((uint32_t)0x00000008) /*!< USART2 Alternate Function mapping */
#define GPIO_PartialRemap_USART3 ((uint32_t)0x00140010) /*!< USART3 Partial Alternate Function mapping */
#define GPIO_FullRemap_USART3 ((uint32_t)0x00140030) /*!< USART3 Full Alternate Function mapping */
#define GPIO_PartialRemap_TIM1 ((uint32_t)0x00160040) /*!< TIM1 Partial Alternate Function mapping */
#define GPIO_FullRemap_TIM1 ((uint32_t)0x001600C0) /*!< TIM1 Full Alternate Function mapping */
#define GPIO_PartialRemap1_TIM2 ((uint32_t)0x00180100) /*!< TIM2 Partial1 Alternate Function mapping */
#define GPIO_PartialRemap2_TIM2 ((uint32_t)0x00180200) /*!< TIM2 Partial2 Alternate Function mapping */
#define GPIO_FullRemap_TIM2 ((uint32_t)0x00180300) /*!< TIM2 Full Alternate Function mapping */
#define GPIO_PartialRemap_TIM3 ((uint32_t)0x001A0800) /*!< TIM3 Partial Alternate Function mapping */
#define GPIO_FullRemap_TIM3 ((uint32_t)0x001A0C00) /*!< TIM3 Full Alternate Function mapping */
#define GPIO_Remap_TIM4 ((uint32_t)0x00001000) /*!< TIM4 Alternate Function mapping */
#define GPIO_Remap1_CAN1 ((uint32_t)0x001D4000) /*!< CAN1 Alternate Function mapping */
#define GPIO_Remap2_CAN1 ((uint32_t)0x001D6000) /*!< CAN1 Alternate Function mapping */
#define GPIO_Remap_PD01 ((uint32_t)0x00008000) /*!< PD01 Alternate Function mapping */
#define GPIO_Remap_TIM5CH4_LSI ((uint32_t)0x00200001) /*!< LSI connected to TIM5 Channel4 input capture for calibration */
#define GPIO_Remap_ADC1_ETRGINJ ((uint32_t)0x00200002) /*!< ADC1 External Trigger Injected Conversion remapping */
#define GPIO_Remap_ADC1_ETRGREG ((uint32_t)0x00200004) /*!< ADC1 External Trigger Regular Conversion remapping */
#define GPIO_Remap_ADC2_ETRGINJ ((uint32_t)0x00200008) /*!< ADC2 External Trigger Injected Conversion remapping */
#define GPIO_Remap_ADC2_ETRGREG ((uint32_t)0x00200010) /*!< ADC2 External Trigger Regular Conversion remapping */
#define GPIO_Remap_ETH ((uint32_t)0x00200020) /*!< Ethernet remapping (only for Connectivity line devices) */
#define GPIO_Remap_CAN2 ((uint32_t)0x00200040) /*!< CAN2 remapping (only for Connectivity line devices) */
#define GPIO_Remap_SWJ_NoJTRST ((uint32_t)0x00300100) /*!< Full SWJ Enabled (JTAG-DP + SW-DP) but without JTRST */
#define GPIO_Remap_SWJ_JTAGDisable ((uint32_t)0x00300200) /*!< JTAG-DP Disabled and SW-DP Enabled */
#define GPIO_Remap_SWJ_Disable ((uint32_t)0x00300400) /*!< Full SWJ Disabled (JTAG-DP + SW-DP) */
#define GPIO_Remap_SPI3 ((uint32_t)0x00201100) /*!< SPI3/I2S3 Alternate Function mapping (only for Connectivity line devices) */
#define GPIO_Remap_TIM2ITR1_PTP_SOF ((uint32_t)0x00202000) /*!< Ethernet PTP output or USB OTG SOF (Start of Frame) connected
to TIM2 Internal Trigger 1 for calibration
(only for Connectivity line devices) */
#define GPIO_Remap_PTP_PPS ((uint32_t)0x00204000) /*!< Ethernet MAC PPS_PTS output on PB05 (only for Connectivity line devices) */
#define GPIO_Remap_TIM15 ((uint32_t)0x80000001) /*!< TIM15 Alternate Function mapping (only for Value line devices) */
#define GPIO_Remap_TIM16 ((uint32_t)0x80000002) /*!< TIM16 Alternate Function mapping (only for Value line devices) */
#define GPIO_Remap_TIM17 ((uint32_t)0x80000004) /*!< TIM17 Alternate Function mapping (only for Value line devices) */
#define GPIO_Remap_CEC ((uint32_t)0x80000008) /*!< CEC Alternate Function mapping (only for Value line devices) */
#define GPIO_Remap_TIM1_DMA ((uint32_t)0x80000010) /*!< TIM1 DMA requests mapping (only for Value line devices) */
#define GPIO_Remap_TIM9 ((uint32_t)0x80000020) /*!< TIM9 Alternate Function mapping (only for XL-density devices) */
#define GPIO_Remap_TIM10 ((uint32_t)0x80000040) /*!< TIM10 Alternate Function mapping (only for XL-density devices) */
#define GPIO_Remap_TIM11 ((uint32_t)0x80000080) /*!< TIM11 Alternate Function mapping (only for XL-density devices) */
#define GPIO_Remap_TIM13 ((uint32_t)0x80000100) /*!< TIM13 Alternate Function mapping (only for High density Value line and XL-density devices) */
#define GPIO_Remap_TIM14 ((uint32_t)0x80000200) /*!< TIM14 Alternate Function mapping (only for High density Value line and XL-density devices) */
#define GPIO_Remap_FSMC_NADV ((uint32_t)0x80000400) /*!< FSMC_NADV Alternate Function mapping (only for High density Value line and XL-density devices) */
#define GPIO_Remap_TIM67_DAC_DMA ((uint32_t)0x80000800) /*!< TIM6/TIM7 and DAC DMA requests remapping (only for High density Value line devices) */
#define GPIO_Remap_TIM12 ((uint32_t)0x80001000) /*!< TIM12 Alternate Function mapping (only for High density Value line devices) */
#define GPIO_Remap_MISC ((uint32_t)0x80002000) /*!< Miscellaneous Remap (DMA2 Channel5 Position and DAC Trigger remapping,
only for High density Value line devices) */
#define IS_GPIO_REMAP(REMAP) (((REMAP) == GPIO_Remap_SPI1) || ((REMAP) == GPIO_Remap_I2C1) || \
((REMAP) == GPIO_Remap_USART1) || ((REMAP) == GPIO_Remap_USART2) || \
((REMAP) == GPIO_PartialRemap_USART3) || ((REMAP) == GPIO_FullRemap_USART3) || \
((REMAP) == GPIO_PartialRemap_TIM1) || ((REMAP) == GPIO_FullRemap_TIM1) || \
((REMAP) == GPIO_PartialRemap1_TIM2) || ((REMAP) == GPIO_PartialRemap2_TIM2) || \
((REMAP) == GPIO_FullRemap_TIM2) || ((REMAP) == GPIO_PartialRemap_TIM3) || \
((REMAP) == GPIO_FullRemap_TIM3) || ((REMAP) == GPIO_Remap_TIM4) || \
((REMAP) == GPIO_Remap1_CAN1) || ((REMAP) == GPIO_Remap2_CAN1) || \
((REMAP) == GPIO_Remap_PD01) || ((REMAP) == GPIO_Remap_TIM5CH4_LSI) || \
((REMAP) == GPIO_Remap_ADC1_ETRGINJ) ||((REMAP) == GPIO_Remap_ADC1_ETRGREG) || \
((REMAP) == GPIO_Remap_ADC2_ETRGINJ) ||((REMAP) == GPIO_Remap_ADC2_ETRGREG) || \
((REMAP) == GPIO_Remap_ETH) ||((REMAP) == GPIO_Remap_CAN2) || \
((REMAP) == GPIO_Remap_SWJ_NoJTRST) || ((REMAP) == GPIO_Remap_SWJ_JTAGDisable) || \
((REMAP) == GPIO_Remap_SWJ_Disable)|| ((REMAP) == GPIO_Remap_SPI3) || \
((REMAP) == GPIO_Remap_TIM2ITR1_PTP_SOF) || ((REMAP) == GPIO_Remap_PTP_PPS) || \
((REMAP) == GPIO_Remap_TIM15) || ((REMAP) == GPIO_Remap_TIM16) || \
((REMAP) == GPIO_Remap_TIM17) || ((REMAP) == GPIO_Remap_CEC) || \
((REMAP) == GPIO_Remap_TIM1_DMA) || ((REMAP) == GPIO_Remap_TIM9) || \
((REMAP) == GPIO_Remap_TIM10) || ((REMAP) == GPIO_Remap_TIM11) || \
((REMAP) == GPIO_Remap_TIM13) || ((REMAP) == GPIO_Remap_TIM14) || \
((REMAP) == GPIO_Remap_FSMC_NADV) || ((REMAP) == GPIO_Remap_TIM67_DAC_DMA) || \
((REMAP) == GPIO_Remap_TIM12) || ((REMAP) == GPIO_Remap_MISC))
/**
* @}
*/
/** @defgroup GPIO_Port_Sources
* @{
*/
#define GPIO_PortSourceGPIOA ((uint8_t)0x00)
#define GPIO_PortSourceGPIOB ((uint8_t)0x01)
#define GPIO_PortSourceGPIOC ((uint8_t)0x02)
#define GPIO_PortSourceGPIOD ((uint8_t)0x03)
#define GPIO_PortSourceGPIOE ((uint8_t)0x04)
#define GPIO_PortSourceGPIOF ((uint8_t)0x05)
#define GPIO_PortSourceGPIOG ((uint8_t)0x06)
#define IS_GPIO_EVENTOUT_PORT_SOURCE(PORTSOURCE) (((PORTSOURCE) == GPIO_PortSourceGPIOA) || \
((PORTSOURCE) == GPIO_PortSourceGPIOB) || \
((PORTSOURCE) == GPIO_PortSourceGPIOC) || \
((PORTSOURCE) == GPIO_PortSourceGPIOD) || \
((PORTSOURCE) == GPIO_PortSourceGPIOE))
#define IS_GPIO_EXTI_PORT_SOURCE(PORTSOURCE) (((PORTSOURCE) == GPIO_PortSourceGPIOA) || \
((PORTSOURCE) == GPIO_PortSourceGPIOB) || \
((PORTSOURCE) == GPIO_PortSourceGPIOC) || \
((PORTSOURCE) == GPIO_PortSourceGPIOD) || \
((PORTSOURCE) == GPIO_PortSourceGPIOE) || \
((PORTSOURCE) == GPIO_PortSourceGPIOF) || \
((PORTSOURCE) == GPIO_PortSourceGPIOG))
/**
* @}
*/
/** @defgroup GPIO_Pin_sources
* @{
*/
#define GPIO_PinSource0 ((uint8_t)0x00)
#define GPIO_PinSource1 ((uint8_t)0x01)
#define GPIO_PinSource2 ((uint8_t)0x02)
#define GPIO_PinSource3 ((uint8_t)0x03)
#define GPIO_PinSource4 ((uint8_t)0x04)
#define GPIO_PinSource5 ((uint8_t)0x05)
#define GPIO_PinSource6 ((uint8_t)0x06)
#define GPIO_PinSource7 ((uint8_t)0x07)
#define GPIO_PinSource8 ((uint8_t)0x08)
#define GPIO_PinSource9 ((uint8_t)0x09)
#define GPIO_PinSource10 ((uint8_t)0x0A)
#define GPIO_PinSource11 ((uint8_t)0x0B)
#define GPIO_PinSource12 ((uint8_t)0x0C)
#define GPIO_PinSource13 ((uint8_t)0x0D)
#define GPIO_PinSource14 ((uint8_t)0x0E)
#define GPIO_PinSource15 ((uint8_t)0x0F)
#define IS_GPIO_PIN_SOURCE(PINSOURCE) (((PINSOURCE) == GPIO_PinSource0) || \
((PINSOURCE) == GPIO_PinSource1) || \
((PINSOURCE) == GPIO_PinSource2) || \
((PINSOURCE) == GPIO_PinSource3) || \
((PINSOURCE) == GPIO_PinSource4) || \
((PINSOURCE) == GPIO_PinSource5) || \
((PINSOURCE) == GPIO_PinSource6) || \
((PINSOURCE) == GPIO_PinSource7) || \
((PINSOURCE) == GPIO_PinSource8) || \
((PINSOURCE) == GPIO_PinSource9) || \
((PINSOURCE) == GPIO_PinSource10) || \
((PINSOURCE) == GPIO_PinSource11) || \
((PINSOURCE) == GPIO_PinSource12) || \
((PINSOURCE) == GPIO_PinSource13) || \
((PINSOURCE) == GPIO_PinSource14) || \
((PINSOURCE) == GPIO_PinSource15))
/**
* @}
*/
/** @defgroup Ethernet_Media_Interface
* @{
*/
#define GPIO_ETH_MediaInterface_MII ((u32)0x00000000)
#define GPIO_ETH_MediaInterface_RMII ((u32)0x00000001)
#define IS_GPIO_ETH_MEDIA_INTERFACE(INTERFACE) (((INTERFACE) == GPIO_ETH_MediaInterface_MII) || \
((INTERFACE) == GPIO_ETH_MediaInterface_RMII))
/**
* @}
*/
/**
* @}
*/
/** @defgroup GPIO_Exported_Macros
* @{
*/
/**
* @}
*/
/** @defgroup GPIO_Exported_Functions
* @{
*/
void GPIO_DeInit(GPIO_TypeDef* GPIOx);
void GPIO_AFIODeInit(void);
void GPIO_Init(GPIO_TypeDef* GPIOx, GPIO_InitTypeDef* GPIO_InitStruct);
void GPIO_StructInit(GPIO_InitTypeDef* GPIO_InitStruct);
uint8_t GPIO_ReadInputDataBit(GPIO_TypeDef* GPIOx, uint16_t GPIO_Pin);
uint16_t GPIO_ReadInputData(GPIO_TypeDef* GPIOx);
uint8_t GPIO_ReadOutputDataBit(GPIO_TypeDef* GPIOx, uint16_t GPIO_Pin);
uint16_t GPIO_ReadOutputData(GPIO_TypeDef* GPIOx);
void GPIO_SetBits(GPIO_TypeDef* GPIOx, uint16_t GPIO_Pin);
void GPIO_ResetBits(GPIO_TypeDef* GPIOx, uint16_t GPIO_Pin);
void GPIO_WriteBit(GPIO_TypeDef* GPIOx, uint16_t GPIO_Pin, BitAction BitVal);
void GPIO_Write(GPIO_TypeDef* GPIOx, uint16_t PortVal);
void GPIO_PinLockConfig(GPIO_TypeDef* GPIOx, uint16_t GPIO_Pin);
void GPIO_EventOutputConfig(uint8_t GPIO_PortSource, uint8_t GPIO_PinSource);
void GPIO_EventOutputCmd(FunctionalState NewState);
void GPIO_PinRemapConfig(uint32_t GPIO_Remap, FunctionalState NewState);
void GPIO_EXTILineConfig(uint8_t GPIO_PortSource, uint8_t GPIO_PinSource);
void GPIO_ETH_MediaInterfaceConfig(uint32_t GPIO_ETH_MediaInterface);
#ifdef __cplusplus
}
#endif
#endif /* __STM32F10x_GPIO_H */
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/

View File

@@ -0,0 +1,682 @@
/**
******************************************************************************
* @file stm32f10x_i2c.h
* @author MCD Application Team
* @version V3.6.2
* @date 17-September-2021
* @brief This file contains all the functions prototypes for the I2C 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_I2C_H
#define __STM32F10x_I2C_H
#ifdef __cplusplus
extern "C" {
#endif
/* Includes ------------------------------------------------------------------*/
#include "stm32f10x.h"
/** @addtogroup STM32F10x_StdPeriph_Driver
* @{
*/
/** @addtogroup I2C
* @{
*/
/** @defgroup I2C_Exported_Types
* @{
*/
/**
* @brief I2C Init structure definition
*/
typedef struct
{
uint32_t I2C_ClockSpeed; /*!< Specifies the clock frequency.
This parameter must be set to a value lower than 400kHz */
uint16_t I2C_Mode; /*!< Specifies the I2C mode.
This parameter can be a value of @ref I2C_mode */
uint16_t I2C_DutyCycle; /*!< Specifies the I2C fast mode duty cycle.
This parameter can be a value of @ref I2C_duty_cycle_in_fast_mode */
uint16_t I2C_OwnAddress1; /*!< Specifies the first device own address.
This parameter can be a 7-bit or 10-bit address. */
uint16_t I2C_Ack; /*!< Enables or disables the acknowledgement.
This parameter can be a value of @ref I2C_acknowledgement */
uint16_t I2C_AcknowledgedAddress; /*!< Specifies if 7-bit or 10-bit address is acknowledged.
This parameter can be a value of @ref I2C_acknowledged_address */
}I2C_InitTypeDef;
/**
* @}
*/
/** @defgroup I2C_Exported_Constants
* @{
*/
#define IS_I2C_ALL_PERIPH(PERIPH) (((PERIPH) == I2C1) || \
((PERIPH) == I2C2))
/** @defgroup I2C_mode
* @{
*/
#define I2C_Mode_I2C ((uint16_t)0x0000)
#define I2C_Mode_SMBusDevice ((uint16_t)0x0002)
#define I2C_Mode_SMBusHost ((uint16_t)0x000A)
#define IS_I2C_MODE(MODE) (((MODE) == I2C_Mode_I2C) || \
((MODE) == I2C_Mode_SMBusDevice) || \
((MODE) == I2C_Mode_SMBusHost))
/**
* @}
*/
/** @defgroup I2C_duty_cycle_in_fast_mode
* @{
*/
#define I2C_DutyCycle_16_9 ((uint16_t)0x4000) /*!< I2C fast mode Tlow/Thigh = 16/9 */
#define I2C_DutyCycle_2 ((uint16_t)0xBFFF) /*!< I2C fast mode Tlow/Thigh = 2 */
#define IS_I2C_DUTY_CYCLE(CYCLE) (((CYCLE) == I2C_DutyCycle_16_9) || \
((CYCLE) == I2C_DutyCycle_2))
/**
* @}
*/
/** @defgroup I2C_acknowledgement
* @{
*/
#define I2C_Ack_Enable ((uint16_t)0x0400)
#define I2C_Ack_Disable ((uint16_t)0x0000)
#define IS_I2C_ACK_STATE(STATE) (((STATE) == I2C_Ack_Enable) || \
((STATE) == I2C_Ack_Disable))
/**
* @}
*/
/** @defgroup I2C_transfer_direction
* @{
*/
#define I2C_Direction_Transmitter ((uint8_t)0x00)
#define I2C_Direction_Receiver ((uint8_t)0x01)
#define IS_I2C_DIRECTION(DIRECTION) (((DIRECTION) == I2C_Direction_Transmitter) || \
((DIRECTION) == I2C_Direction_Receiver))
/**
* @}
*/
/** @defgroup I2C_acknowledged_address
* @{
*/
#define I2C_AcknowledgedAddress_7bit ((uint16_t)0x4000)
#define I2C_AcknowledgedAddress_10bit ((uint16_t)0xC000)
#define IS_I2C_ACKNOWLEDGE_ADDRESS(ADDRESS) (((ADDRESS) == I2C_AcknowledgedAddress_7bit) || \
((ADDRESS) == I2C_AcknowledgedAddress_10bit))
/**
* @}
*/
/** @defgroup I2C_registers
* @{
*/
#define I2C_Register_CR1 ((uint8_t)0x00)
#define I2C_Register_CR2 ((uint8_t)0x04)
#define I2C_Register_OAR1 ((uint8_t)0x08)
#define I2C_Register_OAR2 ((uint8_t)0x0C)
#define I2C_Register_DR ((uint8_t)0x10)
#define I2C_Register_SR1 ((uint8_t)0x14)
#define I2C_Register_SR2 ((uint8_t)0x18)
#define I2C_Register_CCR ((uint8_t)0x1C)
#define I2C_Register_TRISE ((uint8_t)0x20)
#define IS_I2C_REGISTER(REGISTER) (((REGISTER) == I2C_Register_CR1) || \
((REGISTER) == I2C_Register_CR2) || \
((REGISTER) == I2C_Register_OAR1) || \
((REGISTER) == I2C_Register_OAR2) || \
((REGISTER) == I2C_Register_DR) || \
((REGISTER) == I2C_Register_SR1) || \
((REGISTER) == I2C_Register_SR2) || \
((REGISTER) == I2C_Register_CCR) || \
((REGISTER) == I2C_Register_TRISE))
/**
* @}
*/
/** @defgroup I2C_SMBus_alert_pin_level
* @{
*/
#define I2C_SMBusAlert_Low ((uint16_t)0x2000)
#define I2C_SMBusAlert_High ((uint16_t)0xDFFF)
#define IS_I2C_SMBUS_ALERT(ALERT) (((ALERT) == I2C_SMBusAlert_Low) || \
((ALERT) == I2C_SMBusAlert_High))
/**
* @}
*/
/** @defgroup I2C_PEC_position
* @{
*/
#define I2C_PECPosition_Next ((uint16_t)0x0800)
#define I2C_PECPosition_Current ((uint16_t)0xF7FF)
#define IS_I2C_PEC_POSITION(POSITION) (((POSITION) == I2C_PECPosition_Next) || \
((POSITION) == I2C_PECPosition_Current))
/**
* @}
*/
/** @defgroup I2C_NCAK_position
* @{
*/
#define I2C_NACKPosition_Next ((uint16_t)0x0800)
#define I2C_NACKPosition_Current ((uint16_t)0xF7FF)
#define IS_I2C_NACK_POSITION(POSITION) (((POSITION) == I2C_NACKPosition_Next) || \
((POSITION) == I2C_NACKPosition_Current))
/**
* @}
*/
/** @defgroup I2C_interrupts_definition
* @{
*/
#define I2C_IT_BUF ((uint16_t)0x0400)
#define I2C_IT_EVT ((uint16_t)0x0200)
#define I2C_IT_ERR ((uint16_t)0x0100)
#define IS_I2C_CONFIG_IT(IT) ((((IT) & (uint16_t)0xF8FF) == 0x00) && ((IT) != 0x00))
/**
* @}
*/
/** @defgroup I2C_interrupts_definition
* @{
*/
#define I2C_IT_SMBALERT ((uint32_t)0x01008000)
#define I2C_IT_TIMEOUT ((uint32_t)0x01004000)
#define I2C_IT_PECERR ((uint32_t)0x01001000)
#define I2C_IT_OVR ((uint32_t)0x01000800)
#define I2C_IT_AF ((uint32_t)0x01000400)
#define I2C_IT_ARLO ((uint32_t)0x01000200)
#define I2C_IT_BERR ((uint32_t)0x01000100)
#define I2C_IT_TXE ((uint32_t)0x06000080)
#define I2C_IT_RXNE ((uint32_t)0x06000040)
#define I2C_IT_STOPF ((uint32_t)0x02000010)
#define I2C_IT_ADD10 ((uint32_t)0x02000008)
#define I2C_IT_BTF ((uint32_t)0x02000004)
#define I2C_IT_ADDR ((uint32_t)0x02000002)
#define I2C_IT_SB ((uint32_t)0x02000001)
#define IS_I2C_CLEAR_IT(IT) ((((IT) & (uint16_t)0x20FF) == 0x00) && ((IT) != (uint16_t)0x00))
#define IS_I2C_GET_IT(IT) (((IT) == I2C_IT_SMBALERT) || ((IT) == I2C_IT_TIMEOUT) || \
((IT) == I2C_IT_PECERR) || ((IT) == I2C_IT_OVR) || \
((IT) == I2C_IT_AF) || ((IT) == I2C_IT_ARLO) || \
((IT) == I2C_IT_BERR) || ((IT) == I2C_IT_TXE) || \
((IT) == I2C_IT_RXNE) || ((IT) == I2C_IT_STOPF) || \
((IT) == I2C_IT_ADD10) || ((IT) == I2C_IT_BTF) || \
((IT) == I2C_IT_ADDR) || ((IT) == I2C_IT_SB))
/**
* @}
*/
/** @defgroup I2C_flags_definition
* @{
*/
/**
* @brief SR2 register flags
*/
#define I2C_FLAG_DUALF ((uint32_t)0x00800000)
#define I2C_FLAG_SMBHOST ((uint32_t)0x00400000)
#define I2C_FLAG_SMBDEFAULT ((uint32_t)0x00200000)
#define I2C_FLAG_GENCALL ((uint32_t)0x00100000)
#define I2C_FLAG_TRA ((uint32_t)0x00040000)
#define I2C_FLAG_BUSY ((uint32_t)0x00020000)
#define I2C_FLAG_MSL ((uint32_t)0x00010000)
/**
* @brief SR1 register flags
*/
#define I2C_FLAG_SMBALERT ((uint32_t)0x10008000)
#define I2C_FLAG_TIMEOUT ((uint32_t)0x10004000)
#define I2C_FLAG_PECERR ((uint32_t)0x10001000)
#define I2C_FLAG_OVR ((uint32_t)0x10000800)
#define I2C_FLAG_AF ((uint32_t)0x10000400)
#define I2C_FLAG_ARLO ((uint32_t)0x10000200)
#define I2C_FLAG_BERR ((uint32_t)0x10000100)
#define I2C_FLAG_TXE ((uint32_t)0x10000080)
#define I2C_FLAG_RXNE ((uint32_t)0x10000040)
#define I2C_FLAG_STOPF ((uint32_t)0x10000010)
#define I2C_FLAG_ADD10 ((uint32_t)0x10000008)
#define I2C_FLAG_BTF ((uint32_t)0x10000004)
#define I2C_FLAG_ADDR ((uint32_t)0x10000002)
#define I2C_FLAG_SB ((uint32_t)0x10000001)
#define IS_I2C_CLEAR_FLAG(FLAG) ((((FLAG) & (uint16_t)0x20FF) == 0x00) && ((FLAG) != (uint16_t)0x00))
#define IS_I2C_GET_FLAG(FLAG) (((FLAG) == I2C_FLAG_DUALF) || ((FLAG) == I2C_FLAG_SMBHOST) || \
((FLAG) == I2C_FLAG_SMBDEFAULT) || ((FLAG) == I2C_FLAG_GENCALL) || \
((FLAG) == I2C_FLAG_TRA) || ((FLAG) == I2C_FLAG_BUSY) || \
((FLAG) == I2C_FLAG_MSL) || ((FLAG) == I2C_FLAG_SMBALERT) || \
((FLAG) == I2C_FLAG_TIMEOUT) || ((FLAG) == I2C_FLAG_PECERR) || \
((FLAG) == I2C_FLAG_OVR) || ((FLAG) == I2C_FLAG_AF) || \
((FLAG) == I2C_FLAG_ARLO) || ((FLAG) == I2C_FLAG_BERR) || \
((FLAG) == I2C_FLAG_TXE) || ((FLAG) == I2C_FLAG_RXNE) || \
((FLAG) == I2C_FLAG_STOPF) || ((FLAG) == I2C_FLAG_ADD10) || \
((FLAG) == I2C_FLAG_BTF) || ((FLAG) == I2C_FLAG_ADDR) || \
((FLAG) == I2C_FLAG_SB))
/**
* @}
*/
/** @defgroup I2C_Events
* @{
*/
/*========================================
I2C Master Events (Events grouped in order of communication)
==========================================*/
/**
* @brief Communication start
*
* After sending the START condition (I2C_GenerateSTART() function) the master
* has to wait for this event. It means that the Start condition has been correctly
* released on the I2C bus (the bus is free, no other devices is communicating).
*
*/
/* --EV5 */
#define I2C_EVENT_MASTER_MODE_SELECT ((uint32_t)0x00030001) /* BUSY, MSL and SB flag */
/**
* @brief Address Acknowledge
*
* After checking on EV5 (start condition correctly released on the bus), the
* master sends the address of the slave(s) with which it will communicate
* (I2C_Send7bitAddress() function, it also determines the direction of the communication:
* Master transmitter or Receiver). Then the master has to wait that a slave acknowledges
* his address. If an acknowledge is sent on the bus, one of the following events will
* be set:
*
* 1) In case of Master Receiver (7-bit addressing): the I2C_EVENT_MASTER_RECEIVER_MODE_SELECTED
* event is set.
*
* 2) In case of Master Transmitter (7-bit addressing): the I2C_EVENT_MASTER_TRANSMITTER_MODE_SELECTED
* is set
*
* 3) In case of 10-Bit addressing mode, the master (just after generating the START
* and checking on EV5) has to send the header of 10-bit addressing mode (I2C_SendData()
* function). Then master should wait on EV9. It means that the 10-bit addressing
* header has been correctly sent on the bus. Then master should send the second part of
* the 10-bit address (LSB) using the function I2C_Send7bitAddress(). Then master
* should wait for event EV6.
*
*/
/* --EV6 */
#define I2C_EVENT_MASTER_TRANSMITTER_MODE_SELECTED ((uint32_t)0x00070082) /* BUSY, MSL, ADDR, TXE and TRA flags */
#define I2C_EVENT_MASTER_RECEIVER_MODE_SELECTED ((uint32_t)0x00030002) /* BUSY, MSL and ADDR flags */
/* --EV9 */
#define I2C_EVENT_MASTER_MODE_ADDRESS10 ((uint32_t)0x00030008) /* BUSY, MSL and ADD10 flags */
/**
* @brief Communication events
*
* If a communication is established (START condition generated and slave address
* acknowledged) then the master has to check on one of the following events for
* communication procedures:
*
* 1) Master Receiver mode: The master has to wait on the event EV7 then to read
* the data received from the slave (I2C_ReceiveData() function).
*
* 2) Master Transmitter mode: The master has to send data (I2C_SendData()
* function) then to wait on event EV8 or EV8_2.
* These two events are similar:
* - EV8 means that the data has been written in the data register and is
* being shifted out.
* - EV8_2 means that the data has been physically shifted out and output
* on the bus.
* In most cases, using EV8 is sufficient for the application.
* Using EV8_2 leads to a slower communication but ensure more reliable test.
* EV8_2 is also more suitable than EV8 for testing on the last data transmission
* (before Stop condition generation).
*
* @note In case the user software does not guarantee that this event EV7 is
* managed before the current byte end of transfer, then user may check on EV7
* and BTF flag at the same time (ie. (I2C_EVENT_MASTER_BYTE_RECEIVED | I2C_FLAG_BTF)).
* In this case the communication may be slower.
*
*/
/* Master RECEIVER mode -----------------------------*/
/* --EV7 */
#define I2C_EVENT_MASTER_BYTE_RECEIVED ((uint32_t)0x00030040) /* BUSY, MSL and RXNE flags */
/* Master TRANSMITTER mode --------------------------*/
/* --EV8 */
#define I2C_EVENT_MASTER_BYTE_TRANSMITTING ((uint32_t)0x00070080) /* TRA, BUSY, MSL, TXE flags */
/* --EV8_2 */
#define I2C_EVENT_MASTER_BYTE_TRANSMITTED ((uint32_t)0x00070084) /* TRA, BUSY, MSL, TXE and BTF flags */
/*========================================
I2C Slave Events (Events grouped in order of communication)
==========================================*/
/**
* @brief Communication start events
*
* Wait on one of these events at the start of the communication. It means that
* the I2C peripheral detected a Start condition on the bus (generated by master
* device) followed by the peripheral address. The peripheral generates an ACK
* condition on the bus (if the acknowledge feature is enabled through function
* I2C_AcknowledgeConfig()) and the events listed above are set :
*
* 1) In normal case (only one address managed by the slave), when the address
* sent by the master matches the own address of the peripheral (configured by
* I2C_OwnAddress1 field) the I2C_EVENT_SLAVE_XXX_ADDRESS_MATCHED event is set
* (where XXX could be TRANSMITTER or RECEIVER).
*
* 2) In case the address sent by the master matches the second address of the
* peripheral (configured by the function I2C_OwnAddress2Config() and enabled
* by the function I2C_DualAddressCmd()) the events I2C_EVENT_SLAVE_XXX_SECONDADDRESS_MATCHED
* (where XXX could be TRANSMITTER or RECEIVER) are set.
*
* 3) In case the address sent by the master is General Call (address 0x00) and
* if the General Call is enabled for the peripheral (using function I2C_GeneralCallCmd())
* the following event is set I2C_EVENT_SLAVE_GENERALCALLADDRESS_MATCHED.
*
*/
/* --EV1 (all the events below are variants of EV1) */
/* 1) Case of One Single Address managed by the slave */
#define I2C_EVENT_SLAVE_RECEIVER_ADDRESS_MATCHED ((uint32_t)0x00020002) /* BUSY and ADDR flags */
#define I2C_EVENT_SLAVE_TRANSMITTER_ADDRESS_MATCHED ((uint32_t)0x00060082) /* TRA, BUSY, TXE and ADDR flags */
/* 2) Case of Dual address managed by the slave */
#define I2C_EVENT_SLAVE_RECEIVER_SECONDADDRESS_MATCHED ((uint32_t)0x00820000) /* DUALF and BUSY flags */
#define I2C_EVENT_SLAVE_TRANSMITTER_SECONDADDRESS_MATCHED ((uint32_t)0x00860080) /* DUALF, TRA, BUSY and TXE flags */
/* 3) Case of General Call enabled for the slave */
#define I2C_EVENT_SLAVE_GENERALCALLADDRESS_MATCHED ((uint32_t)0x00120000) /* GENCALL and BUSY flags */
/**
* @brief Communication events
*
* Wait on one of these events when EV1 has already been checked and:
*
* - Slave RECEIVER mode:
* - EV2: When the application is expecting a data byte to be received.
* - EV4: When the application is expecting the end of the communication: master
* sends a stop condition and data transmission is stopped.
*
* - Slave Transmitter mode:
* - EV3: When a byte has been transmitted by the slave and the application is expecting
* the end of the byte transmission. The two events I2C_EVENT_SLAVE_BYTE_TRANSMITTED and
* I2C_EVENT_SLAVE_BYTE_TRANSMITTING are similar. The second one can optionally be
* used when the user software doesn't guarantee the EV3 is managed before the
* current byte end of transfer.
* - EV3_2: When the master sends a NACK in order to tell slave that data transmission
* shall end (before sending the STOP condition). In this case slave has to stop sending
* data bytes and expect a Stop condition on the bus.
*
* @note In case the user software does not guarantee that the event EV2 is
* managed before the current byte end of transfer, then user may check on EV2
* and BTF flag at the same time (ie. (I2C_EVENT_SLAVE_BYTE_RECEIVED | I2C_FLAG_BTF)).
* In this case the communication may be slower.
*
*/
/* Slave RECEIVER mode --------------------------*/
/* --EV2 */
#define I2C_EVENT_SLAVE_BYTE_RECEIVED ((uint32_t)0x00020040) /* BUSY and RXNE flags */
/* --EV4 */
#define I2C_EVENT_SLAVE_STOP_DETECTED ((uint32_t)0x00000010) /* STOPF flag */
/* Slave TRANSMITTER mode -----------------------*/
/* --EV3 */
#define I2C_EVENT_SLAVE_BYTE_TRANSMITTED ((uint32_t)0x00060084) /* TRA, BUSY, TXE and BTF flags */
#define I2C_EVENT_SLAVE_BYTE_TRANSMITTING ((uint32_t)0x00060080) /* TRA, BUSY and TXE flags */
/* --EV3_2 */
#define I2C_EVENT_SLAVE_ACK_FAILURE ((uint32_t)0x00000400) /* AF flag */
/*=========================== End of Events Description ==========================================*/
#define IS_I2C_EVENT(EVENT) (((EVENT) == I2C_EVENT_SLAVE_TRANSMITTER_ADDRESS_MATCHED) || \
((EVENT) == I2C_EVENT_SLAVE_RECEIVER_ADDRESS_MATCHED) || \
((EVENT) == I2C_EVENT_SLAVE_TRANSMITTER_SECONDADDRESS_MATCHED) || \
((EVENT) == I2C_EVENT_SLAVE_RECEIVER_SECONDADDRESS_MATCHED) || \
((EVENT) == I2C_EVENT_SLAVE_GENERALCALLADDRESS_MATCHED) || \
((EVENT) == I2C_EVENT_SLAVE_BYTE_RECEIVED) || \
((EVENT) == (I2C_EVENT_SLAVE_BYTE_RECEIVED | I2C_FLAG_DUALF)) || \
((EVENT) == (I2C_EVENT_SLAVE_BYTE_RECEIVED | I2C_FLAG_GENCALL)) || \
((EVENT) == I2C_EVENT_SLAVE_BYTE_TRANSMITTED) || \
((EVENT) == (I2C_EVENT_SLAVE_BYTE_TRANSMITTED | I2C_FLAG_DUALF)) || \
((EVENT) == (I2C_EVENT_SLAVE_BYTE_TRANSMITTED | I2C_FLAG_GENCALL)) || \
((EVENT) == I2C_EVENT_SLAVE_STOP_DETECTED) || \
((EVENT) == I2C_EVENT_MASTER_MODE_SELECT) || \
((EVENT) == I2C_EVENT_MASTER_TRANSMITTER_MODE_SELECTED) || \
((EVENT) == I2C_EVENT_MASTER_RECEIVER_MODE_SELECTED) || \
((EVENT) == I2C_EVENT_MASTER_BYTE_RECEIVED) || \
((EVENT) == I2C_EVENT_MASTER_BYTE_TRANSMITTED) || \
((EVENT) == I2C_EVENT_MASTER_BYTE_TRANSMITTING) || \
((EVENT) == I2C_EVENT_MASTER_MODE_ADDRESS10) || \
((EVENT) == I2C_EVENT_SLAVE_ACK_FAILURE))
/**
* @}
*/
/** @defgroup I2C_own_address1
* @{
*/
#define IS_I2C_OWN_ADDRESS1(ADDRESS1) ((ADDRESS1) <= 0x3FF)
/**
* @}
*/
/** @defgroup I2C_clock_speed
* @{
*/
#define IS_I2C_CLOCK_SPEED(SPEED) (((SPEED) >= 0x1) && ((SPEED) <= 400000))
/**
* @}
*/
/**
* @}
*/
/** @defgroup I2C_Exported_Macros
* @{
*/
/**
* @}
*/
/** @defgroup I2C_Exported_Functions
* @{
*/
void I2C_DeInit(I2C_TypeDef* I2Cx);
void I2C_Init(I2C_TypeDef* I2Cx, I2C_InitTypeDef* I2C_InitStruct);
void I2C_StructInit(I2C_InitTypeDef* I2C_InitStruct);
void I2C_Cmd(I2C_TypeDef* I2Cx, FunctionalState NewState);
void I2C_DMACmd(I2C_TypeDef* I2Cx, FunctionalState NewState);
void I2C_DMALastTransferCmd(I2C_TypeDef* I2Cx, FunctionalState NewState);
void I2C_GenerateSTART(I2C_TypeDef* I2Cx, FunctionalState NewState);
void I2C_GenerateSTOP(I2C_TypeDef* I2Cx, FunctionalState NewState);
void I2C_AcknowledgeConfig(I2C_TypeDef* I2Cx, FunctionalState NewState);
void I2C_OwnAddress2Config(I2C_TypeDef* I2Cx, uint8_t Address);
void I2C_DualAddressCmd(I2C_TypeDef* I2Cx, FunctionalState NewState);
void I2C_GeneralCallCmd(I2C_TypeDef* I2Cx, FunctionalState NewState);
void I2C_ITConfig(I2C_TypeDef* I2Cx, uint16_t I2C_IT, FunctionalState NewState);
void I2C_SendData(I2C_TypeDef* I2Cx, uint8_t Data);
uint8_t I2C_ReceiveData(I2C_TypeDef* I2Cx);
void I2C_Send7bitAddress(I2C_TypeDef* I2Cx, uint8_t Address, uint8_t I2C_Direction);
uint16_t I2C_ReadRegister(I2C_TypeDef* I2Cx, uint8_t I2C_Register);
void I2C_SoftwareResetCmd(I2C_TypeDef* I2Cx, FunctionalState NewState);
void I2C_NACKPositionConfig(I2C_TypeDef* I2Cx, uint16_t I2C_NACKPosition);
void I2C_SMBusAlertConfig(I2C_TypeDef* I2Cx, uint16_t I2C_SMBusAlert);
void I2C_TransmitPEC(I2C_TypeDef* I2Cx, FunctionalState NewState);
void I2C_PECPositionConfig(I2C_TypeDef* I2Cx, uint16_t I2C_PECPosition);
void I2C_CalculatePEC(I2C_TypeDef* I2Cx, FunctionalState NewState);
uint8_t I2C_GetPEC(I2C_TypeDef* I2Cx);
void I2C_ARPCmd(I2C_TypeDef* I2Cx, FunctionalState NewState);
void I2C_StretchClockCmd(I2C_TypeDef* I2Cx, FunctionalState NewState);
void I2C_FastModeDutyCycleConfig(I2C_TypeDef* I2Cx, uint16_t I2C_DutyCycle);
/**
* @brief
****************************************************************************************
*
* I2C State Monitoring Functions
*
****************************************************************************************
* This I2C driver provides three different ways for I2C state monitoring
* depending on the application requirements and constraints:
*
*
* 1) Basic state monitoring:
* Using I2C_CheckEvent() function:
* It compares the status registers (SR1 and SR2) content to a given event
* (can be the combination of one or more flags).
* It returns SUCCESS if the current status includes the given flags
* and returns ERROR if one or more flags are missing in the current status.
* - When to use:
* - This function is suitable for most applications as well as for startup
* activity since the events are fully described in the product reference manual
* (RM0008).
* - It is also suitable for users who need to define their own events.
* - Limitations:
* - If an error occurs (ie. error flags are set besides to the monitored flags),
* the I2C_CheckEvent() function may return SUCCESS despite the communication
* hold or corrupted real state.
* In this case, it is advised to use error interrupts to monitor the error
* events and handle them in the interrupt IRQ handler.
*
* @note
* For error management, it is advised to use the following functions:
* - I2C_ITConfig() to configure and enable the error interrupts (I2C_IT_ERR).
* - I2Cx_ER_IRQHandler() which is called when the error interrupt occurs.
* Where x is the peripheral instance (I2C1, I2C2 ...)
* - I2C_GetFlagStatus() or I2C_GetITStatus() to be called into I2Cx_ER_IRQHandler()
* in order to determine which error occurred.
* - I2C_ClearFlag() or I2C_ClearITPendingBit() and/or I2C_SoftwareResetCmd()
* and/or I2C_GenerateStop() in order to clear the error flag and source,
* and return to correct communication status.
*
*
* 2) Advanced state monitoring:
* Using the function I2C_GetLastEvent() which returns the image of both status
* registers in a single word (uint32_t) (Status Register 2 value is shifted left
* by 16 bits and concatenated to Status Register 1).
* - When to use:
* - This function is suitable for the same applications above but it allows to
* overcome the limitations of I2C_GetFlagStatus() function (see below).
* The returned value could be compared to events already defined in the
* library (stm32f10x_i2c.h) or to custom values defined by user.
* - This function is suitable when multiple flags are monitored at the same time.
* - At the opposite of I2C_CheckEvent() function, this function allows user to
* choose when an event is accepted (when all events flags are set and no
* other flags are set or just when the needed flags are set like
* I2C_CheckEvent() function).
* - Limitations:
* - User may need to define his own events.
* - Same remark concerning the error management is applicable for this
* function if user decides to check only regular communication flags (and
* ignores error flags).
*
*
* 3) Flag-based state monitoring:
* Using the function I2C_GetFlagStatus() which simply returns the status of
* one single flag (ie. I2C_FLAG_RXNE ...).
* - When to use:
* - This function could be used for specific applications or in debug phase.
* - It is suitable when only one flag checking is needed (most I2C events
* are monitored through multiple flags).
* - Limitations:
* - When calling this function, the Status register is accessed. Some flags are
* cleared when the status register is accessed. So checking the status
* of one Flag, may clear other ones.
* - Function may need to be called twice or more in order to monitor one
* single event.
*
*/
/**
*
* 1) Basic state monitoring
*******************************************************************************
*/
ErrorStatus I2C_CheckEvent(I2C_TypeDef* I2Cx, uint32_t I2C_EVENT);
/**
*
* 2) Advanced state monitoring
*******************************************************************************
*/
uint32_t I2C_GetLastEvent(I2C_TypeDef* I2Cx);
/**
*
* 3) Flag-based state monitoring
*******************************************************************************
*/
FlagStatus I2C_GetFlagStatus(I2C_TypeDef* I2Cx, uint32_t I2C_FLAG);
/**
*
*******************************************************************************
*/
void I2C_ClearFlag(I2C_TypeDef* I2Cx, uint32_t I2C_FLAG);
ITStatus I2C_GetITStatus(I2C_TypeDef* I2Cx, uint32_t I2C_IT);
void I2C_ClearITPendingBit(I2C_TypeDef* I2Cx, uint32_t I2C_IT);
#ifdef __cplusplus
}
#endif
#endif /*__STM32F10x_I2C_H */
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/

View File

@@ -0,0 +1,138 @@
/**
******************************************************************************
* @file stm32f10x_iwdg.h
* @author MCD Application Team
* @version V3.6.2
* @date 17-September-2021
* @brief This file contains all the functions prototypes for the IWDG
* 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_IWDG_H
#define __STM32F10x_IWDG_H
#ifdef __cplusplus
extern "C" {
#endif
/* Includes ------------------------------------------------------------------*/
#include "stm32f10x.h"
/** @addtogroup STM32F10x_StdPeriph_Driver
* @{
*/
/** @addtogroup IWDG
* @{
*/
/** @defgroup IWDG_Exported_Types
* @{
*/
/**
* @}
*/
/** @defgroup IWDG_Exported_Constants
* @{
*/
/** @defgroup IWDG_WriteAccess
* @{
*/
#define IWDG_WriteAccess_Enable ((uint16_t)0x5555)
#define IWDG_WriteAccess_Disable ((uint16_t)0x0000)
#define IS_IWDG_WRITE_ACCESS(ACCESS) (((ACCESS) == IWDG_WriteAccess_Enable) || \
((ACCESS) == IWDG_WriteAccess_Disable))
/**
* @}
*/
/** @defgroup IWDG_prescaler
* @{
*/
#define IWDG_Prescaler_4 ((uint8_t)0x00)
#define IWDG_Prescaler_8 ((uint8_t)0x01)
#define IWDG_Prescaler_16 ((uint8_t)0x02)
#define IWDG_Prescaler_32 ((uint8_t)0x03)
#define IWDG_Prescaler_64 ((uint8_t)0x04)
#define IWDG_Prescaler_128 ((uint8_t)0x05)
#define IWDG_Prescaler_256 ((uint8_t)0x06)
#define IS_IWDG_PRESCALER(PRESCALER) (((PRESCALER) == IWDG_Prescaler_4) || \
((PRESCALER) == IWDG_Prescaler_8) || \
((PRESCALER) == IWDG_Prescaler_16) || \
((PRESCALER) == IWDG_Prescaler_32) || \
((PRESCALER) == IWDG_Prescaler_64) || \
((PRESCALER) == IWDG_Prescaler_128)|| \
((PRESCALER) == IWDG_Prescaler_256))
/**
* @}
*/
/** @defgroup IWDG_Flag
* @{
*/
#define IWDG_FLAG_PVU ((uint16_t)0x0001)
#define IWDG_FLAG_RVU ((uint16_t)0x0002)
#define IS_IWDG_FLAG(FLAG) (((FLAG) == IWDG_FLAG_PVU) || ((FLAG) == IWDG_FLAG_RVU))
#define IS_IWDG_RELOAD(RELOAD) ((RELOAD) <= 0xFFF)
/**
* @}
*/
/**
* @}
*/
/** @defgroup IWDG_Exported_Macros
* @{
*/
/**
* @}
*/
/** @defgroup IWDG_Exported_Functions
* @{
*/
void IWDG_WriteAccessCmd(uint16_t IWDG_WriteAccess);
void IWDG_SetPrescaler(uint8_t IWDG_Prescaler);
void IWDG_SetReload(uint16_t Reload);
void IWDG_ReloadCounter(void);
void IWDG_Enable(void);
FlagStatus IWDG_GetFlagStatus(uint16_t IWDG_FLAG);
#ifdef __cplusplus
}
#endif
#endif /* __STM32F10x_IWDG_H */
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/

View File

@@ -0,0 +1,154 @@
/**
******************************************************************************
* @file stm32f10x_pwr.h
* @author MCD Application Team
* @version V3.6.2
* @date 17-September-2021
* @brief This file contains all the functions prototypes for the PWR 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_PWR_H
#define __STM32F10x_PWR_H
#ifdef __cplusplus
extern "C" {
#endif
/* Includes ------------------------------------------------------------------*/
#include "stm32f10x.h"
/** @addtogroup STM32F10x_StdPeriph_Driver
* @{
*/
/** @addtogroup PWR
* @{
*/
/** @defgroup PWR_Exported_Types
* @{
*/
/**
* @}
*/
/** @defgroup PWR_Exported_Constants
* @{
*/
/** @defgroup PVD_detection_level
* @{
*/
#define PWR_PVDLevel_2V2 ((uint32_t)0x00000000)
#define PWR_PVDLevel_2V3 ((uint32_t)0x00000020)
#define PWR_PVDLevel_2V4 ((uint32_t)0x00000040)
#define PWR_PVDLevel_2V5 ((uint32_t)0x00000060)
#define PWR_PVDLevel_2V6 ((uint32_t)0x00000080)
#define PWR_PVDLevel_2V7 ((uint32_t)0x000000A0)
#define PWR_PVDLevel_2V8 ((uint32_t)0x000000C0)
#define PWR_PVDLevel_2V9 ((uint32_t)0x000000E0)
#define IS_PWR_PVD_LEVEL(LEVEL) (((LEVEL) == PWR_PVDLevel_2V2) || ((LEVEL) == PWR_PVDLevel_2V3)|| \
((LEVEL) == PWR_PVDLevel_2V4) || ((LEVEL) == PWR_PVDLevel_2V5)|| \
((LEVEL) == PWR_PVDLevel_2V6) || ((LEVEL) == PWR_PVDLevel_2V7)|| \
((LEVEL) == PWR_PVDLevel_2V8) || ((LEVEL) == PWR_PVDLevel_2V9))
/**
* @}
*/
/** @defgroup Regulator_state_is_STOP_mode
* @{
*/
#define PWR_Regulator_ON ((uint32_t)0x00000000)
#define PWR_Regulator_LowPower ((uint32_t)0x00000001)
#define IS_PWR_REGULATOR(REGULATOR) (((REGULATOR) == PWR_Regulator_ON) || \
((REGULATOR) == PWR_Regulator_LowPower))
/**
* @}
*/
/** @defgroup STOP_mode_entry
* @{
*/
#define PWR_STOPEntry_WFI ((uint8_t)0x01)
#define PWR_STOPEntry_WFE ((uint8_t)0x02)
#define IS_PWR_STOP_ENTRY(ENTRY) (((ENTRY) == PWR_STOPEntry_WFI) || ((ENTRY) == PWR_STOPEntry_WFE))
/**
* @}
*/
/** @defgroup PWR_Flag
* @{
*/
#define PWR_FLAG_WU ((uint32_t)0x00000001)
#define PWR_FLAG_SB ((uint32_t)0x00000002)
#define PWR_FLAG_PVDO ((uint32_t)0x00000004)
#define IS_PWR_GET_FLAG(FLAG) (((FLAG) == PWR_FLAG_WU) || ((FLAG) == PWR_FLAG_SB) || \
((FLAG) == PWR_FLAG_PVDO))
#define IS_PWR_CLEAR_FLAG(FLAG) (((FLAG) == PWR_FLAG_WU) || ((FLAG) == PWR_FLAG_SB))
/**
* @}
*/
/**
* @}
*/
/** @defgroup PWR_Exported_Macros
* @{
*/
/**
* @}
*/
/** @defgroup PWR_Exported_Functions
* @{
*/
void PWR_DeInit(void);
void PWR_BackupAccessCmd(FunctionalState NewState);
void PWR_PVDCmd(FunctionalState NewState);
void PWR_PVDLevelConfig(uint32_t PWR_PVDLevel);
void PWR_WakeUpPinCmd(FunctionalState NewState);
void PWR_EnterSTOPMode(uint32_t PWR_Regulator, uint8_t PWR_STOPEntry);
void PWR_EnterSTANDBYMode(void);
FlagStatus PWR_GetFlagStatus(uint32_t PWR_FLAG);
void PWR_ClearFlag(uint32_t PWR_FLAG);
#ifdef __cplusplus
}
#endif
#endif /* __STM32F10x_PWR_H */
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/

View File

@@ -0,0 +1,725 @@
/**
******************************************************************************
* @file stm32f10x_rcc.h
* @author MCD Application Team
* @version V3.6.2
* @date 17-September-2021
* @brief This file contains all the functions prototypes for the RCC 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_RCC_H
#define __STM32F10x_RCC_H
#ifdef __cplusplus
extern "C" {
#endif
/* Includes ------------------------------------------------------------------*/
#include "stm32f10x.h"
/** @addtogroup STM32F10x_StdPeriph_Driver
* @{
*/
/** @addtogroup RCC
* @{
*/
/** @defgroup RCC_Exported_Types
* @{
*/
typedef struct
{
uint32_t SYSCLK_Frequency; /*!< returns SYSCLK clock frequency expressed in Hz */
uint32_t HCLK_Frequency; /*!< returns HCLK clock frequency expressed in Hz */
uint32_t PCLK1_Frequency; /*!< returns PCLK1 clock frequency expressed in Hz */
uint32_t PCLK2_Frequency; /*!< returns PCLK2 clock frequency expressed in Hz */
uint32_t ADCCLK_Frequency; /*!< returns ADCCLK clock frequency expressed in Hz */
}RCC_ClocksTypeDef;
/**
* @}
*/
/** @defgroup RCC_Exported_Constants
* @{
*/
/** @defgroup HSE_configuration
* @{
*/
#define RCC_HSE_OFF ((uint32_t)0x00000000)
#define RCC_HSE_ON ((uint32_t)0x00010000)
#define RCC_HSE_Bypass ((uint32_t)0x00040000)
#define IS_RCC_HSE(HSE) (((HSE) == RCC_HSE_OFF) || ((HSE) == RCC_HSE_ON) || \
((HSE) == RCC_HSE_Bypass))
/**
* @}
*/
/** @defgroup PLL_entry_clock_source
* @{
*/
#define RCC_PLLSource_HSI_Div2 ((uint32_t)0x00000000)
#if !defined (STM32F10X_LD_VL) && !defined (STM32F10X_MD_VL) && !defined (STM32F10X_HD_VL) && !defined (STM32F10X_CL)
#define RCC_PLLSource_HSE_Div1 ((uint32_t)0x00010000)
#define RCC_PLLSource_HSE_Div2 ((uint32_t)0x00030000)
#define IS_RCC_PLL_SOURCE(SOURCE) (((SOURCE) == RCC_PLLSource_HSI_Div2) || \
((SOURCE) == RCC_PLLSource_HSE_Div1) || \
((SOURCE) == RCC_PLLSource_HSE_Div2))
#else
#define RCC_PLLSource_PREDIV1 ((uint32_t)0x00010000)
#define IS_RCC_PLL_SOURCE(SOURCE) (((SOURCE) == RCC_PLLSource_HSI_Div2) || \
((SOURCE) == RCC_PLLSource_PREDIV1))
#endif /* STM32F10X_CL */
/**
* @}
*/
/** @defgroup PLL_multiplication_factor
* @{
*/
#ifndef STM32F10X_CL
#define RCC_PLLMul_2 ((uint32_t)0x00000000)
#define RCC_PLLMul_3 ((uint32_t)0x00040000)
#define RCC_PLLMul_4 ((uint32_t)0x00080000)
#define RCC_PLLMul_5 ((uint32_t)0x000C0000)
#define RCC_PLLMul_6 ((uint32_t)0x00100000)
#define RCC_PLLMul_7 ((uint32_t)0x00140000)
#define RCC_PLLMul_8 ((uint32_t)0x00180000)
#define RCC_PLLMul_9 ((uint32_t)0x001C0000)
#define RCC_PLLMul_10 ((uint32_t)0x00200000)
#define RCC_PLLMul_11 ((uint32_t)0x00240000)
#define RCC_PLLMul_12 ((uint32_t)0x00280000)
#define RCC_PLLMul_13 ((uint32_t)0x002C0000)
#define RCC_PLLMul_14 ((uint32_t)0x00300000)
#define RCC_PLLMul_15 ((uint32_t)0x00340000)
#define RCC_PLLMul_16 ((uint32_t)0x00380000)
#define IS_RCC_PLL_MUL(MUL) (((MUL) == RCC_PLLMul_2) || ((MUL) == RCC_PLLMul_3) || \
((MUL) == RCC_PLLMul_4) || ((MUL) == RCC_PLLMul_5) || \
((MUL) == RCC_PLLMul_6) || ((MUL) == RCC_PLLMul_7) || \
((MUL) == RCC_PLLMul_8) || ((MUL) == RCC_PLLMul_9) || \
((MUL) == RCC_PLLMul_10) || ((MUL) == RCC_PLLMul_11) || \
((MUL) == RCC_PLLMul_12) || ((MUL) == RCC_PLLMul_13) || \
((MUL) == RCC_PLLMul_14) || ((MUL) == RCC_PLLMul_15) || \
((MUL) == RCC_PLLMul_16))
#else
#define RCC_PLLMul_4 ((uint32_t)0x00080000)
#define RCC_PLLMul_5 ((uint32_t)0x000C0000)
#define RCC_PLLMul_6 ((uint32_t)0x00100000)
#define RCC_PLLMul_7 ((uint32_t)0x00140000)
#define RCC_PLLMul_8 ((uint32_t)0x00180000)
#define RCC_PLLMul_9 ((uint32_t)0x001C0000)
#define RCC_PLLMul_6_5 ((uint32_t)0x00340000)
#define IS_RCC_PLL_MUL(MUL) (((MUL) == RCC_PLLMul_4) || ((MUL) == RCC_PLLMul_5) || \
((MUL) == RCC_PLLMul_6) || ((MUL) == RCC_PLLMul_7) || \
((MUL) == RCC_PLLMul_8) || ((MUL) == RCC_PLLMul_9) || \
((MUL) == RCC_PLLMul_6_5))
#endif /* STM32F10X_CL */
/**
* @}
*/
/** @defgroup PREDIV1_division_factor
* @{
*/
#if defined (STM32F10X_LD_VL) || defined (STM32F10X_MD_VL) || defined (STM32F10X_HD_VL) || defined (STM32F10X_CL)
#define RCC_PREDIV1_Div1 ((uint32_t)0x00000000)
#define RCC_PREDIV1_Div2 ((uint32_t)0x00000001)
#define RCC_PREDIV1_Div3 ((uint32_t)0x00000002)
#define RCC_PREDIV1_Div4 ((uint32_t)0x00000003)
#define RCC_PREDIV1_Div5 ((uint32_t)0x00000004)
#define RCC_PREDIV1_Div6 ((uint32_t)0x00000005)
#define RCC_PREDIV1_Div7 ((uint32_t)0x00000006)
#define RCC_PREDIV1_Div8 ((uint32_t)0x00000007)
#define RCC_PREDIV1_Div9 ((uint32_t)0x00000008)
#define RCC_PREDIV1_Div10 ((uint32_t)0x00000009)
#define RCC_PREDIV1_Div11 ((uint32_t)0x0000000A)
#define RCC_PREDIV1_Div12 ((uint32_t)0x0000000B)
#define RCC_PREDIV1_Div13 ((uint32_t)0x0000000C)
#define RCC_PREDIV1_Div14 ((uint32_t)0x0000000D)
#define RCC_PREDIV1_Div15 ((uint32_t)0x0000000E)
#define RCC_PREDIV1_Div16 ((uint32_t)0x0000000F)
#define IS_RCC_PREDIV1(PREDIV1) (((PREDIV1) == RCC_PREDIV1_Div1) || ((PREDIV1) == RCC_PREDIV1_Div2) || \
((PREDIV1) == RCC_PREDIV1_Div3) || ((PREDIV1) == RCC_PREDIV1_Div4) || \
((PREDIV1) == RCC_PREDIV1_Div5) || ((PREDIV1) == RCC_PREDIV1_Div6) || \
((PREDIV1) == RCC_PREDIV1_Div7) || ((PREDIV1) == RCC_PREDIV1_Div8) || \
((PREDIV1) == RCC_PREDIV1_Div9) || ((PREDIV1) == RCC_PREDIV1_Div10) || \
((PREDIV1) == RCC_PREDIV1_Div11) || ((PREDIV1) == RCC_PREDIV1_Div12) || \
((PREDIV1) == RCC_PREDIV1_Div13) || ((PREDIV1) == RCC_PREDIV1_Div14) || \
((PREDIV1) == RCC_PREDIV1_Div15) || ((PREDIV1) == RCC_PREDIV1_Div16))
#endif
/**
* @}
*/
/** @defgroup PREDIV1_clock_source
* @{
*/
#ifdef STM32F10X_CL
/* PREDIV1 clock source (for STM32 connectivity line devices) */
#define RCC_PREDIV1_Source_HSE ((uint32_t)0x00000000)
#define RCC_PREDIV1_Source_PLL2 ((uint32_t)0x00010000)
#define IS_RCC_PREDIV1_SOURCE(SOURCE) (((SOURCE) == RCC_PREDIV1_Source_HSE) || \
((SOURCE) == RCC_PREDIV1_Source_PLL2))
#elif defined (STM32F10X_LD_VL) || defined (STM32F10X_MD_VL) || defined (STM32F10X_HD_VL)
/* PREDIV1 clock source (for STM32 Value line devices) */
#define RCC_PREDIV1_Source_HSE ((uint32_t)0x00000000)
#define IS_RCC_PREDIV1_SOURCE(SOURCE) (((SOURCE) == RCC_PREDIV1_Source_HSE))
#endif
/**
* @}
*/
#ifdef STM32F10X_CL
/** @defgroup PREDIV2_division_factor
* @{
*/
#define RCC_PREDIV2_Div1 ((uint32_t)0x00000000)
#define RCC_PREDIV2_Div2 ((uint32_t)0x00000010)
#define RCC_PREDIV2_Div3 ((uint32_t)0x00000020)
#define RCC_PREDIV2_Div4 ((uint32_t)0x00000030)
#define RCC_PREDIV2_Div5 ((uint32_t)0x00000040)
#define RCC_PREDIV2_Div6 ((uint32_t)0x00000050)
#define RCC_PREDIV2_Div7 ((uint32_t)0x00000060)
#define RCC_PREDIV2_Div8 ((uint32_t)0x00000070)
#define RCC_PREDIV2_Div9 ((uint32_t)0x00000080)
#define RCC_PREDIV2_Div10 ((uint32_t)0x00000090)
#define RCC_PREDIV2_Div11 ((uint32_t)0x000000A0)
#define RCC_PREDIV2_Div12 ((uint32_t)0x000000B0)
#define RCC_PREDIV2_Div13 ((uint32_t)0x000000C0)
#define RCC_PREDIV2_Div14 ((uint32_t)0x000000D0)
#define RCC_PREDIV2_Div15 ((uint32_t)0x000000E0)
#define RCC_PREDIV2_Div16 ((uint32_t)0x000000F0)
#define IS_RCC_PREDIV2(PREDIV2) (((PREDIV2) == RCC_PREDIV2_Div1) || ((PREDIV2) == RCC_PREDIV2_Div2) || \
((PREDIV2) == RCC_PREDIV2_Div3) || ((PREDIV2) == RCC_PREDIV2_Div4) || \
((PREDIV2) == RCC_PREDIV2_Div5) || ((PREDIV2) == RCC_PREDIV2_Div6) || \
((PREDIV2) == RCC_PREDIV2_Div7) || ((PREDIV2) == RCC_PREDIV2_Div8) || \
((PREDIV2) == RCC_PREDIV2_Div9) || ((PREDIV2) == RCC_PREDIV2_Div10) || \
((PREDIV2) == RCC_PREDIV2_Div11) || ((PREDIV2) == RCC_PREDIV2_Div12) || \
((PREDIV2) == RCC_PREDIV2_Div13) || ((PREDIV2) == RCC_PREDIV2_Div14) || \
((PREDIV2) == RCC_PREDIV2_Div15) || ((PREDIV2) == RCC_PREDIV2_Div16))
/**
* @}
*/
/** @defgroup PLL2_multiplication_factor
* @{
*/
#define RCC_PLL2Mul_8 ((uint32_t)0x00000600)
#define RCC_PLL2Mul_9 ((uint32_t)0x00000700)
#define RCC_PLL2Mul_10 ((uint32_t)0x00000800)
#define RCC_PLL2Mul_11 ((uint32_t)0x00000900)
#define RCC_PLL2Mul_12 ((uint32_t)0x00000A00)
#define RCC_PLL2Mul_13 ((uint32_t)0x00000B00)
#define RCC_PLL2Mul_14 ((uint32_t)0x00000C00)
#define RCC_PLL2Mul_16 ((uint32_t)0x00000E00)
#define RCC_PLL2Mul_20 ((uint32_t)0x00000F00)
#define IS_RCC_PLL2_MUL(MUL) (((MUL) == RCC_PLL2Mul_8) || ((MUL) == RCC_PLL2Mul_9) || \
((MUL) == RCC_PLL2Mul_10) || ((MUL) == RCC_PLL2Mul_11) || \
((MUL) == RCC_PLL2Mul_12) || ((MUL) == RCC_PLL2Mul_13) || \
((MUL) == RCC_PLL2Mul_14) || ((MUL) == RCC_PLL2Mul_16) || \
((MUL) == RCC_PLL2Mul_20))
/**
* @}
*/
/** @defgroup PLL3_multiplication_factor
* @{
*/
#define RCC_PLL3Mul_8 ((uint32_t)0x00006000)
#define RCC_PLL3Mul_9 ((uint32_t)0x00007000)
#define RCC_PLL3Mul_10 ((uint32_t)0x00008000)
#define RCC_PLL3Mul_11 ((uint32_t)0x00009000)
#define RCC_PLL3Mul_12 ((uint32_t)0x0000A000)
#define RCC_PLL3Mul_13 ((uint32_t)0x0000B000)
#define RCC_PLL3Mul_14 ((uint32_t)0x0000C000)
#define RCC_PLL3Mul_16 ((uint32_t)0x0000E000)
#define RCC_PLL3Mul_20 ((uint32_t)0x0000F000)
#define IS_RCC_PLL3_MUL(MUL) (((MUL) == RCC_PLL3Mul_8) || ((MUL) == RCC_PLL3Mul_9) || \
((MUL) == RCC_PLL3Mul_10) || ((MUL) == RCC_PLL3Mul_11) || \
((MUL) == RCC_PLL3Mul_12) || ((MUL) == RCC_PLL3Mul_13) || \
((MUL) == RCC_PLL3Mul_14) || ((MUL) == RCC_PLL3Mul_16) || \
((MUL) == RCC_PLL3Mul_20))
/**
* @}
*/
#endif /* STM32F10X_CL */
/** @defgroup System_clock_source
* @{
*/
#define RCC_SYSCLKSource_HSI ((uint32_t)0x00000000)
#define RCC_SYSCLKSource_HSE ((uint32_t)0x00000001)
#define RCC_SYSCLKSource_PLLCLK ((uint32_t)0x00000002)
#define IS_RCC_SYSCLK_SOURCE(SOURCE) (((SOURCE) == RCC_SYSCLKSource_HSI) || \
((SOURCE) == RCC_SYSCLKSource_HSE) || \
((SOURCE) == RCC_SYSCLKSource_PLLCLK))
/**
* @}
*/
/** @defgroup AHB_clock_source
* @{
*/
#define RCC_SYSCLK_Div1 ((uint32_t)0x00000000)
#define RCC_SYSCLK_Div2 ((uint32_t)0x00000080)
#define RCC_SYSCLK_Div4 ((uint32_t)0x00000090)
#define RCC_SYSCLK_Div8 ((uint32_t)0x000000A0)
#define RCC_SYSCLK_Div16 ((uint32_t)0x000000B0)
#define RCC_SYSCLK_Div64 ((uint32_t)0x000000C0)
#define RCC_SYSCLK_Div128 ((uint32_t)0x000000D0)
#define RCC_SYSCLK_Div256 ((uint32_t)0x000000E0)
#define RCC_SYSCLK_Div512 ((uint32_t)0x000000F0)
#define IS_RCC_HCLK(HCLK) (((HCLK) == RCC_SYSCLK_Div1) || ((HCLK) == RCC_SYSCLK_Div2) || \
((HCLK) == RCC_SYSCLK_Div4) || ((HCLK) == RCC_SYSCLK_Div8) || \
((HCLK) == RCC_SYSCLK_Div16) || ((HCLK) == RCC_SYSCLK_Div64) || \
((HCLK) == RCC_SYSCLK_Div128) || ((HCLK) == RCC_SYSCLK_Div256) || \
((HCLK) == RCC_SYSCLK_Div512))
/**
* @}
*/
/** @defgroup APB1_APB2_clock_source
* @{
*/
#define RCC_HCLK_Div1 ((uint32_t)0x00000000)
#define RCC_HCLK_Div2 ((uint32_t)0x00000400)
#define RCC_HCLK_Div4 ((uint32_t)0x00000500)
#define RCC_HCLK_Div8 ((uint32_t)0x00000600)
#define RCC_HCLK_Div16 ((uint32_t)0x00000700)
#define IS_RCC_PCLK(PCLK) (((PCLK) == RCC_HCLK_Div1) || ((PCLK) == RCC_HCLK_Div2) || \
((PCLK) == RCC_HCLK_Div4) || ((PCLK) == RCC_HCLK_Div8) || \
((PCLK) == RCC_HCLK_Div16))
/**
* @}
*/
/** @defgroup RCC_Interrupt_source
* @{
*/
#define RCC_IT_LSIRDY ((uint8_t)0x01)
#define RCC_IT_LSERDY ((uint8_t)0x02)
#define RCC_IT_HSIRDY ((uint8_t)0x04)
#define RCC_IT_HSERDY ((uint8_t)0x08)
#define RCC_IT_PLLRDY ((uint8_t)0x10)
#define RCC_IT_CSS ((uint8_t)0x80)
#ifndef STM32F10X_CL
#define IS_RCC_IT(IT) ((((IT) & (uint8_t)0xE0) == 0x00) && ((IT) != 0x00))
#define IS_RCC_GET_IT(IT) (((IT) == RCC_IT_LSIRDY) || ((IT) == RCC_IT_LSERDY) || \
((IT) == RCC_IT_HSIRDY) || ((IT) == RCC_IT_HSERDY) || \
((IT) == RCC_IT_PLLRDY) || ((IT) == RCC_IT_CSS))
#define IS_RCC_CLEAR_IT(IT) ((((IT) & (uint8_t)0x60) == 0x00) && ((IT) != 0x00))
#else
#define RCC_IT_PLL2RDY ((uint8_t)0x20)
#define RCC_IT_PLL3RDY ((uint8_t)0x40)
#define IS_RCC_IT(IT) ((((IT) & (uint8_t)0x80) == 0x00) && ((IT) != 0x00))
#define IS_RCC_GET_IT(IT) (((IT) == RCC_IT_LSIRDY) || ((IT) == RCC_IT_LSERDY) || \
((IT) == RCC_IT_HSIRDY) || ((IT) == RCC_IT_HSERDY) || \
((IT) == RCC_IT_PLLRDY) || ((IT) == RCC_IT_CSS) || \
((IT) == RCC_IT_PLL2RDY) || ((IT) == RCC_IT_PLL3RDY))
#define IS_RCC_CLEAR_IT(IT) ((IT) != 0x00)
#endif /* STM32F10X_CL */
/**
* @}
*/
#ifndef STM32F10X_CL
/** @defgroup USB_Device_clock_source
* @{
*/
#define RCC_USBCLKSource_PLLCLK_1Div5 ((uint8_t)0x00)
#define RCC_USBCLKSource_PLLCLK_Div1 ((uint8_t)0x01)
#define IS_RCC_USBCLK_SOURCE(SOURCE) (((SOURCE) == RCC_USBCLKSource_PLLCLK_1Div5) || \
((SOURCE) == RCC_USBCLKSource_PLLCLK_Div1))
/**
* @}
*/
#else
/** @defgroup USB_OTG_FS_clock_source
* @{
*/
#define RCC_OTGFSCLKSource_PLLVCO_Div3 ((uint8_t)0x00)
#define RCC_OTGFSCLKSource_PLLVCO_Div2 ((uint8_t)0x01)
#define IS_RCC_OTGFSCLK_SOURCE(SOURCE) (((SOURCE) == RCC_OTGFSCLKSource_PLLVCO_Div3) || \
((SOURCE) == RCC_OTGFSCLKSource_PLLVCO_Div2))
/**
* @}
*/
#endif /* STM32F10X_CL */
#ifdef STM32F10X_CL
/** @defgroup I2S2_clock_source
* @{
*/
#define RCC_I2S2CLKSource_SYSCLK ((uint8_t)0x00)
#define RCC_I2S2CLKSource_PLL3_VCO ((uint8_t)0x01)
#define IS_RCC_I2S2CLK_SOURCE(SOURCE) (((SOURCE) == RCC_I2S2CLKSource_SYSCLK) || \
((SOURCE) == RCC_I2S2CLKSource_PLL3_VCO))
/**
* @}
*/
/** @defgroup I2S3_clock_source
* @{
*/
#define RCC_I2S3CLKSource_SYSCLK ((uint8_t)0x00)
#define RCC_I2S3CLKSource_PLL3_VCO ((uint8_t)0x01)
#define IS_RCC_I2S3CLK_SOURCE(SOURCE) (((SOURCE) == RCC_I2S3CLKSource_SYSCLK) || \
((SOURCE) == RCC_I2S3CLKSource_PLL3_VCO))
/**
* @}
*/
#endif /* STM32F10X_CL */
/** @defgroup ADC_clock_source
* @{
*/
#define RCC_PCLK2_Div2 ((uint32_t)0x00000000)
#define RCC_PCLK2_Div4 ((uint32_t)0x00004000)
#define RCC_PCLK2_Div6 ((uint32_t)0x00008000)
#define RCC_PCLK2_Div8 ((uint32_t)0x0000C000)
#define IS_RCC_ADCCLK(ADCCLK) (((ADCCLK) == RCC_PCLK2_Div2) || ((ADCCLK) == RCC_PCLK2_Div4) || \
((ADCCLK) == RCC_PCLK2_Div6) || ((ADCCLK) == RCC_PCLK2_Div8))
/**
* @}
*/
/** @defgroup LSE_configuration
* @{
*/
#define RCC_LSE_OFF ((uint8_t)0x00)
#define RCC_LSE_ON ((uint8_t)0x01)
#define RCC_LSE_Bypass ((uint8_t)0x04)
#define IS_RCC_LSE(LSE) (((LSE) == RCC_LSE_OFF) || ((LSE) == RCC_LSE_ON) || \
((LSE) == RCC_LSE_Bypass))
/**
* @}
*/
/** @defgroup RTC_clock_source
* @{
*/
#define RCC_RTCCLKSource_LSE ((uint32_t)0x00000100)
#define RCC_RTCCLKSource_LSI ((uint32_t)0x00000200)
#define RCC_RTCCLKSource_HSE_Div128 ((uint32_t)0x00000300)
#define IS_RCC_RTCCLK_SOURCE(SOURCE) (((SOURCE) == RCC_RTCCLKSource_LSE) || \
((SOURCE) == RCC_RTCCLKSource_LSI) || \
((SOURCE) == RCC_RTCCLKSource_HSE_Div128))
/**
* @}
*/
/** @defgroup AHB_peripheral
* @{
*/
#define RCC_AHBPeriph_DMA1 ((uint32_t)0x00000001)
#define RCC_AHBPeriph_DMA2 ((uint32_t)0x00000002)
#define RCC_AHBPeriph_SRAM ((uint32_t)0x00000004)
#define RCC_AHBPeriph_FLITF ((uint32_t)0x00000010)
#define RCC_AHBPeriph_CRC ((uint32_t)0x00000040)
#ifndef STM32F10X_CL
#define RCC_AHBPeriph_FSMC ((uint32_t)0x00000100)
#define RCC_AHBPeriph_SDIO ((uint32_t)0x00000400)
#define IS_RCC_AHB_PERIPH(PERIPH) ((((PERIPH) & 0xFFFFFAA8) == 0x00) && ((PERIPH) != 0x00))
#else
#define RCC_AHBPeriph_OTG_FS ((uint32_t)0x00001000)
#define RCC_AHBPeriph_ETH_MAC ((uint32_t)0x00004000)
#define RCC_AHBPeriph_ETH_MAC_Tx ((uint32_t)0x00008000)
#define RCC_AHBPeriph_ETH_MAC_Rx ((uint32_t)0x00010000)
#define IS_RCC_AHB_PERIPH(PERIPH) ((((PERIPH) & 0xFFFE2FA8) == 0x00) && ((PERIPH) != 0x00))
#define IS_RCC_AHB_PERIPH_RESET(PERIPH) ((((PERIPH) & 0xFFFFAFFF) == 0x00) && ((PERIPH) != 0x00))
#endif /* STM32F10X_CL */
/**
* @}
*/
/** @defgroup APB2_peripheral
* @{
*/
#define RCC_APB2Periph_AFIO ((uint32_t)0x00000001)
#define RCC_APB2Periph_GPIOA ((uint32_t)0x00000004)
#define RCC_APB2Periph_GPIOB ((uint32_t)0x00000008)
#define RCC_APB2Periph_GPIOC ((uint32_t)0x00000010)
#define RCC_APB2Periph_GPIOD ((uint32_t)0x00000020)
#define RCC_APB2Periph_GPIOE ((uint32_t)0x00000040)
#define RCC_APB2Periph_GPIOF ((uint32_t)0x00000080)
#define RCC_APB2Periph_GPIOG ((uint32_t)0x00000100)
#define RCC_APB2Periph_ADC1 ((uint32_t)0x00000200)
#define RCC_APB2Periph_ADC2 ((uint32_t)0x00000400)
#define RCC_APB2Periph_TIM1 ((uint32_t)0x00000800)
#define RCC_APB2Periph_SPI1 ((uint32_t)0x00001000)
#define RCC_APB2Periph_TIM8 ((uint32_t)0x00002000)
#define RCC_APB2Periph_USART1 ((uint32_t)0x00004000)
#define RCC_APB2Periph_ADC3 ((uint32_t)0x00008000)
#define RCC_APB2Periph_TIM15 ((uint32_t)0x00010000)
#define RCC_APB2Periph_TIM16 ((uint32_t)0x00020000)
#define RCC_APB2Periph_TIM17 ((uint32_t)0x00040000)
#define RCC_APB2Periph_TIM9 ((uint32_t)0x00080000)
#define RCC_APB2Periph_TIM10 ((uint32_t)0x00100000)
#define RCC_APB2Periph_TIM11 ((uint32_t)0x00200000)
#define IS_RCC_APB2_PERIPH(PERIPH) ((((PERIPH) & 0xFFC00002) == 0x00) && ((PERIPH) != 0x00))
/**
* @}
*/
/** @defgroup APB1_peripheral
* @{
*/
#define RCC_APB1Periph_TIM2 ((uint32_t)0x00000001)
#define RCC_APB1Periph_TIM3 ((uint32_t)0x00000002)
#define RCC_APB1Periph_TIM4 ((uint32_t)0x00000004)
#define RCC_APB1Periph_TIM5 ((uint32_t)0x00000008)
#define RCC_APB1Periph_TIM6 ((uint32_t)0x00000010)
#define RCC_APB1Periph_TIM7 ((uint32_t)0x00000020)
#define RCC_APB1Periph_TIM12 ((uint32_t)0x00000040)
#define RCC_APB1Periph_TIM13 ((uint32_t)0x00000080)
#define RCC_APB1Periph_TIM14 ((uint32_t)0x00000100)
#define RCC_APB1Periph_WWDG ((uint32_t)0x00000800)
#define RCC_APB1Periph_SPI2 ((uint32_t)0x00004000)
#define RCC_APB1Periph_SPI3 ((uint32_t)0x00008000)
#define RCC_APB1Periph_USART2 ((uint32_t)0x00020000)
#define RCC_APB1Periph_USART3 ((uint32_t)0x00040000)
#define RCC_APB1Periph_UART4 ((uint32_t)0x00080000)
#define RCC_APB1Periph_UART5 ((uint32_t)0x00100000)
#define RCC_APB1Periph_I2C1 ((uint32_t)0x00200000)
#define RCC_APB1Periph_I2C2 ((uint32_t)0x00400000)
#define RCC_APB1Periph_USB ((uint32_t)0x00800000)
#define RCC_APB1Periph_CAN1 ((uint32_t)0x02000000)
#define RCC_APB1Periph_CAN2 ((uint32_t)0x04000000)
#define RCC_APB1Periph_BKP ((uint32_t)0x08000000)
#define RCC_APB1Periph_PWR ((uint32_t)0x10000000)
#define RCC_APB1Periph_DAC ((uint32_t)0x20000000)
#define RCC_APB1Periph_CEC ((uint32_t)0x40000000)
#define IS_RCC_APB1_PERIPH(PERIPH) ((((PERIPH) & 0x81013600) == 0x00) && ((PERIPH) != 0x00))
/**
* @}
*/
/** @defgroup Clock_source_to_output_on_MCO_pin
* @{
*/
#define RCC_MCO_NoClock ((uint8_t)0x00)
#define RCC_MCO_SYSCLK ((uint8_t)0x04)
#define RCC_MCO_HSI ((uint8_t)0x05)
#define RCC_MCO_HSE ((uint8_t)0x06)
#define RCC_MCO_PLLCLK_Div2 ((uint8_t)0x07)
#ifndef STM32F10X_CL
#define IS_RCC_MCO(MCO) (((MCO) == RCC_MCO_NoClock) || ((MCO) == RCC_MCO_HSI) || \
((MCO) == RCC_MCO_SYSCLK) || ((MCO) == RCC_MCO_HSE) || \
((MCO) == RCC_MCO_PLLCLK_Div2))
#else
#define RCC_MCO_PLL2CLK ((uint8_t)0x08)
#define RCC_MCO_PLL3CLK_Div2 ((uint8_t)0x09)
#define RCC_MCO_XT1 ((uint8_t)0x0A)
#define RCC_MCO_PLL3CLK ((uint8_t)0x0B)
#define IS_RCC_MCO(MCO) (((MCO) == RCC_MCO_NoClock) || ((MCO) == RCC_MCO_HSI) || \
((MCO) == RCC_MCO_SYSCLK) || ((MCO) == RCC_MCO_HSE) || \
((MCO) == RCC_MCO_PLLCLK_Div2) || ((MCO) == RCC_MCO_PLL2CLK) || \
((MCO) == RCC_MCO_PLL3CLK_Div2) || ((MCO) == RCC_MCO_XT1) || \
((MCO) == RCC_MCO_PLL3CLK))
#endif /* STM32F10X_CL */
/**
* @}
*/
/** @defgroup RCC_Flag
* @{
*/
#define RCC_FLAG_HSIRDY ((uint8_t)0x21)
#define RCC_FLAG_HSERDY ((uint8_t)0x31)
#define RCC_FLAG_PLLRDY ((uint8_t)0x39)
#define RCC_FLAG_LSERDY ((uint8_t)0x41)
#define RCC_FLAG_LSIRDY ((uint8_t)0x61)
#define RCC_FLAG_PINRST ((uint8_t)0x7A)
#define RCC_FLAG_PORRST ((uint8_t)0x7B)
#define RCC_FLAG_SFTRST ((uint8_t)0x7C)
#define RCC_FLAG_IWDGRST ((uint8_t)0x7D)
#define RCC_FLAG_WWDGRST ((uint8_t)0x7E)
#define RCC_FLAG_LPWRRST ((uint8_t)0x7F)
#ifndef STM32F10X_CL
#define IS_RCC_FLAG(FLAG) (((FLAG) == RCC_FLAG_HSIRDY) || ((FLAG) == RCC_FLAG_HSERDY) || \
((FLAG) == RCC_FLAG_PLLRDY) || ((FLAG) == RCC_FLAG_LSERDY) || \
((FLAG) == RCC_FLAG_LSIRDY) || ((FLAG) == RCC_FLAG_PINRST) || \
((FLAG) == RCC_FLAG_PORRST) || ((FLAG) == RCC_FLAG_SFTRST) || \
((FLAG) == RCC_FLAG_IWDGRST)|| ((FLAG) == RCC_FLAG_WWDGRST)|| \
((FLAG) == RCC_FLAG_LPWRRST))
#else
#define RCC_FLAG_PLL2RDY ((uint8_t)0x3B)
#define RCC_FLAG_PLL3RDY ((uint8_t)0x3D)
#define IS_RCC_FLAG(FLAG) (((FLAG) == RCC_FLAG_HSIRDY) || ((FLAG) == RCC_FLAG_HSERDY) || \
((FLAG) == RCC_FLAG_PLLRDY) || ((FLAG) == RCC_FLAG_LSERDY) || \
((FLAG) == RCC_FLAG_PLL2RDY) || ((FLAG) == RCC_FLAG_PLL3RDY) || \
((FLAG) == RCC_FLAG_LSIRDY) || ((FLAG) == RCC_FLAG_PINRST) || \
((FLAG) == RCC_FLAG_PORRST) || ((FLAG) == RCC_FLAG_SFTRST) || \
((FLAG) == RCC_FLAG_IWDGRST)|| ((FLAG) == RCC_FLAG_WWDGRST)|| \
((FLAG) == RCC_FLAG_LPWRRST))
#endif /* STM32F10X_CL */
#define IS_RCC_CALIBRATION_VALUE(VALUE) ((VALUE) <= 0x1F)
/**
* @}
*/
/**
* @}
*/
/** @defgroup RCC_Exported_Macros
* @{
*/
/**
* @}
*/
/** @defgroup RCC_Exported_Functions
* @{
*/
void RCC_DeInit(void);
void RCC_HSEConfig(uint32_t RCC_HSE);
ErrorStatus RCC_WaitForHSEStartUp(void);
void RCC_AdjustHSICalibrationValue(uint8_t HSICalibrationValue);
void RCC_HSICmd(FunctionalState NewState);
void RCC_PLLConfig(uint32_t RCC_PLLSource, uint32_t RCC_PLLMul);
void RCC_PLLCmd(FunctionalState NewState);
#if defined (STM32F10X_LD_VL) || defined (STM32F10X_MD_VL) || defined (STM32F10X_HD_VL) || defined (STM32F10X_CL)
void RCC_PREDIV1Config(uint32_t RCC_PREDIV1_Source, uint32_t RCC_PREDIV1_Div);
#endif
#ifdef STM32F10X_CL
void RCC_PREDIV2Config(uint32_t RCC_PREDIV2_Div);
void RCC_PLL2Config(uint32_t RCC_PLL2Mul);
void RCC_PLL2Cmd(FunctionalState NewState);
void RCC_PLL3Config(uint32_t RCC_PLL3Mul);
void RCC_PLL3Cmd(FunctionalState NewState);
#endif /* STM32F10X_CL */
void RCC_SYSCLKConfig(uint32_t RCC_SYSCLKSource);
uint8_t RCC_GetSYSCLKSource(void);
void RCC_HCLKConfig(uint32_t RCC_SYSCLK);
void RCC_PCLK1Config(uint32_t RCC_HCLK);
void RCC_PCLK2Config(uint32_t RCC_HCLK);
void RCC_ITConfig(uint8_t RCC_IT, FunctionalState NewState);
#ifndef STM32F10X_CL
void RCC_USBCLKConfig(uint32_t RCC_USBCLKSource);
#else
void RCC_OTGFSCLKConfig(uint32_t RCC_OTGFSCLKSource);
#endif /* STM32F10X_CL */
void RCC_ADCCLKConfig(uint32_t RCC_PCLK2);
#ifdef STM32F10X_CL
void RCC_I2S2CLKConfig(uint32_t RCC_I2S2CLKSource);
void RCC_I2S3CLKConfig(uint32_t RCC_I2S3CLKSource);
#endif /* STM32F10X_CL */
void RCC_LSEConfig(uint8_t RCC_LSE);
void RCC_LSICmd(FunctionalState NewState);
void RCC_RTCCLKConfig(uint32_t RCC_RTCCLKSource);
void RCC_RTCCLKCmd(FunctionalState NewState);
void RCC_GetClocksFreq(RCC_ClocksTypeDef* RCC_Clocks);
void RCC_AHBPeriphClockCmd(uint32_t RCC_AHBPeriph, FunctionalState NewState);
void RCC_APB2PeriphClockCmd(uint32_t RCC_APB2Periph, FunctionalState NewState);
void RCC_APB1PeriphClockCmd(uint32_t RCC_APB1Periph, FunctionalState NewState);
#ifdef STM32F10X_CL
void RCC_AHBPeriphResetCmd(uint32_t RCC_AHBPeriph, FunctionalState NewState);
#endif /* STM32F10X_CL */
void RCC_APB2PeriphResetCmd(uint32_t RCC_APB2Periph, FunctionalState NewState);
void RCC_APB1PeriphResetCmd(uint32_t RCC_APB1Periph, FunctionalState NewState);
void RCC_BackupResetCmd(FunctionalState NewState);
void RCC_ClockSecuritySystemCmd(FunctionalState NewState);
void RCC_MCOConfig(uint8_t RCC_MCO);
FlagStatus RCC_GetFlagStatus(uint8_t RCC_FLAG);
void RCC_ClearFlag(void);
ITStatus RCC_GetITStatus(uint8_t RCC_IT);
void RCC_ClearITPendingBit(uint8_t RCC_IT);
#ifdef __cplusplus
}
#endif
#endif /* __STM32F10x_RCC_H */
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/

View File

@@ -0,0 +1,133 @@
/**
******************************************************************************
* @file stm32f10x_rtc.h
* @author MCD Application Team
* @version V3.6.2
* @date 17-September-2021
* @brief This file contains all the functions prototypes for the RTC 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_RTC_H
#define __STM32F10x_RTC_H
#ifdef __cplusplus
extern "C" {
#endif
/* Includes ------------------------------------------------------------------*/
#include "stm32f10x.h"
/** @addtogroup STM32F10x_StdPeriph_Driver
* @{
*/
/** @addtogroup RTC
* @{
*/
/** @defgroup RTC_Exported_Types
* @{
*/
/**
* @}
*/
/** @defgroup RTC_Exported_Constants
* @{
*/
/** @defgroup RTC_interrupts_define
* @{
*/
#define RTC_IT_OW ((uint16_t)0x0004) /*!< Overflow interrupt */
#define RTC_IT_ALR ((uint16_t)0x0002) /*!< Alarm interrupt */
#define RTC_IT_SEC ((uint16_t)0x0001) /*!< Second interrupt */
#define IS_RTC_IT(IT) ((((IT) & (uint16_t)0xFFF8) == 0x00) && ((IT) != 0x00))
#define IS_RTC_GET_IT(IT) (((IT) == RTC_IT_OW) || ((IT) == RTC_IT_ALR) || \
((IT) == RTC_IT_SEC))
/**
* @}
*/
/** @defgroup RTC_interrupts_flags
* @{
*/
#define RTC_FLAG_RTOFF ((uint16_t)0x0020) /*!< RTC Operation OFF flag */
#define RTC_FLAG_RSF ((uint16_t)0x0008) /*!< Registers Synchronized flag */
#define RTC_FLAG_OW ((uint16_t)0x0004) /*!< Overflow flag */
#define RTC_FLAG_ALR ((uint16_t)0x0002) /*!< Alarm flag */
#define RTC_FLAG_SEC ((uint16_t)0x0001) /*!< Second flag */
#define IS_RTC_CLEAR_FLAG(FLAG) ((((FLAG) & (uint16_t)0xFFF0) == 0x00) && ((FLAG) != 0x00))
#define IS_RTC_GET_FLAG(FLAG) (((FLAG) == RTC_FLAG_RTOFF) || ((FLAG) == RTC_FLAG_RSF) || \
((FLAG) == RTC_FLAG_OW) || ((FLAG) == RTC_FLAG_ALR) || \
((FLAG) == RTC_FLAG_SEC))
#define IS_RTC_PRESCALER(PRESCALER) ((PRESCALER) <= 0xFFFFF)
/**
* @}
*/
/**
* @}
*/
/** @defgroup RTC_Exported_Macros
* @{
*/
/**
* @}
*/
/** @defgroup RTC_Exported_Functions
* @{
*/
void RTC_ITConfig(uint16_t RTC_IT, FunctionalState NewState);
void RTC_EnterConfigMode(void);
void RTC_ExitConfigMode(void);
uint32_t RTC_GetCounter(void);
void RTC_SetCounter(uint32_t CounterValue);
void RTC_SetPrescaler(uint32_t PrescalerValue);
void RTC_SetAlarm(uint32_t AlarmValue);
uint32_t RTC_GetDivider(void);
void RTC_WaitForLastTask(void);
void RTC_WaitForSynchro(void);
FlagStatus RTC_GetFlagStatus(uint16_t RTC_FLAG);
void RTC_ClearFlag(uint16_t RTC_FLAG);
ITStatus RTC_GetITStatus(uint16_t RTC_IT);
void RTC_ClearITPendingBit(uint16_t RTC_IT);
#ifdef __cplusplus
}
#endif
#endif /* __STM32F10x_RTC_H */
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/

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