Today we are going to learn how to easily learn the ARM series and play with the buzzer, based on the Samsung S5PV210 development platform of the ARM cortex_a8 core.
So let's see how to learn to use pwm to control the buzzer?
1. Overall Architecture Diagram
Before we can solve the buzzer problem, we need to have a certain understanding of the relevant chapters of Samsung's GPIO introduction, mainly the timer.
2. Several tips for playing with timers
2.1 Check the schematic diagram of the buzzer connection on the development board
Schematic diagram of the buzzer
The corresponding schematic diagram of the core board
2.2 Select the xpwmTOUT1 function of the GPD0CON configuration register
GPD0.GPD0CON = ((~(0xf 0)) & GPD0CON) | (0x2 << 4); Select PWM output function
2.3 Configuration of pre-scaling and frequency division registers
Configure the prescaler value, TIMER.TCFG0 = (TIME.TCFG0 & (~0xff)) | 0xff;
The prescaler value is set to 255 + 1
Configure the frequency division value to 16:
TIMR.TCFG1 = (TIME.TCFG1 & (~0xf0)) | (0x4 << 4);
2.4 Set the register value of the buffer counter and the value of the buffer comparator
Working principle: The value of the counter is decremented by 1 every clock cycle. If the value is equal to the value of the comparator, a high-low level conversion is performed, and the counter continues to decrement by 1 until it reaches 0, then it flips to achieve a complete square wave cycle.
Set the count buffer register value
TIME.TCNTB1 = XXX; Set the total cycle, one pwm
Set the compare buffer register value
TIME.TCMPB1 = XXX/2; Setting is duty cycle
2.5 Manually update the value in the buffer register to the counter
Steps to set up pwm:
According to the second step of 1.3.15, first set the manual update, then clear the manual update and start the timer
Manual update, update the value in the buffer to the counter, double buffer mechanism
TIME.TCON = TIME.TCON & (0x0e << 8); 0000 1110
Clear the manual update bit and start the timer. 0000 1101 0x0d
TIME.TCON = TIME.TCON & (0x0d << 8);
Previous article:Learn ARM series I2C bus easily
Next article:S5PC100 peripherals pulse width modulation timer
- Popular Resources
- Popular amplifiers
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
- Innovation is not limited to Meizhi, Welling will appear at the 2024 China Home Appliance Technology Conference
- Innovation is not limited to Meizhi, Welling will appear at the 2024 China Home Appliance Technology Conference
- Huawei's Strategic Department Director Gai Gang: The cumulative installed base of open source Euler operating system exceeds 10 million sets
- Download from the Internet--ARM Getting Started Notes
- Learn ARM development(22)
- Learn ARM development(21)
- Learn ARM development(20)
- Learn ARM development(19)
- Learn ARM development(14)
- Learn ARM development(15)
- Request: DC-DC small package chip similar to LM2596
- What is the reason! Another wind turbine fire accident! And caused a ground wildfire
- 【Iprober 520 current probe】Practical use in motor control
- Can you please help me find out where is the problem with the program?
- What are the basic units of Weber Wb and Tesla T?
- How to add c files in esp32 idf components to compile
- Have you noticed the LPDSP32 audio codec inside RSL10? Does your project use this resource?
- Will the push-pull circuit be straight through?
- EEWORLD University - Industrial Internet of Things using CC1310 sub-1 GHz wireless MCU
- A simple way to distinguish between broadband FM and narrowband FM