I was bored and made some fun stuff at home recently. I needed a module to drive a speaker to play a reminder sound. I initially bought the WT588DM01 because it came with 8M Flash and was worry-free. But it turned out that I had to buy a programmer worth more than 30 dollars to use it.
Later, I gritted my teeth and bought a JQ6500 voice module. I could burn MP3 files into it by plugging it into a computer via USB. It turned out that Shenzhen manufacturers had a good insight into the needs.
I bought it, but the information provided by the manufacturer was divided into three versions. The PCB appearance was changed, but the PDF was not updated. I had to tinker with it myself and try it out with a 51 according to the reference materials.
This is the external view of the module in the PDF. The actual product you bought looks like this:
The chip has 24 pins and the module has 16 pins. The 16 pins have not changed, but there are slight changes on the module PCB board, but it does not affect the direct use of the 16 pins led out of the module.
Module wiring schematic diagram, SPK+ and SPK- can be directly connected to a passive buzzer.
The microcontroller source program is as follows:
#include #include /* The ninth pin of this module, which is the RX pin, is connected to P3^1 of the microcontroller. The tenth pin, also known as the TX pin, is connected to P3^0 of the microcontroller (if you do not process the data returned by this module, you can leave it unconnected) At the same time, the module and the microcontroller must share the same ground and connect GND The module can also be powered directly by the power supply on the microcontroller. */ typedef unsigned char uint8; typedef unsigned int uint16; sbit KEY1=P3^2; //First key sbit KEY2=P3^3; // First song loop key sbit KEY3=P3^4; //Pause key sbit KEY4=P3^5; //Enter sleep mode uint8 First[]={0x7E,0x04,0x03,0x00,0X01,0xEF}; //First song instruction uint8 Next[]={0x7E,0x03,0x11,0x01,0xEF}; // First loop uint8 Add[]={0x7E ,0x02, 0x0E, 0xEF}; // 0x0e pause uint8 Sub[]={0x7E, 0x02, 0x0A, 0xEF}; // 0x0a enters sleep void delay150ms(void) //error -0.000000000047us { unsigned char a,b,c; for(c=6;c>0;c--) for(b=52;b>0;b--) for(a=220;a>0;a--); _nop_(); //if Keil,require use intrins.h } /* * UART initialization * Baud rate: 9600 */ void UART_init(void) { SCON = 0x50; // 10-bit uart, allow serial reception TMOD = 0x20; // Timer 1 works in mode 2 (auto reload) 0010 0000 TH1 = 0xFD; TL1 = 0xFD; //Set the baud rate to 9600 TR1 = 1; } /* * UART sends one byte The data type of the input parameter uint8 is the data to be sent */ void UART_send_byte(uint8 dat) { SBUF = dat; while (TI == 0); TI = 0; } /* * UART sends string The first parameter is the address of the string or data to be sent. The second parameter is the length of the data or string to be sent */ void UART_send_string(uint8 *buf,uint8 len) { uint8 i; for(i=0;i } main() { UART_init(); //Serial port initialization while (1) //A large loop that keeps detecting key presses and sending commands { if(KEY1==0) //If the first key is pressed, play the first segment { while(!KEY1); //Wait for the key to be released UART_send_string(First,6); } else if(KEY2==0) //If the second button is pressed, loop the first song { while(!KEY2); //Wait for the key to be released UART_send_string(Next,5); delay150ms(); //After testing, a delay of 150ms between two instructions works best UART_send_string(First,6); } else if(KEY3==0) //If the third button is pressed, pause the playback { while(!KEY3); //Wait for the key to be released UART_send_string(Add,4); } else if(KEY4==0) //If the fourth button is pressed, enter sleep mode { while(!KEY4); //Wait for the key to be released UART_send_string(Sub,4); } } } Four buttons and a serial port are used. Every time a button is detected, the microcontroller sends a serial port command to the module JQ6500. The time between two commands should be no less than 150ms (actual measurement), otherwise there will be no response.
Previous article:Jump Jump game source program based on 51 single chip microcomputer
Next article:A learning infrared remote control switch program was made using the STc15f104e microcontroller
Recommended ReadingLatest update time:2024-11-15 13:28
- Popular Resources
- Popular amplifiers
- Wireless Sensor Network Technology and Applications (Edited by Mou Si, Yin Hong, and Su Xing)
- Modern Electronic Technology Training Course (Edited by Yao Youfeng)
- Modern arc welding power supply and its control
- Small AC Servo Motor Control Circuit Design (by Masaru Ishijima; translated by Xue Liang and Zhu Jianjun, by Masaru Ishijima, Xue Liang, and Zhu Jianjun)
- Learn ARM development(16)
- Learn ARM development(17)
- Learn ARM development(18)
- Embedded system debugging simulation tool
- A small question that has been bothering me recently has finally been solved~~
- Learn ARM development (1)
- Learn ARM development (2)
- Learn ARM development (4)
- Learn ARM development (6)
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- LED chemical incompatibility test to see which chemicals LEDs can be used with
- Application of ARM9 hardware coprocessor on WinCE embedded motherboard
- What are the key points for selecting rotor flowmeter?
- LM317 high power charger circuit
- A brief analysis of Embest's application and development of embedded medical devices
- Single-phase RC protection circuit
- stm32 PVD programmable voltage monitor
- Introduction and measurement of edge trigger and level trigger of 51 single chip microcomputer
- Improved design of Linux system software shell protection technology
- What to do if the ABB robot protection device stops
- Wi-Fi 8 specification is on the way: 2.4/5/6GHz triple-band operation
- Wi-Fi 8 specification is on the way: 2.4/5/6GHz triple-band operation
- Vietnam's chip packaging and testing business is growing, and supply-side fragmentation is splitting the market
- Vietnam's chip packaging and testing business is growing, and supply-side fragmentation is splitting the market
- Three steps to govern hybrid multicloud environments
- Three steps to govern hybrid multicloud environments
- Microchip Accelerates Real-Time Edge AI Deployment with NVIDIA Holoscan Platform
- Microchip Accelerates Real-Time Edge AI Deployment with NVIDIA Holoscan Platform
- Melexis launches ultra-low power automotive contactless micro-power switch chip
- Melexis launches ultra-low power automotive contactless micro-power switch chip
- BlueNRG-1/2 Flash operations require mutual exclusion with BLE events
- 1S2192 Parameters
- Does anyone have the BAP protocol in Volkswagen's CAN protocol?
- The Definitive Guide to Automotive Ethernet
- Bluetooth learning notes: analysis of example broadcast data
- Live Review: New Opportunities in UWB Market on June 23
- Questions about DDR3 VTT
- Learn to use WiFi module to remotely burn programs to STM32/GD32 MCU in two minutes
- CMSIS_RTOS_Tutorial self-translated Chinese version
- [Qinheng Trial] Run the ID reading routine