Rachna College of Engineering and Technology Gujranwala Project Report Intercom (using AT89C2051) Submitted to: Engr. UsmanAslam Submitted By: Abubakar Butt 2011-EE-527 Faraz Ahmed Khan 2011-EE-566 Table of contents 1. Acknowledgement………………………………………………………………….. 3 2. Abstract ……………………………………………………………………………… 4 3. COMPONENTS…………………………………………….................................. 4 2.1 ULN 2003....................................................................................... 4 2.2 AT89C2051 MicrocontrollerDiscription…….………………………….. 6 2.2.1 AT89C2051 Features…………………………………………….. 6 2.2.2Pin Descript……………………………………………………… 7 2.3 MT2E Description ….. ……………………………………..…………... 8 2.3.1 Pin Description……………….…………………………………… 8 2.3.2 Internal Structure of MT2E …………………………………….... 8 2.4 DTM 8870decode………………………………………………….……9 4. Circuit diagram ……………………………………………………………………..11 5. WORKING………………………………………………………………………… 12 6. PROBLEM FACED……………………………………………………………….. 13 7. MARKET VALUE………………………………………………………………… 13 8. PROGRAM TO MAKE AINTERCOM…………………………........................ 13 9. Programme 10. Hex File ……………………………………………………………………………. 13 ACKNOWLEDGEMENT To complete our this telephone based INTERCOM project we got help from a famous site electrical4study.com. From this site we get the main idea of our project and also helpful material related to our project. We also got help from our project incharge Engr. Muhammad UsmanAslam. Who helped us to resolve our all problems regarding this project. ABSTRACT Our project is Intercom. This project is used as an electronic private exchange. It has two telephones, which have the intercom facility, and they can be connected to the telephone line. All the functions are controlled by the 8-bit microcontroller AT89C2051 which has an Program Memory (ROM) of 2 kilobytes. The DTMF (Dual tone multiple frequency) signals are decoded by the DTMF decoder IC 8870 and its output will be in decimal of the pressed key. The switching functiond are done by 12v relays. Components Microcontroller AT89C2051 IC ULN 2003 IC MCT 2E IC MT 8870 Capacitors Resistors Relays Oscillator LED ULN 2003 DESCRIPTION The ULN2003 is a monolithic high voltage and high currentDarlington transistor arrays. It consists of seven NPN darlingtonpairs that features high-voltage outputs with commoncathodeclamp diode for switching inductive loads. The collector-currentrating of a single darlington pair is 500mA. The darlington pairsmay be parrlleled for higher current capability. Applications includerelay drivers,hammer drivers, lampdrivers,display drivers(LED gasdischarge),line drivers, and logic buffers.The ULN2003 has a 2.7kW series base resistor for eachdarlington pair for operation directly with TTL or 5V CMOSdevices. FEATURES 500mA rated collector current (Single ( output) High-voltage voltage outputs: 50V Inputs compatibale with various types of logic. Relay driver application_ AT89C2051 Description The AT89C2051 is a low-voltage, high-performance CMOS 8-bit microcomputer with 2K bytes of Flash programmable and erasable read-only memory (PEROM). The device is manufactured using Atmel’s high-density nonvolatile memory technology and is compatible with the industrystandard MCS-51 instruction set. By combining a versatile 8-bit CPU with Flash on a monolithic chip, the Atmel AT89C2051 is a power-ful 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 opera-tion 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. Features • 2K Bytes of Reprogrammable Flash Memory – Endurance: 10,000 Write/Erase Cycles 2.7V to 6V Operating Range Fully Static Operation: 0 Hz to 24 MHz Two-level Program Memory Lock 128 x 8-bit Internal RAM 15 Programmable I/O Lines Two 16-bit Timer/Counters Six Interrupt Sources Programmable Serial UART Channel Direct LED Drive Outputs On-chip Analog Comparator Low-power Idle and Power-down Modes Green (Pb/Halide-free) Packaging Option PIN CONFIGURATION BLOCK DIAGRAM MCT 2E Gallium Arsenide Diode Infrared SourceOptically SourceOptically Coupled to a Silicon NPN Phototransistor High Direct-Current Current Transfer Ratio Base Lead Provided for Conventional Transistor Biasing High-Voltage Voltage Electrical Isolation . . .1.5-kV, .1.5 or 3.55-kV Rating Plastic Dual-In-Line Line Package High-Speed Speed Switching:tr = 5 s, tf = 5 s Typical Designed to be Interchangeable with General Instruments MCT2 and MCT2E DESCRIPTION It contains optically coupled isolated consisting of gallium arsenide infrared emitting diode and an NPN silicon phototransistor mounted in a 6 in dual line package. package PIN DESCRIPTION INTERNAL STRUCTURE OF MCT 2E DTMF DECODER (MT 8870) Description It is used for decoding the mobile signal. It gets DTMF tone from the telephone headset’s speaker pins (here we used pin 1) at its Pin 2 & 3 and decodes the DTMF tone into 4-bit digital signal which is fed to the 4:16 DECODER via Pins 11,12,13,14 & 15(StD).The DTMF Decoder is operated with a 3.579MHz crystal (XTAL2) applied between Pin 7 and 8.In the DTMF receiver MT8870 (IC), capacitor is used to filter the noise and the resistors R and R help to amplify the input signal using the internal amplifier.Pin 16 connected to resistor R provides the early steering output. It goes high immediately when the digital diagram detects a valid tone pair. Any momentary loss of signal condition causes ESt to return to low state.Pin 17 connected to capacitor U2 is bidirectional, acting as steering input/ guard time output (St/Gt). A voltage greater than threshold of the steering logic VTSt detected at St causes the device to register the detected tone pair. The guard time output resets the external steering time constant, and its state is a function of ESt and the voltage at St.Pin 10 is kept high by Vcc. Pins 5,6,9 are grounded. Pin 1 & 4 is shorted. Features Complete DTMF Receiver Low power consumption Internal gain setting amplifier Adjustable guard time Central office quality Power-down mode Inhibit mode Backward compatible withMT8870C/MT8870C-1 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 BLOCK DIAGRAM PIN DESCRIPTION CIRCUIT DIAGRAM WORKING Intercom simply work on the switching of relays controlled by microcontroller. Two phones are connected on the same telephone line. Both of them are connected to MCT2E photocoupler when a receiver is pick up and any button is pushed from any of the telephone it will deactivate the photocoupler and the photocoupler will send zero logic on the output and send it to microcontroller. Decoder MT8870 receives input from relays which is decoded and the output of 8870 is fed to the microcontroller and the output of microcontroller is connected to the input of ULN2003 which in result turn off and on the respective relays and as a result a ring bell is received on the other telephone. PROBLEM FACED In this project of telephone based intercom we faced many problems. At first chance we faced the problem of the unavailability of the components on the software like proteus and multisim then after that we faced the problem of unavailability of the components in the market. After mounted on the breadboard we faced problem regarding relays and orthocoupler. MARKET VALUE The total cost of this project when we are making it first time is Rs. 2000 but when we are preparing it on a larger scale the cost of this project is Rs. 1000. PROGRAM TO MAKE A INTERCOM INCLUDE REG_51 STD Q3 Q2 Q1 Q0 EQU P3.0 EQU EQU EQU EQU HOOK2 EQU HOOK1 EQU P3.7 P1.0 RING TEL TEL1 TEL2 P1.4 P1.7 P1.5 P1.6 EQU EQU EQU EQU P3.1 P3.2 P3.3 P3.4 DSEG ; This is internal data memory ORG 20H ; Bit adressable memory DTMF DATA 20H D0 BIT DTMF.0 D1 BIT DTMF.1 D2 BIT DTMF.2 D3 BIT DTMF.3 STACK: DS 1 ; Stack begins here CSEG ; Code begins here ;---------==========----------==========---------=========--------; PROCESSOR INTERRUPT AND RESET VECTORS ;---------==========----------==========---------=========--------ORG 00H ; Reset ; ---------==========----------==========---------=========--------; Main routine ; ---------==========----------==========---------=========--------MOV SP,STACK MOV P1,#00H UUP: CLR TEL CLR TEL1 CLR TEL2 SETB HOOK1 SETB HOOK2 JNB HOOK1,TTEL1 JNB HOOK2,TTEL4 AJMP UUP TTEL4: AJMP TTEL2 SXS11: AJMP SXS1 TTEL1: SETB TEL2 DCD1: DCD3: ;CUT TEL 2 SETB STD SETB HOOK1 JB HOOK1,UUP JNB STD,DCD1 CALL READ MOV A,DTMF CJNE A,#01H,SXS11 SETB STD JB STD,$ JB HOOK1,UUP JNB STD,DCD3 CALL READ MOV A,DTMF CJNE A,#01H,SXS11 SETB TEL SIGNAL CLR TEL2 SETB TEL1 NOP SETB RING CALL DELAY CALL DELAY CALL DELAY CALL DELAY CALL DELAY CLR RING CALL DELAY CALL DELAY CALL DELAY CALL DELAY CALL DELAY SETB RING CALL DELAY CALL DELAY CALL DELAY CALL DELAY CALL DELAY CLR RING CALL DELAY CLR TEL CLR TEL1 CLR TEL2 ;GIVE RING CALL DELAY SETB HOOK1 JNB HOOK1,$ uup1: AJMP UUP TTEL2: SETB TEL1 DCD2: DCD4: ;CUT TEL 2 SETB STD SETB HOOK2 JB HOOK2,UUP1 JNB STD,DCD2 CALL READ MOV A,DTMF CJNE A,#01H,SXS2 SETB STD JB STD,$ JB HOOK2,UUP1 JNB STD,DCD4 CALL READ MOV A,DTMF CJNE A,#02H,SXS2 SETB TEL SIGNAL CLR TEL1 SETB TEL2 SETB RING CALL DELAY CALL DELAY CALL DELAY CALL DELAY CALL DELAY CLR RING CALL DELAY CALL DELAY CALL DELAY CALL DELAY CALL DELAY SETB RING CALL DELAY CALL DELAY CALL DELAY CALL DELAY CALL DELAY CLR RING CALL DELAY CLR TEL CLR TEL1 CLR TEL2 ;GIVE RING CALL DELAY SETB HOOK2 JNB HOOK2,$ AJMP UUP SXS1: SETB HOOK1 JNB HOOK1,$ CLR TEL2 AJMP UUP ;WAIT IF OTHER NUMBER DIALLED SXS2: SETB HOOK2 JNB HOOK2,$ CLR TEL1 AJMP UUP ;WAIT IF OTHER NUMBER DIALLED DELAY: MOV R5,#01H REP3: MOV R0,#0FFH REP2: MOV R1,#0FFH REP1: NOP DJNZ R1,REP1 DJNZ R0,REP2 DJNZ R5,REP3 RET ;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%% ; READ DTMF TONES ;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%% READ: MOV DTMF,#00H SETB Q0 SETB Q1 SETB Q2 SETB Q3 JNB Q0,VB1 SETB D0 VB1: JNB Q1,VB2 SETB D1 VB2: JNB Q2,VB3 SETB D2 VB3: JNB Q3,VB4 SETB D3 VB4: RET ;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%% END HEX FILE :03000000020800F3 :0C080000787FE4F6D8FD7581200200002E :10000000852081759000C297C295C296D290D2B7D2 :1000100030900930B7020106017F01E1D296D2B0DB :10002000D2902090E130B0FA3101E520B401EBD25A :10003000B020B0FD2090CF30B0FA3101E520B401FE :10004000D9D297C296D29500D29411F311F311F33D :1000500011F311F3C29411F311F311F311F311F32E :10006000D29411F311F311F311F311F3C29411F3BC :10007000C297C295C29611F3D2903090FD0106D27C :1000800095D2B0D2B720B7F530B0FA3101E520B43F :100090000158D2B020B0FD20B7E330B0FA3101E50D :1000A00020B40246D297C295D296D29411F311F39E :1000B00011F311F311F3C29411F311F311F311F3CE :1000C00011F3D29411F311F311F311F311F3C2945C :1000D00011F3C297C295C29611F3D2B730B7FD01A2 :1000E00006D2903090FDC2960106D2B730B7FDC25D :1000F0009501067D0178FF79FF00D9FDD8F9DDF57E :1001000022752000D2B4D2B3D2B2D2B130B402D26E :100110000030B302D20130B202D20230B102D203B7 :0101200022BC :00000001FF