According to our project requirements, the brightness of the two LEDs must be gradually adjusted from the darkest to the brightest and then from the brightest to the darkest in opposite order within a few seconds. During the "ramp 1" time, the pulse width of the PWM signal for LED 1 gradually increases, while the pulse width of the PWM signal for LED 2 gradually decreases. For example, assume that the ramp time is equal to 2 seconds and consists of 128 up/down steps. Therefore, each step lasts about 16ms. Please note that the pulse width should change only once in one PWM period. Therefore, the PWM period should also be equal to 16ms.
We used a low-end 8-bit Motorola MC68HC908-QT2 Flash MCU, which has an embedded oscillator. Its oscillation frequency is 12.8MHz, and the prescaler ratio is set to 1:64 in the program, and the timer clock period is 0.02 ms. Then, in order to generate a PWM period of 16ms, the number of clocks to be loaded into the timer/counter mode register (Tmod) should be equal to 16/0.02 = 800 (equal to $0320 in hexadecimal).
The maximum pulse width (PWmax) can be less than or equal to the PWM period. Consider the case where PWmax is approximately 15ms. For 128 steps, to get this maximum value from zero, each step value should be 15/128 = 0.117ms, which is rounded to 0.12ms. From this we can get PWmax = 15.36 ms, which is equivalent to 96% of the PWM period. Therefore, in each step, PW should be ramped up/down in increments of 0.12ms (equal to 0.12/0.02 = 6 timer clocks).
Any MCU with PWM and any timing consideration can be used to implement this technique. Resistors R1 and R2 should be selected according to the LED used. Pin pA2 = 1 is used to activate the brightness control and pin pA2 = 0 is used to disable the brightness control.
Previous article:The Current Status and Future of LED Lighting Driving Technology
Next article:Design of LED rotating screen based on AVR
- MathWorks and NXP Collaborate to Launch Model-Based Design Toolbox for Battery Management Systems
- STMicroelectronics' advanced galvanically isolated gate driver STGAP3S provides flexible protection for IGBTs and SiC MOSFETs
- New diaphragm-free solid-state lithium battery technology is launched: the distance between the positive and negative electrodes is less than 0.000001 meters
- [“Source” Observe the Autumn Series] Application and testing of the next generation of semiconductor gallium oxide device photodetectors
- 采用自主设计封装,绝缘电阻显著提高!ROHM开发出更高电压xEV系统的SiC肖特基势垒二极管
- Will GaN replace SiC? PI's disruptive 1700V InnoMux2 is here to demonstrate
- From Isolation to the Third and a Half Generation: Understanding Naxinwei's Gate Driver IC in One Article
- The appeal of 48 V technology: importance, benefits and key factors in system-level applications
- Important breakthrough in recycling of used lithium-ion batteries
- Innolux's intelligent steer-by-wire solution makes cars smarter and safer
- 8051 MCU - Parity Check
- How to efficiently balance the sensitivity of tactile sensing interfaces
- What should I do if the servo motor shakes? What causes the servo motor to shake quickly?
- 【Brushless Motor】Analysis of three-phase BLDC motor and sharing of two popular development boards
- Midea Industrial Technology's subsidiaries Clou Electronics and Hekang New Energy jointly appeared at the Munich Battery Energy Storage Exhibition and Solar Energy Exhibition
- Guoxin Sichen | Application of ferroelectric memory PB85RS2MC in power battery management, with a capacity of 2M
- Analysis of common faults of frequency converter
- In a head-on competition with Qualcomm, what kind of cockpit products has Intel come up with?
- Dalian Rongke's all-vanadium liquid flow battery energy storage equipment industrialization project has entered the sprint stage before production
- Allegro MicroSystems Introduces Advanced Magnetic and Inductive Position Sensing Solutions at Electronica 2024
- Car key in the left hand, liveness detection radar in the right hand, UWB is imperative for cars!
- After a decade of rapid development, domestic CIS has entered the market
- Aegis Dagger Battery + Thor EM-i Super Hybrid, Geely New Energy has thrown out two "king bombs"
- A brief discussion on functional safety - fault, error, and failure
- In the smart car 2.0 cycle, these core industry chains are facing major opportunities!
- The United States and Japan are developing new batteries. CATL faces challenges? How should China's new energy battery industry respond?
- Murata launches high-precision 6-axis inertial sensor for automobiles
- Ford patents pre-charge alarm to help save costs and respond to emergencies
- New real-time microcontroller system from Texas Instruments enables smarter processing in automotive and industrial applications
- Graduation project help
- It is found that domestic manufacturers like to polish the logo and model outside the chip.
- [Qinheng Trial] CH559EVT Trial 2: Development Environment
- Application design using the FRAM-based MCU MSP430FR57xx series
- EEWORLD University Hall----Live Replay: AVNET uses MPLAB? Ecosystem and Curiosity Nano Development Board to create an innovative development workflow
- BleuNRG-1 one master and multiple slaves master module search interval setting
- How to use iic to make LCD screen display
- An Engineer's Guide to Temperature Sensing
- N ways to program the development board
- Analysis of Rectification Circuit and Filter Circuit