Sunteți pe pagina 1din 17

Digital Clock ( Group 17)

2010 SUMMER SEMESTER


ELEC 254 MICROPROCESSOR EXPERIMENTS
FINAL PROJECT REPORT

DIGITAL CLOCK

Course Instructor: Dr. Tim K. T. Woo


Course Demonstrator: Fox C. H. Wu
Teaching Assistant: Lo Ming yam

Group 17
Name of Member Li Yin Ming 08224080 ee_lymae
Or Wing Ho 09463891 Whor

Au Lap Kwan 08073948 ee_alk

Contents
1. Introduction
1
Digital Clock ( Group 17)

2. Overall Description
3. Equipment List
4. Set up instruction
5. Limitation
6. Difficulties
7. Detailed Hardware Description
8. Detailed Software Description
9. Summary and Conclusion

10. Program Listing

1. Intr oduction
Nowadays, there are many high-tech electronic devices. Digital photo viewers,

mobile video players, mp3 players, even the new generation movie player, PMP,

could be found easily in electronic retails. Except for all these devices, I believe that

clocks could also be found in electronic shop. Almost every home has at least one

clock; so, we design a digital clock for our project .We know that the project is very

regardless if it is a traditional alarm clock or an antique clock. Therefore, we design a

clock of multiple functions. The display of clock will be change when we press the

different button.

Making use of 8051 microprocessor, together with ADC0804, 128X64 LCD,

2
Digital Clock ( Group 17)

Vibrater and temperature sensor (LM35DZ), we constructed a multi-functional clock

which contained 3 main functions as following:

1) Time and weekly, for time it can be displayed as 12 or 24 hours.

2) Alarm clock

3) Room temperature

2.1 Har dwar e Description

The hardware system consists of:

1) 8051(32k bytes rom)

Store the main program


2) 128 x 64 dot matrix LCD

LCD used for display


3) 6 Buttons

Use to control column and page of LCD


4) Vibrator

Use for Vibration of clock


5) ADC0804

Convert analog to digital


6) LM35DZ

Use to detect room temperature


7) Buzzer
3
Digital Clock ( Group 17)

Use for alarm


8) Logic AND gate

Use to control the buzzer


9) Amplifier

Use to generate the reference voltage to ADC0804

This is the main command of LCD 128X64 dot matrix. Based the following command
setting of the LCD, we can print graphics in the LCD easily.

Use of LM35
Block diagram of LM35DZ

4
Digital Clock ( Group 17)

The LM35 series are precision integrated-circuit temperature sensors, whose output
voltage is linearly proportional to the Celsius (Centigrade) temperature.

It does not require any external calibration or trimming to provide typical accuracies
of ±1⁄4°C at room temperature and ±3⁄4°C over a full −55 to +150°C temperature
range. Low cost is assured by trimming and calibration at the wafer level.

Its low output impedance, linear output, and precise inherent calibration make
interfacing to readout or control circuitry especially easy. It can be used with single
power supplies, or with plus and minus supplies.

As it draws only 60 μA from its supply, it has very low self-heating, less than 0.1°C in
still air. The LM35DZ is rated to operate over a 0° to +100°C temperature range.
Thus, we have decided to use LM35DZ.

LM35 use with ADC0804

5
Digital Clock ( Group 17)

This is the circuit we have used in our device. LM35DZ will generate
an analog voltage to ADC0804, while ADC0804 will give a 8-bits
digital value to 8051.

2.2 Softwar e Description

1) The system is written by the 8051 assembly programming.

2) MedWin is used for programming.

6
Digital Clock ( Group 17)

3) Fast LCD is used to transfer the pictures from paint to data.

2.2 Principles of oper ation

Block Diagram - Flow chart of digital clock

Welcome Page

7
Temperature
Digital Clock ( Group 17)

Time & Date

Setting –Alarm &Vibrator


-Time
-Weekly

To change the mode of display, we use switches to control display. 3 modes can
be obtained by 3 switches. When all the switches are connected to VCC (111 mode),
welcome page will be displayed.

8
Digital Clock ( Group 17)

For the time mode, we use the internal timer of 8051, the
program will loop and delay for every second. This mode can display
time and weekly. For time, it can shown 12 hours or 24 hours. AM or
PM is displayed if 12 hours format is selected.

24 hours mode 12 hours mode

For the alarm & Vibrater, we use a buzzer on the PCB board.
We use 2 buttons to set the clock, alarm and weekly display. To set
the alarm, we can point the cursor to the Alarm and then enable
the alarm to turn on the alarm and vibrator function. To set the
time, point the cursor to the Time. Then a box of TIME SETTING
appeared, set the time in 24 hours format and then selected 12
hours or 24 hours format. To set the weekly display, point the
cursor to the Weekly.

9
Digital Clock ( Group 17)

For room temperature, it can be sensed automatically by the


use of LM35DZ temperature sensor. The room temperature is
checked for every second.

3. Equipment List
Part Quantity

128 x 64 LCD 1

LM35DZ (Temperature 1
Sensor)
ADC0804 1

Vibrator 1

10
Digital Clock ( Group 17)

74HC154N 1

74LS08 1

Buzzer 1

Transistor 1

Capacitor
330pF 1
150pF 1
1μF 1
Resistors
1KΩ 2
16KΩ 1
8.2KΩ 1
100Ω 1
Variable Resistor
50KΩ 1
10KΩ 1
Resistor Network 1

Buttons & Switches 6

Accessories --
- 8051 Emulator
- Parallel cable
- Power adaptor
- Breadboard
- Wires
4. Set up instruction

Supply 5V to the circuit and make sure all connections are


connected. Then, connect 0851 emulator to the circuit.

5. Limitations

It is hard to limit the code within 4KB as the digital clock


contained many functions. Also, in order to reduce the size of data,
we have made 128X64 graphics as small as they can. It means that
we have cut the graphic into different sizes, and then set up the

11
Digital Clock ( Group 17)

print information in the print function. Although we can really reduce


the size of the data(from 1K bytes to 0.4~0.6K), we have increase
the size of the codes since we need to set up the pages, column,
print size and the times of loop once we call the print function.

6. Difficulties

Since 89c58 can only do one instruction in one cycle, we need to


consider some problem of the clock and alarm. When the alarm is
enabled, the program will go to the function call
“check_matchtime”. Once the time is matched, the clock will be
alarmed with a different pattern. But, since the 89c58 can only do
one instruction only, then the device will be alarm first and then
increment the second. Therefore, the clock will have the delay on it.
To fix this problem, we have design two different pattern of alarm.
They will be called in different seconds, then we can set the delay as
less as it can.

On the other hand, we also faced some difficulties on the LCD


display. One 128X64 dot pixels graphic need to spend around 1K
bytes. Thus we need to use another way to deduce the size of them
such that we no need to use external memory to store them. To fix
this problem, we have decided to cut the graphic into some small
size graphics. We have successfully deduced the size of the data.

7. Detailed Hardware Description

7.1 Block Diagrams:

12
LCD 128 x 64 pixel screen
Digital Clock ( Group 17)

Vibrator

8051
Switches

Buzzer

ADC 0804

LM35DZ (Temp Sensor)

7.2Schematic:

13
Digital Clock ( Group 17)

Main program A hidden mode, when the switchs given the value is
“111”, then the welcome pages will be shown.

Temperature Clock Mode


Mode

Print the
interface of
temperature
mode

The temperature
will be updated Get all data
every 10 from variables.
seconds. Print the
following
information on
the LCD.

Show the
temperature
given by
ADC0804 and
print it on the Time
LCD

The day of week

Start to wait the Format (A/PM


next 10 seconds or 24 hrs)

8. Detailed Software Description

14
Digital Clock ( Group 17)

Get the value


of switchs

Setting
Mode

Alarm

Disable

Don’t show anything


Enable alarm
Show the
setting of the
alarm
Back to
Setting Mode

Time setting

Set hours and


minutes in 24
hours format

Set format

Back to
Setting Mode

Weekly
setting
Set the day
of the
week
Back to
Setting Mode

9. Summary and conclusion


After one complete looping, back to main to check the value of switchs whether change or15not
Digital Clock ( Group 17)

In this project, we intended to construct a digital clock with


vibrator and temperature sensor in orderbto make it more user
friendly. Throughout this project period, we gain many experience
on both hardware and software.

First of all, we learned how to have a good planning and


time management for the project. We know which place we can buy
the components that we need. We also learned how to read the data
sheets of different electronic components, how to build a circuit and
write a program to make the clock works.

Second, we learned how to use a 128X64 LCD display. We spent


a lot of time on building the circuit of the digital clock with the LCD
display since we have no experience before. Trouble shooting skills
were developed during tseting the LCD display. Afterward, we
learned how to use and manage the LCD display afer debuding the
circuit several time and with the reference of code posted on the
Inernet. Since the LCD is the most important part of the digital
clock, we spent most of our time on this.

Moreover, we have to design the circuit carefully because of the


limitations of number of ports. Design is based on the datasheet.
Also we learned how to use some hardwear the are not present in
the lab such as the temperature sensor as well as the vibrator.
Originally we want to use an infra red circuit to manage the vibrator.
We had tried to build an infrared circuit but it does not work. After
that, we search from the internet and found anther infrared circuit
and planed to build it. However, we spent much time on making the
LCD display work and we cannot find the encoder and the decoder
in Hong Kong. Due to this, we ignore this part at last. But we have
learn much from this, we learn the basic structure of the infrared
circuit and design which part is more important as we should do it
first.

For software part, The debuging problem is the most


troublesome part, since the code is quite long and we need to
discuss with each other to find out the problem.
16
Digital Clock ( Group 17)

To conclude, we learn much from this course. What we learned


not just pratical experience, but most important is how to cooperate
with each others as a team. During this project periode, we also
learnt how to manage the time progress to meet the deadline of the
project under high pressure. Undoubtly, this is a valuable experience
to us and it is highly recomment to those who willing learn more.

10. Program Listing

17

After one complete looping, back to main to check the value of 2D


sensor whether change or not

S-ar putea să vă placă și