Clock & Timer Circuit DiagramsFrequency multiplier

Tiny Pulser Schematic Circuit Diagram

The author repeatedly needed several different digital signals for testing his circuits, and a simple function generator did not provide a satisfactory solution. He quickly developed a design for a pulse generator with three outputs, as described here, which can generate a variety of pulse trains with adjustable frequency.

Tiny Pulser Schematic Circuit Diagram

The heart of the circuit is an ATtiny13. This compact AVR microcontroller has five external I/O pins, of which three (PB0, PB1 and PB2) are used for the pulse outputs and two (PB3 and PB4) are used as inputs for the A/D converter. Switches Select 1 to Select 3 and the R/2R network (R5, R6, R7, R8, R13 and R14) are used to set a voltage on PB4 that selects the pulse mode (0–7) in the software. The pulse rate is controlled by the voltage on PB3, which can be adjusted with potentiometer R11 to cover the range from 290 Hz to approximately 8 kHz. The timing diagrams illustrate the pulse sequences generated in modes 0 to 6:

Modes 1 & 2: non-overlapping pulses with adjustable frequency (normal or inverted)

Modes 2 & 3: fully overlapping pulses with adjustable frequency (normal or inverted)

Modes 4 & 5: partially overlapping pulses with adjustable frequency (normal or inverted)

Mode 6: three-bit binary counter with an adjustable frequency

Mode 7 is a special mode in which PWM signals at a frequency of 2300 Hz are output on the PB0 and PB1 pins. PB1 provides a PWM signal that periodically ramps up from 0 to 100% (0–255) and back down again, with a repetition rate of approximately 0.5 Hz. The PWM signal on PB0 can be controlled via the ADC3 input. The pulses from Timer0 are output on PB2. We have more to say about Timer0 further on.

The firmware for the Tiny Pulser was written in assembly language using Atmel AVR Studio 4. Fast execution is especially important here because the output pulses are generated by software in the Timer0 interrupt routine. The pulse sequence is generated using a cyclic counter with a range of 0 to 7, and the values of the three output signals are stored in an array indexed by mode (0 to 7) and cycle state. Each time an interrupt occurs, the appropriate values are read from the PULSE[MODE, CYCLE] array and fed to the outputs.

The ATtiny13 microcontroller is clocked by its internal RC oscillator at 4.8 MHz, and the fuse bits must be configured accordingly:


CKSEL = 0,1 → 4.8 MHz

CKDIV8 = 0 → no divide by 8

SUT = 1,0 → slow rising power

The source code and a hex file can be downloaded from the Elektor website (www.elektor. com/090444), along with a ReadMe file with information about programming. If you don’t want to program the microcontroller yourself, you can order a pre-programmed device from the Elektor Shop at (order number 090444-41).


Related Articles

Leave a Reply

Your email address will not be published.

Back to top button