Did you know that most AVR chips have a type of hardware exclusive OR (XOR) option when it comes to the logic levels of the output pins? If you look in the datasheet (the image above is a screenshot from an ATtiny13 datasheet) you’ll find a section on Toggling the Pin. It turns out that if you set a PORT as an output, writing logic one to the corresponding PIN register will toggle the logic levels of that out. This is really easy to overlook if you’re writing in C, but I’ve been working on learning a bit of assembler language and found this to be very useful. Keep reading after the break and I’ll tell you how I happened upon this info and what it’s good for.
Continue reading “Hardware XOR for output pins on AVR microcontrollers”
PIC, AVR, and Arduino are ubiquitous in projects these days and a lot of the time it’s easy to over-complicate things with their use. In this case, [Tod] wanted to use a momentary tactile switch to turn something on and off. Instead of going with a microcontroller he built the circuit around a 555 timer. What he really needed in this case is a flip-flop but lacking a chip for that he went with the 555 because it has one built-in. Three resistors and a capacitor later he’s in business, adding another resistor and a transistor to deal with the load switching. We’ve embedded video of the circuit controlling an LED after the break. This IC ends up in a lot of projects so dig through your parts bin and give this circuit a try.
Continue reading “Beginner concepts: 555 push button toggle”