Clock Report1

Embed Size (px)

Citation preview

  • 8/6/2019 Clock Report1

    1/23

    A

    Minor Project Report

    DIGITAL GENIUS

    Submitted to the School of Electronics and Communication Engineering

    In partial fulfillment of the requirements for the award of

    Degree in Electronics and Communication Engineering

    Submitted By

    Ajay Kumar(2008EEC13)

    Bibhor Kumar Singh(2008EEC15)

    Md. Liyakat(2008EEC18)

    Under the Guidance of

    Asst. Prof. Sumeet Gupta

    School of Electronics and Communication Engineering

    Shri Mata Vaishno Devi University, Katra

    Jammu & Kashmir- 182 320

    (2008-2012)

  • 8/6/2019 Clock Report1

    2/23

    ~ 1 ~

    Candidates Declaration

    _________________________________________

    This is to declare that the Project work titled Design and implementation of

    DIGITAL GENIUSby Ajay kumar (2008EEC13) , Bibhor Kumar Singh

    (2008EEC15) and Md.Liyakat(2008EEC18) of Electronics and communication

    engineering, SMVDU, is a bonafied work carried out by us from August 2010 to

    December 2010.

  • 8/6/2019 Clock Report1

    3/23

    ~ 2 ~

    ACKNOWLEDGEMENTS

    The satisfaction that accompanies the successful completion of any tasks would be

    incomplete without the mention of the people who made it possible and whose

    encouragement and guidance has been a source of inspiration throughout the

    course of the project.

    We take this opportunity to express our gratitude to all those who helped us to

    carry out this project successfully. We owe our sincere gratitude to Associate

    professorSumeet Gupta for giving their encouragement , guidance and constant

    support at each point of time during the whole course of project ,that helped us to

    complete it successfully.

    We are deeply indebted to contribution offered by Mr. Bhawani Singh , Mr.

    Naresh Kumar and Mr. Atul till the end of project .

    We are also grateful to Mr.Vikas Singh, system engineer, SavitarResearch

    Group ,Hydrabad, Mr. Suryansh Nigam, Research Associate atIIT,

    Hydrabad and Mr. Om Prakash final year student of B.TECH(ECE), SMVDU,

    Jammu for their valuable guidance and encouragement during the course of

    project.

    We are also thankful to Prof. Vipan Kakkar, Head of Department, ECE, Shri

    Mata Vaishno Devi University, for his valuable guidance during the project work.

    We aslo express our sincere thanks to ourParents and friends who supported and

    encouraged us directly or indirectly in many ways for successful completion of theproject.

    Lastly a special thanks to Anurag Koul and Sorab Gupta for taking care of

    marketing issues of the project.

  • 8/6/2019 Clock Report1

    4/23

    ~ 3 ~

    Certificate

    This is to certify that the Minor-Project entitled DIGITAL GENIUS being

    submitted by Ajay Kumar(2008EEC13), Bibhor Kumar Singh(2008EEC15) and

    Md.Liyakat(2008EEC18) to the School of Electronics and Communication

    Engineering, for the award of Bachelor of Technology Degree in Electronics and

    Communication, is a bona-fide work carried out by him under the supervision and

    guidance of the undersigned. His project work has reached the standard of

    fulfilling of requirements of the regulations related to degree.

    Project Supervisor

    Asst. Prof. Sumeet Gupta

    ( Dr. Vipan Kakkar )

    Director ( SECE )

  • 8/6/2019 Clock Report1

    5/23

    ~ 4 ~

    Table of Contents

    Declaration....2

    Acknowledgement3

    Certificate.4

    Table content.....5

    Objective6

    Features..6

    Block diagram...7

    Description. ..8

    Working.9

    Code.10

    Future Extensions.22

    Software Listing ..23Problem Solving & Debugging23

    Results & Discussions ...24

    References and Data-sheets ...24

  • 8/6/2019 Clock Report1

    6/23

    ~ 5 ~

    Objective:

    The project involves:

    Putting together the electronic circuit for implementation of Digital Clockand Appliance Controller using 8-bit (AT89C52) microcontroller.

    Feature: Clock display alongwith :

    Alarm facility. Time reset ability Appliance controller. Battery backup for microcontroller operation.

  • 8/6/2019 Clock Report1

    7/23

    ~ 6 ~

    Block diagram

  • 8/6/2019 Clock Report1

    8/23

    ~ 7 ~

    Description:

    This Digital Genius has been developed as a combination of 8051

    microcontroller and various ICs, seven segment display, mechanical switches,

    transistor, 7-seg. Driver, resistances that are interdependent and play their uniqueroles in fulfillment of projects aim and vision. The supply requirement is met by

    stepping down main supply and rectifying it to obtain DC voltages to drive various

    ICs. This project involves a complete satisfactory performance of a digital clock

    alongwith its certain features enabling a user with basic requirements.

    This circuit includes:-

    8-bit microcontroller (AT89C52)y ADC 0804.y BCD to 7-segment decoder(7447).y 7-segment display(common anode).y IC 7805.y Transistors(BC547)y Resistors(100E,10k) of 1/2w.

    10k and 100E resistors are used for biasing purpose of transistorsBC547

    y Capacitors(33pF ,33pF ,150pF) 33pF for connecting the crystal oscillator. 150pF to supply clock pulses to ADC 0804.

    y Crystal oscillator(11.0592MHz)y Switches.y Step down transformer(18-0-18)v.y Relay

    For appliance control with the help of transistor BC547y LM35 temperature sensor for input to ADC 0804.

  • 8/6/2019 Clock Report1

    9/23

    ~ 8 ~

    WORKING:

    A step down transformer to step down 220V to 18v The input supply (18V) is rectified by diode circuit. The ripples are eliminated by filter and regulator ICs. A 5V Vcc is supplied to the microcontroller at pin no. 40 for its proper

    functioning, along with a capacitor(150pF) to remove the ripples.

    Pin no. 31 is set to 1 by connecting it to Vcc.(No external fetch). Port 0 is used for supplying inputs to BCD to 7-segment decoder.

    Half of the port_

    0 (P0.0-P0.3) is connected to one of the two IC SN74LS47to send data to one set of 7-segment displays for displaying unit place of

    each Hour, Minute and Second respectively.

    Another half of port_0 (P0.4-P0.7)is connected to other IC SN74LS47 tosend data to another set of 7-segment displays for displaying tens place of

    each Hour, Minute and Second respectively.

    The common anode of each 7-SEGMENT display is connected to emitter oftheir respective transistors to enable the 7-segment displays.

    Base of each transistor those are used to enable the 7-segment display isdriven by connecting the bases of transistors to the port line

    no.(P2.7,P2.6,P2.5).

    Pin no. 9 of AT89C52 is used for RESET purpose with the help of amechanical switch.

    Each 7-segment display is enabled by sending 1 to respective transistor. Port line no. P2.1 and P2.2 are used to set Hour and Minute respectively. Port line no. P2.4(S1) and P3.4(S0) are used to set mode of operation of the

    system.

    S1=1,S0=1(clock mode)

  • 8/6/2019 Clock Report1

    10/23

    ~ 9 ~

    S1=0,S0=1(Timer mode) S1=1,S0=0(Appliance control mode) S1=0,S0=0(Temp. indicator mode)

    y Alarm is connected to port line no.P3.5.y Port 2 is connected to ADC lines for transfer of data(D7-D0) and connecting

    the RD(active low),WR(active low), INTR(active low) signals.

    y A 5V Vcc is also used for biasing of all transistors BC547, 100E as Rc and10k as Rb.

    CODE

    y HHC EQU 40Hy MMC EQU 41Hy SSC EQU 42Hy TMPU EQU 43Hy TMPL EQU 44Hy TMPS EQU 45Hy APCLM EQU 46Hy APCLH EQU 47Hy APCUM EQU 48Hy APCUH EQU 49Hy HHA EQU 4AHy MMA EQU 4BHy ORG 0000Hy LJMP MAINy ORG 001BHy LJMP CLK_INTy ORG 0300Hy MAIN: MOV SP,#80H

  • 8/6/2019 Clock Report1

    11/23

    ~ 10 ~

    y MOV IE,#88Hy SETB IP.3y MOV TMOD,#11Hy MOV P0,#00Hy MOV P1,#0FFHy CLR P2.0y SETB P2.1y SETB P2.2y SETB P2.3y SETB P2.4y CLR P2.5y CLR P2.6y CLR P2.7y SETB P3.1y SETB P3.2y SETB P3.3y SETB P3.4y CLR P3.5y CLR P3.6y

    CLR P3.7

    y MOV HHC,#00Hy MOV MMC,#00Hy MOV SSC,#00Hy MOV TMPU,#00Hy MOV TMPL,#00Hy MOV TMPS,#00Hy MOV APCLM,#00Hy MOV APCLH,#00Hy MOV APCUM,#00Hy MOV APCUH,#00Hy MOV HHA,#00Hy MOV MMA,#00H

  • 8/6/2019 Clock Report1

    12/23

    ~ 11 ~

    y MOV TL1,#0FCHy MOV TH1,#1EHy JB P3.4,MCHEK_1y JNB P3.4,MCHEK_2y MCHEK_1: JB P2.4,CLOCKy JNB P2.4,TIMERy MCHEK_2: JB P2.4,APCONy JNB P2.4,TEMPI

    y CLOCK: SETB TR1y MOV B,#3CHy MOV R1,#00Hy LOOP_1: JNB P3.4,MCHEK_2y JNB P2.4,TIMERy JB P3.2,GOTO_1y LCALL ALLARM_STNGy GOTO_1:JB P3.3,GOTO_2y LCALL CLOCK_STNGy GOTO_2:MOV A,SSCy LCALL CNVBCDy MOV P0,Ay CLR P2.6y CLR P2.7y SETB P2.5y

    LCALL DELAY_

    10y MOV A,MMCy LCALL CNVBCDy MOV P0,Ay CLR P2.5y CLR P2.7

  • 8/6/2019 Clock Report1

    13/23

    ~ 12 ~

    y SETB P2.6y LCALL DELAY_10y MOV A,HHCy LCALL CNVBCDy MOV P0,Ay CLR P2.6y CLR P2.5y SETB P2.7y LCALL DELAY_10y JMP LOOP_1

    y MCHEK_01: LJMP MCHEK_1y CNVBCD: MOV B,#0AHy DIV ABy ANL A,#0FHy ANL B,#0FHy RR Ay RR Ay RR Ay RR Ay ORL A,By MOV B,#3CHy RETy TIMER: LJMP TIMER1y

    APCON: LJMP APCON1y MCHEK_02: LJMP MCHEK_2y MCHEK_1_1: LJMP MCHEK_1y TEMPI: CLR P2.7y CLR P2.6

  • 8/6/2019 Clock Report1

    14/23

    ~ 13 ~

    y SETB P2.5y LOOP_5: CLR P3.6y JB P3.4,MCHEK_1_1y JB P2.4,APCONy JB P3.3,GOTO_3y LCALL TEMPI_STNGy GOTO_3: CLR P3.6y NOPy SETB P3.6y LOOP_6: JB P3.1,LOOP_6y SETB P3.7y NOPy CLR P3.7y LCALL DELAY_10y MOV TMPS,Ay LCALL CNVBCDy MOV P0,Ay MOV A,TMPLy

    CLR Cy SUBB A,TMPSy JC NEXT_8y CLR P2.0y SJMP NEXT_10y NEXT_8: CLR Cy SUBB A,TMPUy JC NEXT_9y CLR P2.0y SJMP NEXT_10y NEXT_9: SETB P2.0y NEXT_10: LJMP LOOP_5y CLOCK_1: LJMP CLOCKy APCON1: CLR P2.7

  • 8/6/2019 Clock Report1

    15/23

    ~ 14 ~

    y CLR P2.6y SETB P2.5y LOOP_7: MOV P0,#00Hy JB P3.4,MCHEK_01y JNB P2.4,TEMPIy JB P3.3,GOTO_4y LCALL APCON_STNGy GOTO_4: MOV A,HHCy CJNE A,APCLH,NEXT_11y MOV A,MMCy CJNE A,APCLM,NEXT_12y SETB P2.0y MOV P0,#01Hy SETB P2.5y NEXT_12: NOPy NEXT_11: MOV A,HHCy CJNE A,APCUH,NEXT_13y MOV A,MMCy CJNE A,APCUM,NEXT_14y

    CLR P2.0y MOV P0,#00Hy SETB P2.5y NEXT_14: NOPy NEXT_13: SJMP LOOP_7

    y MCHEK_02_1: LJMP MCHEK_02yy TIMER1: NOPy REPEAT: JNB P3.4,MCHEK_02_1y JB P2.4,CLOCK_1y SJMP REPEAT

  • 8/6/2019 Clock Report1

    16/23

    ~ 15 ~

    y CLOCK_STNG: CLR TR1y SETB P2.5y SETB P2.6y SETB P2.7y MOV P0,#00Hyy LOOP_8: JB P2.2,NEXT_20y BACK_A: JNB P2.2,BACK_Ay MOV R2,MMCy CJNE R2,#3CH,NEXT_21y MOV MMC,#00Hy NEXT_21: INC MMCy MOV A,MMCy LCALL CNVBCDy CLR P2.7y CLR P2.5y SETB P2.6y MOV P0,Ay NEXT_20: JB P2.1,NEXT_22y

    BACK_

    B: JNB P2.1,BACK_

    By MOV R2,HHCy CJNE R2,#19H,NEXT_23y MOV HHC,#00Hy NEXT_23: INC HHCy MOV A,HHCy LCALL CNVBCDy CLR P2.6y CLR P2.5y SETB P2.7y MOV P0,Ay NEXT_22: JB P2.3,LOOP_8y BACK_C: JNB P2.3,BACK_Cy SETB TR1

  • 8/6/2019 Clock Report1

    17/23

    ~ 16 ~

    y RET

    y TEMPI_STNG: SETB P2.6y CLR P2.7y SETB P2.5y MOV P0,#00Hy LOOP_9: JB P2.2,NEXT_24y BACK_D: JNB P2.1,BACK_Dy MOV R2,TMPLy CJNE R2,#63H,NEXT_25y MOV TMPL,#00Hy NEXT_25: INC TMPLy MOV A,TMPLy LCALL CNVBCDy MOV P0,Ay CLR P2.5y SETB P2.6y NEXT_24: JB P2.1,NEXT_26y

    BACK_

    E: JNB P2.1,BACK_

    Ey MOV R2,TMPUy CJNE R2,#63H,NEXT_27y MOV TMPU,#00Hy NEXT_27: INC TMPUy MOV A,TMPUy LCALL CNVBCDy MOV P0,Ay CLR P2.6y SETB P2.5y NEXT_2: JB P2.3,LOOP_9y BACK_F: JNB P2.3,BACK_Fy RET

  • 8/6/2019 Clock Report1

    18/23

    ~ 17 ~

    y APCON_STNG: CLR P2.7y CLR P2.6y SETB P2.5y MOV P0,#01Hy LOOP_10: JB P2.2,NEXT_28y BACK_1: JNB P2.2,BACK_1y MOV R2,APCLMy CJNE R2,#3CH,NEXT_29y MOV APCLM,#00Hy NEXT_29: INC APCLMy MOV A,APCLMy LCALL CNVBCDy CLR P2.5y CLR P2.7y SETB P2.6y MOV P0,Ay NEXT_28: JB P2.1,NEXT_30y BACK_2: JNB P2.1,BACK_2y MOV R2,APCLHy

    CJNE R2,#18H,NEXT_

    31y MOV APCLH,#00Hy NEXT_31: INC APCLHy MOV A,APCLHy LCALL CNVBCDy CLR P2.6y SETB P2.7y MOV P0,Ay NEXT_30: JB P2.3,LOOP_10y BACK_3: JNB P2.3,BACK_3y CLR P2.6y CLR P2.7y SETB P2.5y MOV P0,#00H

  • 8/6/2019 Clock Report1

    19/23

    ~ 18 ~

    y LOOP_11: JB P2.2,NEXT_32y BACK_4: JNB P2.2,BACK_4y MOV R2,APCUMy CJNE R2,#3CH,NEXT_33y MOV APCUM,#00Hy NEXT_33: INC APCUMy MOV A,APCUMy LCALL CNVBCDy CLR P2.5y SETB P2.6y MOV P0,Ay NEXT_32: JB P2.1,NEXT_34y BACK_5: JNB P2.1,BACK_5y MOV R2,APCUHy CJNE R2,#18H,NEXT_35y MOV APCUH,#00Hy NEXT_35: INC APCUHy MOV A,APCUHy LCALL CNVBCDy

    CLR P2.6y SETB P2.7y MOV P0,Ay NEXT_34: JB P2.3,LOOP_11y BACK_6: JNB P2.3,BACK_6y RET

    yDELAY

    _

    10: NOPy REP: MOV TL0,#0F0Hy MOV TH0,#0D8Hy SETB TR0y AGAIN: JNB TF0,AGAINy CLR TF0

  • 8/6/2019 Clock Report1

    20/23

    ~ 19 ~

    y RET

    y ALLARM_STNG: MOV A,#00Hy MOV P0,Ay SETB P2.5y SETB P2.6y SETB P2.7y LOOP_2: JB P2.2,NEXT_6y LOOP_3: JNB P2.2,LOOP_3y MOV R2,MMAy CJNE R2,#3CH,NEXT_Py MOV MMA,#00Hy NEXT_P: INC MMAy MOV A,MMAy CLR P2.7y CLR P2.5y SETB P2.6y LCALL CNVBCDy MOV P0,Ay NEXT_6: JB P2.1,NEXT_7y LOOP_4: JNB P2.1,LOOP_4y MOV R2,HHAy CJNE R2,#18H,NEXT_Qy MOV HHA,#00Hy NEXT_Q: INC HHAy MOV A,HHAy

    CLR P2.6y CLR P2.5y SETB P2.7y LCALL CNVBCDy MOV P0,Ay NEXT_7: JB P2.3,LOOP_2

  • 8/6/2019 Clock Report1

    21/23

    ~ 20 ~

    y BACK_R: JNB P2.3,BACK_Ry RETI

    y CLK_INT: CLR TR1y MOV TL1,#0FCHy TIMER_STNG:RETyy END

    Future Extensions

    Serial Communication facility(using TxD,RxD pins).o The facility acquired by serial communication can be utilized in the

    sense that one can easily load the code onto the microcontroller chip

    without dismounting the chip from the system board, and hence the

    overall process of debugging and testing becomes easier.

    Event counter.o

    Using the Timer in counter mode operation one count the number oftimes a particular event occurs during an interval, which can be a

    method of finding the frequency of an arbitrary periodic wave

    acknowledge at one of the interrupt pin of AT89C52

    microcontroller.

    Timer Recorder.o We noticed that one more enhancement can be done while dealing

    with timer block, that is Time Recorder with help of which one can

    measure the interval during which an event was in effect.

    Software Listing

    1. Keil uvision3

  • 8/6/2019 Clock Report1

    22/23

    ~ 21 ~

    Using Keil software testing of the code written for the project for errors

    became easier so that different approaches for the target code were

    undertaken.

    2. MultisimUsing Multisim the various circuit diagrams were drawn for the well

    understanding of the project and good display of the design through block

    diagrams.

    3.Chip Prog Python+

    For burning program in microcontroller.

    Problems and Debugging

    At the first instant when the project was designed on the bread-board the circuit did

    not responded at all due to loose connections and various overlapping of the wires,

    and faulty LEDs, but as soon as it was mounted on a zero-hole board then it

    worked quite well, but some problems remained in effect because of some code

    instructions, it required a little adjustment, debugging and correction in the code,

    going through this stage a correct output was observed and it worked successfully.

    At different stages we faced problems due to unavailability of the components inthe market but it was removed with the issuing of components from the laboratory

    with prior permission of Dr. Vipan Kakkar(Director of SECE)

  • 8/6/2019 Clock Report1

    23/23

    ~ 22 ~

    Results and Discussion:

    The Digital Clock is functioning well, its timer mode as well as Appliance

    controller mode are working very well. All the parameters have been

    observed correctly. Its future extensions have been noticed and will be taken

    as future reference features so that its overall working and efficiency can be

    enhanced accordingly.

    References

    1. www.datasheets.com2. www.alldatasheets.com3. www.datasheetcatalog.com4. www.sparkfun.com5. www.axman.com6. www.dunfield.com7. www.fsinc.com8. The 8051 microcontroller and Embedded systems (PEARSON Education)9. www.MicroDigitalED.com10.www.wikipidia.com