There are many ways to design LED flashers using transistors, op amps, 555 timers, or even relays. And specialized ICs exist for driving LEDs, such as the LX1990...93 from Microsemi Integrated Products. But all of these approaches need extra hardware, meaning extra cost and space on the pc board.
When a design already uses a microcontroller (MCU), it would be beneficial to build an LED flasher exclusively in software—without using any external components. Such a solution is extremely flexible. You can program any period and duration of flashing, ranging from a fraction of a second to hours. In the case of two or more LEDs, you can choose any sequence of lighting: blinking together, one by one, etc. You would only require one or several vacant MCU pins.
Any MCU can be employed. In our design, we used the 8-bit low-end MC68HRC908JK1 from Motorola (see the figure). According to the project requirements, the flasher can generate two sequences determined by the switch, SW. When the switch is closed, LED1 and LED2 should flash simultaneously at a one-second rate. When the switch is open, they alternate flashing at the same rate. The LEDs are LTL-4231T-R1, with a built-in resistor from LiteOn.
The timer interrupt service routine (TISR) is available in the online version of this Design Brief at www.elecdesign.com. The TISR doesn't interfere with the main MCU program because it only takes about 30 µs (with fOSC = 4.85 MHz ) to be executed. Slightly modifying the program can supply any other flashing time rate and sequence—for example, the "running light."