5.5.3 · D3 · Coding › Embedded Systems & Real-Time Software › Timers — PWM generation, input capture, output compare
Har timer problem in cells mein se ek (ya inka blend) hoti hai. Neeche har worked example tagged hai un cell(s) ke saath jo wo cover karta hai.
| # |
Cell (case class) |
Kya tricky hai |
Example |
| A |
Forward design, PWM % — target frequency + duty ke liye PSC/ARR/CCR choose karo |
PSC choose karna taaki ticks tidy rahein |
Ex 1 |
| B |
Forward design, pulse-width (servo/ESC) — CCR ko µs mein set karo, % mein nahi |
duty irrelevant hai; width matter karta hai |
Ex 2 |
| C |
Degenerate duty — 0%, 100%, aur top par off-by-one |
CCR=ARR+1 vs CCR=ARR |
Ex 3 |
| D |
Toggle mode — square wave, divide-by-2 subtlety |
do toggles = ek period |
Ex 4 |
| E |
Input capture, no wrap — frequency measure karo |
plain subtraction |
Ex 5 |
| F |
Input capture, WITH wrap — negative-difference trap |
modulo arithmetic |
Ex 6 |
| G |
Limiting / resolution — 16-bit timer ki smallest & largest frequency |
ARR range limits |
Ex 7 |
| H |
Real-world word problem — LED ko perceived brightness par dim karo |
physical want ko registers se map karna |
Ex 8 |
| I |
Exam twist — scope reading dekhke registers reverse-engineer karo |
har formula ko invert karo |
Ex 9 |
- Parent topic (Hinglish) — wo machinery jin par ye examples exercise karte hain.
- Clock Tree and Prescalers — jahan se fclk aur tidy-tick choices aate hain.
- GPIO and Alternate Functions — wo pin jo har PWM/toggle example drive karta hai.
- Interrupts and NVIC — Cell F wrap case ke liye overflow-counting.
- Servo and ESC Control — Example 2 ki pulse-width interpretation.
- Motor Control and H-Bridges — Example 1 & 8 style duty control at speed.
- Encoder Mode — curious logon ke liye ek capture cousin.