Professional Documents
Culture Documents
INTRODUCTION
1.1 INTRODUCTION TO EMBEDDED SYSTEMS
1
2. PROJECT DESCRIPTION
2
appliance load and to a dual timer circuit. A first timer in the circuit is immediately
energized causing a first indicator to represent an on state to the user
AT89S52
Reset 9
P2^3-P2^7 Ds1307 Crystal
RTC
Crystal
XTAL1, XTAL2
Back-up
Battery
+12V to Relay
3
Fig 2.2.1 Basic block diagram of “TIME BASED ELECTRICAL APPLIANCES
CONTROL IN INDUSTRIES”.
Power supply
The simplest DC power supply circuit consists of a single diode and resistor in series
with the AC supply.
• The Transformer
• The Rectifier
• The Filter
4
Usually steps up or step down the incoming line voltage depending on the
needs of the power supply. This alternating voltage is then fed to the rectifier.
I s a diode circuit that converts the ac to pulsating dc. This pulsating dc is then
applied to the filter.
Filter is a circuit that reduces the variations of the in the dc voltage. It can
include one or several passive
5
The back-up used here is of 3v which is used provide back-up for RTC in
times of power failure
2.3.7 Crystal
A reset circuit is like a switch which is used reset the circuit. It is connected to
pin 9 of the controller.
2.3.9 Relays
6
FIG 2.3.1 Basic relay
3. HARDWARE DESCRIPTION
AC/ DC supply
7
or DC mains, often without using a transformer. The power supply consisted of a
rectifier and a capacitor filter. The rectifier was essentially a conductor, having no
sudden effect when operating from DC.
Overload Protection
230V
Step Down Rectifier
AC Filter
Mains Transformer
12v dc
Regulator Filter 12V
8
3.1.2 Transformers
The first component of the power supply is the transformer. Using magnetic
coupling between windings, the transformer is used to isolate the rectifier from the
mains voltage, and to reduce the voltage to something the regulator can tolerate. The
primary winding will be rated at 220 0V AC and the secondary will be a more user
friendly (or less user hostile) voltage to suit the application.
Mains variations: These occur in all situations, and the mains voltage at any point in
time will usually be somewhat different from the nominal voltage quoted by the
supplier. Any variation of 10% or less can be considered "normal", and greater
variations are not at all uncommon.
Losses: Since all transformers have losses, these cannot be ignored in the design
phase. Magnetizing loss (AKA iron loss) is the current that is required to maintain the
design value of magnetic flux in the transformer core. There is nothing you can do to
affect this loss, as it is dependent on the size of the core and the design criteria of the
manufacturer. Large transformers will have a larger magnetising loss than small ones,
but will be less affected by it due to the larger surface area which allows the
transformer to remain cool at no load. Small transformers have a greater loss per VA
than bigger ones, and this is one of the reasons that small transformers run quite warm
even when unloaded.
The iron losses are greatest at no-load and fall as more current is drawn from the
transformer. Copper losses are caused by the resistance of the winding, and are
negligible at no load, and rise with increasing output current. There is a fine balance
between iron and copper losses during transformer design. A relatively high iron loss
means that copper losses will be reduced (thus improving regulation), but if too high,
the transformer will overheat with no load. A full description of the magnetising
current and its effect on regulation is outside the scope of this article, and since there
is little you can do about it, it shall be discussed no further.
Mains noise: Noise can easily get through a transformer, both in transverse and
common modes. Transverse noise is any noise or waveform distortion that is
effectively superimposed on the incoming AC waveform, and this is coupled through
the transformer along with the wanted signal - the mains.
Common mode noise is any noise signal that is common to both the active
(hot) and neutral mains leads. This is not coupled through the transformer
magnetically, but capacitive. The higher the capacitance between primary and
secondary windings, the more common mode noise will get through to the amplifier.
9
The much loved toroidal transformer is much worse than conventional "EI" (Ee-Eye)
lamination transformers in this respect because of the large inter-winding capacitance.
An electrostatic shield will help, but these are uncommon in mass produced toroidal
transformers. The conventional transformer is usually better, and by using side-by-
side windings instead of the more common (and cheaper) concentric windings,
common mode noise can be reduced by an order of magnitude.
Input mains filters can remove either form of high frequency noise component
to some degree, and large spikes can be removed using Metal Oxide Varsities
(MOVs) that effectively short circuit the noise pulse, reducing it to a level that is
(hopefully) inaudible. Contrary to the beliefs of some, there is no panacea for noise,
and it is best attacked in the equipment, rather than the now popular (but mainly
misconceived) notion that an expensive mains lead will cure all.
3.1.3 Rectifiers:
The second block of the power supply is the rectifier block. The most
common rectifiers are...
The full wave voltage doubler is still common in valve amplifier circuits and for
preamp supplies.
The bridge rectifier is the most commonly used rectifier circuit for the
following reasons:
• No centre - tapped transformer is required.
• The bridge rectifier produces almost double the output voltage as a full wave
C-T transformer rectifier using the same secondary voltage
10
Fig 3.1.2 The Bridge rectifier
During the positive half cycle, both D1 and D3 are forward biased. At
the same time, both D2 and D4 are reverse biased. Note the direction of current flow
through the load. On the negative half cycle, D2 and D4 are forward biased and D1
and D3 are reverse biased. Again note that direction of current through the load is in
the same direction although the secondary winding polarity has reversed.
3.14 Regulators:
Very many devices need well regulated power. The most typical
approach used electronics devices is to use a transformers that work directly from the
domestic electricity supply at 60 Hz (in the U.S.A, 50 Hz in some other countries)and
this is followed by rectifier + regulator circuitry that uses linear regulation. In this
type of regulator a transistor, or a special IC, is used as a series resistor whose value
of resistance is controlled so as to maintain the output voltage constant despite
variations in load. This work well, is quite simple to make, but is quite inefficient as a
lot of power is wasted as heat (wasted heat is define by formula: drop voltage over
regulator (volts) * current taken (in amperes) = power loss (in watts)).Linear
regulation works very well in low power applications where some lost heat is no
problem (in higher power applications switched more power supplies are nowadays
preferred because of less wasted power).
3.1.5 Filters
11
Three-level Program Memory Lock
256 x 8-bit Internal RAM
32 Programmable I/O Lines
Three 16-bit Timer/Counters
Eight Interrupt Sources
Full Duplex UART Serial Channel
Low-power Idle and Power-down Modes
Interrupt Recovery from Power-down Mode
Watchdog Timer
Dual Data Pointer
Power-off Flag
3.2.1 Description:
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 interrupt or hardware reset.
12
Fig 3.2.1 Microcontroller
13
AT
89S52
• VCC
Supply voltage.
14
• GND
Ground.
• Port 0
Port 0 is an 8-bit open drain bidirectional I/O port. As an output port, each pin
can sink eight TTL inputs. When 1s are written to port 0 pins, the pins can be used as
high impedance
Inputs. Port 0 can also be configured to be the multiplexed low order address/data bus
during accesses to external program and data memory. In this mode, P0 has internal
pull-ups.Port 0 also receives the code bytes during Flash programming and outputs
the code bytes during program verification. External pull-ups are required during
program verification.
clock-out
• Port 1
Port 1 is an 8-bit bidirectional I/O port with internal pullups. The Port 1 output
buffers can sink/source four TTL inputs. When 1s are written to Port 1 pins, they are
15
pulled high by the internal pullups and can be used as inputs. As inputs, Port 1 pins
that are externally being pulled low will source current (IIL) because of the internal
pullups.
In addition, P1.0 and P1.1 can be configured to be the timer/counter 2 external count
input (P1.0/T2) and the timer/counter 2 trigger input (P1.1/T2EX), respectively, as
shown in the following table. Port 1 also receives the low-order address bytes during
Flash programming and verification.
• Port 2
Port 2 is an 8-bit bidirectional I/O port with internal pullups. The Port 2 output
buffers can sink/source four TTL inputs. When 1s are written to Port 2 pins, they are
pulled high by the internal pullups and can be used as inputs. As inputs, Port 2 pins
that are externally being pulled low will source current (IIL) because of the internal
pullups. Port 2 emits the high-order address byte during fetches from external
program memory and during accesses to external data memory that use 16-bit
addresses (MOVX @ DPTR). In this application, Port 2 uses strong internal pull-ups
when emitting 1s. During accesses to external data memory that use 8-bit addresses
(MOVX @ RI), Port 2 emits the contents of the P2 Special Function Register. Port 2
also receives the high-order address bits and some control signals during Flash
programming and verification.
• RST
Reset input. A high on this pin for two machine cycles while the oscillator
is running resets the device. This pin drives High for 96 oscillator periods after the
Watchdog times out. The DISRTO bit in SFR AUXR (address 8EH) can be used to
disable this feature. In the default state of bit DISRTO, the RESET HIGH out feature
is enabled.
• Port 3
Port 3 is an 8-bit bidirectional I/O port with internal pullups. The Port 3
output buffers can sink/source four TTL inputs. When 1s are written to Port 3 pins,
they are pulled high by the internal pull-ups and can be used as inputs. As inputs, Port
3 pins that are externally being pulled low will source current (IIL) because of the
pull-ups. Port 3 also serves the functions of various special features of the AT89S52,
as shown in the following table. Port 3 also receives some control signals for Flash
programming and verification
16
Port Pin Alternate Functions
17
Table 3.2.2 Pin configuration for port3
• ALE/PROG
Address Latch Enable (ALE) is an output pulse for latching the low byte
of the address during accesses to external memory. This pin is also the program pulse
input (PROG) during Flash programming. In normal operation, ALE is emitted at a
constant rate of 1/6 the oscillator frequency and may be used for external timing or
clocking purposes. Note, however, that one ALE pulse is skipped during each access
to external data memory. If desired, ALE operation can be disabled by setting bit 0 of
SFR location 8EH. With the bit set, ALE is active only during a MOVX or MOVC
instruction. Otherwise, the pin is weakly pulled high. Setting the ALE-disable bit has
no effect if the microcontroller is in external execution mode.
• PSEN
Program Store Enable (PSEN) is the read strobe to external program
memory. When the AT89S52 is executing code from external program memory,
PSEN is activated twice each machine cycle, except that two PSEN activations are
skipped during each access to external data memory.
18
Fig 3.2.3 Architecture of AT 89S52
• EA/VPP
19
External Access Enable. EA must be strapped to GND in order to enable
the device to fetch code from external program memory locations starting at 0000H
up to FFFFH. Note, however, that if lock bit 1 is programmed, EA will be internally
latched on reset. EA should be strapped to VCC for internal program executions. This
pin also receives the 12-volt programming enable voltage
(VPP) during Flash programming.
• XTAL1
Input to the inverting oscillator amplifier and input to the internal clock
operating circuit.
• XTAL2
A map of the on-chip memory area called the Special Function Register
(SFR) space is shown in Table 1.
Note that not all of the addresses are occupied, and unoccupied
addresses may not be implemented on the chip. Read accesses to these addresses will
in general return random data, and write accesses will have an indeterminate effect.
User software should not write 1s to these unlisted locations, since they may be used
in future products to invoke new features. In that case, the reset or inactive values of
the new bits will always be 0.
Timer 2 Registers:
• Interrupt Register
The individual interrupt enable bits are in the IE register. Two priorities
can be set for each of the six interrupt sources in the IP register.
• Memory Organization
MCS-51 devices have a separate address space for Program and Data
Memory. Up to 64K bytes each of external Program and Data Memory can be
addressed.
20
• Program Memory
Data Memory
The AT89S52 implements 256 bytes of on-chip RAM. The upper 128
bytes occupy a parallel address space to the Special Function Registers. This means
that the upper 128 bytes have the same addresses as the SFR space but are physically
separate from SFR space. When an instruction accesses an internal location above
address 7FH, the address mode used in the instruction specifies whether the CPU
accesses the upper 128 bytes of RAM or the SFR space. Instructions which use direct
addressing access of the SFR space. For example, the following direct addressing
instruction accesses the SFR at location 0A0H (which is P2). MOV 0A0H, #data
Instructions that use indirect addressing access the upper 128 bytes of RAM. For
example, the following indirect addressing instruction, where R0 contains 0A0H,
accesses the data byte at address 0A0H, rather than P2 (whose address is 0A0H).
MOV @R0, #data Note that stack operations are examples of indirect addressing, so
the upper 128 bytes of data RAM are available as stack space.
• TIMERS
Both Timer 0 and timer 1 are 16 bits wide. Since the 89s52 has an 8-bit
architecture, each 16-bit timer is accessed as two separate registers of low byte and
high byte.
• Timer 0 registers
The 16-bit register of timer 0 is accessed as low byte and high byte.
The low byte register is called TLO(Timer 0 low byte)and the high byte register is
referred to as TH0(Timer 0 high byte).These registers can be accessed like any other
registers, such as A,B,R0,R1,R2,etc.For example, the instruction “MOV TLO,#4FH”
moves the value 4FH into TLO, the low byte of timer 0.
• Timer1 registers
Timer 1 is also 16 bits, and its 16-bit register is split into two bytes
• Timer 2
21
Timer 2 is a 16-bit Timer/Counter that can operate as either a timer or
an event counter. The type of operation is selected by bit C/T2 in the SFR T2CON
(shown in Table 2). Timer 2 has three operating modes: capture, auto-reload (up or
down counting), and baud rate generator. The modes are selected by bits in T2CON,
as shown in Table 3. Timer 2 consists of two 8-bit registers, TH2 and TL2. In the
Timer function, the TL2 register is incremented every machine cycle. Since a machine
cycle consists of 12 oscillator periods, the count rate is 1/12 of the oscillator
frequency.
0 0 1 16-bit Auto-
reload
0 1 1 16-bit Capture
1 X 1 Baud Rate
Generator
X X 0 (Off)
Since two machine cycles (24 oscillator periods) are required to recognize a 1-
to-0 transition, the maximum count rate is 1/24 of the oscillator frequency. To ensure
that a given level is sampled at least once before it changes, the level should be held
for at least one full machine cycle.
Timer 2 is selected as the baud rate generator by setting TCLK and/or RCLK
in T2CON (Table 2). Note that the baud rates for transmit and receive can be different
if Timer 2 is used for the receiver or transmitter and Timer 1 is used for the other
function. Setting RCLK and/or TCLK puts Timer 2 into its baud rate generator mode,
as shown in Figure 8.
The baud rate generator mode is similar to the auto-reload mode, in that a rollover in
TH2 causes the Timer 2 registers to be reloaded with the 16-bit value in registers
RCAP2H and RCAP2L, which are preset by software. The baud rates in Modes 1 and
3 are determined by Timer 2’s overflow rate according to the following equation.
22
Modes 1 and 3 Baud Rates = Timer2 Overflow Rate
16
The Timer can be configured for either timer or counter operation. In most
applications, it is configured for timer operation (CP/T2 = 0). The timer operation is
different for Timer 2 when it is used as a baud rate generator. Normally, as a timer, it
increments every machine cycle (at 1/12 the oscillator frequency). As a baud rate
generator, however, it increments every state time (at 1/2 the oscillator
frequency).The baud rate formula is given below.
Where (RCAP2H, RCAP2L) is the content of RCAP2H and RCAP2L taken as a 16-
bit unsigned integer.
• Interrupts
• Oscillator Characteristics
23
• Idle Mode
In idle mode, the CPU puts itself to sleep while all the on chip
peripherals remain active. The mode is invoked by software. The content of the on-
chip RAM and all the special functions registers remain unchanged during this mode.
The idle mode can be terminated by any enabled
Interrupt or by hardware reset. Note that when idle mode is terminated by a
hardware reset, the device normally resumes program execution from where it left off,
up to two machine cycles before the internal reset algorithm takes control. On-chip
hardware inhibits access to internal RAM in this event, but access to the port pins is
not inhibited. To eliminate the possibility of an unexpected write to a port pin when
idle mode is terminated by a reset, the instruction following the one that invokes idle
mode should not write to a port pin or to external memory.
• Power-down Mode
The AT89S52 is shipped with the on-chip Flash memory array ready
to be programmed.The programming interface needs a high-voltage (12-volt) program
enable signal and is compatible with conventional third-party Flash or EPROM
programmers. The AT89S52 code memory array is programmed byte by byte.
• Programming Algorithm
• Steps
o .Input the desired memory location on the address Lines.
o Input the appropriate data byte on the data lines.
o Activate the correct combination of control signals.
o Raise EA/VPP to 12V.
o Pulse ALE/PROG once to program a byte in the Flash array or the lock bits.
The byte-write cycle is self-timed and typically takes no more than 50 μs.
Repeat steps 1 through 5, changing the address and data for the entire array or
until the end of the object file is reached
.
• Data Polling
24
The AT89S52 features Data Polling to indicate the end of a byte write
cycle. During a write cycle, an attempted read of the last byte written will result in the
complement of the written data on P0.7. Once the write cycle has been completed,
true data is valid on all outputs, and the next cycle may begin. Data Polling may begin
any time after a write cycle has been initiated.
The three control lines are referred to as EN, RS, and RW.
The EN line is called "Enable." This control line is used to tell the LCD
that we are sending data to the LCD. To send data to the LCD, our program should
make sure this line is low (0) and then set the other two control lines and/or put data
on the data bus. When the other lines are completely ready, we bring EN high (1) and
wait for the minimum amount of time required by the LCD datasheet (this varies from
LCD to LCD), and end by bringing it low (0) again.
The RS line is the "Register Select" line. When RS is low (0), the data is
to be treated as a command or special instruction (such as clear screen, position
cursor, etc.). When RS is high (1), the data being sent is text data which sould be
displayed on the screen. For example, to display the letter "T" on the screen we would
set RS high.
The RW line is the "Read/Write" control line. When RW is low (0), the
information on the data bus is being written to the LCD. When RW is high (1), the
program is effectively querying (or reading) the LCD. Only one instruction ("Get
LCD status") is a read command. All others are write commands--so RW will almost
25
always be low.Finally, the data bus consists of 4 or 8 lines (depending on the mode of
operation selected by the user). In the case of an 8-bit data bus, the lines are referred
to as DB0, DB1, DB2, DB3, DB4, DB5, DB6, and DB7.
AT89S52s
26
3.4 CRYSTAL
A crystal is a solid in which the constituent atoms, molecules, or ions are packed in a
regularly ordered, repeating pattern extending in all three spatial dimensions
3.5 RELAYS
Relays allow one circuit to switch a second circuit which can be completely separate
from the first. For example a low voltage battery circuit can use a relay to switch a
27
230V AC mains circuit. There is no electrical connection inside the relay between the
two circuits, the link is magnetic and mechanical.
The coil of a relay passes a relatively large current, typically 30mA for a 12V
relay, but it can be as much as 100mA for relays designed to operate from lower
voltages. Most ICs (chips) cannot provide this current and a transistor is usually used
to amplify the small IC current to the larger value required for the relay coil. The
maximum output current for the popular 555 timer IC is 200mA so these devices can
supply relay coils directly without amplification. Relays are usually SPDT or DPDT
but they can have many more sets of switch contacts, for example relays with 4 sets of
changeover contacts are readily available. For further information about switch
contacts and the terms used to describe them please see the page on switches. Most
relays are designed for PCB mounting but you can solder wires directly to the pins
providing you take care to avoid melting the plastic case of the relay.
The supplier's catalogue should show you the relay's connections. The coil
will be obvious and it may be connected either way round. Relay coils produce brief
high voltage 'spikes' when they are switched off and this can destroy transistors and
ICs in the circuit. To prevent damage you must connect a protection diode across the
relay coil.
The animated picture shows a working relay with its coil and switch
contacts. You can see a lever on the left being attracted by magnetism when the coil is
switched on. This lever moves the switch contacts. There is one set of contacts
(SPDT) in the foreground and another behind them, making the relay DPDT.
The relay's switch connections are usually labeled COM, NC and NO:
4. SOFTWARE DESIGN
28
4.1 OVERVIEW OF KIEL COMPILER
\
It is possible to create the source files in a text editor such as
Notepad, run the Compiler on each C source file, specifying a list of controls, run the
Assembler on each Assembler source file, specifying another list of controls, run
either the Library Manager or Linker (again specifying a list of controls) and finally
running the Object-HEX Converter to convert the Linker output file to an Intel Hex
File. Once that has been completed the Hex File can be downloaded to the target
hardware and debugged. Alternatively KEIL can be used to create source files;
automatically compile, link and covert using options set with an easy to use user
interface and finally simulate or perform debugging on the hardware with access to C
variables and memory. Unless you have to use the tolls on the command line, the
choice is clear. KEIL Greatly simplifies the process of creating and testing an
embedded application.
4.2 PROJECTS
29
The Keil Software AT 89S52 development tools listed below are the
programs you use to compile your C code, assemble your assembler source files, link
your program together, create HEX files, and debug your target program. µVision2
for Windows™ Integrated Development Environment: combines Project
Management, Source Code Editing, and Program Debugging in one powerful
environment.
C51 ANSI Optimizing C Cross Compiler: creates relocatable object modules from
your C source code,
A project manager.
A make facility.
Tool configuration.
Editor.
A powerful debugger. To help you get started, several example programs (located
in the \C51\Examples, C251\Examples, \C166\Examples, and
\ARM\...\Examples) are provided.
HELLO is a simple program that prints the string "Hello World" using the Serial
Interface.
MEASURE is a data acquisition system for analog and digital systems.
TRAFFIC is a traffic light controller with the RTX Tiny operating system.
SIEVE is the SIEVE Benchmark.
DHRY is the Dhrystone Benchmark
5. SOURCE CODE
30
#include<REG52.h>
#include<stdio.h>
sbit sda=P2^5;
sbit scl=P2^4;
sbit LED=P0^3;
sbit LED1=P0^4;
sbit LED2=P0^6;
sbit LED3=P0^7;
sbit FAN=P0^0;
void start(void);
void stop();
void writeack();
void readack();
void noack();
void lcd_init();
void voltage();
31
sbit rw = P3^1;// rw pin of lcd
void main()
LED=1;
LED1=1;
LED2=1;
LED3=1;
FAN=0;
lcd_init();
lcdcmd(0x80);
for(i=0;i<5;i++)
lcddata(a[i]);
start();
sda=1;
writeack();
sda=1;
32
writeack();
writebyte(0x00); // seconds
sda=1;
writeack();
writebyte(0x00); // minutes
sda=1;
writeack();
writebyte(0x10); // hours
sda=1;
writeack();
stop();
do{
c=0;
start();
sda=1;
writeack();
writebyte(0x00); // 00 location
sda=1;
writeack();
delay(0);
start();
writeack();
while(c<6)
33
{
k[c]=readbyte();
readack();
c++;
k[c]=readbyte();
noack();
stop();
lcdcmd(0x86);
hex2ascii(k[2]); // hours
lcddata(':');
hex2ascii(k[1]); // minutes
lcddata(':');
hex2ascii(k[0]); // seconds
LED=0;
voltage();
lcddata('0');
lcddata('2');
lcddata('V');
LED1=0;
34
voltage();
lcddata('0');
lcddata('4');
lcddata('V');
LED2=0;
voltage();
lcddata('0');
lcddata('6');
lcddata('V');
LED3=0;
voltage();
lcddata('0');
lcddata('8');
lcddata('V');
LED3=1;
voltage();
35
lcddata('0');
lcddata('6');
lcddata('V');
LED2=1;
voltage();
lcddata('0');
lcddata('4');
lcddata('V');
LED3=0;
voltage();
lcddata('0');
lcddata('6');
lcddata('V');
LED=1;
LED1=1;
LED3=1;
36
FAN=1;
voltage();
lcddata('1');
lcddata('0');
lcddata('V');
FAN=0;
voltage();
lcddata('0');
lcddata('0');
lcddata('V');
} while(1);
void voltage()
unsigned char i;
lcdcmd(0xc0);
for(i=0;i<9;i++)
lcddata(vol[i]);
37
}
void start()
scl=1; // clock
sda=0;
delay(0);
scl=0;
void stop()
sda=0;
delay(0);
scl=1;
delay(0);
sda=1;
while(j<8)
k=i;
38
k=(k<<j)+0x80;
sda=CY;
scl=1;
scl=0;
++j;
bit d1;
sda=1;
while(j<8)
scl=1;
delay(0);
d1=sda;
i=i<<1;
i=i|d1;
delay(0);
scl=0;
++j;
return i;
39
void writeack()
delay(0);
scl=1;
while(sda);
scl=0;
void readack()
sda=0;
scl=1;
delay(1);
scl=0;
void noack()
sda=1;
scl=1;
scl=0;
void lcd_init()
lcdcmd(0x38);
delay(50);
lcdcmd(0x0e);
40
delay(50);
lcdcmd(0x06);
delay(50);
lcdcmd(0x01);
delay(50);
P1 = value;
rs = 0;
rw = 0;
en = 1;
delay(1);
en = 0;
return;
P1 = value;
rs = 1;
rw = 0;
en = 1;
delay(1);
en = 0;
return;
41
}
for(i =0 ;i<ti;i++)
for(j=0 ;j<1275;j++);
k=i;
k=k&0x0f;
j=k|0x30;
k=i;
i=0;
k=k&0xf0;
k=k>>4;
k=k|0x30;
delay(1);
lcddata(k);
delay(1);
lcddata(j);
6. RESULT ANALYSIS
42
A time based electrical appliance control system is used to switch on and off
the electrical appliances automatically, i.e. after a predetermined time. This eliminates
manual switching.
1. 1 LED1 2V 10:00:00
When the power is turned on first electrical appliance is turned the display on
the LCD is
Time 10:00:10
voltage 2V
Time 10:00:20
voltage 4V
After a predetermined time i.e. as in our project third electrical is also turned
on. then the display on the LCD is
Time 10:00:30
voltage 6V
43
Table LCD display in third instant of time
Time 10:00:40
voltage 8V
After a predetermined time i.e. as in our project fourth electrical is turned off
Then the display on the LCD is
Time 10:00:50
voltage 6V
After a predetermined time i.e. as in our project third electrical is also turned
off. Then the display on the LCD is
Time 10:01:00
voltage 4V
After a predetermined time i.e. as in our project third electrical is also turned
on. then the display on the LCD is
Time 10:01:10
voltage 6V
After a predetermined time i.e. as in our project fifth electrical is also turned
on. then the display on the LCD is
Time 10:01:10
voltage 10V
After a predetermined time all electrical appliances are turned off and time on
LCD will be incrementing unless there is a power failure
7. APPLICATIONS
44
• Power Saving Using Time based Electrical Appliance Controlling System is
used in industries where we require different loads to be supplied in different
intervals of time.
• This project can also be used to switch off the air condition (A.C) and again
switch on after a predefined time and this can be repeated number of times
• Time based circuits are also used in shopping malls to automatically switch on
lights in side the shop and on the signboard in night hours. in some cases light
in shopping malls will be glowing continuously so, they we can switch on the
alternately.
• We have timer switches which are Programmable Time Switches
manufactured by us are useful for automatic functioning of electric
components like street lights, hoardings and glow signs etc. These switches
can be programmed to supply required amount of output for any electrical
devices. It can take load up to 3000 Amps.
• In communications systems timers are used to know the status of the massage.
• .Our time switch with LED display and accurate operation is widely used for
different applications. Our time switch can be operated at different voltage
range and can be mounted on the wall. Some of the salient features of our time
switch are as follows
8.1 ADVANTAGES
45
• In industries, there will be various loads to be operated and these loads are to
be operated at some specific intervals according to our requirements and also
based on the device’s constraints. For these purposes, a person should be
employed to monitor the status of the loads. But there may be chances that the
person may forget to operate these loads at defined intervals. So, we use this
project to automatically change loads according to the requirements.
• It has an Inbuilt Real Time Clock which tracks over the Real Time. When this
time equals to the programmed time, then the corresponding Relay for the
device is switched ON.
• This project uses a time based controller which supplies power to appliances
instead of manual operation thus resulting in reducing power wastage. This
project also reduces the risk factor because it is not easy to operate such high
loads in industries.
8.2 DISADVANTAGES:
• If the load requirements change than the pre-determined ones then the
controller has to be programmed again to the required timings. In order to
over this we need to have key pad to edit timings and load requirements
according to our future requirements.
9. FUTURE TRENDS
46
• This project can be expanded to find applications in area like providing
security and denying access to the unauthenticated users.
• This project in feature can be extended to the home automation systems.
Whre in if we want to switch on a water heater before retuning home from
a days work in\t can be automatically switched off.
• The disadvantage we have in this project is that if load requirements differ
than the pre determined ones then we can have keypad in the circuit which
can inrease or decrease the load requirements as we require.
• A time-based operation, as planned in the ATM future, is assumed to
affect the controllers’ Situation Awareness (SA) due to a higher priority of
meeting a time objective and increasing automation. This paper provides
SA requirements on the design of controller support tools in time-based
operations,
• Clothes in a future are made from organic textiles and can repair
themselves, .... This means that an appliance that provide flexibility in terms
of time and space ... power mat at the top of the table brings energy to any
electrical appliance.... The new GE dishwasher with integrated control panel
offers a stylish...
• In future we can extend this project to robots where human need not operate
the robot for the daily routine work it does.
• This system in future can be used in vehchiles if the vehicle is un moved for
some-time it may automatically turn-off. This saves fuel. This usually
happens in large traffic jams.
• This can be applied in future in many fields like communications, bio-
technology, bio-medical fields, and mechanical fields, electrical &
mechanical fields ……….. and so on.
10. CONCLUSION
47
Proper set of instructions that are suitable for a specific application
always leads to a better system. As search never stops “Still better” never dies. Still
better systems are always implemented with a small bit of intelligence
The advantage of using this project is power Saving Using Time Operated
Electrical Appliance Controlling System is a reliable circuit that takes over the task of
switch on/off the electrical devices with respect to time. This project replaces the
Manual Switching & there by it reduces the power consumption and it also the risk
factor .The added advantage of this project is that it is cost effective when compared
to different sensors applications
11. BIBLOGRAPHY
References
48
[1]. The AT 89S52 Microcontroller and Embedded Systems by M.A Mazidi & J.G
Mazidi, PHI, 2005.
WEBSITES
[2].www.atmel.com/dym/resources/prod_doccuments/doc1919.pdf
49