Programming
Programming
Date: 19-04-2025
Theory : DTMF stands for Dual-Tone Multi-Frequency. The DTMF is a popular signaling method between
telephones and switching centers. This method is also used for signaling between the Telephone network
and computer networks. The DTMF signals are transmitted over a telephone line and uses speech frequency
signals. These signals are the superposition of two sine waves with different frequencies.
When we press the buttons on the keypad, a connection is made that generates two tones at the same time.
A "Row" tone and a "Column" tone. These two tones identify the key you pressed to any equipment you are
controlling. If the keypad is on your phone, the telephone company's "Central Office" equipment knows what
numbers you are dialing by these tones, and will switch your call accordingly. If you are using a DTMF keypad
to remotely control equipment, the tones can identify what unit you want to control, as well as which unique
function you want it to perform. A DTMF signal consists of the sum of two sinusoids - or tones - with frequencies
taken from two mutually exclusive groups.
These frequencies were chosen to prevent any harmonics from being incorrectly detected by the receiver as
some other DTMF frequency. Each pair of tones contains one frequency of the low group (697 Hz, 770 Hz, 852
Hz, 941 Hz) and one frequency of the high group (1209 Hz, 1336 Hz, 1477Hz) and represents a unique symbol.
The frequencies allocated to the push-buttons of the telephone pad are shown below:
clc;
clear all;
close all;
number=input('enter a phone number with no spaces:','s')
number =
'9876543210'
1
fs=8192;
T=0.5;
x=2*pi*[697 770 852 941];
y=2*pi*[1209 1336 1477 1602];
t=[0:1/fs:T]';
tx=[sin(x(1)*t),sin(x(2)*t),sin(x(3)*t),sin(x(4)*t)]/2;
ty=[sin(y(1)*t),sin(y(2)*t),sin(y(3)*t),sin(y(4)*t)]/2;
for k=1:length(number)
switch number(k)
case'1'
tone=tx(:,1)+ty(:,1);
sound(tone);
case'2'
tone=tx(:,1)+ty(:,2);
sound(tone);
case'3'
tone=tx(:,1)+ty(:,3);
sound(tone);
case'A'
tone=tx(:,1)+ty(:,4);
sound(tone);
case'4'
tone=tx(:,2)+ty(:,1);
sound(tone);
case'5'
tone=tx(:,2)+ty(:,2);
sound(tone);
case'6'
tone=tx(:,2)+ty(:,3);
sound(tone);
case'B'
tone=tx(:,2)+ty(:,4);
sound(tone);
case'7'
tone=tx(:,3)+ty(:,1);
sound(tone);
case'8'
tone=tx(:,3)+ty(:,2);
sound(tone);
case'9'
tone=tx(:,3)+ty(:,3);
sound(tone);
case'C'
tone=tx(:,3)+ty(:,4);
sound(tone);
case'#'
tone=tx(:,4)+ty(:,1);
sound(tone);
case'0'
tone=tx(:,4)+ty(:,2);
2
sound(tone);
case'*'
tone=tx(:,4)+ty(:,3);
sound(tone);
case'D'
tone=tx(:,4)+ty(:,4);
sound(tone);
otherwise
disp('invalid number');
end;
pause(0.75);
end;