当前位置:网站首页>Interaction method I between STM32 single chip microcomputer and ld3320 voice module
Interaction method I between STM32 single chip microcomputer and ld3320 voice module
2022-04-22 06:04:00 【*wj】
stm32 SCM and LD3320 Voice module interaction method 1
Serial port interaction method link
## Interactive mode : stm32 Read LD3320 Corresponding to the level change of the pin , Achieve control
1. Hardware wiring
LD3320 and stm32
GND —— GND
5V —— 5V
notes :
①LD3320 Of RXD,TXD,3.3V The pin can be left alone
②LD3320 Of P1^0 There's another one out there LED Small lights , Small lamp negative pole and LD3320 and stm32 common GND
2.LD3320 Procedure part
LD3320 Refer to the official schedule (YS-V0.7 Password mode in the project template ), The specific changes are as follows :
①main function



LD3320 Train schedule :
link :https://pan.baidu.com/s/1DuKH3GuQ08w8RABLPgQajA
Extraction code :49xo
3.stm32 Procedure part
General idea : adopt stm32f103 One pin of (PA1) Read out LD3320 Of P1^0 The level of the pin changes , then stm32 The other pin (PA2) To control the LED The state of the small lamp
LD3320 Received the light on command , P1^0 Output high level , be stm32 Pin PA1 Read the level ,PA2 Output high level
LD3320 Received the light off command , P1^0 Output low level , be stm32 Pin PA1 Read the level ,PA2 Output low level
Reference procedure :
void GPIO_Configuration(void)
{
RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA,ENABLE);
GPIO_InitTypeDef GPIO_InitStructure;
// Output pin configuration
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_2;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;
GPIO_Init(GPIOA, &GPIO_InitStructure);
// Input pin configuration
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_1;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IPD; // Drop down input
GPIO_InitStructure.GPIO_Speed= GPIO_Speed_50MHz;
GPIO_Init(GPIOA, &GPIO_InitStructure);
}
The main function :
#define LED GPIO_ReadInputDataBit(GPIOA,GPIO_Pin_1) // Read PA1 level
int main(void)
{
GPIO_Configuration();
while(1)
{
if(LED == 1)
{
GPIO_SetBits(GPIOA,GPIO_Pin_2); //PA2 Output high level
}
else
{
GPIO_ResetBits(GPIOA,GPIO_Pin_2);//PA2 Output low level
}
}
}
4. summary
Therefore, we can draw inferences from one instance : For example, turn on the steering gear , The command to turn on the fan only needs to change the corresponding password , Configure the corresponding IO Control can be realized through the port .
advantage :
Compared with serial port interaction, the overall implementation idea is very simple , Easy to implement
shortcoming :
When more modules are needed, it wastes the of MCU IO mouth

Project code
link :https://pan.baidu.com/s/18wBMPuvAbLh-IcVmADP8Eg
Extraction code :8q4j
版权声明
本文为[*wj]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204220541420553.html
边栏推荐
- Chapter 86 leetcode refers to offer dynamic programming (III) maximum profit of stock
- [2022 Ali security] real scene tampering image detection challenge final rank17 scheme sharing
- Integer splitting problem (dynamic programming + recursion & record array)
- Out range of signed 32bit display when compiling openssl-0.9.8e
- redis定时写入,直播流视频拉取
- 第88篇 LeetCode剑指Offer动态规划(五)礼物的最大值
- What compiler is used for beginners of C language (there is a surprise at the end of the article)
- 蓝桥杯嵌入式省赛第七届:模拟液位检测告警系统”
- RTL8367学习笔记1——基础知识
- Blue Bridge Cup 31 day sprint Day17
猜你喜欢
随机推荐
Software test classification
第75篇 LeetCode题目练习(八) 8.字符串转整数
IWDG
Golang calculates the number of days rounded to time
13 - container - List
07- 运算符
Blue Bridge Cup 31 day sprint day23
Three lines of recursive output code of stack C
汇编 makefile
抓包工具mitmproxy和Anyproxy
[2022 Ali security] real scene tampering image detection challenge final rank17 scheme sharing
日常学习记录——读取自定义数据集
14 - container - tuple
Part 84 leetcode sword refers to offer dynamic programming (I) Fibonacci sequence
Standard input, standard output, standard error redirection and pipeline
Installation and use of cmake and cross tool compilation chain
ocilib库连接oracle
geojson文件与shapefile文件 单个 互转 小工具
C / S architecture
LeetCode 898. Subarray bitwise OR operation - set








