RTC Using Ghraphical LCD 2003
RTC Using Ghraphical LCD 2003
CONTENTS
ABSTRACT
CHAPTER 1: INRODUCTION 1
1.1 Circuit description 2
1.2 Embedded system 4
1.3 Characteristics of embedded system 4
1.4 Debugging 6
1.5 Design of embedded system 6
CHAPTER 3: DS1307 17
3.1 Features of DS1307 18
3.2 Pin description 18
3.3 Typical operating circuit 19
3.4 Block diagram 20
3.5 Signal description 20
3.6 Time keeper registers 23
3.7 Control registers 23
3.8 2-wire serial data bus 24
3.9 2 –bus configurations 24
3.10 Data transfer on 2-wire serial bus 25
3.11 Slave receiver mode 25
3.11.1 Data –write slave mode 27
3.11.2 Data –read slave mode 27
DESCRIPTION:
The aim of this project is to interface the graphical LCD to display the data in different graphical
formats and to display time in addition to text and numeric formats on the graphical LCD. This project gives
details of a simple interface technique between a display graphic and a micro-controller.
We had used Atmega-8515 which is 8-bit microcontroller and JHD12864E Graphical LCD to
display the graphical Images. The Graphical LCD we have used is 128 X 64 on which we can display any
type of images. The display is split logically in two half’s. It contains two controllers with controller 1 (Chip
select 1) controlling the left half of the display and controller 2 (Chip select 2) controlling the right half.
Each controller must be addressed independently. The page addresses, 0-7, specify one of the 8 horizontal
pages which are 8 bits (1 byte) high. To display the image on the LCD we should configure the pixel by
selecting the particular half (right half /left half) and page (form 0 to 7), we are using DS1307 and AT24C08
to display the clock in Graphical LCD.
The purpose of using controller is to clear the display, move the cursor, to give the data to be
displayed and controlling the Graphic LCD operations. It is used to display soft font text, line drawing;
graphic symbol and icon display, pixel setting etc. Using this graphic LCD we can create images which we
can’t create by using normal LCD display. Using normal LCD we can display only characters and symbols.
The Graphical LCD often require more initial time and effort to get them running than alphanumeric LCD’s
but they do not have the character limits of such LCD displays. Here we can create images using pixels like
in our C programming.
To prepare data that can be embedded in our program so that we can display a specific image on the
LCD we need to prepare the data for each pixel on the LCD which can be done manually or by using some
modern software’s that translates a bitmap file to display data.
REQUIREMENTS:
HARDWARE REQUIREMENTS:
MICROCONTROLLER
GRAPHICAL LCD
DS1307
SWITCHES
SOFTWARE REQUIREMENTS:
Embedded c programming
Chapter 1
INTRODUCTION
1.1CIRCUIT DESCRIPTION
DESIGNING:
Since the main intension of this project is to design a real time clock display on graphical this
application there are few steps that has been performed i.e.
1) Designing the power supply for the entire circuitry.
2) Selection of microcontroller that suits our application.
Selection LCD.
3) In order to fulfill of RTC
4) Selection of LCD.
Complete studies of all the above points are useful to develop this project.
BLOCK DIAGRAM:
GRAPHICAL
LCD
DS 1307
MICRO
CONTROLLER
Atmega 8515
SWITCHES
SWITCHES
SELECTION OF MICROCONTROLLER:
We are selecting Atmega 8515 AVR microcontroller
There are minimum five requirements for proper operation of microcontroller.
Those are:
1) power supply section
2) pull-ups for ports
3) Reset circuit
4) Crystal circuit
5) ISP circuit (for program dumping)
SELECTION OF RTC:
Here in this project I selected i2c protocol based DS1307 RTC. Real-time clock counts
seconds, minutes, hours, date of the month, month, day of the week, and year with leap-year compensation
valid up to 2100.RTC contains particular memory locations to store the seconds, minutes, hours, date of the
month, month, day of the week whenever power up these locations will count. By using push button
switches we can change these locations to set the current time.
CONNECTIONS OF RTC:
In this application we are using i2c protocol based IC DS1307.The 5th 6th pin’s of IC is
connected to the PC.0, PC.7 of microcontroller respectively.
CIRCUIT OPERATION:
The main aim of the project is to interface the graphical LCD and DS1307 (RTC) to the controller
.Here our application program is reading the data from DS1307 through I2c protocol. And displaying on the
graphical LCD and 4 switches are for adjusting the time.
1.2 EMBEDDED SYSTEMS
Embedded systems are electronic devices that incorporate microprocessors with in their
implementations. The main purposes of the microprocessors are to simplify the system design and provide
flexibility. Having a microprocessor in the device helps in removing the bugs, making modifications, or
adding new features are only matter of rewriting the software that controls the device. Or in other words
embedded computer systems are electronic systems that include a microcomputer to perform a specific
dedicated application. The computer is hidden inside these products. Embedded systems are ubiquitous.
Every week millions of tiny computer chips come pouring out of factories finding their way into our
everyday products.
Embedded systems are self-contained programs that are embedded within a piece of hardware.
Whereas a regular computer has many different applications and software that can be applied to various
tasks, embedded systems are usually set to a specific task that cannot be altered without physically
manipulating the circuitry. Another way to think of an embedded system is as a computer system that is
created with optimal efficiency, thereby allowing it to complete specific functions as quickly as possible.
Embedded systems designers usually have a significant grasp of hardware technologies. They use
specific programming languages and software to develop embedded systems and manipulate the equipment.
When searching online, companies offer embedded systems development kits and other embedded systems
tools for use by engineers and businesses.
Embedded systems technologies are usually fairly expensive due to the necessary development time
and built in efficiencies, but they are also highly valued in specific industries. Smaller businesses may wish
to hire a consultant to determine what sort of embedded systems will add value to their organization.
1.3 CHARACTERISTICS:
Two major areas of differences are cost and power consumption. Since many embedded systems are
produced in tens of thousands to millions of units range, reducing cost is a major concern. Embedded
systems often use a (relatively) slow processor and small memory size to minimize costs.
The slowness is not just clock speed. The whole architecture of the computer is often intentionally
simplified to lower costs. For example, embedded systems often use peripherals controlled by synchronous
serial interfaces, which are ten to hundreds of times slower than comparable peripherals used in PCs.
Programs on an embedded system often run with real-time constraints with limited hardware resources:
often there is no disk drive, operating system, keyboard or screen. A flash drive may replace rotating media,
and a small keypad and LCD screen may be used instead of a PC's keyboard and screen.
Firmware is the name for software that is embedded in hardware devices, e.g. in one or more
ROM/Flash memory IC chips. Embedded systems are routinely expected to maintain 100% reliability while
running continuously for long periods, sometimes measured in years. Firmware is usually developed and
tested too much harsher requirements than is general-purpose software, which can usually be easily restarted
if a problem occurs.
PLATFORM:
There are many different CPU architectures used in embedded designs. This in contrast to the
desktop computer market which is limited to just a few competing architectures mainly the Intel/AMD x86
and the Apple/Motorola/IBM Power PC’s which are used in the Apple Macintosh. One common
configuration for embedded systems is the system on a chip, an application-specific integrated circuit, for
which the CPU was purchased as intellectual property to add to the IC's design.
TOOLS:
Like a typical computer programmer, embedded system designers use compilers, assemblers and
debuggers to develop an embedded system. Those software tools can come from several sources:
Software companies that specialize in the embedded market Ported from the GNU software
development tools. Sometimes, development tools for a personal computer can be used if the embedded
processor is a close relative to a common PC processor. Embedded system designers also use a few software
tools rarely used by typical computer programmers. Some designers keep a utility program to turn data files
into code, so that they can include any kind of data in a program. Most designers also have utility programs
to add a checksum or CRC to a program, so it can check its program data before executing it.
OPERATING SYSTEM:
They often have no operating system, or a specialized embedded operating system (often a real-time
operating system), or the programmer is assigned to port one of these to the new system.
DEBUGGING:
Debugging is usually performed with an in-circuit emulator, or some type of debugger that can
interrupt the micro controller’s internal microcode. The microcode interrupt lets the debugger operate in
hardware in which only the CPU works. The CPU-based debugger can be used to test and debug the
electronics of the computer from the viewpoint of the CPU.
Developers should insist on debugging which shows the high-level language, with breakpoints and
single stepping, because these features are widely available. Also, developers should write and use simple
logging facilities to debug sequences of real-time events. PC or mainframe programmers first encountering
this sort of programming often become confused about design priorities and acceptable methods. Mentoring,
code-reviews and ego less programming are recommended.
START-UP:
All embedded systems have start-up code. Usually it disables interrupts, sets up the electronics, tests
the computer (RAM, CPU and software), and then starts the application code. Many embedded systems
recover from short-term power failures by restarting (without recent self-tests). Restart times under a tenth
of a second are common.
Many designers have found one of more hardware plus software-controlled LED’s useful to
indicate errors during development (and in some instances, after product release, to produce troubleshooting
diagnostics). A common scheme is to have the electronics turn off the LED(s) at reset, whereupon the
software turns it on at the first opportunity, to prove that the hardware and start-up software have performed
their job so far. After that, the software blinks the LED(s) or sets up light patterns during normal operation,
to indicate program execution progress and/or errors. This serves to reassure most technicians/engineers and
some users.
THE CONTROL LOOP:
In this design, the software has a loop. The loop calls subroutines. Each subroutine manages a part of
the hardware or software. Interrupts generally set flags, or update counters that are read by the rest of the
software. A simple API disables and enables interrupts. Done right, it handles nested calls in nested
subroutines, and restores the preceding interrupt state in the outermost enable. This is one of the simplest
methods of creating an exocrine.
Typically, there's some sort of subroutine in the loop to manage a list of software timers, using a
periodic real time interrupt. When a timer expires, an associated subroutine is run, or flag is set. Any
expected hardware event should be backed-up with a software timer. Hardware events fail about once in a
trillion times.
State machines may be implemented with a function-pointer per state-machine (in C++, C or
assembly, anyway). A change of state stores a different function into the pointer. The function pointer is
executed every time the loop runs.
Many designers recommend reading each IO device once per loop, and storing the result so the logic
acts on consistent values. Many designers prefer to design their state machines to check only one or two
things per state. Usually this is a hardware event, and a software timer. Designers recommend that
hierarchical state machines should run the lower-level state machines before the higher, so the higher run
with accurate information.
Complex functions like internal combustion controls are often handled with multi-dimensional
tables. Instead of complex calculations, the code looks up the values. The software can interpolate between
entries, to keep the tables small and cheap.
One major disadvantage of this system is that it does not guarantee a time to respond to any
particular hardware event. Careful coding can easily assure that nothing disables interrupts for long. Thus
interrupt code can run at very precise timings. Another major weakness of this system is that it can become
complex to add new features. Algorithms that take a long time to run must be carefully broken down so only
a little piece gets done each time through the main loop.
This system's strength is its simplicity, and on small pieces of software the loop is usually so fast that
nobody cares that it is not predictable. Another advantage is that this system guarantees that the software
will run. There is no mysterious operating system to blame for bad behavior.
USER INTERFACES:
Interface designers at PARC, Apple Computer, Boeing and HP minimize the number of types of user
actions. For example, use two buttons (the absolute minimum) to control a menu system (just to be clear,
one button should be "next menu entry" the other button should be "select this menu entry"). A touch-screen
or screen-edge buttons also minimize the types of user actions.
Another basic trick is to minimize and simplify the type of output. Designs should consider using a
status light for each interface plug, or failure condition, to tell what failed. A cheap variation is to have two
light bars with a printed matrix of errors that they select- the user can glue on the labels for the language that
she speaks.
For example, Boeing's standard test interface is a button and some lights. When you press the button,
all the lights turn on. When you release the button, the lights with failures stay on. The labels are in Basic
English.
Designers use colors. Red defines the users can get hurt- think of blood. Yellow defines something
might be wrong. Green defines everything's OK.
Another essential trick is to make any modes absolutely clear on the user's display. If an interface
has modes, they must be reversible in an obvious way. Most designers prefer the display to respond to the
user. The display should change immediately after a user action. If the machine is going to do anything, it
should start within 7 seconds, or give progress reports.
One of the most successful general-purpose screen-based interfaces is the two menu buttons and a
line of text in the user's native language. It's used in pagers, medium-priced printers, network switches, and
other medium-priced situations that require complex behavior from users. When there's text, there are
languages. The default language should be the one most widely understood.
CHAPTER 2
ATMEGA8515
ATMEGA8515
2.1 FEATURES:
The ATmega8515 is a low-power CMOS 8-bit microcontroller based on the AVR enhanced
RISC architecture. By executing powerful instructions in a single clock cycle, the ATmega8515 achieves
throughputs approaching 1 MIPS per MHz allowing the system designer to optimize power consumption
versus processing speed.
2.3.1 Overview of ATMGA 8515
The AVR core combines a rich instruction set with 32 general purpose working registers. All
the 32 registers are directly connected to the Arithmetic Logic Unit (ALU), allowing two independent
registers to be accessed in one single instruction executed in one clock cycle. The resulting architecture is
more code efficient while achieving throughputs up to ten times faster than conventional CISC
microcontrollers.
The device is manufactured using Atmel’s high density nonvolatile memory technology. The
On-chip ISP Flash allows the Program memory to be reprogrammed In-System through an SPI serial
interface, by a conventional nonvolatile memory programmer, or by an On-chip Boot program running on
the AVR core. The boot program can use any interface to download the application program in the
Application Flash memory. Software in the Boot Flash section will continue to run while the Application
Flash section is updated, providing true Read-While-Write operation. By combining an 8-bit RISC CPU
with In-System Self-programmable Flash on a monolithic chip, the Atmel ATmega8515 is a powerful
microcontroller that provides a highly flexible and cost effective solution to many embedded control
applications.
The ATmega8515 is supported with a full suite of program and system development tools
including: C Compilers, Macro assemblers, Program debugger/simulators, In-circuit Emulators, and
Evaluation kits.
Typical values contained in this datasheet are based on simulations and characterization of
other AVR microcontrollers manufactured on the same process technology. Min and Max values will be
available after the device is characterized.
Port B (PB7...PB0):
Port B is an 8-bit bi-directional I/O port with internal pull-up resistors (selected for each bit).
The Port B output buffers have symmetrical drive characteristics with both high sink and source capability.
As inputs, Port B pins that are externally pulled low will source current if the pull-up resistors are activated.
The Port B pins are tri-stated when a reset condition becomes active, even if the clock is not running.
Port C (PC7...PC0):
Port C is an 8-bit bi-directional I/O port with internal pull-up resistors (selected for each bit).
The Port C output buffers have symmetrical drive characteristics with both high sink and source capability.
As inputs, Port C pins that are externally pulled low will source current if the pull-up resistors are activated.
The Port C pins are tri-stated when a reset condition becomes active, even if the clock is not running.
Port D (PD7...PD0):
Port D is an 8-bit bi-directional I/O port with internal pull-up resistors (selected for each bit).
The Port D output buffers have symmetrical drive characteristics with both high sink and source capability.
As inputs, Port D pins that are externally pulled low will source current if the pull-up resistors are activated.
The Port D pins are tri-stated when a reset condition becomes active, even if the clock is not running.
Port E (PE2...PE0):
Port E is a 3-bit bi-directional I/O port with internal pull-up resistors (selected for each bit).
The Port E output buffers have symmetrical drive characteristics with both high sink and source capability.
As inputs, Port E pins that are externally pulled low will source current if the pull-up resistors are activated.
The Port E pins are tri-stated when a reset condition becomes active, even if the clock is not running.
RESET Bar:
Reset input. A low level on this pin for longer than the minimum pulse length will generate a
reset, even if the clock is not running. The minimum pulse length is given in Table 18 on page 46. Shorter
pulses are not guaranteed to generate a reset.
XTAL1:
Input to the inverting Oscillator amplifier and input to the internal clock operating circuit.
XTAL2:
Output from the inverting Oscillator amplifier
DS1307
3.1 FEATURES OF DS1307:
Real-time clock (RTC) counts seconds, minutes, hours, date of the month, month,
day of the week, and year with leap-year compensation valid up to 2100.
56-byte, battery-backed, nonvolatile (NV) RAM for data storage.
Two-wire serial interface.
Programmable square wave output signal.
Automatic power-fail detects and switches circuitry.
Consumes less than 500nA in battery backup mode with oscillator running.
Optional industrial temperature range: 40°C to +85°C
Available in 8-pin DIP or SOIC.
Underwriters Laboratory (UL) recognized.
3.2 PIN DESCRIPTION:
DESCRIPTION:
The DS1307 Serial Real-Time Clock is a low-power; full binary-coded decimal (BCD)
clock/calendar plus 56 bytes of NV SRAM. Address and data are transferred serially via a 2-wire, bi-
directional bus. The clock/calendar provides seconds, minutes, hours, day, date, month, and year
information. The end of the month date is automatically adjusted for months with fewer than 31 days,
including corrections for leap year. The clock operates in either the 24-hour or 12-hour format with AM/PM
indicator. The DS1307 has a built-in power sense circuit that detects power failures and automatically
switches to the battery supply.
The DS1307 operates as a slave device on the serial bus. Access is obtained by
implementing a START condition and providing a device identification code followed by a register address.
Subsequent registers can be accessed sequentially until a STOP condition is executed. When VCC falls
below 1.25 x VBAT the device terminates an access in progress and resets the device address counter.
Inputs to the device will not be recognized at this time to prevent erroneous data from being written to the
device from an out of tolerance system. When VCC falls below VBAT the device switches into a low-
current battery backup mode. Upon power-up, the device switches from battery to VCC when VCC is
greater than VBAT + 0.2V and recognizes inputs when VCC is greater than 1.25 x VBAT. The above
diagram shows the main elements of the serial RTC.
VBAT:
Battery input for any standard 3V lithium cell or other energy source. Battery voltage must be
held between 2.0V and 3.5V for proper operation. The nominal write protect trip point voltage at which
access to the RTC and user RAM is denied is set by the internal circuitry as 1.25 x VBAT nominal. A
lithium battery with 48mAhr or greater will back up the DS1307 for more than 10 years in the absence of
power at 25ºC. UL recognized to ensure against reverse charging current when used in conjunction with a
Lithium battery.
SCL (Serial Clock Input):
SCL is used to synchronize data movement on the serial interface.
SDA (Serial Data Input/Output):
SDA is the input/output pin for the 2-wire serial interface. The SDA pin is open drain which
requires an external pull up resistor.
X1 X2:
Connections for a standard 32.768 kHz quartz crystal. The internal oscillator circuitry is designed
for operation with a crystal having a specified load capacitance (CL) of 12.5pF.
CLOCK ACCURACY:
The accuracy of the clock is dependent upon the accuracy of the crystal and the accuracy of
the match between the capacitive load of the oscillator circuit and the capacitive load for which the crystal
was trimmed. Additional error will be added by crystal frequency drift caused by temperature shifts.
External circuit noise coupled into the oscillator circuit may result in the clock running fast.
The time and calendar information is obtained by reading the appropriate register bytes.
The RTC registers are illustrated in the below figure. The time and calendar are set or initialized
by writing the appropriate register bytes. The contents of the time and calendar registers are in the BCD
format. Bit 7 of register 0 is the clock halt (CH) bit. When this bit is set to a 1, the oscillator is disabled.
When cleared to a 0, the oscillator is enabled.
The DS1307 can be run in either 12-hour or 24-hour mode. Bit 6 of the hours register is defined
as the 12- or 24-hour mode select bit. When high, the 12-hour mode is selected. In the 12-hour mode, bit 5
is the AM/PM bit with logic high being PM. In the 24-hour mode, bit 5 is the second 10 hour bit (20- 23
hours).
On a 2-wire START, the current time is transferred to a second set of registers. The time
information is read from these secondary registers, while the clock may continue to run. This eliminates the
need to reread the registers in case of an update of the main registers during a read.
Depending upon the state of the R/W bit, two types of data transfer are possible:
CHAPTER 4
GRAPHICAL LCD
GRAPHICAL LCD
4.1 INTRODUCTION
A liquid crystal display (LCD) is a thin, flat panel used for electronically
displaying information such as text, images, and moving pictures. ...
1. RS is equivalent to PIN D/I as stated on JHD12864J data sheet. It controls data or command action
(D/I=LOW _ command; D/I=HIGH _ data).
2. Horizontal pixel addressed by Y address counter (0-63). The nomenclature is not the same as our
convention of Cartesian coordinate system (x-y) learned in secondary school. The Y address indicates the
column position in the horizontal direction. Why only 64 pixels but not 128 pixels? Because the LCD is
splitted logically in half with controller #1 (CS1) driving the left half of the display, and controller #2 (CS2)
driving the right half. We need to handle each half individually.
3. The term Page refers to 8-pixel vertically. There are 8 pages ranging from 0 to 7, thus matching a vertical
matrix size of 64 pixels. Refer to Figure 8.1.2 for illustration.
4. R/W controls data READ/WRITE (R/W=LOW _ write; R/W=HIGH _ read). The reason of writing bytes
to the LCD is obvious: we need to display something on the LCD. However, being capable of reading from
the module is also important because it is only possible to write to a whole Page in 8-bit format. As an
example, we want to display a single pixel at the 10th column on 3rd pixel down the top Page where there is
an existing byte 0xAB. If we simply output 0x40 (0b0000 0100), the byte pattern 0xAB would be erased.
One possible way is to perform a data read first, store the byte in background to a temporary variable, and
do a bitwise OR operation with 0x40. This makes a new byte value of 0xAF. The whole procedure is
illustrated below.
CHAPTER 5
POWER SUPPLY
POWER SUPPLY
In-order to work with any components basic requirement is power supply. In this section there is a
requirement of two different voltage levels.
Those are
1)5V DC power supply.
Now the aim is to design the power supply section which converts 230V AC in to 5V DC.
Since 230V AC is too high to reduce it to directly 5V DC, therefore we need a step-down transformer that
reduces the line voltage to certain voltage that will help us to convert it in to a 5V DC. Considering the
efficiency factor of the bridge rectifier, we came to a conclusion to choose a transformer, whose secondary
voltage is 3 to 4 V higher than the required voltage i.e. 5V. For this application 0-9V transformers is used,
since it is easily available in the market.
The output of the transformer is 9V AC; it feed to rectifier that converts AC to pulsating DC. As we all
know that there are 3 kind of rectifiers that is
1. half wave
2. Full wave and
3. Bridge rectifier
Here we short listed to use Bridge rectifier, because half wave rectifier has we less in efficiency. Even
though the efficiency of full wave and bridge rectifier are the same, since there is no requirement for any
negative voltage for our application, we gone with bridge rectifier.
Since the output voltage of the rectifier is pulsating DC, in order to convert it into pure DC we use a high
value (1000UF/1500UF) of capacitor in parallel that acts as a filter. The most easy way to regulate this
voltage is by using a 7805 voltage regulator, whose output voltage is constant 5V DC irrespective of any
fluctuation in line voltage.
CHAPTER 6
AND
SCHEMATIC DIAGRAM
GND
VC C VC C
VCC
R2
R4
R5
R7
R2
R4
R6
R7
R1
R3
R6
R8
R1
R3
R5
R8
VC C 3 V0
5K 4 D/I
VC C PC 1 5 R/W
PC 2
1
2
3
4
5
6
7
8
9
1
2
3
4
5
6
7
8
9
1 40 6 EN
2 (O C 0 /T 0 ) P B 0 VC C 39 PC 3 7 DB0
S W 1
3 (T 1 ) P B 1 P A 0/A D 0 38
D B 0 PA 0 8 DB1
S W 2
4 (A IN 0 ) P B 2 P A 1/A D 1 37
D B 1 PA 1 9 DB2
S W 3
5 (A IN 1 ) P B 3 P A 2/A D 2 36
D B 2 PA 2 10 DB3
S W 4
6 (S S ) P B 4 P A 3/A D 3 35
D B 3 PA 3 11 DB4
F R O M IS P (1 0 ) 7 (M O S I) P B 5 P A 4/A D 4 34
D B 4 PA 4 12 DB5
F R O M I S P (2 ) 8 (M IS O ) P B 6 P A 5/A D 5 33
D B 5 PA 5 13 DB6
F R O M I S P (4 ) (S C K ) P B 7 P A 6/A D 6 32
D B 6 PA 6 14 DB7
9 P A 7/A D 7 31
D B 7 PA 7 15 CS1
F R O M IS P (6 )R E S E T R ESET P E 0 (IC P /IN T 2 ) PC 4 16 CS2
10 30 PC 5 17 RST
11 (R X D ) P D 0 P E 1 (A L E ) PC 6 18 VEE
12 (T D X ) P D 1 29 19 LED+
13 (IN T 0 ) P D 2 P E 2 (O C 1 B ) 20 LED-
SW 5 (IN T 1 ) P D 3
SW 6 14 28
(X C K ) P D 4 P C 7 (A 1 5 ) S C L
SW 7 15 27
(O C 1 A ) P D 5 P C 6 (A 1 4 ) R ST VC C G R A P H IC A L L C D
16 26
SW 8 (W R ) P D 6 P C 5 (A 1 3 ) C S2
17 25
C S1
GND
18 (R D ) P D 7 P C 4 (A 1 2 ) 24
XTA L2 XTA L 2 P C 3 (A 1 1 ) E N
23
P C 2 (A 1 0 ) R /W
22
PC 1 (A 9 ) O /I
19 21
XTA L1 XTA L 1 PC 0 (A 8 ) VC C S D A
VC C
20
G N D
GND
VCC
R1
R2
R3
R4
R5
R6
R7
R8
3 2 .7 6 8 K H Z 1 X1 VCC 8
10K PU LLU P 2 X2 SQW 7
3 VBAT SCL 6 330 ohm s
PC 7
4 GND SDA 5
PC 0
3V B ATTER Y
330 ohm s
D S1307
GND
1 5 B R ID G E R E C T IF IE R
SW 1
2 7805 R EG U LA TO R VC C
1 - + 1 3 PB1
4 8 V IN VO U T
GND SW 2
23 0V A .C TR AN S F O R M ER 2
220 ohm
33 pf 104 pf SW 3
1 0 0 0 u f /3 5 v PB3
LED
SW 4
PB4
P O W E R S U P P L Y (5 V D C )
GND
GND
VC C
G N D
22 pf SW 5
XTA L2 22K PD 3
1 I 2
PB6
3 4 8.000M H z
PB7 R ESET SW 6
5 S 6 22 pf
R ESET
7 8 0 .1 u f /3 5 V PD 4
XTA L1
9 P 10
PB5
SW 1 SW 7
VC C PD 5
GND
A T M E G A 8 5 1 5 IS P GND
ATM E G A8515 C R YS TAL SW 8
R ES ET PD 6
GND
/**HEADER FILES**/
#include <mega8515.h>
#include <i2c.h>
#include <stdio.h>
#include <delay.h>
#include <string.h>
/**SWITCH CONNECTIONS**/
#define SEL PIND.3
#define INC PIND.4
#define DEC PIND.5
#define EXIT PIND.6
#define sw1 PINB.1
#define sw2 PINB.2
#define sw3 PINB.3
#define sw4 PINB.4
void graph0(void);
void graph1(void);
void graph2(void);
void graph3(void);
/**VARIABLES INITIALIZATION**/
unsigned char flash charset[27][6] = {
{0x3e,0x51,0x49,0x45,0x3e,0}, //0
{0x04,0x42,0x7f,0x40,0x00,0}, //1
{0x42,0x61,0x51,0x49,0x46,0}, //2
{0x21,0x41,0x45,0x4b,0x31,0}, //3
{0x18,0x14,0x12,0x7f,0x10,0}, //4
{0x27,0x45,0x45,0x45,0x39,0}, //5
{0x3c,0x4a,0x49,0x49,0x30,0}, //6
{0x01,0x71,0x09,0x05,0x03,0}, //7
{0x36,0x49,0x49,0x49,0x36,0}, //8
{0x06,0x49,0x49,0x29,0x1e,0}, //9
{0x20,0x36,0x36,0x00,0x00,0}, // ':'10
{0x20,0x10,0x08,0x04,0x02,0}, // '/'11
{0x00,0x00,0x00,0x00,0x00,0}, // ' '12
{0x01,0x01,0x7F,0x01,0x01,0}, // 'T'13
{0x41,0x41,0x7F,0x41,0x41,0}, // 'I'14
{0x7F,0x02,0x0C,0x02,0x7F,0}, // 'M'15
{0x7F,0x49,0x49,0x49,0x41,0}, // 'E'16
{0x7f,0x41,0x41,0x22,0x1c,0}, //'D'17
{0x7f,0x08,0x04,0x04,0x78,0}, //'h'18
{0x38,0x44,0x44,0x44,0x38,0}, //'o'19
{0x3c,0x40,0x40,0x20,0x7c,0}, //'u'20
{0x7c,0x08,0x04,0x04,0x00,0}, //'r'21
{0xF8,0x08,0x10,0x08,0xF0,0}, //'m'22
{0x80,0x88,0xFA,0x80,0x80,0}, //'i'23
{0xF8,0x10,0x08,0x08,0xF0,0}, //'n'24
{0x90,0xA8,0xA8,0xA8,0x40,0}, //'s'25
{0x07,0x08,0x70,0x08,0x07,0} //'Y'26
};
//COLLEGE NAME
unsigned char const arr1[8][128] =
{
{
255,255, 15, 7, 3,131,143, 19, 35, 67,131, 3, 3, 3, 3, 3,
3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 35,227,227, 3, 35, 35,
227,227, 35, 3, 35,227, 35, 35,227,227, 35, 35, 35, 99, 3, 3,
35,227,227, 35, 3, 3, 3, 3, 3, 3,131,195, 99, 35, 35, 67,
227, 3, 3, 3,131,195, 99, 35, 35, 99,195,131, 3, 35,227,227,
227, 3, 3, 3,227,227,227, 35, 3, 3, 35,227,227, 35, 35, 35,
99, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
3, 3, 3, 3, 3,131, 67, 35, 19,143,131, 3, 7, 15,255,255},
{
255,255, 0, 78,145, 36,164, 35, 16, 72,135, 16, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 63, 56, 6,
1, 7, 62, 56, 6, 1, 0, 32, 63, 63, 34, 39, 32, 48, 0, 0,
32, 63, 63, 32, 32, 48, 60, 0, 0, 0, 15, 31, 48, 32, 32, 32,
16, 0, 0, 0, 15, 31, 48, 32, 32, 48, 31, 15, 0, 32, 63, 32,
7, 63, 56, 7, 32, 63, 63, 32, 0, 0, 32, 63, 63, 34, 39, 32,
48, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 16,135, 72, 16, 35,164, 36,145, 78, 0,255,255},
{
255,255, 0,128,192,192,128, 1, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 24, 8, 8,248,248, 8, 8, 24, 0, 0,224,
240, 24, 8, 8, 24,240,224, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 1,128,192,192,128, 0,255,255},
{
255,255, 0, 1, 3, 3, 1, 0, 0,128,128, 0, 0, 0, 0,128,
128,128,128,128,128,128,128,128,128,128,128,128,128,128,128, 0,
0, 0, 0,128,128,128,128,128,128,128,128,128, 0, 0, 0, 0,
128,128,128,128,128,128,128,136,143, 15,136,128,128,128,128,131,
135,140,136,136,140,135,131,128,128,128,128,128, 0, 0, 0, 0,
0, 0, 0,128,128,128,128,128,128,128,128,128, 0,128,128,128,
128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,
0, 0, 0, 0, 0,128,128, 0, 0, 1, 3, 3, 1, 0,255,255},
{
255,255, 0, 0, 0, 0, 0, 0, 3, 7, 7, 3, 0, 0, 0, 0,
0, 0,255,255,255,255,255, 0, 0, 0, 0, 1,131,255,255,255,
126, 56, 0, 0, 1, 7, 31,255,255,255,248,192, 0, 0, 0, 0,
192,248,255,255,255, 31, 7, 1, 0, 0, 0, 0, 0,255,255,255,
255,255, 1, 1, 1, 1, 1, 1, 3,255,255,255,255,126, 0, 0,
0, 0, 0, 0, 0,255,255,255,255,255, 0, 0, 0, 31, 7, 1,
0, 0, 0, 0,255,255,255,255,255, 0, 0, 0, 0, 1, 7, 31,
0, 0, 0, 0, 3, 7, 7, 3, 0, 0, 0, 0, 0, 0,255,255},
{
255,255, 0, 12, 30, 30, 12, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0,255,255,255,255,255, 2, 2, 2, 2, 7, 15,255,253,252,
248,240,224, 0, 0, 0, 0, 0, 3, 15,127,255,255,248,248,255,
255,127, 15, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0,255,255,255,
255,255, 12, 12, 12, 28,124,254,255,255,199,129, 0, 0, 0, 0,
0, 0, 0, 0, 0,255,255,255,255,255, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0,255,255,255,255,255, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 12, 30, 30, 12, 0,255,255},
{
255,255, 0, 0, 0, 0, 0, 0, 24, 60, 60, 24, 0, 0, 0, 16,
16, 16, 31, 31, 31,159, 95,144, 16, 16, 16, 24, 28, 31, 31, 15,
7,131, 65,128, 0, 0, 0, 0, 0, 0, 0, 1, 15,159, 95,143,
1, 0, 0, 0, 0, 0, 0, 0, 0,128, 80,144, 16, 31, 31, 31,
31, 31, 16, 16, 16,128, 64,128, 3, 7, 15, 31, 31, 30, 28, 24,
16,144, 64,144, 16, 31, 31, 31, 31, 31, 16, 16, 0,128, 64,128,
0, 16, 16, 16, 31, 31, 31, 31, 31,144, 80,144, 0, 0, 0, 0,
0, 0, 0, 0, 24, 60, 60, 24, 0, 0, 0, 0, 0, 0,255,255},
{
255,255,224,216,252,252,216,192,192,192,192,192,192,192,224,224,
240,232,228,226,225,248,228,248,225,226,228,232,240,232,228,226,
225,248,228,248,225,226,228,232,240,232,228,226,225,248,228,248,
225,226,228,232,240,232,228,226,225,248,228,248,225,226,228,232,
240,232,228,226,225,248,228,248,225,226,228,232,240,232,228,226,
225,248,228,248,225,226,228,232,240,232,228,226,225,248,228,248,
225,226,228,232,240,232,228,226,225,248,228,248,225,226,228,232,
240,224,192,192,192,192,192,192,192,216,220,252,216,224,255,255}
};
//TAJ PICTURE
unsigned char const arr2[8][128] =
{
{
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0,156,255, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1,
1, 1, 6, 8, 16, 8, 6, 2, 2, 3, 1, 1, 1, 3, 2, 2,
6, 4, 12, 24, 24, 24, 48, 16, 16, 48, 32, 32, 96, 64,192, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 64, 64, 96, 48, 24,
8, 12, 4, 8, 12, 4, 4, 24,144,240, 0, 0, 0,112,252, 2,
1, 1, 1, 1, 1, 1, 1, 2, 12, 8, 12, 4, 12, 8, 8, 12,
6, 2, 2, 2, 2, 2, 6, 28, 16, 16, 16, 16, 16, 48, 32, 32},
{
0, 0, 0, 0, 0, 0, 0, 0, 0,128,192,120, 12, 12, 4, 6,
3, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0,128,240, 16, 16, 16, 24, 8, 13, 7,
0, 0, 0,128, 64,126,126, 64,134, 11, 8, 8, 24, 16, 16, 16,
16, 28, 4, 8, 8, 4, 4, 7,129,112, 16, 24, 8, 8, 13, 7,
2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0,128,128,192, 64, 64, 64,128, 0,128,192, 64, 64, 64, 64, 64},
{
0, 0, 0, 0, 0, 0, 0, 0, 0, 64, 64, 64,112, 16, 48, 32,
64, 64, 32, 48, 16, 8, 8, 8, 14,134,228,132, 8, 24, 8, 4,
4, 6, 3, 2, 6, 6, 12, 12, 8, 8, 8, 12, 8, 12, 6, 2,
2, 6, 6, 6, 2, 2, 2, 3, 0, 0, 0,128, 64, 32, 16, 8,
4, 2, 1, 0, 0, 0, 0, 0, 0, 1, 2, 4, 8, 16, 32, 64,
128, 0, 0, 0, 0, 0, 0, 0, 3, 6, 4, 12, 8, 24, 48, 32,
32, 32, 32, 24, 8, 12, 4, 4, 4, 4, 4, 4, 6, 2, 1,129,
225,129, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0},
{
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,255, 92, 84, 92,255, 0, 0, 0,
0, 0, 0, 0,128,128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0,128,240,128,128,255,160,160,160,160,160,
160,160,160,160,160,160,160,160,160,160,160,160,160,160,160,160,
160,255,128,128,240,128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0,128,128, 0, 0, 0, 0, 0, 0,255, 44,
44, 44,255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0,128,255,128,128,128,255,128, 0, 0,
0, 0, 0,254, 27, 27,254, 0, 0, 0, 0, 0, 0,224, 32, 60,
224, 0, 0,248, 30, 17,144, 80, 80,145, 19, 30,210, 82, 82, 82,
82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82,222,
19, 17,144, 80, 80,144, 17, 30,252,128,128,240,156,144,240, 0,
0, 0, 0, 0, 0,254, 27, 27,254, 0, 0, 0, 0,192,255,192,
192,192,255,192, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 1,255, 1, 1, 1,255, 1, 0, 0,
0, 0, 96,255, 96, 96,255, 96, 0, 0, 0, 0, 0,255, 1,113,
73,113, 1,255, 0,239, 40, 40, 40, 40,239, 0,255, 0,227, 19,
200, 36, 18, 10, 10,138, 10, 10, 18, 36,200, 16,227, 3, 0,255,
0,239, 40, 40, 40, 40,239, 0,255, 0, 56, 36, 56, 0,255, 0,
0, 0, 0, 0, 48,255, 48, 48,255, 48, 0, 0, 0, 0,255, 0,
0, 0,255, 0,192, 64, 96, 32, 64, 32, 32,224,192,224,240, 48},
{
96,192,128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0,254,255, 6, 6, 6,255,254,128,128,
192, 0,240,255, 48, 48,255,240, 0, 0, 0, 0, 0,255, 0,158,
82,158, 0,255, 0,199,100, 52,100,196, 7, 0,255, 0,255, 0,
255, 0, 0,254, 3, 1, 3,254, 0, 0,255, 0,255, 0, 0,255,
0,135, 68, 52, 52, 68,199, 0,255, 0,143, 73,143, 0,255, 0,
0, 0, 0, 0,240,255, 48, 48,255,240, 0, 0, 0,254,255, 6,
6, 6,255,254, 1,112, 24,224,176, 24, 8, 0,131,243, 0, 0},
{
48, 96,193, 2, 6,136,140, 8, 8,248, 96, 48,184, 88,140, 4,
12,152,240, 96, 64, 64,192,255,255,225,193,193,193, 64, 64, 64,
67, 68, 71, 95, 88, 88, 95, 95, 88, 88, 88, 88, 88, 95, 88, 95,
216, 95, 88,223, 88, 95, 88, 88, 88, 95, 88, 88, 95, 88, 95, 88,
95, 88, 88, 95, 88, 88, 88, 95, 88, 88, 95, 88, 95, 88, 88, 95,
88, 95, 88, 88, 88, 88,223, 88, 95, 88, 95, 88,223, 88, 95, 88,
88, 88, 88, 88, 95, 95, 88, 88,223, 95, 88, 88,216, 95,223, 88,
88, 88, 95, 95, 88, 80, 96,224,231, 12, 8,216,224,240,248,254}
};
//WORLD MAP
unsigned char const arr3[8][128] =
{
{
0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x7F,0x7F,
0x7F,0x7F,0x7F,0x7F,0x7F,0x7F,0xFF,0xFF,
0xFF,0xFF,0x7F,0x7F,0x3F,0xBF,0x3F,0x1F,
0x3F,0x3F,0x3F,0x7F,0xFF,0xBF,0x1F,0x47,
0x87,0x07,0x07,0x07,0x27,0x77,0x77,0x67,
0xE7,0xE7,0xE7,0xC7,0x87,0x07,0x07,0x07,
0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x87,
0xC7,0xF7,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
0xFF,0xFF,0xFF,0xFF,0xFF,0xEF,0xEF,0x7F,
0x7F,0x7F,0x7F,0xFF,0xFF,0xFF,0xFF,0xFF,
0xFF,0xFF,0xFF,0xBF,0xFF,0xFF,0xFF,0xFF,
0x3F,0x7F,0x7F,0x7F,0x3F,0x3F,0x3F,0x1F,
0x1F,0x1F,0x1F,0x1F,0x0F,0x1F,0x1F,0x1F,
0x3F,0x3F,0x3F,0x3F,0x3F,0x7F,0x7F,0x7F,
0x7F,0x3F,0x3F,0x7F,0x7F,0x7F,0x7F,0x7F,
0x7F,0xFF,0xFF,0xFF,0x7F,0x7F,0xFF,0xFF},
{0xFE,0xFE,0xFE,0xFF,0xFF,0xFF,0xF8,0xF8,
0xF0,0xF0,0xF8,0xF8,0xF8,0xF8,0xF8,0xF8,
0xF0,0xE0,0xC0,0x80,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0C,
0x0C,0x0E,0x1C,0x3F,0x0F,0x03,0x00,0x04,
0x04,0x87,0xCF,0x9F,0xFF,0xFE,0xFC,0xF8,
0xF8,0xFC,0xFE,0xFE,0xFF,0xFF,0xFF,0xFF,
0xFF,0xFD,0xFF,0xFF,0xFF,0xDF,0xCF,0x1F,
0x3F,0x3F,0x13,0x03,0x01,0x10,0x1C,0x0C,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x80,0x80,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x90,0xF8,0xF8,0xF8,0xF8,0xF8,0xCC,
0xE0,0xF0,0xF8,0xF8,0xF8,0xFC,0xFC,0xFE},
{0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
0xFF,0xFF,0xFF,0xFF,0xF8,0xF0,0xE0,0xE0,
0xC0,0x80,0x00,0x00,0x00,0x80,0xC0,0xC0,
0xE0,0xE0,0xC0,0xE0,0xF0,0xFC,0xFE,0xFE,
0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
0xFF,0xFF,0xFF,0x3F,0x1F,0x09,0x01,0x00,
0x04,0x06,0x06,0x06,0x0E,0x1C,0x1E,0x18,
0x1C,0x18,0x19,0x19,0x01,0x03,0x00,0x00,
0x00,0x07,0x46,0x00,0x00,0x80,0x80,0x80,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x84,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0,0x0,0x0,0x00,0x0,
0x0,0x0,0x0,0x0,0x0,0x0,0x00,0x0,
0x0,0x0,0x0,0x0,0x0,0x0,0x00,0x0,
0x0,0x0,0x0,0x0,0x0,0x0,0x00,0x0,
0x0,0x0,0x0,0x0,0x0,0x0,0x00,0x0}
};
/**MAIN FUCNTION**/
void main()
{
unsigned char i,sel=0;
DDRD.2=0;
DDRD.3=0;
DDRD.4=0;
DDRD.5=0;
DDRD.6=0;
DDRB.1=0;
DDRB.2=0;
DDRB.3=0;
DDRB.4=0;
strcpyf(Time[6],charset[10]); //':'
strcpyf(Time[9],charset[10]);
strcpyf(Time[15],charset[11]); //'/'
strcpyf(Time[18],charset[11]);
rtc_write(0x00,0x00); //RTC WRITE FUNCTION CALLING
while(1)
{
graph3(); // WORLD MAP
if(sw1==0)
{
}
else if(sw2==0)
{
graph0(); //DISPLAY COLLEGE NAME
delay_ms(5000);
}
else if(sw3==0)
{
}
else if(sw4==0)
{
while(1) //DISPLAY ALL IMAGES CONTINOUSLY
{
graph2();
delay_ms(3000);
graph0();
delay_ms(3000);
graph1();
delay_ms(3000);
}
}
//DISPLAY TIME
strcpyf(Time[0],charset[13]);
strcpyf(Time[1],charset[14]);
strcpyf(Time[2],charset[15]);
strcpyf(Time[3],charset[16]);
i = rtc_read(0x02); //hours
i = rtc_read(0x01); //min
strcpyf(Time[7],charset[i >> 4]);
strcpyf(Time[8],charset[i & 0x0F]);
i = rtc_read(0x00); //sec
strcpyf(Time[10],charset[i >> 4]);
strcpyf(Time[11],charset[i & 0x0F]);
i = rtc_read(0x04); // date
strcpyf(Time[13],charset[i >> 4]);
strcpyf(Time[14],charset[i & 0x0F]);
i = rtc_read(0x05); //month
strcpyf(Time[16],charset[i >> 4]);
strcpyf(Time[17],charset[i & 0x0F]);
i = rtc_read(0x06); //year
strcpyf(Time[19],charset[i >> 4]);
strcpyf(Time[20],charset[i & 0x0F]);
display_lcd();
if(SEL == 0 )
{
strcpyf(Time[0],charset[16]); //'E'
strcpyf(Time[1],charset[17]); //'D'
strcpyf(Time[2],charset[14]); //'I'
strcpyf(Time[3],charset[13]); //'T'
strcpyf(Time[6],charset[10]); //'10'
strcpyf(Time[9],charset[10]);
strcpyf(Time[4],charset[0]); //'0'
strcpyf(Time[5],charset[0]);
strcpyf(Time[7],charset[0]);
strcpyf(Time[8],charset[0]);
strcpyf(Time[10],charset[0]);
strcpyf(Time[11],charset[0]);
display_lcd();
if(sel==0)
edit_hr();
delay_ms(1);
} //filling the array time it includes TIME :and hours:min:sec which read from rtc
delay_ms(100);
}
}
/**EDIT HOURS FUNCTION**/
void edit_hr()
{
unsigned char j=0,temp;
strcpyf(Time[0],charset[18]); //'H'
strcpyf(Time[1],charset[19]); //'O'
strcpyf(Time[2],charset[20]); //'U'
strcpyf(Time[3],charset[21]); //'R'
do
{
if(INC==0)
j++;
if(DEC==0)
j--;
if(j<=9)
{
strcpyf(Time[5],charset[j]);
}
if(j>9 && j<=19)//above 9 and below 20
{
strcpyf(Time[4],charset[1]);
strcpyf(Time[5],charset[j-10]);
}
if(j>19 && j<=24)//above20
{
strcpyf(Time[4],charset[2]);
strcpyf(Time[5],charset[j-20]);
}
if(j>24)
{
j=0;
strcpyf(Time[4],charset[0]);
strcpyf(Time[5],charset[0]);
}
display_lcd();
delay_ms(100);
}while(SEL==1);
if(j!=0)
{
temp=j%10;
j=j/10;
j=j<<4;
temp=temp|j;
rtc_write(0x02,temp);
delay_ms(100);
}
edit_min();
}
strcpyf(Time[0],charset[22]); //'M'
strcpyf(Time[1],charset[23]); //'I'
strcpyf(Time[2],charset[24]); //'N'
strcpyf(Time[3],charset[25]);//'S'
do
{
if(INC==0)
j++;
if(DEC==0)
j--;
if(j<=9)
{
strcpyf(Time[8],charset[j]);
}
if(j>9 && j<=19)//above 9 and below 20
{
strcpyf(Time[7],charset[1]);
strcpyf(Time[8],charset[j-10]);
}
if(j>19 && j<=29)//above20
{
strcpyf(Time[7],charset[2]);
strcpyf(Time[8],charset[j-20]);
}
if(j>29 && j<=39)//above20
{
strcpyf(Time[7],charset[3]);
strcpyf(Time[8],charset[j-30]);
}
if(j>29 && j<=39)//above20
{
strcpyf(Time[7],charset[3]);
strcpyf(Time[8],charset[j-30]);
}
if(j>39 && j<=49)//above20
{
strcpyf(Time[7],charset[4]);
strcpyf(Time[8],charset[j-40]);
strcpyf(Time[7],charset[5]);
strcpyf(Time[8],charset[j-50]);
if(j==60)
{
j=0;
strcpyf(Time[7],charset[6]);
strcpyf(Time[8],charset[0]);
}
display_lcd();
delay_ms(100);
}while(SEL==1);
if(j!=0)
{
temp=j%10;
j=j/10;
j=j<<4;
temp=temp|j;
rtc_write(0x01,temp);
delay_ms(100);
}
edit_date();
}
strcpyf(Time[0],charset[17]); //'D'
strcpyf(Time[1],charset[17]);
strcpyf(Time[2],charset[17]);
strcpyf(Time[3],charset[17]);
do
{
if(INC==0)
j++;
if(DEC==0)
j--;
if(j<=9)
{
strcpyf(Time[13],charset[0]);
strcpyf(Time[14],charset[j]);
}
if(j>9 && j<=19)//above 9 and below 20
{
strcpyf(Time[13],charset[1]);
strcpyf(Time[14],charset[j-10]);
}
if(j>19 && j<=29)//above20
{
strcpyf(Time[13],charset[2]);
strcpyf(Time[14],charset[j-20]);
}
if(j==30)
{
j=0;
strcpyf(Time[13],charset[3]);
strcpyf(Time[14],charset[0]);
}
display_lcd();
delay_ms(100);
}while(SEL==1);
if(j!=0)
{
temp=j%10;
j=j/10;
j=j<<4;
temp=temp|j;
rtc_write(0x04,temp);
delay_ms(100);
}
edit_month();
}
strcpyf(Time[0],charset[15]); //'M'
strcpyf(Time[1],charset[15]);
strcpyf(Time[2],charset[15]);
strcpyf(Time[3],charset[15]);
do
{
if(INC==0)
j++;
if(DEC==0)
j--;
if(j<=9)
{
strcpyf(Time[16],charset[0]);
strcpyf(Time[17],charset[j]);
}
if(j>9 && j<=12)//above 9 and below 20
{
strcpyf(Time[16],charset[1]);
strcpyf(Time[17],charset[j-10]);
}
display_lcd();
delay_ms(100);
if(j>12)
j=0;
}while(SEL==1);
if(j!=0)
{
temp=j%10;
j=j/10;
j=j<<4;
temp=temp|j;
rtc_write(0x05,temp);
delay_ms(100);
}
edit_year();
}
strcpyf(Time[0],charset[26]); //'Y'
strcpyf(Time[1],charset[26]);
strcpyf(Time[2],charset[26]);
strcpyf(Time[3],charset[26]);
do
{
if(INC==0)
j++;
if(DEC==0)
j--;
if(j<=9)
{
strcpyf(Time[19],charset[0]);
strcpyf(Time[20],charset[j]);
}
if(j>9 && j<=19)//above 9 and below 20
{
strcpyf(Time[19],charset[1]);
strcpyf(Time[20],charset[j-10]);
}
if(j>19 && j<=29)//above20
{
strcpyf(Time[19],charset[2]);
strcpyf(Time[20],charset[j-20]);
}
if(j==30)
{
j=0;
strcpyf(Time[19],charset[3]);
strcpyf(Time[20],charset[0]);
}
display_lcd();
delay_ms(100);
}while(EXIT==1);
if(j!=0)
{
temp=j%10;
j=j/10;
j=j<<4;
temp=temp|j;
rtc_write(0x06,temp);
delay_ms(100);
}
}
for(j=0;j<21;j++)
{
writecmd(0xBF);
for(i=0;i<6;i++)
{
temp = (j * 6) + i;
RS = 0;
CS1 = 1;
CS2 = 1; // CS1 AND CS2(P1.23 and P1.24) are enabled.
bus = G_lcd;
LCD_EN = 1; // E->SET.
LCD_EN = 0; // E->CLR.
}
RS = 1;
bus = ch;
LCD_EN = 1;
LCD_EN = 0;
}
CS1 = 1;
CS2 = 1; // CS1 AND CS2(P1.23 and P1.24) are enabled.
for(i=0xb8;i<0xc0;i++)
{
writecmd(i); // Select Pages.
writecmd(0x40);
for (y=0;y<64;y++)
writedata(0x00); // Clear data in the LCD.
}
}
for(j=0;j<8;j++)
{
writecmd(0xB8+j);
writecmd(0x40);
for(i=0;i<128;i++)
{
if(i==64)
{
CS2 = 1; //PAGE 2 IS SELECGTED
CS1 = 0; //PAGE 1 IS DISABLE.
}
writedata(arr0[j][i]);
}
}
}
for(j=0;j<8;j++)
{
writecmd(0xB8+j);
writecmd(0x40);
for(i=0;i<128;i++)
{
if(i==64)
{
CS2 = 1; //PAGE 2 IS SELECGTED
CS1 = 0; //PAGE 1 IS DISABLE.
}
writedata(arr1[j][i]);
}
}
}
for(j=0;j<8;j++)
{
writecmd(0xB8+j);
writecmd(0x40);
for(i=0;i<128;i++)
{
if(i==64)
{
CS2 = 1; //PAGE 2 IS SELECGTED
CS1 = 0; //PAGE 1 IS DISABLE.
}
writedata(arr2[j][i]);
}
}
}
for(j=0;j<8;j++)
{
writecmd(0xB8+j);
writecmd(0x40);
CS1 = 1; // PAGE 1 IS SELECGTED.
CS2 = 0; // PAGE 2 IS DISABLE.
for(i=0;i<128;i++)
{
if(i==64)
{
CS2 = 1; //PAGE 2 IS SELECGTED
CS1 = 0; //PAGE 1 IS DISABLE.
}
writedata(arr3[j][i]);
}
}
}
REFERCENCE
TEXT BOOKS REFERED:
1. “The 8051 Microcontroller and Embedded Systems” by Muhammad Ali Mazidi and Janice Gillispie
Mazidi, Pearson Education.
WEBSITES VIEWED:
www.atmel.com
www.beyondlogic.org
www.dallassemiconductors.com
www.maxim-ic.com
www.alldatasheets.com
www.howstuffworks.com