Make some quiet!

I’m making progress on testing the latest board and I got it making some noise. But, it’s not all the noise that I was looking for. It’s more!  Specifically, I made some layout choices that turn out to be quite poor.  Let me save you from making the same mistake.  Click through for the details.

Continue reading

Bandlimited Wavetable Synthesis

Sin Wavetable
I’ve discussed the phenomenon of aliasing in digital synthesis in several previous posts.  I described the phenomena, it’s source and what it sounds like.  There are many, many solutions to the problem of aliasing in digital synthesis.  A lot of them rely on performing sequences of calculations, multiplications and additions to implement various filtering methods or methods of synthesis which theoretically do not create aliasing, like additive synthesis. In my Rockit 8 Bit Synth, I don’t have the luxury of loads of extra cycles to throw at calculations, so I need something that can reduce the aliasing without requiring boatloads of clock cycles.  I settled on bandlimited wavetable synthesis.  With it, I have reduced the aliasing to a point that I can tolerate and probably further optimize.  Let’s discuss how it works.  Also, click through for source code for generating a wavetable and a sample wavetable from my synthesizer.

Continue reading

MCP23S08: 8 Bit I/O Expander: Part Two:
Extra Switch Inputs

In Part One about the MCP23S08, I discussed how to set up one of these i/o expanders as a bank of outputs to drive LEDs.  They can also be used as digital inputs.  They don’t do any good as analog inputs for things like pots.  You can use analog multiplexers for that.  As digital input expanders though, they make an excellent way to expand your systems switch capabilities.  I am using them for banks of tactile switches to step through options to control my synthesizer.  Follow the jump to see how I configure them…

Continue reading

Volatile and the GNU C Compiler

Twice now, I’ve been burned.  I’m using the GNU C Compiler with the AVR ATMEGA164PA for my current project, the 8 Bit Synth.  I need to use external interrupts to determine when a switch has been pressed.  When it has, the i/o expander drops its interrupt pin from high to low.  So, I set up the external interrupt routine to be falling edge-triggered.  I had to figure out how to get the i/o expander to trigger its pin when a button was pressed.  I knew that the i/o expander’s output interrupt pin was changing when I pressed a button.  I also knew that the microcontroller’s interrupt service routine was being triggered because I made a pin toggle when the routine ran.  I set a flag high in the service routine.  I configured an if statement in the main routine checking for the flag.  If the flag is set, I need to read the i/o expander’s interrupt latch register to determine which switch was pressed.  The microcontroller never sends the read command.  Not ever, ever.  I couldn’t figure out why.  Do you know?  Follow the jump for the answer to this riddle…

Continue reading

8 Bit Synth: Decimator in Blue

Blinding Blazing Blue!

Decimation in Blue

There you have it! I told you the I/O Expanders were working.  The machine has started to watch me back. All these LEDs won’t be on at the same time in the final design, but it’s fun to turn them all on to make a flashlight.  I’ll probably turn the brightness back down to 7 before I’m done.  This brightness is with only 8.5mA coursing through their die.  I’m used to the el-cheapo LEDs that can go from 15 to 100mA with no change in brightness.  Once those charge wells are full, that’s all you get.  Anyways, it doesn’t have to be blue.  Maybe there will be an option for customization with different colors.  Blue just looks sweet!

MCP23S08: 8-Bit I/O Expander: Part One: Extra Ports for LEDs

So you’ve got 100 LEDs, 72 Buttons, and a microcontroller with 18 I/O pins?  You could try multiplexing the LED.  Use 8 pins for the cathodes of LEDs and drive groups of 8 LEDs with transistors to turn them on groups at a time.  That’s the cheapest thing you could do, but the more LEDs the more complicated it gets and the more pins you still need.  You could do 96 LEDs with 20 pins, 8 for cathodes and 12 for multiplexing transistors.  You’d have to sink all that current and switch everything fast enough to maintain persistence of vision (about 30Hz).  There must be a better way.

And there certainly is.  There are shift registers, which are a great way to go especially if you’re doing simple input and output.  They have to be polled regularly, but you can send them information serially which they put out in parallel, using only a few microcontroller pins.  What I’ve landed upon recently are I/O Expanders from Microchip, particularly the MCP23S08.  Follow the jump to learn about them and how to use them.

Continue reading