Microcontroller Logic Gates with AVR Event System

David Johnson-Davies shows how to generate logic gates outside of normal processing with Microchip's AVR Event System.

Jeremy Cook
9 months ago

As David Johnson-Davies notes in his latest Technoblogy write-up: If you’re designing an AVR project and you need a few buffers or inverters, you can add a CMOS gate package to your circuit. While not a huge deal hardware-wise, as it turns out you can instead solve this challenge using the microcontroller itself via the AVR Event System. This is reportedly an under-appreciated aspect of AVR microcontrollers, likely because it’s somewhat unintuitive to use. I’d also argue that many people, including myself, have never heard of it.

Utilized or not, the Event System was introduced in the ATtiny 1-series processors and has been a part of all AVR processors released since then. There are three versions available, and Johnson-Davies deals with V2 and 3, which feature a number of improvements over the original. Long story short, the Event System effectively allows you to shortcut leads between inputs and outputs, creating functionality – i.e. logic gates – that work independently of the normal processing paradigm, outside of even the processor’s clock speed.

Johnson-Davies' blog post gives lots more detail, along with links to reference material. He also gives several concrete examples of what you can do with these gates, substituting AVR-generated inverters and an AVR-generated buffer to form a blink circuit (in two different configurations). He then outlines how to make a pushbutton debouncer with this logic circuitry, which could perhaps be a more practical application.

With this “hello world” gate functionality understood on a basic level, one could see it applied to a wide range of applications. It's a solution waiting for the right problem. If you don’t see a use for it now, it’s something you'll want to keep in your mental electronics toolbox for just the right circumstance!

Jeremy Cook
Engineer, maker of random contraptions, love learning about tech. Write for various publications, including Hackster!
Latest articles
Sponsored articles
Related articles
Latest articles
Read more
Related articles