N116 Documentation (Repaired)
N116 Documentation (Repaired)
N116 Documentation (Repaired)
BACHELOR OF TECHNOLOGY
in
ELECTRICAL ENGINEERING
By
June 2020
DEPARTMENT OF ELECTRICAL ENGINEERING
MAULANA AZAD NATIONAL INSTITUTE OF TECHNOLOGY
BHOPAL (M.P.) – 462003
1
STUDENT’S DECLARATION
We hereby declare that the work presented in the dissertation entitled “BILLING AND
LOAD CONTROL OF SMART ENEGRY METER USING GSM” in partial fulfillment of
the requirement for the award of the degree of Bachelor of Technology in Electrical
Engineering submitted in the Department of Electrical Engineering, MANIT, Bhopal is an
authentic record of our own work under the guidance of Dr. Suresh Kumar Gawre.
We have not submitted the matter embodied in this dissertation for the award of any
other degree.
CERTIFICATE
This is to certify that the above statement made by students is correct to the best of my
knowledge.
Supervisor
2
Assistant Professor,
Department of
Electrical Engineering
MANIT, Bhopal.
ACKNOWLEDGEMENT
The project has been made for the fulfillment of the B.Tech. VIII semester curriculum
2019-20 of the Electrical Engineering Department of MANIT, Bhopal.
We extend our thankfulness to the Director of the College Dr. N.S. Raghuvanshi for
having provided an opportunity for doing major project and enjoying hands on
experience with the technical applications of the knowledge acquired in the college.
Unparalleled gratefulness is due to Dr. Manisha Dubey, HOD for their motivation.
We thank our guide Dr. Suresh Kumar Gawre for his continuous guidance, motivation
and support. We thank him for his valuable time and efforts in conceptualization of our
ideas. We owe him to the technical skills developed in us in the course of the project.
We thank the auxiliary staff of the department for the cooperation during the course of
project.
We heartedly acknowledge every support and guidance from the department and the
college.
3
S.No. Contents Page no.
1. Title 1
2. Student’s Decleration 2
3. Acknowledgement 3
4. Contents 4
6. Conventional system 6
14. Applications 17
15. Conclusion 18
16. References 18
1. ABSTRACT 10
4. HARDWARE REQUIREMENTS
4
4.1 TRANSFORMERS 17
4.3 RECTIFIER
4.4 FILTER
4.8 ULN2003
4.9 RELAY
4.10 LED
4.12 MAX-232
4.15 OPTOCOUPLER
4.16 1N4007
4.17 RESISTOR
4.18 CAPACITOR
5. SOFTWARE REQUIREMENTS 56
5.1 IDE 57
5
5.7 DEBUGGING AN APPLICATION IN UVISION2 60
5.15 EMBEDDED C 64
6. SCHEMATIC DIAGRAM 66
6.1 DESCRIPTION 67
7. CODING 75
7.1 COMPILER 76
8. HARDWARE TESTING 88
9. RESULTS 69
10. CONCLUSION 93
11. BIBLIOGRAPHY 94
6
4.1(a) A TYPICAL TRANSFORMER 26
REGULATOR 28
4.3PERFORMANCE CHARACTERISTICS
OF VOLTAGE REGULATOR 21
4.7 LCD
1. INTRODUCTION
The project consists of a Power meter reader system with GSM (SMS sender device)
interface. The energy department needs to send its employees every month in order to
take energy meter readings. This is an expensive as well as a time consuming system.
7
consumption of electrical energy. Collecting meter reading remains one of the most
difficult procedures in billing. The traditional electrical energy meter data collection is
such that a person from the utility provider visits the consumer sites periodically to note
the meter reading.
This procedure has lot of drawbacks including that it is time consuming, tiresome,
requires more human resource; even human errors and corruption is a high probability.
The process may be interrupted due to bad weather conditions, also if the consumer is
not available, the billing will be pending and billing officer needs to revisit. In recent
years however, shifts are being made towards prepaid meters and automatic meter
reading (AMR).
Our project determines a more efficient way to get energy meter readings.
Both Electricity Company as well as user gets their energy meter readings via SMS
every month. User may also control the system using SMS.
The energy meter is interfaced to a microcontroller of 8051 family. The energy meter
readings are also read by the microcontroller and displayed on an LCD Screen, this
data is also sent via SMS through a GSM modem interfaced to the microcontroller.
The GSM modem also has SMS receiving capability. On receiving particular user
request it sends required signal to the microcontroller in order to do counting for
required operation. It can switch loads On/Off as desired.
This system will also be used to effectively monitor energy usage, and disconnect the
power supply to the house in case of non-payment of electricity bills or suspicion of
fraud.
Conventional System
High chance of stealing and bribery always high to misuse it especially during
events.
Wherever energy meter installed inside the house, which may lead to non-
checking of reading due to lock.
The consumer may not receive his energy bill as per regular interval of the due
date.
Objective of Project
The main aim of this study is to design and develop a fully functional “Smart Energy
meter based on mobile communication technology (GSM)” having innovative
9
capabilities like remote metering, load control and billing through SMS the unit
consumption to the consumer. The research is about to handle all the information of the
consumer regarding energy consumption using a software system.
Proposed system-
A smart energy meter works on communication directly with wireless data protocol, so
there will be precise reading & there's no necessary for a meter reader to take energy
meter reading in consumer premises. Smart energy meters can operate in divergent
ways with GSM Module.
There are so many different merits of smart energy meter such as. User new smart
energy meters send precise reading on a regular interval in sequence about customer’s
energy usage to utility (Electricity provider). So the bills will be proper and labor cost is
reduced for taking a reading in consumer residents. If the consumer did not pay the
energy bill within time, the utility can remotely disconnect the service (line) of a
particular consumer and after payment, the service continues to the consumer.
So we can avoid sending an employee to cut off energy from the network and again to
reconnect their connection. We have connected lever switch for tampering attempt
detect. When anyone tries to open the meter cover the button will release and send
information to the service provider. When the power quality is not maintained from the
distribution supply, then the customer equipment can be protected by disconnecting and
reconnecting to the supply by SSR. The proposed system consists of digital energy
meter, an Arduino (microcontroller), GSM modem and SSR. After switching power on
the Arduino and the GSM modem, turn on the SSR and connects the energy meter to
load via SSR. Then read the EEPROM and display the current data.
Arduino checks the readings from voltage and current sensor i.e. PT and CT
respectively. If there is any difference in value between CT’s connected in phase and
neutral line then Arduino turns OFF the relay sends SMS to the service provider.
Also, this Arduino helps the utility for power disconnection when the bill is not cleared by
the customer. From customer point, this is a benefit to monitoring their daily/monthly
consumption, voltage fluctuation and gets disconnected from the supply.
3. Working Principle
10
Energy Meter-
The pressure coil creates the magnetic field because of the supply voltage, and the
current coil produces it because of the current.
The field induces by the voltage coil is lagging by 90º on the magnetic field of the
current coil because of which eddy current induced in the disc. The interaction of the
eddy current and the magnetic field causes torque, which exerts a force on the disc.
Thus, the disc starts rotating.
The force on the disc is proportional to the current and voltage of the coil. The
permanent magnet controls their rotation. The permanent magnet opposes the
movement of the disc and equalises it on the power consumption. The cyclometer
counts the rotation of the disc.
11
4. BLOCK DIAGRAM
4. HARDWARE REQUIREMENTS
HARDWARE COMPONENTS:
2. RECTIFIER
12
3. FILTER
4. MICROCONTROLLER (AT89S52/AT89C51)
5. GSM COMMUNICATION
6. GSM MODEM
7. ULN2003
8. RELAY
9. LED
15. 1N4007
16. RESISTOR
17. CAPACITOR
14
FIG 4.2(a): BLOCK DIAGRAM OF VOLTAGE REGULATOR
4.3 RECTIFIER
15
cycle only two diodes ( 1 set of parallel diodes) will conduct, in negative half cycle
remaining two diodes will conduct and they will conduct only in forward bias only.
4.4 FILTER
Capacitive filter is used in this project. It removes the ripples from the output of
rectifier and smoothens the D.C. Output received from this filter is constant until the
mains voltage and load is maintained constant. However, if either of the two is varied,
D.C. voltage received at this point changes. Therefore a regulator is applied at the
output stage.
The simple capacitor filter is the most basic type of power supply filter. The use
of this filter is very limited. It is sometimes used on extremely high-voltage, low-current
power supplies for cathode-ray and similar electron tubes that require very little load
current from the supply. This filter is also used in circuits where the power-supply ripple
frequency is not critical and can be relatively high. Below figure can show how the
capacitor charges and discharges.
16
4.5 MICROCONTROLLER AT89S52
• Watchdog Timer
• Power-off Flag
18
FIG 4.5(A): BLOCK DIAGRAM OF AT89S52
Pin Configurations of AT89S52
Pin Description:
VCC:
Supply voltage.
GND:
19
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).
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. 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.
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.
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
20
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.
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.
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.
XTAL2:
Output from the inverting oscillator amplifier.
Oscillator Characteristics:
XTAL1 and XTAL2 are the input and output, respectively, of an inverting amplifier
which can be configured for use as an on-chip oscillator, as shown in Figure 1. 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 as shown in
Figure 6.2. 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.
21
FIG 4.5(c): Oscillator Connections
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 a hardware reset.
In the power down mode the oscillator is stopped, and the instruction that
invokes power down is the last instruction executed. The on-chip RAM and Special
Function Registers retain their values until the power down mode is terminated. The
only exit from power down is a hardware reset. Reset redefines the SFRs but does not
change the on-chip RAM. The reset should not be activated before VCC is restored to
its normal operating level and must be held active long enough to allow the oscillator to
restart and stabilize.
22
4.6 GSM COMMUNICATION
GSM for mobile system is increasingly popular and established throughout the world.
The term GSM usually means the GSM standard and protocols in the frequency
spectrum around 900MHz. There is also DCS1800 - GSM protocols but at different air
frequencies around 1800 MHz - and in the United States, where spectrum for Personal
Communication Services (PCS) was auctioned at around 1900MHz. As a result of this,
the original and most widely-used GSM frequency implementation is known as
GSM900, and DCS1800 is also known as GSM1800. Though the physical frequencies
used are differed, the protocols and architecture remain the same. The following
sections describe about the functional entities, the radio interface signaling protocol, the
logical and physical channel structure and the TDMA structure based on GSM.
System architecture
The figure below shows the GSM system architecture, which consists of the
switching system, the base station system and the user equipment. Functional entities
are briefly explained as follows.
23
FIG: 4.6(b) BASIC GSM NETWORK
25
FIG4.6(c): LOGICAL AND PHYSICAL CHANNELS IN GSM
Common channels
The forward common channels are used for broadcasting bulletin board
information, paging and response to channel requests. The return common channel is a
slotted Aloha type random access channel used by the MS to request channel
resources before timing information is conveyed by the BSS, and uses a burst with an
extended guard period.
26
are used to set-up the connection, and the traffic channel of a variety of rates is used to
convey the user information once the session is established.
A GSM modem is a specialized type of modem which accepts a SIM card, and
operates over a subscription to a mobile operator, just like a mobile phone. From the
mobile operator perspective, a GSM modem looks just like a mobile phone.
4.7 ULN2003
RELAY DRIVER:
28
ULN2003 is a high voltage and high current Darlington transistor array.
DESCRIPTION:
The ULN2003 is a monolithic high voltage and high current Darlington transistor
arrays. It consists of seven NPN Darlington pairs that feature high-voltage outputs with
common-cathode Clamp diode for switching inductive loads. The collector-current rating
of a single Darlington pair is 500mA. The Darlington pairs may be paralleled for higher
current capability. Applications include relay drivers, hammer drivers, lamp drivers,
display drivers (LED gas discharge), line drivers, and logic buffers.
The ULN2003 has a 2.7kW series base resistor for each Darlington pair for
operation directly with TTL or 5V CMOS devices.
29
Pin no.:16
Temperature, Operating Range:-20°C to +85°C
Transistor Polarity: NPN
Transistors, No. of:7
Case Style:DIP-16
Temp, Op. Min:-20°C
Temp, Op. Max:85°C
Base Number:2003
Channels, No. of:7
Current, Output Max:500mA
Device Marking:ULN2003A
IC Generic Number:2003
Input Type: TTL, CMOS 5V
Logic Function Number:2003
Output Type: Open Collector
Transistor Type: Power Darlington
Voltage, Input Max:5V
Voltage, Output Max:50V
30
PIN Diagram:
31
Fig: Darlington pair
Darlington pairs are back to back connection of two transistors with some source
resistors and when they are arranged as shown in the circuit they are used to amplify
weak signals. The amount by which the weak signal is amplified is called the ‘GAIN’. .
FEATURES OF DRIVER:
Seven Darlington’s per package
Output currents500mA per driver(600mA peak)
Integrated suppression diodes for inductive loads
Outputs can be paralleled for high currents
TTL/CMOS/PMOS/DTL compatible inputs.
Inputs pinned opposite to outputs
Simplified layout
Figure shows the Darlington pair connection of transistor. The circuit above is a
‘Darlington Pair’ driver. The first transistor’s emitter feeds into the second transistor’s
base and as a result the input signal is amplified by the time it reaches the output. The
important point to remember is that the Darlington Pair is made up of two transistors
FEATURES
* 500mA rated collector current (Single output).
* High-voltage outputs: 50V.
* Inputs compatible with various types of logic.
* Relay driver application.
4.9 RELAY
A relay is an electrically operated switch. Many relays use an electromagnet to
operate a switching mechanism mechanically, but other operating principles are also
used. Relays are used where it is necessary to control a circuit by a low-power signal
(with complete electrical isolation between control and controlled circuits), or where
several circuits must be controlled by one signal.
32
A relay is an electrically operated switch. Current flowing through the coil of the
relay creates a magnetic field which attracts a lever and changes the switch contacts.
The coil current can be on or off so relays have two switch positions and most have
double throw (changeover) switch contacts as shown in the diagram.
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 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.
33
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 figure shows a 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 labelled COM, NC and NO:
COM = Common, always connect to this; it is the moving part of the switch.
NC = Normally Closed, COM is connected to this when the relay coil is off.
NO = Normally Open, COM is connected to this when the relay coil is on.
34
35
Applications of relays
4.9 LED
Light Emitting Diodes (LED) have recently become available that are white and
bright, so bright that they seriously compete with incandescent lamps in lighting
applications. They are still pretty expensive as compared to a GOW lamp but draw
much less current and project a fairly well focused beam.
The diode in the photo came with a neat little reflector that tends to sharpen the
beam a little but doesn't seem to add much to the overall intensity.
When run within their ratings, they are more reliable than lamps as well. Red
LEDs are now being used in automotive and truck tail lights and in red traffic signal
lights. You will be able to detect them because they look like an array of point sources
and they go on and off instantly as compared to conventional incandescent lamps.
36
LEDs are monochromatic (one color) devices. The color is determined by the
band gap of the semiconductor used to make them. Red, green, yellow and blue LEDs
are fairly common. White light contains all colors and cannot be directly created by a
single LED. The most common form of "white" LED really isn't white. It is a Gallium
Nitride blue LED coated with a phosphor that, when excited by the blue LED light, emits
a broad range spectrum that in addition to the blue emission, makes a fairly white light.
There is a claim that these white LED's have a limited life. After 1000 hours or so
of operation, they tend to yellow and dim to some extent. Running the LEDs at more
than their rated current will certainly accelerate this process.
There are two primary ways of producing high intensity white-light using LED’S.
One is to use individual LED’S that emit three primary colours—red, green, and blue—
and then mix all the colours to form white light. The other is to use a phosphor material
to convert monochromatic light from a blue or UV LED to broad-spectrum white light,
much in the same way a fluorescent light bulb works. Due to metamerism, it is possible
to have quite different spectra that appear white.
LEDs are semiconductor devices. Like transistors, and other diodes, LEDs are
made out of silicon. What makes an LED give off light are the small amounts of
chemical impurities that are added to the silicon, such as gallium, arsenide, indium, and
nitride.
When current passes through the LED, it emits photons as a byproduct. Normal
light bulbs produce light by heating a metal filament until it is white hot. LEDs produce
photons directly and not via heat, they are far more efficient than incandescent bulbs.
37
Not long ago LEDs were only bright enough to be used as indicators on
dashboards or electronic equipment. But recent advances have made LEDs bright
enough to rival traditional lighting technologies. Modern LEDs can replace incandescent
bulbs in almost any application.
Types of LED’S
LEDs are produced in an array of shapes and sizes. The 5 mm cylindrical package is the
most common, estimated at 80% of world production. The color of the plastic lens is often the
same as the actual color of light emitted, but not always. For instance, purple plastic is often
used for infrared LEDs, and most blue devices have clear housings. There are also LEDs in
extremely tiny packages, such as those found on blinkers and on cell phone keypads. The
main types of LEDs are miniature, high power devices and custom designs such as
alphanumeric or multi-color.
Description:
This is the example for the Parallel Port. This example doesn't use the Bi-
directional feature found on newer ports, thus it should work with most, if not all Parallel
Ports. It however doesn't show the use of the Status Port as an input for a 16 Character
x 2 Line LCD Module to the Parallel Port. These LCD Modules are very common these
days, and are quite simple to work with, as all the logic required running them is on
board.
Pros:
LCD Background:
Frequently, an 8051 program must interact with the outside world using input and
output devices that communicate directly with a human being. One of the most common
devices attached to an 8051 is an LCD display. Some of the most common LCDs
connected to the 8051 are 16x2 and 20x2 displays. This means 16 characters per line
by 2 lines and 20 characters per line by 2 lines, respectively.
The 44780 standard requires 3 control lines as well as either 4 or 8 I/O lines for
the data bus. The user may select whether the LCD is to operate with a 4-bit data bus
or an 8-bit data bus. If a 4-bit data bus is used the LCD will require a total of 7 data lines
(3 control lines plus the 4 lines for the data bus). If an 8-bit data bus is used the LCD will
require a total of 11 data lines (3 control lines plus the 8 lines for the data bus).
39
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 you
are sending it data. To send data to the LCD, your 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, 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 should be displayed on the
screen. For example, to display the letter "T" on the screen you 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 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.
40
4.11MAX 232
The MAX232 is an integrated circuit that converts signals from an RS-232 serial
port to signals suitable for use in TTL compatible digital logic circuits. The MAX232 is a
dual driver/receiver and typically converts the RX, TX, CTS and RTS signals.
The drivers provide RS-232 voltage level outputs (approx. ± 7.5 V) from a single
+ 5 V supply via on-chip charge pumps and external capacitors. This makes it useful for
implementing RS-232 in devices that otherwise do not need any voltages outside the
0 V to + 5 V range, as power supply design does not need to be made more
complicated just for driving the RS-232 in this case. The receivers reduce RS-232
inputs (which may be as high as ± 25 V), to standard 5 V TTL levels. These receivers
have a typical threshold of 1.3 V, and a typical hysteresis of 0.5 V.
The later MAX232A is backwards compatible with the original MAX232 but may
operate at higher baud rates and can use smaller external capacitors (0.1 μF) in place
of the 1.0 μF capacitors used with the original device. The newer MAX3232 is also
backwards compatible, but operates at a broader voltage range, from 3 to 5.5V.
Voltage levels:
It is helpful to understand what occurs to the voltage levels. When a MAX232 IC
receives a TTL level to convert, it changes a TTL Logic 0 to between +3 and +15V, and
changes TTL Logic 1 to between -3 to -15V, and vice versa for converting from RS232
to TTL.
This can be confusing when you realize that the RS232 Data Transmission
voltages at a certain logic state are opposite from the RS232 Control Line voltages at
the same logic state. To clarify the matter, see the table below. For more information
see RS-232 Voltage Levels.
41
Pin Description:
42
Application:
The MAX232 has two receivers (converts from RS-232 to TTL voltage levels)
and two drivers (converts from TTL logic to RS-232 voltage levels). This means only two
of the RS-232 signals can be converted in each direction.
DB9 CONNECTOR
The DB9 (originally DE-9) connector is an analog 9-pin plug of the D-Sub miniature
connector family (D-Sub or Sub-D). The DB9 connector is mainly used for serial
connections, allowing for the asynchronous transmission of data as provided for by
standard RS-232 (RS-232C).
43
Pins:
D-sub connectors are usually described by the total number of pins that they can
hold. In some cases, a DB25 connector may only have 4 or 5 pins loaded into it;
however, it is still called a “DB25” connector and not a “DB4” or “DB5”. Another example
44
is the HD15 connector used by monitors—most monitor cables only are loaded with 14
pins, but it is still called an HD15 connector.
4.13
ENERGY METER
An energy or electric meter is a device that measures the amount of electrical energy
consumed by a residence, business, or an electrically-powered device.
45
electric rates are higher during certain times of day, to encourage reduction in use. Also,
in some areas meters have relays to turn off nonessential equipment.
4.14OPTOISOLATOR
If the optocoupler IC breakdown, it will cause the equipment to have low power,
blink, no power, erratic power and even power shut down once switch on the
equipment. Many technicians and engineers do not know that they can actually test the
optocoupler with their analog multimeter. Most of them thought that there is no way of
testing an IC with an analog meter.
This is the principle used in Opto−Triacs and opto−SCRs, which are readily available
in Integrated circuit (I.C.) form, and do not need very complex circuitry to make them
46
work. Simply provide a small pulse at the right time to the Light Emitting Diode in the
package. The light produced by the LED activates the light sensitive properties of the
Triac or Thyristor gate and the power is switched on. The isolation between the low
power and high power circuits in these optically connected devices is typically several
thousand volts.
OPTOISOLATOR
47
Collector-emitter voltage
This is the maximum voltage that can be present from the collector to the emitter
of the receiving phototransistor (when it is turned off – no light) before it may break-
down.
Cree page distance
This is physically how far a spark would have to travel around the outside of the
package to get from one side to the other. If the package has contaminants on it, solder
flux, or dampness, then a lower-resistance path can be created for noise signals to
travel along.
Forward current
This is the current passing through the sending LED. Typically, an Opto-isolator
will require about 5mAto turn the output transistor on.
Forward voltage
This is the voltage that is dropped across the LED when it is turned on. Most
normal diodes drop about 0.7v, but with LEDs it is typically 1 – 2 volts.
Collector dark current
This is the current that can flow through the output phototransistor when it is
turned off.
Isolation resistance
This is the resistance from a pin in the input side to a pin on the output side. It
should be very high.
48
Response time
The rise and fall times are the times that the output voltage takes to get from zero
to maximum. The rise time is very much dependant on the load resistor, since it is this
that is pulling the output up. Therefore this value is always quoted with a fixed load
resistance. Note however that the value, 100 Ohms, is much less than you are likely to
use in practice. This is another of the manufacturer’s attempts to make the product look
better than it is!
Cutoff frequency
This is effectively the highest frequency of square wave that can be sent through
the Opto-isolator. It is actually the frequency at which the output voltage is only swinging
half the amplitude than at DC levels (-3Db = half). It is therefore linked with the rise and
fall times.
4.15 1N4007
Diodes are used to convert AC into DC these are used as half wave rectifier or full
wave rectifier. Three points must he kept in mind while using any type of diode.
1. Maximum forward current capacity
2. Maximum reverse voltage capacity
3. Maximum forward voltage capacity
49
The number and voltage capacity of some of the important diodes available in the
market are as follows:
Diodes of number IN4001, IN4002, IN4003, IN4004, IN4005, IN4006 and IN4007
have maximum reverse bias voltage capacity of 50V and maximum forward current
capacity of 1 Amp.
Diode of same capacities can be used in place of one another. Besides this
diode of more capacity can be used in place of diode of low capacity but diode of low
capacity cannot be used in place of diode of high capacity. For example, in place of
IN4002; IN4001 or IN4007 can be used but IN4001 or IN4002 cannot be used in place
of IN4007.The diode BY125made by company BEL is equivalent of diode from IN4001
to IN4003. BY 126 is equivalent to diodes IN4004 to 4006 and BY 127 is equivalent to
diode IN4007.
PN JUNCTION OPERATION
Now that you are familiar with P- and N-type materials, how these materials are
joined together to form a diode, and the function of the diode, let us continue our
discussion with the operation of the PN junction. But before we can understand how the
PN junction works, we must first consider current flow in the materials that make up the
junction and what happens initially within the junction when these two materials are
joined together.
Current flow through the P-type material is illustrated. Conduction in the P material
is by positive holes, instead of negative electrons. A hole moves from the positive
terminal of the P material to the negative terminal. Electrons from the external circuit
enter the negative terminal of the material and fill holes in the vicinity of this terminal. At
the positive terminal, electrons are removed from the covalent bonds, thus creating new
holes. This process continues as the steady stream of holes (hole current) moves
toward the negative terminal
4.16 RESISTORS
51
The primary characteristics of resistors are their resistance and the power they
can dissipate. Other characteristics include temperature coefficient, noise, and
inductance. Less well-known is critical resistance, the value below which power
dissipation limits the maximum permitted current flow, and above which the limit is
applied voltage. Critical resistance depends upon the materials constituting the resistor
as well as its physical dimensions; it's determined by design.
Resistors can be integrated into hybrid and printed circuits, as well as
integrated circuits. Size, and position of leads (or terminals) are relevant to equipment
designers; resistors must be physically large enough not to overheat when dissipating
their power.
A resistor is a two-terminal passive electronic component which implements
electrical resistance as a circuit element. When a voltage V is applied across the
terminals of a resistor, a current I will flow through the resistor in direct proportion to that
voltage. The reciprocal of the constant of proportionality is known as the resistance R,
since, with a given voltage V, a larger value of R further "resists" the flow of current I as
given by Ohm's law:
Resistors are common elements of electrical networks and electronic circuits and are
ubiquitous in most electronic equipment. Practical resistors can be made of various
compounds and films, as well as resistance wire (wire made of a high-resistivity alloy,
such as nickel-chrome). Resistors are also implemented within integrated circuits,
particularly analog devices, and can also be integrated into hybrid and printed circuits.
The electrical functionality of a resistor is specified by its resistance: common
commercial resistors are manufactured over a range of more than 9 orders of
magnitude. When specifying that resistance in an electronic design, the required
52
precision of the resistance may require attention to the manufacturing tolerance of the
chosen resistor, according to its specific application. The temperature coefficient of the
resistance may also be of concern in some precision applications. Practical resistors are
also specified as having a maximum power rating which must exceed the anticipated
power dissipation of that resistor in a particular circuit: this is mainly of concern in power
electronics applications. Resistors with higher power ratings are physically larger and
may require heat sinking. In a high voltage circuit, attention must sometimes be paid to
the rated maximum working voltage of the resistor.
The series inductance of a practical resistor causes its behaviour to depart from
ohms law; this specification can be important in some high-frequency applications for
smaller values of resistance. In a low-noise amplifier or pre-amp the noise
characteristics of a resistor may be an issue. The unwanted inductance, excess noise,
and temperature coefficient are mainly dependent on the technology used in
manufacturing the resistor. They are not normally specified individually for a particular
family of resistors manufactured using a particular technology. [1] A family of discrete
resistors is also characterized according to its form factor, that is, the size of the device
and position of its leads (or terminals) which is relevant in the practical manufacturing of
circuits using them.
Units
The ohm (symbol: Ω) is the SI unit of electrical resistance, named after Georg
Simon Ohm. An ohm is equivalent to a volt per ampere. Since resistors are specified
and manufactured over a very large range of values, the derived units of milliohm (1 mΩ
= 10−3 Ω), kilohms (1 kΩ = 103 Ω), and mega ohm (1 MΩ = 106 Ω) are also in common
usage.
The reciprocal of resistance R is called conductance G = 1/R and is measured in
Siemens (SI unit), sometimes referred to as a mho. Thus a Siemens is the reciprocal of
an ohm: S = Ω − 1. Although the concept of conductance is often used in circuit analysis,
practical resistors are always specified in terms of their resistance (ohms) rather than
conductance.
Theory of operation
Ohm's law
The behaviour of an ideal resistor is dictated by the relationship specified in Ohm's law:
Ohm's law states that the voltage (V) across a resistor is proportional to the current (I)
passing through it, where the constant of proportionality is the resistance (R).
Equivalently, Ohm's law can be stated:
53
This formulation of Ohm's law states that, when a voltage (V) is present across a
resistance (R), a current (I) will flow through the resistance. This is directly used in
practical computations. For example, if a 300 ohm resistor is attached across the
terminals of a 12 volt battery, then a current of 12 / 300 = 0.04 amperes (or 40 mill
amperes) will flow through that resistor.
As a special case, the resistance of N resistors connected in series, each of the same
resistance R, is given by NR.
Resistors in a parallel configuration are each subject to the same potential difference
(voltage), however the currents through them add. The conductance of the resistors
then add to determine the conductance of the network. Thus the equivalent resistance
(Req) of the network can be computed:
The parallel equivalent resistance can be represented in equations by two vertical lines
"||" (as in geometry) as a simplified notation. For the case of two resistors in parallel, this
can be calculated using:
54
As a special case, the resistance of N resistors connected in parallel, each of the same
resistance R, is given by R/N.
A resistor network that is a combination of parallel and series connections can be
broken up into smaller parts that are either one or the other. For instance,
Power dissipation
The power P dissipated by a resistor (or the equivalent resistance of a resistor network)
is calculated as:
The first form is a restatement of Joule's first law. Using Ohm's law, the two other forms
can be derived.
55
The total amount of heat energy released over a period of time can be determined from
the integral of the power over that period of time:
Practical resistors are rated according to their maximum power dissipation. The
vast majority of resistors used in electronic circuits absorb much less than a watt of
electrical power and require no attention to their power rating. Such resistors in their
discrete form, including most of the packages detailed below, are typically rated as 1/10,
1/8, or 1/4 watt.
Resistors required to dissipate substantial amounts of power, particularly used in power
supplies, power conversion circuits, and power amplifiers, are generally referred to as
power resistors; this designation is loosely applied to resistors with power ratings of 1
watt or greater. Power resistors are physically larger and tend not to use the preferred
values, colour codes, and external packages described below.
If the average power dissipated by a resistor is more than its power rating,
damage to the resistor may occur, permanently altering its resistance; this is distinct
from the reversible change in resistance due to its temperature coefficient when it
warms. Excessive power dissipation may raise the temperature of the resistor to a point
where it can burn the circuit board or adjacent components, or even cause a fire. There
are flameproof resistors that fail (open circuit) before they overheat dangerously.
Note that the nominal power rating of a resistor is not the same as the power that
it can safely dissipate in practical use. Air circulation and proximity to a circuit board,
ambient temperature, and other factors can reduce acceptable dissipation significantly.
Rated power dissipation may be given for an ambient temperature of 25 °C in free air.
Inside an equipment case at 60 °C, rated dissipation will be significantly less; a resistor
dissipating a bit less than the maximum figure given by the manufacturer may still be
outside the area and may prematurely fail.
4.12 CAPACITORS
A capacitor or condenser is a passive electronic component consisting of a
pair of conductors separated by a dielectric. When a voltage potential difference exists
between the conductors, an electric field is present in the dielectric. This field stores
energy and produces a mechanical force between the plates. The effect is greatest
between wide, flat, parallel, narrowly separated conductors.
56
An ideal capacitor is characterized by a single constant value, capacitance,
which is measured in farads. This is the ratio of the electric charge on each conductor to
the potential difference between them. In practice, the dielectric between the plates
passes a small amount of leakage current. The conductors and leads introduce an
equivalent series resistance and the dielectric has an electric field strength limit
resulting in a breakdown voltage.
The properties of capacitors in a circuit may determine the resonant frequency
and quality factor of a resonant circuit, power dissipation and operating frequency in a
digital logic circuit, energy capacity in a high-power system, and many other important
aspects.
A capacitor (formerly known as condenser) is a device for storing electric charge. The
forms of practical capacitors vary widely, but all contain at least two conductors
separated by a non-conductor. Capacitors used as parts of electrical systems, for
example, consist of metal foils separated by a layer of insulating film.
Capacitors are widely used in electronic circuits for blocking direct current while
allowing alternating current to pass, in filter networks, for smoothing the output of power
supplies, in the resonant circuits that tune radios to particular frequencies and for many
other purposes.
A capacitor is a passive electronic consisting of a pair of conductors separated
by a dielectric (insulator). When there is a potential difference (voltage) across the
conductors, a static electric field develops in the dielectric that stores energy and
produces a mechanical force between the conductors. An ideal capacitor is
57
characterized by a single constant value, capacitance, measured in farads. This is the
ratio of the electric charge on each conductor to the potential difference between them.
The capacitance is greatest when there is a narrow separation between large
areas of conductor; hence capacitor conductors are often called "plates", referring to an
early means of construction. In practice the dielectric between the plates passes a small
amount of leakage current and also has an electric field strength limit, resulting in a
breakdown voltage, while the conductors and leads introduce an undesired inductance
and resistance.
Theory of operation
Capacitance
58
electric field. In SI units, a capacitance of one farad means that one coulomb of charge
on each conductor causes a voltage of one volt across the device. The capacitor is a
reasonably general model for electric fields within electric circuits. An ideal capacitor is
wholly characterized by a constant capacitance C, defined as the ratio of charge ±Q on
each conductor to the voltage V between them:
Sometimes charge build-up affects the capacitor mechanically, causing its capacitance
to vary. In this case, capacitance is defined in terms of incremental changes:
Energy storage
Work must be done by an external influence to "move" charge between the conductors
in a capacitor. When the external influence is removed the charge separation persists in
the electric field and energy is stored to be released when the charge is allowed to
return to its equilibrium position. The work done in establishing the electric field, and
hence the amount of energy stored, is given by:
Current-voltage relation
The current i(t) through any component in an electric circuit is defined as the rate of flow
of a charge q(t) passing through it, but actual charges, electrons, cannot pass through
the dielectric layer of a capacitor, rather an electron accumulates on the negative plate
for each one that leaves the positive plate, resulting in an electron depletion and
consequent positive charge on one electrode that is equal and opposite to the
accumulated negative charge on the other. Thus the charge on the electrodes is equal
to the integral of the current as well as proportional to the voltage as discussed above.
As with any ant derivative, a constant of integration is added to represent the initial
voltage v (t0). This is the integral form of the capacitor equation,
.
Taking the derivative of this, and multiplying by C, yields the derivative form,
.
The dual of the capacitor is the inductor, which stores energy in the magnetic field
rather than the electric field. Its current-voltage relation is obtained by exchanging
current and voltage in the capacitor equations and replacing C with the inductance L.
59
5. SOFTWARE REQUIREMENTS
60
5.1 INTRODUCTION TO KEIL MICRO VISION (IDE)
Keil an ARM Company makes C compilers, macro assemblers, real-time
kernels, debuggers, simulators, integrated environments, evaluation boards, and
emulators for ARM7/ARM9/Cortex-M3, XC16x/C16x/ST10, 251, and 8051 MCU
families.
Keil development tools for the 8051 Microcontroller Architecture support every
level of software developer from the professional applications engineer to the student
just learning about embedded software development. When starting a new project,
simply select the microcontroller you use from the Device Database and the µVision IDE
sets all compiler, assembler, linker, and memory options for you.
Keil is a cross compiler. So first we have to understand the concept of compilers
and cross compilers. After then we shall learn how to work with Keil.
61
called cross development. And the compiler used for cross development is called cross
compiler. So the definition of cross compiler is a compiler that runs on one computer but
produces object code for a different type of computer.
62
1. Select Debug - Start/Stop Debug Session.
2. Use the Step toolbar buttons to single-step through your program. You may enter
G, main in the Output Window to execute to the main C function.
3. Open the Serial Window using the Serial #1 button on the toolbar.
Debug your program using standard options like Step, Go, Break, and so on.
63
The µVision2 simulator traps and reports illegal memory accesses. In addition to
memory mapping, the simulator also provides support for the integrated peripherals of
the various 8051 derivatives. The on-chip peripherals of the CPU you have selected are
configured from the Device.
64
You may use the dialog Debug – Inline Assembly… to modify the CPU
instructions. That allows you to correct mistakes or to make temporary changes to the
target program you are debugging. Numerous example programs are included to help
you get started with the most popular embedded 8051 devices.
The Keil µVision Debugger accurately simulates on-chip peripherals (I²C, CAN,
UART, SPI, Interrupts, I/O Ports, A/D Converter, D/A Converter, and PWM Modules) of
your 8051 device. Simulation helps you understand hardware configurations and avoids
time wasted on setup problems. Additionally, with simulation, you can write and test
applications before target hardware is available.
5.15 EMBEDDED C
Use of embedded processors in passenger cars, mobile phones, medical
equipment, aerospace systems and defense systems is widespread, and even everyday
domestic appliances such as dish washers, televisions, washing machines and video
recorders now include at least one such device.
Because most embedded projects have severe cost constraints, they tend to
use low-cost processors like the 8051 family of devices considered in this book. These
popular chips have very limited resources available most such devices have around 256
bytes (not megabytes!) of RAM, and the available processor power is around 1000
times less than that of a desktop processor. As a result, developing embedded software
presents significant new challenges, even for experienced desktop programmers. If you
have some programming experience - in C, C++ or Java - then this book and its
accompanying CD will help make your move to the embedded world as quick and
painless as possible.
65
6. SCHEMATIC DIAGRAM
6.1 DESCRIPTION
POWER SUPPLY
The circuit uses standard power supply comprising of a step-down transformer
from 230Vto 12V and 4 diodes forming a bridge rectifier that delivers pulsating dc which
is then filtered by an electrolytic capacitor of about 470µF to 1000µF. The filtered dc
being unregulated, IC LM7805 is used to get 5V DC constant at its pin no 3 irrespective
of input DC varying from 7V to 15V. The input dc shall be varying in the event of input
ac at 230volts section varies from 160V to 270V in the ratio of the transformer primary
voltage V1 to secondary voltage V2 governed by the formula V1/V2=N1/N2. As N1/N2
i.e. no. of turns in the primary to the no. of turns in the secondary remains unchanged
V2 is directly proportional to V1.Thus if the transformer delivers 12V at 220V input it will
give 8.72V at 160V.Similarly at 270V it will give 14.72V.Thus the dc voltage at the input
of the regulator changes from about 8V to 15V because of A.C voltage variation from
160V to 270V the regulator output will remain constant at 5V.
The regulated 5V DC is further filtered by a small electrolytic capacitor of 10µF
for any noise so generated by the circuit. One LED is connected of this 5V point in
series with a current limiting resistor of 330Ω to the ground i.e., negative voltage to
indicate 5V power supply availability. The unregulated 12V point is used for other
applications as and when required.
66
as crystal oscillator It is just a crystal, while connected to the appropriate pin of the
microcontroller it results in oscillator function inside the microcontroller. Typically
11.0592 MHz crystal is used in general for most of the circuits using 8051 series
microcontroller. Two small value ceramic capacitors of 33pF each is used as a standard
connection for the crystal as shown in the circuit diagram.
RESET
OPTO COUPLER:
68
MAX232
The MAX232used in the project is an integrated circuit that converts signals from
an RS-232 serial port to signals suitable for use in TTL compatible digital logic circuits
like microcontroller. The MAX232 is a dual driver/receiver and typically converts the RX,
TX, CTS and RTS signals.
OPERATION
CONNECTIONS:
The output of power supply which is 5v is connected to 40 th pin of microcontroller and Gnd
is connected to 20th pin of microcontroller. Pin 2.0 to pin 2.7 of port 2 of MC is connected to
data pins i.e., D0 to D7 of LCD display. Pins 4, 5, 6 i.e., RS, RW, EN. Of LCD are given to p
0.0 to p 0.2 of port of 0 of MC. Pin 3.0 and pin 3.1 of port 3 of MC are connected to pin 11
and pin 12 of Max232. Pin 3.3 of port 3 of MC is connected to pin 5 of Opto coupler. Pin 1
& 2 of Opto coupler are connected to energy meter. Pin 14 & 13 of Max232 are given to
pins 2 & 3 of DB9 male connector. Pin 2 & pin 5 of DB9 Female Connector are given to
GSM modem. The output of the power supply which is 5v is connected to the 40 th pin of MC
and GND is connected to its 20th pin. Pin 31 of MC is connected to 2nd pin of Max232. Pin
14 of Max232 is connected to pin 3 of DB9 Male connector. Pin 13 of Max232 is connected
to pin 2 of DB9 connector. Pin 11 & 12 of Max232 is connected to port 3.0 and 3.1 of MC.
Port 2.0 to 2.7 of MC are connected to pin D0 – D7 of LCD display. Port 0.0 to 0.2 of MC are
connected to 4, 5, 6 pin’s of LCD display. Port 0.3 to 0.6 of MC are connected to pin’s (1, 2,
3, 4) pin’s of ULN2003A. Pins (1, 2, 3, 4) C of ULN2003A are connected to relay’s.
WORKING:
The project uses a commercial digital energy meter and derives positive pulses
from the same by taking a connection from the pulsing LED. The pulsing LED pulses
69
3200 times for 1 unit of electrical energy i.e., 1 kilo watt hour. As it is not feasible to wait
for consuming 1000 Wt Hr. the program assumes 10 pulses for unit, which is fed to the
microcontroller to send 1 unit consumption through the GSM Modem duly interfaced to
the microcontroller through Max232, Therefore the 1 unit so sent shown have to be read
as 1/3200 unit.
The project uses a GSM modem. Upon a missed a call to the project board GSM
modem, the caller’s number gets stored in the microcontroller for further communication to
that number only. This gives the unique flexibility for changing number by the user at will
without going through the cumbersome process of writing the number while burning the
program on to the microcontroller .Thus in that case only that number is used for
communication and the user has no option to change that . The ‘AT’ commands from which
are received by the micro controller through level shifted IC Max232. The program while
executed drives relays from the microcontroller through relay driver IC ULN2003. Loads are
switched ON and switched OFF based on the corresponding command sent from the GSM
modem. As per the program, an acknowledgement is received by an SMS being sent from
the controller to the user upon the status of the load depending on port 0 logic outputs
responsible for operating the loads. The complete operation is displayed on the LCD
screen.
Operating procedure:
1. The mobile number stored in the microcontroller will get constant
messages regarding the unit consumed and the price.
2. To switch the load on and off, do the following operations from any other
mobile number not from the phone whose number is stored and send the
message to SIM in the modem:
i) Send 1 to switch ON load 1.
ii) Send 2 to switch OFF load 1.
iii) Send 3 to switch ON load 2.
iv) Send 4 to switch OFF load 2.
v) Send 5 to switch ON load 3.
vi) Send 6 to switch OFF load 3.
vii) Send 7 to switch ON load 4.
viii) Send 8 to switch OFF load 4.
4. To get the status of the loads send ‘S’ from any other mobile phone(whose
number is not stored inside the controller) and send it to SIM inside the modem.
Status will be sent to mobile whose number is stored on the controller.
70
71
7.PROJECT LAYOUT
72
8. BILLS OF MATERIAL
73
7. CODING
7.1 COMPILER
1. Click on the Keil Vision Icon on Desktop
2. The following fig will appear
74
3. Click on the Project menu from the title bar
4. Then Click on New Project
5. Save the Project by typing suitable project name with no extension in u r own
folder sited in either C:\ or D:\
75
6. Then Click on Save button above.
7. Select the component for u r project. i.e. Atmel……
8. Click on the + Symbol beside of Atmel
76
10. Then Click on “OK”
11. The Following fig will appear
77
15. Click on the file option from menu bar and select “new”.
16. The next screen will be as shown in next page, and just maximize it by double
clicking on its blue boarder.
78
17. Now start writing program in either in “EMBEDDED C” or “ASM”.
18. For a program written in Assembly, then save it with extension “. asm” and
for “EMBEDDED C” based program save it with extension “ .C”
19. Now right click on Source group 1 and click on “Add files to Group Source”.
79
20. Now you will get another window, on which by default “EMBEDDED C” files
will appear.
21. Now select as per your file extension given while saving the file
22. Click only one time on option “ADD”.
23. Now Press function key F7 to compile. Any error will appear if so happen.
80
24. If the file contains no error, then press Control+F5 simultaneously.
25. The new window is as follows
27. Now click on the Peripherals from menu bar, and check your required port as
shown in fig below.
81
28. Drag the port a side and click in the program file.
29. Now keep Pressing function key “F11” slowly and observe.
30. You are running your program successfully.
82
8. HARDWARE TESTING
Then we apply this voltage to the power supply circuit. Note that we do this test
without microcontroller because if there is any excessive voltage, this may lead to
damaging the controller. We check for the input to the voltage regulator i.e., are we
getting an input of 12v and an output of 5v. This 5v output is given to the
microcontrollers’ 40th pin. Hence we check for the voltage level at 40 th pin. Similarly, we
check for the other terminals for the required voltage. In this way we can assure that the
voltage at all the terminals is as per the requirement.
84
9. RESULTS
85
10. CONCLUSION
11. BIBLIOGRAPHY
1. “The 8051 Microcontroller and Embedded systems” by Muhammad Ali Mazidi and
Janice GillispieMazidi , Pearson Education.
WEBSITES
www.atmel.com
86
www.beyondlogic.org
www.wikipedia.org
www.howstuffworks.com
www.alldatasheets.com
87