Вы находитесь на странице: 1из 19

8051 MicroController Based

Caller ID

- Faraz Siddiqui
- Nishad Nerurkar
- Bhrugesh Parsawala

Introduction
Caller ID, known also as caller identification (CID), or more properly calling number
identification (CNID), is a telephone service, available on POTS (plain old telephone
service) lines, that transmits a caller's number to the called party's telephone equipment
during the ringing signal, or when the call is being set up but before the call is answered.
Where available, caller ID can also provide a name associated with the calling telephone
number, in some cases for a higher fee. The information made available to the called party
may be made visible on a telephone's own display or on a separate attached device.
Caller ID may be used to track down or limit the impact of prank calls, telemarketers,
and other intrusions. However, it can also impede communication by enabling users to
become evasive. The concept behind caller ID is the value of informed consent; however, it
also poses problems for personal privacy. Another problem is that the possibility of caller ID
spoofing makes it unreliable.

Abstract:
This is an 8051 microcontroller based caller identification circuit which detects the
number of the caller whose call appears on the telephone line connected to this circuitry.
The circuit also detects the number being dialed by the user.

Brief Overview of the Project:


This Project can be used in home, shops, offices etc. It keeps tracking of both
Incoming and Outgoing Calls. The circuit has a built in DTMF identification circuitry. The
incoming and the dialed numbers are displayed on the LCD display.
The Microcontroller is used to control the whole system it completely control the LCD
display and the DTMF decoder. It gets the numbers through the DTMF decoder and
displays it over the LCD (Liquid Crystal Display). With extra circuitry, a memory add-on may
be interfaced with the microcontroller to store the numbers. However, the memory add-on
is not a part of the basic circuitry.

Circuit Diagram:

Components:
Component Name
Microcontroller
DTMF Decoder
Opto-coupler
LCD Screen
Crystals
Transistors
Diodes
Zener Diode
Capacitors
Resistors

Specification
AT89C2051
MT8870
MCT2E
16X2
3.5MHz, 12MHz
BC547
1N4007
15V
As per the Circuit Diagram

Number
1
1
1
1
2
2
4
1

Component Specifications:
1) Microcontroller:
Pin Configuration:

Description
The AT89C2051 is a low-voltage, high-performance CMOS 8-bit microcomputer with
2Kbytes of Flash programmable and erasable read only memory (PEROM). The device is
manufactured using Atmels high-density nonvolatile memory technology and is compatible
with the industry-standard MCS-51 instruction set. By combining a versatile 8-bit CPU with
Flash on a monolithic chip, the Atmel AT89C2051 is a powerful microcomputer which
provides a highly-flexible and cost-effective solution to many embedded control
applications.
The AT89C2051 provides the following standard features: 2K bytes of Flash, 128
bytes of RAM, 15 I/O lines, two 16-bit timer/counters, a five vector two-level interrupt
architecture, a full duplex serial port, a precision analog comparator, on-chip oscillator and
clock circuitry. In addition, the AT89C2051 is designed with static logic for operation down
to zero frequency and supports two software selectable power saving modes. The Idle
Mode stops the CPU while allowing the RAM, timer/counters, serial port and interrupt
system to continue functioning. The power-down mode saves the RAM contents but
freezes the oscillator disabling all other chip functions until the next hardware reset.

2) DTMF decoder MT8870:


Pin diagram:

Features:

Complete DTMF Receiver


Low power consumption
Internal gain setting amplifier
Adjustable guard time
Central office quality
Power-down mode
Inhibit mode
Backward compatible with MT8870C/MT8870C-1

Description:
The MT8870D/MT8870D-1 is a complete DTMF receiver integrating both the band
split filter and digital decoder functions. The filter section uses switched capacitor
techniques for high and low group filters; the decoder uses digital counting techniques to
detect and decode all 16 DTMF tone pairs into a 4-bit code. External component count is
minimized by on chip provision of a differential input amplifier, clock oscillator and latched
three-state bus interface. The DTMF tones are set with the following frequency table.
1209Hz 1336Hz 1477Hz
697Hz
1
2
3
770Hz
4
5
6
852Hz
7
8
9
941Hz
*
0
#
The DTMF is connected to the telephone lines using the IN +, IN and the GS pins. These
are internally connected to an Op-amp frequency decoder circuit. Depending on the timing
and input frequencies, the output is decoded n the binary code of the number is latched to
the output pins Q0-Q4. If the guard time and the tone width are not of proper then the tone

is missed and rejected. In such a case the output on the pins is the previous decoded digit.
Whenever a digit is decoded, the Std pin goes high and sends a pulse.

Applications

Receiver system for British Telecom (BT) or


CEPT Spec (MT8870D-1)
Paging systems
Repeater systems/mobile radio
Credit card systems
Remote control
Personal computers
Telephone answering machine

3) Opto-Coupler
Pin Configuration:

Features

Interfaces with common logic families


Input-output coupling capacitance < 0.5 pF
Industry Standard Dual-in line 6-pin package
5300 VRMS isolation test voltage

Description:
Each optocoupler consists of gallium arsenide infrared LED and a silicon NPN
phototransistor. Just like the external opto couplers used in counting applications, this
device is an inbuilt opto coupler. the LED lights up when the current is passed through the
A and C pins. Due to this there is a voltage generated at the C and E pins of the transistor.

Applications

AC mains detection
Reed relay driving
Switch mode power supply feedback
Telephone ring detection
Logic ground isolation
Logic coupling with high frequency noise rejection

4) 16x2 LCD Display:


Pin Configuration:

Description:
The LCD module is 16 Characters long and 2 lines in breadth. it also has control for
brightness and back light enhancement. It accepts data bytewise.

Working:
The Circuitry can be divided into the following parts:
The Full-wave rectifier
On/Off Hook Detection
DTMF decoder
Microcontroller and LCD control.

The Full-Wave Rectifier:


The Telephone lines are connected to a full-wave rectifier. This is done since it is difficult to
detect the + and of the telephone line.

The output of this circuit is used to drive the On/Off hook detection circuit and is also given
directly to the DTMF detector.

The DTMF Decoder:

The DTMF Decoder IC is given a clock of 3.58Mhz. The input of telephone line is
given via a R-C network to pins 2 and 3. These pins drive the internal Op-amp tone
frequency detection. Every telephone line when in idle state has a voltage of 110V.
Whenever there is an incoming call, the voltage drops down in a range of 0V to 50V. This
drop is detected by the detector. On detection, the decoder will poll for incoming tones. If
the tone time and frequency are valid, the tone is accepted and the corresponding digit is
output as a 4-bit binary on the lines Q0 Q4. The output is latched and the Std line is
pulsed.
The RC network is a guard time qualifier circuit and necessary for proper frequency
detection. It is set to detect the higher and lower tone frequencies used in standard DTMF
dial.

The On/Off Hook Detection Circuit:

This circuit is made of two transistors working as switches. The first transistor is switched
on when the telephone line voltage drops in a region of 0V 50 V. The Zener Diode clamps
the output to 15 V. This output switches the 2 nd transistor on. The 2nd transistor is basically
required to drive the opto-coupler. When it is on, the opto-coupler will be on and the
collector pin of the phototransistor will be high. This pin is used to signal to the
microprocessor whether the phone is on hook or off hook.

The Microcontroller:
The microcontroller is working at crystal frequency of 12Mhz. The Pins 2,6,7,8,9 i.e.
pin 0,2,3,4,5 of port 3 are working as input pins. These pins take input from the DTMF
decoder. The pin 11 i.e. port 3 pin 7 is used to detect the on/off hook state coming from the
opto-coupler. The pins 14 to 19 are used to drive the LCD module. The pins 2,3,4,5 of port
1 are used to deliver Data to the LCD where as the pins 6 and 7 of the port are used to shift
and display on the LCD.

The Working Algorithm of the Microcontroller is as follows:


If pin 11 is low (idle state) and pin 6 is also low, then display Microcontroller Based
Called ID on the LCD
If Pin 11 is low, then Display Please Dial and the dialed number taken from input
port.
If Pin 6 is high, then Display Incoming Call and the incoming call number taken
from the input port.
For displaying the number, the digit is displayed and cursor is shifted and the next digit is
displayed and so on.

Program:
INCLUDE
REG_51.PDF
RB0
EQU
000H
; Select Register Bank 0
RB1
EQU
008H
; Select Register Bank 1 ...poke to PSW to use
;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
;
PORT DECLERATION
;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
STD
EQU P3.2
Q1
EQU P3.0
Q2
EQU P3.3
Q3
EQU P3.4
Q4
EQU P3.5
PHONE
EQU P3.7
; ***LCD CONTROL***
LCD_RS
EQU
P1.7
;LCD REGISTER SELECT LINE
LCD_E
EQU
P1.6
;LCD ENABLE LINE
LCD_DB4
EQU
P1.5
;PORT 1 IS USED FOR DATA
LCD_DB5
EQU
P1.4
;USED FOR DATA
LCD_DB6
EQU
P1.3
;FOR DATA
LCD_DB7
EQU
P1.2
;FOR DATA
; ***CURSOR CONTROL INSTRUCTIONS***
OFFCUR
EQU
0CH
BLINKCUR
EQU
0DH
; ***DISPLAY CONTROL INSTRUCTIONS***
CLRDSP
EQU
01H
ONDSP
EQU
0CH
; ***SYSTEM INSTRUCTIONS***
CONFIG
EQU
28H
; 4-BIT DATA,2 LINES,5X7 MATRIX LCD
ENTRYMODE EQU
6
; INCREMENT CURSOR DON'T SHIFT DISPLAY
DSEG
; This is internal data memory
ORG
20H
; Bit adressable memory
FLAGS: DS
1
A1
BIT
FLAGS.3
A2
BIT
FLAGS.2
A3
BIT
FLAGS.1
A4
BIT
FLAGS.0
STACK:
DS
1
CSEG
; Code begins here
; ---------==========----------==========---------=========--------; Main routine. Program execution starts here.
; ---------==========----------==========---------=========--------ORG
00H
; Reset
MOV PSW,#RB0
; Select register bank 0
MOV SP,#25H
CALL RESETLCD4
CALL INITLCD4
MAINS1:CALL TITLE1
CALL DELAY
CALL DELAY

MAINS:
SETB
SETB
JNB
JB
AJMP
DISP_NUM:

PHONE
STD
PHONE,DISP_NUM
STD,DISP_CALLER
MAINS

CALL PLZDIAL
SETB STD
SETB PHONE
UPP1:
JB
PHONE,MAINS1
JNB STD,UPP1
CALL GET_NUMBER
MOV A,FLAGS
ADD A,#30H
MOV R4,A
CALL WRLCDDATA
JB
STD,$
SETB STD
SETB PHONE
AJMP UPP1
DISP_CALLER:
CALL DISP_CALL
CALL GET_NUMBER
MOV A,FLAGS
ADD A,#30H
MOV R4,A
CALL WRLCDDATA
JB
STD,$
SETB PHONE
SETB STD
UPP2:
JNB PHONE,MAINS12
JNB STD,UPP2
CALL GET_NUMBER
MOV A,FLAGS
ADD A,#30H
MOV R4,A
CALL WRLCDDATA
JB
STD,$
SETB STD
SETB PHONE
AJMP UPP2
MAINS12:
JNB PHONE,$
AJMP MAINS1
;##########################################################
;
DISPLAY ROUTINES
;##########################################################
TITLE1:
MOV DPTR,#MSAG1
CALL LCD_MSG
RET
MSAG1:

DB
1H,80H,'Microcontroller',0C0H,'Based Caller ID',00H
;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
PLZDIAL:
MOV DPTR,#MSAG2
CALL LCD_MSG
RET
MSAG2:
DB
1H,80H,'Please Dial...',0C0H,00H
;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
DISP_CALL:
MOV DPTR,#MSAG3
CALL LCD_MSG
RET
MSAG3:
DB
1H,80H,'Incoming Call...',0C0H,00H
;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
;##########################################################
;
READ FOR DTMF IC
;##########################################################
GET_NUMBER:
SETB Q1
SETB Q2
SETB Q3
SETB Q4
MOV FLAGS,#00H
JNB Q1,PP1
SETB A1
PP1:
JNB Q2,PP2
SETB A2
PP2:
JNB Q3,PP3
SETB A3
PP3:
JNB Q4,PP4
SETB A4
PP4:
MOV A,FLAGS
CJNE A,#0AH,RFD
MOV FLAGS,#00H
RFD:
RET
;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
DELAY:
MOV R1,#0FFH
RE1:
MOV R2,#0FFH
RE:
NOP
DJNZ R2,RE
DJNZ R1,RE1
RET
;**********************************************************
; INITIALIZE THE LCD 4-BIT MODE
;**********************************************************
INITLCD4:
CLR
LCD_RS
; LCD REGISTER SELECT LINE
CLR
LCD_E
; ENABLE LINE
MOV
R4, #CONFIG; FUNCTION SET - DATA BITS,; LINES, FONTS
CALL
WRLCDCOM4

MOV
R4, #ONDSP ; DISPLAY ON
CALL
WRLCDCOM4
MOV
R4, #ENTRYMODE ; SET ENTRY MODE
CALL
WRLCDCOM4 ; INCREMENT CURSOR RIGHT, NO SHIFT
MOV
R4, #CLRDSP; CLEAR DISPLAY, HOME CURSOR
CALL
WRLCDCOM4
RET
; **********************************************************
; SOFTWARE VERSION OF THE POWER ON RESET
; **********************************************************
RESETLCD4:
CLR
LCD_RS
; LCD REGISTER SELECT LINE
CLR
LCD_E
; ENABLE LINE
CLR
LCD_DB7
; SET BIT PATTERN FOR...
CLR
LCD_DB6
; ... POWER-ON-RESET
SETB
LCD_DB5
SETB
LCD_DB4
SETB
LCD_E
; START ENABLE PULSE
CLR
LCD_E
; END ENABLE PULSE
MOV
A, #4
; DELAY 4 MILLISECONDS
CALL
MDELAY
SETB
LCD_E
; START ENABLE PULSE
CLR
LCD_E
; END ENABLE PULSE
MOV
A, #1
; DELAY 1 MILLISECOND
CALL
MDELAY
SETB
LCD_E
; START ENABLE PULSE
CLR
LCD_E
; END ENABLE PULSE
MOV
A, #1
; DELAY 1 MILLISECOND
CALL
MDELAY
CLR
LCD_DB4
; SPECIFY 4-BIT OPERATION
SETB
LCD_E
; START ENABLE PULSE
CLR
LCD_E
; END ENABLE PULSE
MOV
A, #1
; DELAY 1 MILLISECOND
CALL
MDELAY
MOV
R4, #CONFIG; FUNCTION SET
CALL
WRLCDCOM4
MOV
R4, #08H
; DISPLAY OFF
CALL
WRLCDCOM4
MOV
R4, #1
; CLEAR DISPLAY, HOME CURSOR
CALL
WRLCDCOM4
MOV
R4,#ENTRYMODE ; SET ENTRY MODE
ACALL
WRLCDCOM4
JMP
INITLCD4
; **********************************************************
; SUB WRITES A COMMAND WORD TO THE LCD
; COMMAND MUST BE PLACED IN R4 BY CALLING PROGRAM
; **********************************************************
WRLCDCOM4:
CLR
LCD_E
CLR
LCD_RS
; SELECT SEND COMMAND
PUSH
ACC
; SAVE ACCUMULATOR
MOV
A, R4
; PUT DATA BYTE IN ACC
MOV
C, ACC.4
; LOAD HIGH NIBBLE ON DATA BUS

MOV
LCD_DB4, C ; ONE BIT AT A TIME USING...
MOV
C, ACC.5
; BIT MOVE OPERATOINS
MOV
LCD_DB5, C
MOV
C, ACC.6
MOV
LCD_DB6, C
MOV
C, ACC.7
MOV
LCD_DB7, C
SETB
LCD_E
; PULSE THE ENABLE LINE
CLR
LCD_E
MOV
C, ACC.0
; SIMILARLY, LOAD LOW NIBBLE
MOV
LCD_DB4, C
MOV
C, ACC.1
MOV
LCD_DB5, C
MOV
C, ACC.2
MOV
LCD_DB6, C
MOV
C, ACC.3
MOV
LCD_DB7, C
CLR
LCD_E
SETB
LCD_E
; PULSE THE ENABLE LINE
CLR
LCD_E
CALL
MADELAY
POP
ACC
RET
; **********************************************************
; SUB TO WRITE A DATA WORD TO THE LCD
; DATA MUST BE PLACED IN R4 BY CALLING PROGRAM
; **********************************************************
WRLCDDATA:
CLR
LCD_E
SETB
LCD_RS
; SELECT SEND DATA
PUSH
ACC
; SAVE ACCUMULATOR
MOV
A, R4
; PUT DATA BYTE IN ACC
MOV
C, ACC.4
; LOAD HIGH NIBBLE ON DATA BUS
MOV
LCD_DB4, C ; ONE BIT AT A TIME USING...
MOV
C, ACC.5
; BIT MOVE OPERATOINS
MOV
LCD_DB5, C
MOV
C, ACC.6
MOV
LCD_DB6, C
MOV
C, ACC.7
MOV
LCD_DB7, C
SETB
LCD_E
; PULSE THE ENABLE LINE
CLR
LCD_E
MOV
C, ACC.0
; SIMILARLY, LOAD LOW NIBBLE
MOV
LCD_DB4, C
MOV
C, ACC.1
MOV
LCD_DB5, C
MOV
C, ACC.2
MOV
LCD_DB6, C
MOV
C, ACC.3
MOV
LCD_DB7, C
CLR
LCD_E
SETB
LCD_E
; PULSE THE ENABLE LINE
CLR
LCD_E

NOP
NOP
POP
ACC
RET
; **********************************************************
; SUB TAKES THE STRING IMMEDIATELY FOLLOWING THE CALL AND
; DISPLAYS ON THE LCD. STRING MUST BE TERMINATED WITH A
; NULL (0).
; **********************************************************
LCD_MSG:
CLR A
; Clear Index
MOVC A,@A+DPTR
; Get byte pointed by Dptr
INC DPTR
; Point to the next byte
JZ
LCD_Msg9
; Return if found the zero (end of stringz)
CJNE A,#001H,Lcd_Msg1 ; Check if is a Clear Command
MOV R4,A
CALL WRLCDCOM4
;If yes, write it as command to LCD
JMP LCD_MSG
;Go get next byte from stringz
Lcd_Msg1:
CJNE A,#0FFH,FLL
;Check for displaying full character
MOV R4,A
CALL WRLCDDATA
JMP LCD_MSG
FLL: CJNE A,#080h,$+3
; Data or Address?
If => 80h then is
address.
JC
Lcd_Msg_Data
; Carry will be set if A < 80h (Data)
MOV R4,A
CALL WRLCDCOM4
; Carry not set if A=>80, it is address
JMP Lcd_Msg
; Go get next byte from stringz
Lcd_Msg_Data:
;
MOV R4,A
CALL WRLCDDATA
; It was data, write it to Lcd
JMP Lcd_Msg
; Go get next byte from stringz
Lcd_Msg9:
RET
; Return to Caller
; **********************************************************
; 1 MILLISECOND DELAY ROUTINE
; **********************************************************
MDELAY:
PUSH
ACC
MOV
A,#0A6H
MD_OLP:
INC
A
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
JNZ
MD_OLP
NOP

POP
RET

ACC

PUSH
MOV

ACC
A,#036H

MADELAY:
MAD_OLP:
INC
A
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
JNZ
MAD_OLP
NOP
POP
ACC
RET
;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
END

REFERENCES:

Blackle search engine


8051projects.info
Wikipedia
Datasheetcatalog.com
Programming and Customizing the 8051 Microcontroller by Myke Predko

Вам также может понравиться