Application Note-mun Bin

  • April 2020
  • PDF

This document was uploaded by user and they confirmed that they have the permission to share it. If you are author or own the copyright of this book, please report to us by using this DMCA report form. Report DMCA


Overview

Download & View Application Note-mun Bin as PDF for free.

More details

  • Words: 796
  • Pages: 11
Application Note Generating second clock using seven segment display

Project: Digital Clock for Classroom DATE: 25 MARCH 2009

Submitted by: Wong Mun Bin Matrix No. : HK2006-3812

Executive Summary This paper is an application note intended to give a brief insight on the way to generate an accurate time every second. The main electronic components that will be used here is Microchip PIC16F84A and a seven segment display. The outcome is to generate interest among beginner in microcontroller to further build a working digital clock.

1

1.0 Introduction Most often every decent middle-class family owns a clock in their home whether it is analog or a digital clock. Although most of us never really care how it runs as long as it gives us an accurate timing and is working. In this application note, we will expose briefly on how to generate a quite accurate second digital clock using a Microchip microcontroller.

2.0 Objectives The main objective in this tutorial based application note is to enable interested reader to build own digital clock hands-on. Although after completion from this tutorial the reader will only able to build a second digital clock, it nevertheless be able to build an interest for reader to further pursuit developing further project using a microcontroller.

3.0 Issues The main issue that is always related to a digital is on how accurate our clock can be? One can always say that a clock is accurate enough that they cannot detect any error by naked eye looking at the timing. Some give specific measurement or deviation. Just like if the clock deviate couple of seconds after continuously running for a month time, it can to be said to be accurate.

4.0 Tools Used •



4.1 Hardware -

A PIC16F84A (18pins)

-

A common cathode seven segment display

-

A low value resistor

-

A Breadboard

-

+5±1V power supply

-

20MHz crystal oscillator

-

A suitable programmer

4.2 Software 2

-

MPLAB IDE (compiler - any new version that is up to date)

-

PICkit 2 (Programmer - any new version that is up to date)

-

PicLoopsv2.2(Loops generator)

3

5.0 Circuit Connection

g

f

I

a

e

d

II

c

b

Figure 1: Diagram for PIC16F84A and a common cathode seven segment display

MCLR, Vss - connect to +Vs power supply Vdd – connect to ground OSC1, OSC2 – connect together with a 20MHz crystal oscillator RB0, RB1, RB2, RB3, RB4, RB5, RB6 – connect to pins a, b, c, d, e, f, g respectively Pin II – Connect in series with a low value resistor to ground

Figure 2: Circuit connection following the steps mentioned above. 4

6.0 Program A program included in Appendix A is opened in MPLAB. A new project must be created. Go to Project > New Project and a prompt will pop-up. Proceed by creating a folder and name the project. Next go to View > Project. Then click on the New File icon or go to File > New open a blank page and start to write the program in Appendix A as in Figure 3. After finish typing it, save it and press on the build all button or press CTRL + F10 to build the project. If there is no typo, the successful built page should appear as in Figure 4.

Figure 3: Typing the program attached in Appendix A

5

Figure 4: “Build succeeded” message will appear if it is built successfully

7.0 Results The following is the results showing seven segment displaying the decimal from 0 to 9 in every second.

Figure 5: The seven segment display the second clock.

6

8.0 Interpretation The common cathode display is connected to the same ground. If any of the pins from “a” to “g” is connected to a positive supply, the segment will illuminate. So by controlling the timing of giving a positive power supply given to the seven segment pins, a second clock can be generated. While it is assumed that the readers do have some basic programming knowledge in this note, the point that must be stress out is the program used to generate one second looping. From PicLoops v2.2, type in the speed of oscillator we are using and the delay timing we desired, the software will then generate appropriate instruction that will loop for 1 second as in Figure 6.

Figure 6: PicLoops v2.2 software will generate instructions to the delay timing desired

9.0 Conclusion The process explained in this paper covers basic programming skills and connection of hardware to generate a second clock using the seven segment displaying. Further study and more selfprogramming will only serve to be the way for one to build a full functional digital clock.

10.0 Reference www.microchip.com

7

Appendix A

8

9

10

Related Documents

Bin
August 2019 53
Bin
November 2019 60
Am Bin
November 2019 18
Bin 5
November 2019 28
Bin 8
November 2019 28