DTMF detetctor
1209 1336 1477 1633
| | | |
697 -- 1 ----- 2 ----- 3 ---- A ----
| | | |
770 -- 4 ----- 5 ----- 6 ---- B ----
| | | |
852 -- 7 ----- 8 ----- 9 ---- C ----
| | | |
941 -- * ----- 0 ----- # ---- D ----
| | | |
Overview
1) sample:
measure input using AtoD
2) filter:
Use A=A*M + input
or walsh
3) quantify: - every n ms
scan levels.
leak values
4) Logic: - are any tone detectors above a threshold?
Which Pair are the largest
Has pair changes since last poll?
Output Char?
5) serial out
Send the digit to the serial port
Overview Tone generator
The tone generator uses the catch up call generator.
arrays of quadrature square waves using A= A + M
Every gen_ts seconds add M to A and if gen > max/2 subtract max.
fr[16],fi[16]
Overview Tone detector
The tone detector uses the sign of the tone generator to add or substract signal.
arrays of quadrature square waves using A= A + M
Every 1ms add inout to A and take modulo
function generator_ts( input ){
// this is called once per measurement of the A/D
input = input * 1.0
for ( cnt=0; cnt < 8; cnt++ ){
// add to the buckets in the proportions required
// integrate the phase
generate_r[cnt] += tonesA[cnt]*1.0
generate_i[cnt] += tonesA[cnt]*1.0
// leak phase if overflow
if ( generate_r[cnt] > gen_ts/2 ) {
generate_r[cnt] -= gen_ts*1.0
}
if ( generate_i[cnt] > gen_ts/2 ) {
generate_i[cnt] -= gen_ts*1.0
}
// DFT - if the phase of the square wave >
if ( generate_r[cnt] > 0.0 ) {
measure_r[cnt] += input * 1.0
} else {
measure_r[cnt] += input * -1.0
}
if ( generate_i[cnt] > 0.0 ) {
measure_i[cnt] += input * 1.0
} else {
measure_i[cnt] += input * -1.0
}
}
}