ilikecats567 / arduino

Automatically exported from code.google.com/p/arduino
Other
0 stars 0 forks source link

tone command does not work correctly on ATmega8 #292

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. load and run a tone example script, f.e. toneMelody.pde

What is the expected output? What do you see instead?

You can hear the melody correctly on a Arduino Duemilanove with ATmega328.
On a board with ATmega8 you can only hear one tone (NOTE_B3 I think??). 

What version of the Arduino software are you using? On what operating
system?  Which Arduino board are you using?

Arduino018 on Windows 7. myAVR USB MKII board with ATmega8 3.6864MHz Quarz.

Please provide any additional information below.
Only the following frequencies give a correct signal: 61Hz, 244Hz, 976Hz, 
3.9KHz. Any other frequency gives no signal (PWM output signal measured with 
oscilloscope) 

Original issue reported on code.google.com by p.reckte...@gmail.com on 15 Jul 2010 at 7:34

GoogleCodeExporter commented 9 years ago
Looking into this now.

Original comment by rogue.bh...@gmail.com on 16 Jul 2010 at 3:37

GoogleCodeExporter commented 9 years ago
Since I don't have an ATmega8 handy, I need some help with testing.  See 
http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1279295681/

Original comment by rogue.bh...@gmail.com on 16 Jul 2010 at 3:57

GoogleCodeExporter commented 9 years ago
Pete62 @ the Arduino.cc forums found the bugs.  The later 8 bit AVR's use two 
registers (TCCRxA, TCCRxB) whereas the ATmega8 only uses a single register 
(TCCR2) to house the control bits for Timer 2.  Bits were inadvertently being 
cleared.

Attached is the fixed version of Tone.cpp.

Those with ATmega8's, please verify the changes.

Original comment by rogue.bh...@gmail.com on 17 Jul 2010 at 7:15

Attachments:

GoogleCodeExporter commented 9 years ago
Thank you for teaching me into the right direction to find the bugs in the Tone 
lib. Pete62 is my Arduino.cc username. 

Thread can be closed.

Original comment by p.reckte...@gmail.com on 18 Jul 2010 at 9:59

GoogleCodeExporter commented 9 years ago
Hi,

Will this corrective be included in the arduino's release versions one day ?
I'm using the 1.0.5 and the version 0007 with is supposed to be this correction 
was replaced by this one: 0007    M Sproul    10/08/29 Changed #ifdefs from cpu 
to register

The actual release version of the Tone.cpp does not work with an atmega8.
Thanks.

Original comment by jeison.s...@gmail.com on 10 Nov 2014 at 2:52