Professional Documents
Culture Documents
Smart energy saver system (SESS) is used in many applications for saving the energy in a smarter way like for light control in a room automatically micro controller also imparts smartness to the system. This project aims at design of SESS by AT89S52 micro controller and some additional components as in the block diagram finally to save the power. Here based
on the data in sensors the no. of lights in a room are glowed automatically without wasting much energy here 555 timer are used which may act as timer or counter based on its value the LEDS will glow at the output side. The main advantage of this microcontroller is it saves a large amount of power which is essential for human life as we have to save energy so that we need not many problems in future. face
CHAPTER 01 INTRODUCTION
Smart energy saver system (SESS) is used in many applications for saving the energy in a smarter way like for light control in a room automatically micro controller also imparts smartness to the system. Smart lighting light can be used to transmit broadband data ,which is already implemented in IRDA standards using infrared LEDS ,because LEDs can cycle on and off millions of times per seconds , they can be wireless transmitters and access points for data transport. Lasers can also be modulated in this manner. Many sensor systems rely on light as the signal source LEDs are often ideal as a light source due to the requirements of the sensors. Leds are used as movements sensors, for example in optical computer mouse. In pulse oxi meters for measuring oxygen saturation some flatbed scanners use arrays of RGB LEDs rather than the typical cold cathode fluorescent lamp as the light source having independent control of three illuminated colors allows the scanner to calibrate itself for more accurate color balance, and there is no need for warm up .further,its sensors only need be monochromatic ,since at any one time the page being scanned is only lit by one color of light. Touch sensing since LEds can also be used as photo diodes they can be used for both photo emission and detection. This could be used in for example a touch- sensing screen that register reflected light from a finger
the no .of lights in a room are glowed automatically without wasting much energy here 555 timer are used which may act as timer or counter based on its value the LEDS will glow at the output side. The main advantage of this microcontroller is it saves a large amount of power which is essential for human life as we have to save energy so that we need not future. This project is a device that collects data from the sensors, codes the data into a format that can be understood by the controlling section. This system also collects information from the master device and implements commands that are directed by the master. 2 face many problems in
The objective of the project is to develop a microcontroller based control and display system. It consists of sensors, microcontroller, the display unit, and the loads.
Design of SESS by AT89S52 micro controller and some additional components as in the block diagram finally to save the power. Here based on the data in sensors the no .of lights in a
room are glowed automatically without wasting much energy here 555 timer are used which may act as timer or counter based on its value the LEDS will glow at the output side. The main advantage of this microcontroller is it saves a large amount of power have to save energy so that we need not face many? Which is essential for human life as we
Problems in future :
The Controlling unit has an application program to allow the microcontroller read the data from the sensor, micro controller forward the signal to latch which stores the signal for certain period and makes glow the LED bar. And finally display it on the LCD. The performance of the design is maintained by controlling unit.
Embedded Systems
An embedded system can be defined as a computing device that does a specific focused job. Appliances such as the air-conditioner, VCD player, DVD player, printer, fax machine, mobile phone etc. are examples of embedded systems. Each of these appliances will have a processor and special hardware to meet the specific requirement of the application along with the embedded software that is executed by the processor for meeting that specific requirement. The embedded software is also called firm ware. The desktop/laptop computer is a general purpose computer. You can use it for a variety of applications such as playing games, word processing, accounting, software development and so on. In contrast, the software in the embedded systems is always fixed listed below:
1. They are designed to do a specific task and have real time performance constraints which must be met. 2. They allow the system hardware to be simplified so costs are reduced. 3. They are usually in the form of small computerized parts in larger devices which serve a general purpose. 4. The program instructions for embedded systems run with limited computer hardware resources, little memory and small or even non-existent keyboard or screen.
This chapter briefly explains about the Hardware Implementation of the project. It discusses the design and working of the design with the help of block diagram and circuit diagram and explanation of circuit diagram in detail. It explains the features, timer programming, serial communication, interrupts of AT89S52 microcontroller. It also explains the various modules used in this project.
Hardware implementation deals in drawing the schematic on the plane paper according to the application, testing the schematic design over the bread board using the various ICs to find if the design meets the objective, carrying out the PCB layout of the schematic tested on breadboard, finally preparing the board and testing the designed hardware. The software part deals in programming the microcontroller so that it can control the operation of the ICs used in the implementation. In the present work, we have used the Orcad design software for PCB circuit design, the Keil v3 software development tool to write and compile the source code, which has been written in the C language. The Pro load programmer has been used to write this compile code into the microcontroller. The software implementation is explained in the next chapter. The project design and principle are explained in this chapter using the block diagram and circuit diagram. The block diagram discusses about the required components of the design and working condition is explained using circuit diagram and system wiring diagram.
Transformer
A transformer is a device that transfers electrical energy from one circuit to another
through inductively coupled conductors-the transformer's coils. A varying current in the first or primary winding creates a varying magnetic flux in the transformer's core and thus a varying magnetic field through the secondary winding. This varying magnetic field induces a varying electromotive force (EMF) or "voltage" in the secondary winding. This effect is called mutual induction. If a load is connected to the secondary, an electric current will flow in the secondary winding and electrical energy will be transferred from the primary circuit through the transformer to the load. In an ideal transformer, the induced voltage in the secondary winding (Vs) is in proportion to the primary voltage (Vp), and is given by the ratio of the number of turns in the secondary (Ns) to the number of turns in the primary (Np) as follows:
By appropriate selection of the ratio of turns, a transformer thus allows an alternating current (AC) voltage to be "stepped up" by making Ns greater than Np , or "stepped down" by making Ns less than Np. In the vast majority of transformers, the windings are coils wound around a ferromagnetic core, aircore transformers being a notable exception. Transformers range in size from a thumbnail-sized coupling transformer hidden inside a stage microphone to huge units weighing hundreds of tons used to interconnect portions of power grids. All operate with the same basic principles, although the range of designs is wide. While new technologies have eliminated the need for transformers in some electronic circuits, transformers are still found in nearly all electronic devices designed for household ("mains") voltage. Transformers are essential for high voltage power transmission, which makes long distance transmission economically practical.
Figure: 3.Transformer
Bridge Rectifier
A bridge rectifier makes use of four diodes in a bridge arrangement to achieve full-wave rectification. This is a widely used configuration, both with individual diodes wired as shown and with single component bridges where the diode bridge is wired internally. A bridge rectifier makes use of four diodes in a bridge arrangement as shown in fig (a) to achieve full-wave rectification. This is a widely used configuration, both with individual diodes wired as shown and with single component bridges where the diode bridge is wired internally.
Fig 4. Bridge rectifier Three pin Regulator Voltage regulator ICs is available with fixed (typically 5, 12 and 15V) or variable output voltages. The maximum current they can pass also rates them. Negative voltage regulators are available, mainly for use in dual supplies. Most regulators include some automatic protection from excessive current ('overload protection') and overheating ('thermal protection'). Many of the fixed voltage regulators ICs have 3 leads and look like power transistors, such as the 7805 +5V 1A regulator shown on the right. The LM7805 is simple to use. You simply connect the positive lead of your unregulated DC power supply (anything from 9VDC to 24VDC) to the Input pin, connect the negative lead to the Common pin and then when you turn on the power, you get a 5 volt supply from the output pin.
3.3 Microcontrollers
Microprocessors and microcontrollers are widely used in embedded systems products. Microcontroller is a programmable device. A microcontroller has a CPU in addition to a fixed amount of RAM, ROM, I/O ports and a timer embedded all on a single chip. The fixed amount of onchip ROM, RAM and number of I/O ports in microcontrollers makes them ideal for many applications in which cost and space are critical. The Intel 8051 is Harvard architecture, single chip microcontroller (C) which was developed by Intel in 1980 for use in embedded systems. It was popular in the 1980s and early 1990s, but today it has largely been superseded by a vast range of enhanced devices with 8051-compatible processor cores that are manufactured by more than 20 independent manufacturers including Atmel, Infineon Technologies and Maxim Integrated Products. 8051 is an 8-bit processor, meaning that the CPU can work on only 8 bits of data at a time. Data larger than 8 bits has to be broken into 8-bit pieces to be processed by the CPU. 8051 is available in different memory types such as UV-EPROM, Flash and NV-RAM.
Description
The AT89s52 is a low-voltage, high-performance CMOS 8-bit microcomputer with 8K bytes of Flash programmable memory. The device is manufactured using Atmels high density nonvolatile memory technology and is compatible with the industry-standard MCS-51 instruction set. The on chip flash allows the program memory to be reprogrammed in system or by a conventional non volatile memory programmer. By combining a versatile 8-bit CPU with Flash on a monolithic chip, the Atmel AT89s52 is a powerful microcomputer, which provides a highly flexible and cost-effective solution to many embedded control applications. In addition, the AT89s52 is designed with static logic for operation down to zero frequency and supports two software selectable power saving modes. 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 hardware reset.
PIN DIAGRAM
10
11
Pin description Vcc Pin 40 provides supply voltage to the chip. The voltage source is +5V.
GND Pin 20 is the 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.
Port 1
Port 1 is an 8-bit bidirectional I/O port with internal pull-ups. The Port 1 output buffers can sink/source four TTL inputs. When 1s are written to Port 1 pins, they are pulled high by the internal pull-ups 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 pull-ups. 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 pull-ups. 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 pull-ups 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 pull-ups.
12
Port 2 emits the high-order address byte during fetches from external program memory and during accesses to external data memory that uses 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 uses 8-bit addresses (MOVX @ RI), Port 2 emits the contents of the P2 Special Function Register. The port also receives the high-order address bits and some control signals during Flash programming and verification. Port 3 Port 3 is an 8-bit bidirectional I/O port with internal pull-ups. 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 receives some control signals for Flash programming and verification. Port 3 also serves the functions of various special features of the AT89S52, as shown in the following table.
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 98 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.
13
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. EA/VPP 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.
14
XTAL1 and XTAL2 are the input and output, respectively, of an inverting amplifier that can be configured for use as an on-chip oscillator. Either a quartz crystal or ceramic resonator may be used. To drive the device from an external clock source, XTAL2 should be left unconnected while XTAL1 is driven. There are no requirements on the duty cycle of the external clock signal, since the input to the internal clocking circuitry is through a divide-by-two flip-flop, but minimum and maximum voltage high and low time specifications must be observed
15
contract to LED s, which are limited to numbers and a few characters. 3. Incorporation of a refreshing controller into the LCD, there by relieving the CPU of the task of refreshing the LCD. In the contrast, displaying the data. 4. Ease of programming for characters and graphics. the LED must be refreshed by the CPU to keep
USES
The LCD s used exclusively in watches, calculators and measuring instruments is the simple seven-segment displays, having a limited amount of numeric data. The recent advances in technology have resulted in better legibility, more information displaying capability and a wider temperature range. These have resulted in the LCD s being extensively used in telecommunications and entertainment electronics. The LCD s has even started replacing the cathode ray tubes (CRTs) used for the display of text and graphics, and also in small TV applications
16
3.5.2. Specifications
Number of Characters: 16 characters x 2 Lines Character Table: English-European (RS in Datasheet) Module dimension: 80.0mm x 36.0mm x 13.2mm(MAX) View area: 66.0 x 16.0 mm Active area: 56.2 x 11.5 mm Dot size: 0.56 x 0.66 mm Dot pitch: 0.60 x 0.70 mm Character size: 2.96 x 5.46 mm Character pitch: 3.55 x 5.94 mm LCD type: STN, Positive, Transflective, Yellow/Green Duty: 1/16 View direction: Wide viewing angle Backlight Type: yellow/green LED Ro HS Compliant: lead free Operating Temperature: -20C to + 70
17
Pins Functions: s There are pins along one side of the small printed board used for connection to the microcontroller. There are total of 14 pins marked with numbers (16 in case the background light is built in). Their function is described in the table below Pin 1 2 3 Symbol Vss Vcc VEE I/O ---Description Ground +5V power supply Power supply to
command register RS=1 to select data register 5 R/W I R/W=0 for write R/W=1 for read 6 7 E DB0 I/O I/O Enable The 8-bit data bus
18
8 9 10 11 12 13 14
The 8-bit data bus The 8-bit data bus The 8-bit data bus The 8-bit data bus The 8-bit data bus The 8-bit data bus The 8-bit data bus
Basic Commands of LCD All data transferred to LCD through outputs D0-D7 will be interpreted as commands or as data, which depends on logic state on pin RS: RS = 1 - Bits D0 - D7 are addresses of characters that should be displayed. Built in processor addresses built in map of characters and displays corresponding symbols. Displaying position is determined by DDRAM address. This address is either previously defined or the address of previously transferred character is automatically incremented. RS = 0 - Bits D0 - D7 are commands which determine display mode. List of commands which LCD recognizes are given in the table below:
Code (hex)
19
2 4 6 5 7 8 A C E F 10 14 18 1C 80 C0 38
Return home Decrement cursor Increment cursor Shift display right Shift display left Display off, cursor off Display off, cursor on Display on, cursor off Display on, cursor on Display on, cursor blinking Shift cursor position to left Shift cursor position to right Shift the entire display to the left Shift the entire display to the right Force cursor to beginning of 1st line Force cursor to beginning of 2nd line 2 lines and 5x7 matrix TABLE 4: LCD Command Codes
3.6 IR SENSORS
The solution proposed doesn't contain any special components, like photo-diodes, phototransistors, or IR receiver ICs, only a couple if IR leds, an Op amp, a transistor and a couple of resistors. In need, as the title says, a standard IR led is used for the purpose of detection. Due to that
20
fact, the circuit is extremely simple, and any novice electronics hobbyist can easily understand and build it. To detect the IR light that was emitted from another led of the exact same type! This is an electrical property of Light Emitting Diodes (LEDs) which is the fact that a led produces a voltage difference across its leads when it is subjected to light. As if it was a photo-cell, but with much lower output current. In other words the voltage generated by the leds can't be - in any way - used to generate electrical power from light, It can barely be detected. that's why as you will notice in the schematic,
Features
Direct replacement for SE555/NE555 Timing from microseconds through hours Operates in both astable and monostable modes 21
Adjustable duty cycle Output can source or sink 200 mA Output and supply TTL compatible Temperature stability better than 0.005% per C Normally on and normally off output Available in 8-pin MSOP package
PIN DIAGRAMS
pin diagram
22
Purpose
Fig 16 . Leds
23
3.8.1 Function
LEDs emit light when an electric current passes through them.
LEDs can be damaged by heat when soldering, but the risk is small unless you are very slow. No special precautions are needed for soldering most LEDs.
The 74LS374 is a high-speed, low-power Octal D-type Flip-Flop featuring separate D-type inputs for each flip-flop and 3-state outputs for bus oriented applications. A buffered Clock (CP) and Output Enable (OE) is common to all flip-flops. The SN54 /74LS374 is manufactured using advanced Low Power Schottky technology and is compatible with all Motorola TTL families
Hysteresis on Clock Input to Improve Noise Margin Input Clamp Diodes Limit High Speed Termination Effects
PIN NAMES
D0D7LE CP OE O0O7 data inputs Latch Enable (Active HIGH) Input Clock (Active HIGH going edge) Input Output Enable (Active LOW) Input Outputs
PINDIAGRAM
74LS373 latch
Fig 18 latch IC
25
TRUTH TABLE
D-N H L X X
LE H H L X
Table no 07
OE
O-N H L Q0 Z*
L L L H
Note: Contents of flip-flops unaffected by the state of the Output Enable input (OE)
Description :
These 10 segment bar graph LEDs have many uses. With a compact footprint, simple hookup, they are easy for prototyping or finished products. Essentially, they are 10 individual red LEDs housed together, each with an individual anode and cathode connection
26
This chapter briefly explains about the software implementation of the project. The required software tools are discussed in section 4.2 Section 4.3 shows the flow diagram of the project design. Section 4.4 presents the software implementation of the project design.
A compiler for a high level language helps to reduce production time. To program the AT89S52 microcontroller the Keil v3 is used. The programming is done strictly in the embedded C language. Keil v3 is a suite of executable, open source software development tools for the microcontrollers hosted on the Windows platform. The compilation of the C program converts it into machine language file (.hex). This is the only language the microcontroller will understand, because it contains the original program code converted into a hexadecimal format. During this step there are some warnings about eventual errors in the program. This is shown in Fig 4.1. If there are no errors and warnings then run the program, the system performs all the required tasks and behaves as expected the software developed. If not, the whole procedure will have to be repeated again. Fig 4.2 shows expected outputs for given inputs when run compiled program.
27
SOURCE CODE
1. 2.
Click on the Keil vision Icon on Desktop The following fig will appear
3. 4. 5. 6. 7. 8.
Click on the Project menu from the title bar Then Click on New Project Save the Project by typing suitable project name with no extension in u r own folder sited in either C:\ or D:\ Then Click on save button above. Select the component for u r project. i.e. Atmel Click on the + Symbol beside of Atmel
9.
28
Then Click on OK The Following fig will appear Then Click either YES or NOmostly NO Now your project is ready to USE Now double click on the Target1, you would get another option Source group 1 as shown in next page. Click on the file option from menu bar and select new The next screen will be as shown in next page, and just maximize it by double clicking on its blue boarder.
17. 18.
Now start writing program in either in C or ASM For a program written in Assembly, then save it with extension . asm and for C based program save it with extension .C
19. 20.
Now right click on Source group 1 and click on Add files to Group Source Now you will get another window, on which by default C files will appear.
Now select as per your file extension given while saving the file Click only one time on option ADD Now Press function key F7 to compile. Any error will appear if so happen. If the file contains no error, then press Control+F5 simultaneously. The new window is as follows
26.
Then Click OK 29
27. 28.
Now Click on the Peripherals from menu bar, and check your required port as shown in fig below Drag the port a side and click in the program file.
29. 30.
Now keep Pressing function key F11 slowly and observe. You are running your program successfully
30
count1equ 0020H; visitors in counter count2 equ result equ data1 equ asc_valequ digit0 equ digit1 equ digit2 equ limit1 equ limit2 equ limit3 equ enter1 bit exit1 bit flash bit 0024H ; 0026H ; 0028H ; visitors_out counter remaining visitors dummy variable
0030H ; 0031H ; 0032H ; 0033H ; 0034H 0035H 0036H p1.1 p1.2 p1.0 bit ; ; ; p2.7
latch_en
31
;********** Defining LCD Controls ********** ;p2.0 is used as select either instruction or data RS ;p2.1 is used as read/write select RW ;p2.2 is used as lcd enable EN ;p1.0 is used for diagnostic LED lcd_rs lcd_rw lcd_en bit bit bit p2.0 p2.1 p2.2 ; ; ; lcd RS lcd RW lcd EN
;********************************************** start: mov clr mov mov mov clr clr SP,#70H flash asc_val,#30h count1,#00h count2,#00h enter1 exit1 ; ; ; ; for visitors in for visitors out for enter door for exit door ; ; Move 70h in stack pointer LED ON
32
setb mov mov mov mov mov mov mov mov mov mov mov lcall lcall lcall lcall lcall
latch_en a,#0ffh p0,a data1,#00h result,#00h digit0,#00h digit1,#00h digit2,#00h p1,#0ffh limit1,#00H limit2,#1eH limit3,#0fh display_test delay delay bcd_asc in_display ; loops here ; ; ; hall empty limit is '0' 30 seats available ; 16 seats ; dummy variable for result
LCD test
;********************************************** contnu: clr lcall lcall lcall p1.0 ; LED ON for visitors counting
33
; ; ;
loops here
; ; data_compare: mov cjne mov setb nop nop nop clr mov mov lcall
lcall lcall
bcd_asc line1_in_display
; ;
34
mov mov hex_bcd lcall lcall lcall ret nxt1: mov cjne mov setb nop nop nop clr lcall ret nxt2:
count2,#00h data1,count2lcall ; bcd_asc line1_out_display empty_display calculating digit - 0,1,2 ; ; preparing for LCD display display for visitors out
latch_en full_display
35
jc clr mov subb jc mov setb nop nop nop clr mov subb mov lcall lcall lcall ret nxt3: mov setb nop nop
p0,#80h latch_en
36
nop clr mov subb mov lcall lcall lcall ret nxt4: mov setb nop nop nop clr mov subb mov lcall lcall lcall ret
37
p0,#0f8h latch_en
;*****************VISITORS COUNTING******************* visitor_count: mov mov jnb jnb ret visitor_in: mov cjne ret next1: inc mov lcall calculating digit - 0,1,2lcall display lcall line1_in_display
38
a,limit2 a,count1,next1
ret visitor_out: mov cjne ret next2: inc mov lcall lcall lcall ret count2 data1,count2 hex_bcd bcd_asc line1_out_display ; ; ; calculating digit - 0,1,2 preparing for LCD display display for visitors out a,count1 a,count2,next2
*****************VISITOR IN DISPLAY************************ line1_in_display: MOV ACALL MOV ACALL MOV ACALL MOV a,#0C4H command a,digit0 display a,digit1 display a,digit2
ACALL
display
39
RET **************VISITOR OUT DISPLAY**************** line1_out_display: MOV ACALL MOV ACALL MOV ACALL MOV ACALL RET a,#0CDH command a,digit0 display a,digit1 display a,digit2 display
***********LINE1 DISPLAY********* in_display: LCALL MOV ACALL MOV ACALL MOV ACALL MOV a,#' '
40
ACALL MOV ACALL MOV ACALL MOV ACALL MOV ACALL MOV ACALL MOV ACALL MOV ACALL MOV ACALL MOV a,#' ' a,#'T' a,#'U' a,#'O' a,#' ' a,#'='
display
display
display
display
display
MOV
a,digit0
41
ACALL
display
MOV ACALL
a,digit1 display
MOV ACALL
a,digit2 display
RET
MOV ACALL
MOV ACALL
a,#'H' display
MOV ACALL
a,#'A' display
42
MOV ACALL
a,#'L' display
MOV ACALL
a,#'L' display
MOV ACALL
MOV ACALL
a,#'I' display
MOV ACALL
a,#'S' display
MOV ACALL
MOV ACALL
a,#'E' display
MOV ACALL
a,#'M' display
43
MOV ACALL
a,#'P' display
MOV ACALL
a,#'T' display
MOV ACALL
a,#'Y' display
MOV ACALL
MOV ACALL
RET
full_display: MOV a,#80h ; ACALL MOV a,#' ' address of second line command
44
ACALL MOV a,#' ' ACALL MOV a,#'H' ACALL MOV a,#'A' ACALL MOV a,#'L' ACALL MOV a,#'L' ACALL MOV a,#' ' ACALL MOV a,#'I' ACALL MOV a,#'S' ACALL MOV a,#' ' ACALL MOV a,#'F' ACALL MOV a,#'U'
display
display
display
display
display
display
display
display
display
display
display
45
display
ACALL MOV a,#'L' ACALL MOV a,#' ' ACALL MOV a,#' ' ACALL RET avail_display: MOV a,#80h ; ACALL MOV a,#'A' ACALL MOV a,#'V' ACALL MOV a,#'L' ACALL MOV a,#'B' ACALL MOV a,#'L' ACALL
display
display
display
display
display
display
display
display
display
46
MOV
MOV
MOV
MOV
MOV
MOV
MOV
MOV
MOV
MOV
a,digit2 display
a,data1 MOV DIV MOV MOV MOV DIV MOV MOV RET b,#100 ; ab digit0,a a,b b,#10 ab digit1,a digit2,b Move 100 to b register ; ; ; ; ; ; ; Didide Acc by b Move Acc to digit1_dat Move b to Acc Move 10 to b register Divide Acc by b Move Acc to digit2_dat Move b to digit3_dat
48
a,digit0 a,#asc_val digit0,a a,digit1 ADD MOV a,#asc_val digit1,a ; tens ; hundreds
MOV
RET
;**********************************************
display_test:
LCALL
display_init
49
MOV ACALL MOV ACALL MOV ACALL MOV ACALL MOV ACALL MOV ACALL MOV ACALL MOV ACALL MOV ACALL MOV ACALL MOV ACALL
a,#' ' display a,#'S' display a,#'M' display a,#'A' display a,#'R' display a,#'T' display a,#' ' display a,#'V' display a,#'I' display a,#'S' display a,#'I' display
50
MOV ACALL MOV ACALL MOV ACALL MOV ACALL MOV ACALL
a,#'T' display a,#'O' display a,#'R' display a,#' ' display a,#' ' display
MOV ACALL
a,#0c0h
command
MOV ACALL MOV ACALL MOV ACALL MOV ACALL MOV ACALL MOV ACALL MOV ACALL MOV ACALL MOV ACALL MOV ACALL MOV ACALL MOV
a,#'T' display a,#'R' display a,#' ' display a,#'U' display a,#'S' display a,#'N' display a,#'G' display a,#' ' display a,#'8' display a,#'9' display a,#'5' display a,#'2'
52
ACALL
display
LCALL
delay
RET
;*************************************************************
display_init:
CLR MOV ACALL MOV ACALL MOV ACALL MOV ACALL MOV ACALL
command
53
RET
;************************************************************* ;p0 is used as data port for LCD ;p2.0 is used as select either instruction or data RS ;p2.1 is used as read/write select RW ;p2.2 is used as lcd enable EN ;p0.7 is used as busy flag
command:
MOV
p0,a
move data
RET
;*************************************************************
ready:
wait:
; ; ;
Disble display RS RW
MOV
p0,#0ffh
Enable display
; ;
Disble display RW
RET
55
;*************************************************************
display:
lcd_en ; lcd_en ;
RET
;**********************************************
delay:
PUSH PUSH
acc psw
56
MOV
nhsec,#05h
@12Mhz
relo:
DEC MOV
nhsec b,#41h
again5:
DEC MOV
b a,#0ffh
again6:
a,b
a,nhsec
relo
clint1:
57
POP POP
psw acc
RET
58
Working procedure
The smart energy saver system works as follows we get the power supply from the 5 volts power supply circuit connected externally which is given as input to the micro controller port 1.0 and the standard micro controller is built as per its connections its diagram is been shown. I.e. the crystal oscillator connections n reset signal connections n the ground connections. Here we use two sensors which will sense the presence of persons entering and leaving the room i.e. one sensor is kept at the entrance one at the exit n these sensors will count the number of people entering and leaving the hall the output of the sensors is given to the port 1.1 (entrance) and the output of other sensor is given to port1.2 (exit). The sensors will add and subtract the number of persons entering n leaving the hall n gives the input to the micro controller. the port 0 of the micro controller is given to the LCD data pins where the display comes about the strength of persons in room The same port 0 is also given as the data input to the 74ls373 d latch and the outputs of the latch is given to the 8 segment led bar and the overall thing is controlled by the micro controller. Based on the number of persons entering n leaving the room that much sufficient light will glow without wasting much energy. This is the overall aim of the project. Suppose if the room is empty a single led will be glowing If the number of persons present in room is between 2 to 15 next 4 LEDS will glow. If the number of persons exceed 15 i.e. 16 and above then all the LEDS will glow.
1. Long-lasting - LED bulbs last up to 10 times more than any other bulb.
2. Durable LED bulbs are solid they are not made from filament. Thats why they are not damaged under circumstances when a regular incandescent bulb would be broken.
59
3. Cool LED bulbs do not cause heat build-up and cuts down on air conditioning costs in the home. 4. More efficient - LED light bulbs use only 2-10 watts of electricity which is upto 1/30th of Incandescent or CFL bulbs. Replacing with LED bulbs will be reduced electricity costs by 80% or more. 5. Innovative Lighting Redesign ESI brings you innovative lighting redesign and LED Retrofit program to match IESNA specifications. 6. ZERO out of pocket expense - We are paid through savings on your electric bill. 7. Positive Cash Flow - Realize cash back from day one after the retrofit is complete. 8. Protection Plan - 5 year all-inclusive protection plan. We mean everything. 9. Energy Efficient Lighting Make your building energy efficient with eco friendly lighting.
Results
Assemble the schematic circuit on the general purpose board after assembling the circuit on the general purpose board; check it for proper connections before switching on the power supply.
Conclusion
The main advantage of this microcontroller is it saves a large amount of power which is essential for human life as we have to save energy so that we need not future. face many problems in
60
REFERENCES:
1. Muhammad Ali Mazidi,, The 8051 Microcontroller and Embedded systems, 2nd Edition. 2. Micro processors and interfacing Technical publications 3. www.8051.com 4. en.wikipedia.org/wiki/Infrared sensors 5. en.wikipedia.org/wiki/Light-emitting diode 6. en.wikipedia.org/wiki/Liquid_crystal_display 7. www.datasheetarchive.com/555-datasheet.html
8 www.alldatasheet.com/datasheet-pdf/pdf/.../74LS373 9. www.alldaatsheets.com
61