Monthly Archives: September 2012

Bitcoin Explained (I)

Bitcoin’s core technology is a very clever, and yet surprisingly simple, idea. It’s got distinct parallels with the git version control system; and the concept would work for a great deal more situations than just a virtual currency. There are plenty of ill-informed articles by mainstream (and some tech) writers who haven’t really understood how […]

Posted in FussyLogic | Tagged | Leave a comment

Volatile Delays

You want to write a simple delay loop on your embedded microcontroller. Let’s say you’re waiting for the crystal oscillator to stabilise before you use it. static void delay( int loops ) { while(loops–) ; } You’re then very surprised to find that this takes a total time of 0ms when you call it. You […]

Posted in FussyLogic | Tagged , , , | Leave a comment

Debounce

It’s been a while since I’ve had to use this knowledge, but I happened upon this request on Hackaday. It’s from a few years ago, and so I won’t be submitting to them; but am inspired enough to write an article about debouncing. So first, what is “debouncing”? More importantly, what is “bouncing” in such […]

Posted in FussyLogic | Tagged , | Leave a comment

CPU, Interrupted — Timers II

When last we spoke on this subject I had left you with a time-accurate but impractical timer interrupt handler. #define F_CPU 16000000 uint8_t Timer_ms = 0; static void initTIMER1( void ) { // CTC mode (WGM1[3:0] = 0x04) TCCR1A = 0; TCCR1B = _BV(WGM12); // CLK/8 prescaler (see datasheet for table) TCCR1B |= _BV(CS11); // […]

Posted in FussyLogic | Tagged , , , , , , | Leave a comment

Japanese Long Multiplication

This YouTube video makes it pretty clear how to do it; but I thought I’d run one without the graphical aids… 593 x 472 The trick is to arrange the nine necessary sub-multiplications in a standardised pattern. You can think of this as a square matrix rotated through 45 degrees… c 5|a b c b […]

Posted in FussyLogic | Tagged | Leave a comment

Keeping /etc/ In git

On a UNIX system, the /etc/ directory is what makes it what it is. Assuming you use just open source software, and forgetting about your user data (which should be in /home/), if you have /etc/ backed up for your server you can recreate it without much difficulty. It should definitely be included in your […]

Posted in FussyLogic | Tagged , | Leave a comment

Bashing at the Keyboard (part I)

The command line. The feared enemy of anyone who started using a computer after 1995 (ish). It’s got a bad reputation, and for day to day computer tasks it’s certainly not necessary. However, if you are a programmer or a systems administrator then you’ll benefit enormously from knowing how to get things done on a […]

Posted in FussyLogic | Tagged , , | Leave a comment

CPU, Interrupted — Timers

Yesterday I mentioned that interrupts on an embedded microcontroller can cause you trouble. That’s not strictly true – it’s not the interrupt that causes trouble it’s the way you handle them. An awful lot of programmers don’t handle them correctly and they end up in a sticky mess. Before I can talk about interrupts though, […]

Posted in FussyLogic | Tagged , , , , , | Leave a comment

Replacing an IDE With Makefiles

Developers have been led down a path by graphical tools. The tools in question are the so-called IDEs (integrated development environments). They are a nice idea in theory: combine your editor, compiler and debugger into one graphical program so that the developer can edit away, pressing “build” when they feel like it and single step […]

Posted in FussyLogic | Tagged | Leave a comment

AVR UART Transmit and stdio

The setup for a UART on AVR is such common code that I wonder if possibly it’s just assumed to be understood and explained. This is a quick article to fill in the gaps. First let’s talk initialisation. This is often the most important part of using any hardware peripheral on an embedded processor. In […]

Posted in FussyLogic | Tagged , , , | Leave a comment