Go Down

Topic: Modifying Auduino Code: Wrestling with RAM (Read 1 time) previous topic - next topic


Nov 18, 2012, 05:36 pm Last Edit: Nov 18, 2012, 05:37 pm by dc42 Reason: 1
There are three counter/timers in the atmega328 (more on the chip used in the Mega) and from your description, it appears that the Auduino code uses one or more of them. Each counter/timer controls two of the PWM pins. When you are using a counter/timer for something else, you can't use its associated PWM pins.

I suggest you temporarily modify setBacklight() to write to just one PWM pin, and thereby establish which PWM pin(s) cause the problem. Then try switching those to the spare PWM pins, assuming you have some.

Alternatively, look at the Auduino code to see which counter/timer(s) it is using, then you can work out which PWM pins are available.
Formal verification of safety-critical software, software development, and electronic design and prototyping. See http://www.eschertech.com. Please do not ask for unpaid help via PM, use the forum.


   The Auduino uses Timer1 for scheduling the ISR and Timer2 for generating the PWM, Timer0 is untouched and free for you to use, you should also be able to use timer2 output A.

So, 5,6,11 look like a good starting point.

Duane B


for anyone who cares, I've pretty much finished my code for this project.  I may go back and tweak the range of the scales, and add a button that has to be pressed to allow audio out (right now it's a drone instrument).

(Nearly) finished product: http://pastebin.com/1KMmLjC0

The LCD PWM is a problem that I'm going to solve with a separate AVR chip... it's a pretty cheap fix, and it's something I want to try anyway.  That coupled with the headaches I foresee figuring out timers, and the fact that I'm already getting strange audio effects as my code grows (which sound cool at this point, but much more could ruin the instrument), I don't want this to get much larger.

Right now the LCD displays which scale is selected, and the note that's currently playing.  This helps because without the LCD readout it's really hard to know where the hell you are and what you're playing.  I want to be able to actually use this thing.


Looks like you have done a lot of work there, if your not using additional external effects for performances you should take a look at the delay code here -


But something that might be more interesting is that I have now added trigger to the oscillators in the five dollar synth, what this means is that I can use the keyboard to trigger the other oscillators leading to something very similar sounding to the Auduino with keyboard pitch control -


The keyboard code needs a complete rewrite but the four oscilator synth engine is now pretty capable.

Duane B


That's really rad Duane.  I may take a stab at something similar in the future.

As for the echo, I'm using a Wooster Audio Space Baby.  It's an echo that I absolutely love, and I started this project looking for a way to get better use of it. 

I think the next step for your $5 keyboard is to get the whole thing into its own custom enclosure to make it look complete.  The sounds it makes are really awesome.

Go Up