Boo0ns / arduino

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

CTCSS Encoder #441

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Hi everybody,
i have some friends still searching a nice way to create CTCSS signals 
(http://en.wikipedia.org/wiki/CTCSS)
i already created a array with those frequencies and some choosing code which 
results in a 3020 byte rom
To create those tones i used the tone() function.
My question now is: is tone() capable of using float values?

I thought about how to solve it when tone() only can use integer values.
Multiplying the value by 10 and to use an external counter to divide it by 10 
should give good results (some external components are needed in any way, since 
its just a pwm signal and a sinus is needed).
Maybe someone has a better idea how to do it.

currently hardware-decoder chips aren't available for the masses and there is 
just a guy from switzerland who sells programmed PIC-µCs for about 100$... so 
a new sollution is needed

Original issue reported on code.google.com by Hoffmann...@googlemail.com on 30 Dec 2010 at 4:36

Attachments:

GoogleCodeExporter commented 9 years ago
I missed a ctrl+s before uploading the code so the comments are still there... 
heres the clean version:

Original comment by Hoffmann...@googlemail.com on 31 Dec 2010 at 12:58

Attachments:

GoogleCodeExporter commented 9 years ago
okay, i have looked it up, in Tone.cpp tone() is defined as void tone(uint8_t 
_pin, unsigned int frequency, unsigned long duration)
so every float will just be trimed to int and the 10th are lost. Seems like 
only the multiply-by-10 and external division solves this.
Maybe a hint in the reference which frequency range is okay (and that only full 
int is allowed) should be added.
I´m done here.

Original comment by Hoffmann...@googlemail.com on 31 Dec 2010 at 1:07

GoogleCodeExporter commented 9 years ago
I added the tone parameter types to the reference.

Original comment by dmel...@gmail.com on 3 Jan 2011 at 6:53

GoogleCodeExporter commented 9 years ago
I'm curious how this worked out.  Did truncating the CTCSS frequency cause 
problems? I would like to build this and use two thumbwheel switches to select 
the frequency. My idea for solving the fractional frequency issue is to program 
tone() to ten times the desired freq and use an external divide by ten chip. 
Long ago I used a CMOS 4018 to do exactly this in a Sears 2 meter rig. There is 
a circuit in "CMOS Cookbook" that shows how to wire the 4018 and four resistors 
to get a sine wave approximation.

Original comment by wb8...@gmail.com on 13 Feb 2011 at 4:04

GoogleCodeExporter commented 9 years ago
I have this breadboarded and code working.  There are photos of the PL tone 
output on Flicker at:
http://www.flickr.com/photos/27392624@N00/sets/72157625989821423/

Original comment by wb8...@gmail.com on 23 Feb 2011 at 3:32

Attachments:

GoogleCodeExporter commented 9 years ago
WB8NBS Where can i find more of the schematic or could you release the 
schematic? 

Original comment by Pa4...@gmail.com on 18 Apr 2014 at 12:04