当前位置:网站首页>使用proteus仿真STM32超声波SRF04测距!Code+Proteus
使用proteus仿真STM32超声波SRF04测距!Code+Proteus
2022-04-23 06:14:00 【锦官城外w】
本贴使用Proteus8.10,如低版本打不开可自行根据原理图绘制(很简单)
单片机型号为:stm32f103系列
使用timer3。运行稳定,示数距离有偏差,可在源程序处更改。
如有问题,评论区留言,看到回~
#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);
}
}
版权声明
本文为[锦官城外w]所创,转载请带上原文链接,感谢
https://blog.csdn.net/qq_41740659/article/details/112306517
边栏推荐
猜你喜欢
随机推荐
Five methods are used to obtain the parameters and calculation of torch network model
F.pad 的妙用
第1章 NumPy基础
torch. mm() torch. sparse. mm() torch. bmm() torch. Mul () torch The difference between matmul()
Pytoch model saving and loading (example)
CMSIS CM3源码注解
PyTorch 12. hook的用法
【点云系列】DeepMapping: Unsupervised Map Estimation From Multiple Point Clouds
pth 转 onnx 时出现的 gather、unsqueeze 等算子
1.2 初试PyTorch神经网络
AUTOSAR从入门到精通100讲(八十四)-UDS之时间参数总结篇
Pytorch model pruning example tutorial III. multi parameter and global pruning
Pytorch best practices and coding style guide
Chapter 2 pytoch foundation 1
[point cloud series] pnp-3d: a plug and play for 3D point clouds
第8章 生成式深度学习
PyTorch 11.正则化
[point cloud series] sg-gan: advantageous self attention GCN for point cloud topological parts generation
ARMCC/GCC下的stack protector
Use originpro express for free