Pages: 1 [2]   Go Down
Author Topic: Modifying Auduino Code: Wrestling with RAM  (Read 1326 times)
0 Members and 1 Guest are viewing this topic.
United Kingdom
Offline Offline
Tesla Member
***
Karma: 227
Posts: 6637
Hofstadter's Law: It always takes longer than you expect, even when you take into account Hofstadter's Law.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
« Last Edit: November 18, 2012, 11:37:55 am by dc42 » Logged

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.

Dubai, UAE
Offline Offline
Edison Member
*
Karma: 22
Posts: 1675
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi,
   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
Logged


Offline Offline
Newbie
*
Karma: 0
Posts: 15
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Dubai, UAE
Offline Offline
Edison Member
*
Karma: 22
Posts: 1675
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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 -

http://rcarduino.blogspot.com/2012/11/auduino-with-delay.html

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
Logged


Offline Offline
Newbie
*
Karma: 0
Posts: 15
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Pages: 1 [2]   Go Up
Jump to: