当前位置:网站首页>Use Proteus to simulate STM32 ultrasonic srf04 ranging! Code+Proteus
Use Proteus to simulate STM32 ultrasonic srf04 ranging! Code+Proteus
2022-04-23 13:00:00 【Outside Jinguan City】
This post uses Proteus8.10, If the lower version cannot be opened, it can be drawn according to the schematic diagram ( It's simple )
The model of single chip microcomputer is :stm32f103 series
Use timer3. Stable operation , There is a deviation in the indication distance , Can be changed at the source .
If there is a problem , Comment area , See back ~


#include "sys.h"
#include "delay.h"
#include "led.h"
#include "key.h"
#include "timer.h"
int main(void)
{
float SRF04_Value = 123.45;
uint8_t adcxxx[3] = {
0, 0, 0};
HAL_Init();
Stm32_Clock_Init(RCC_PLL_MUL9);
delay_init(72);
LCD_init();
SRF04_init();
TIM3_Init(1000-1, 72-1);
while(1)
{
SRF04_Value = Hcsr04GetLength();
adcxxx[0] = (uint16_t)SRF04_Value / 100 + 48;
adcxxx[1] = (uint16_t)SRF04_Value % 100 / 10 + 48;
adcxxx[2] = (uint16_t)SRF04_Value % 100 % 10 + 48;
LCD_write_string(1, 0, "Distance:");
LCD_write_string(11, 0, (char*)adcxxx);
}
}
版权声明
本文为[Outside Jinguan City]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204230613382885.html
边栏推荐
- Free and open source charging pile Internet of things cloud platform
- 进程虚拟地址空间区域划分
- 21 天学习MongoDB笔记
- At instruction of nbiot
- Object.keys后key值数组乱序的问题
- Kubernetes 入门教程
- Idea的src子文件下无法创建servlet
- Read the data in Presto through sparksql and save it to Clickhouse
- Van uploader upload picture implementation process, using native input to upload pictures
- Kubernetes 入門教程
猜你喜欢

CVPR 2022 & ntire 2022 | the first transformer for hyperspectral image reconstruction

Servlet监听器&过滤器介绍

SSM框架系列——注解开发day2-2

No idle servers? Import OVF image to quickly experience smartx super fusion community version

Record some NPM related problems (messy records)

Read the data in Presto through sparksql and save it to Clickhouse

Customize classloader and implement hot deployment - use loadclass

软件测试周刊(第68期):解决棘手问题的最上乘方法是:静观其变,顺水推舟。

leetcode:437. 路径总和 III【dfs 选还是不选?】
![Packet capturing and sorting -- TCP protocol [8]](/img/ae/4957a997af725a1bf3f61cb24fc717.png)
Packet capturing and sorting -- TCP protocol [8]
随机推荐
31. Next arrangement
教你快速开发一个 狼人杀微信小程序(附源码)
There is no need to crack the markdown editing tool typora
Introducing vant components on demand
8 websites that should be known for product development to enhance work experience
If you were a golang interviewer, what questions would you ask?
BUUCTF WEB [BJDCTF2020]The mystery of ip
MySQL supports IP access
Go language slicing operation
Process virtual address space partition
Common problems of unity (1)
Record some NPM related problems (messy records)
将新增和编辑的数据同步更新到列表
SSM框架系列——Junit单元测试优化day2-3
Golang implements MD5, sha256 and bcrypt encryption
At instruction of nbiot
Jupiter notebook installation
Learning materials
Free and open source intelligent charging pile SaaS cloud platform of Internet of things
Record Alibaba cloud server mining program processing