Embedded Systems & Firmware

Which method is commonly used by microcontrollers to adjust LED brightness or motor speed?

  1. AMaking the power wires thicker or thinner
  2. BTemporarily halting program execution
  3. CPWM, switching on and off rapidly and varying the fraction of on time
Show answer and explanation

Answer: C. PWM, switching on and off rapidly and varying the fraction of on time

Driving an LED or motor on and off rapidly with PWM makes the LED appear as bright as its on-time fraction, and the motor, through inertia, turns at a speed set by the average power. The transistor operates fully on or fully off, so it dissipates less heat than at intermediate voltages, giving efficient control. The frequency is chosen so that LED flicker and motor noise are not noticeable.

  • A. Wire thickness is not used for control.
  • B. Halting the program does not adjust anything.
  • C. Correct. It finely controls the average power.
Practice this topic Back to topic

More Embedded Systems & Firmware questions

  1. What is the input capture function of a microcontroller timer used for?
  2. What should be avoided inside an interrupt handler?
  3. When the program above is compiled with optimization, led_on() may never be called even after the timer interrupt fires. Which pairs the cause with the fix correctly?
  4. On an 8-bit microcontroller, a timer interrupt increments the 32-bit variable ticks, and the main code reads ticks to compute elapsed time. Why is a wildly wrong value occasionally read?
  5. What is a characteristic of serial communication with a UART?