off. no. 46, 1st floor, kadamba complex gamma-i, greater...

53
HBeonLabs Off. No. 46, 1st Floor, Kadamba Complex Gamma-I, Greater Noida (India) - 201308 Contact us: +91-120-4298000 +91-9212314779 [email protected] [email protected] www. hbeonlabs.com

Upload: others

Post on 31-May-2020

1 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Off. No. 46, 1st Floor, Kadamba Complex Gamma-I, Greater ...docshare02.docshare.tips/files/12910/129106400.pdf · The Microcontroller AT89S52 is used to control all ... We are using

HBeonLabs

Off. No. 46, 1st Floor, Kadamba Complex Gamma-I, Greater Noida (India) - 201308

Contact us:

+91-120-4298000 +91-9212314779

[email protected]

[email protected]

www. hbeonlabs.com

Page 2: Off. No. 46, 1st Floor, Kadamba Complex Gamma-I, Greater ...docshare02.docshare.tips/files/12910/129106400.pdf · The Microcontroller AT89S52 is used to control all ... We are using

CHAPTER 1 INTRODUCTION & COMPONENTS

INTRODUCTION

“ Automatic College Bell (AT89S52 & DS1307)”.

This Project takes over the task of Ringing of the Bell in Colleges. It replaces the Manual Switching of the Bell in the College. It has an Inbuilt Real Time Clock (DS1307) which track over the Real Time. When this time Equals to the Bell Ringing time, then the Relay for the Bell is switched On. The Bell Ringing time can be Edited at any Time, so that it can be used at Normal Class Timings as well as Exam Times. The Real Time Clock is displayed on LCD display. The Microcontroller AT89S52 is used to control all the Functions, it get the time through the keypad and store it in its Memory. And when the Real time and Bell time get equal then the Bell is switched on for a predetermined time.

This is very wonderful project to control the working of College Bell. These bell are equipped with the CPU which control the bell.

1. 8051 Microcontroller

2. DS1307

3. LCD .

4.Relay

In this project we try to give the same prototype as Manual Switching Bell with the help of programmed micro-controller . We are using ATMEL microcontroller 8051 to control all the function as CPU. Microcontroller controls the ringing of bell

Page 3: Off. No. 46, 1st Floor, Kadamba Complex Gamma-I, Greater ...docshare02.docshare.tips/files/12910/129106400.pdf · The Microcontroller AT89S52 is used to control all ... We are using

WHAT IS EMBEDDED TECHNOLOGY

Embedded technology is software or hardware that is hidden embedded

in a large device or system. It typically refers to a fixed function device,

as compared with a PC, which runs general purpose application.

Embedded technology is nothing new. It all around us and has been for

years. An early example of embedded technology is the engine control

unit in a car, which measures what setting to give the engine. Your

coffee maker has embedded technology in the form of a

microcontroller, which is what tells it to make the coffee at 6 a.m. the

vending machine has it too. Overall, billions of devices woven into

everyday life use embedded technology. In the past embedded

technology existed in standalone device vending machines and copiers

that did their jobs with little regard for what went on around them,. But

as technology has learned to connect device to the internet and to each

other, embedded technology potential has grown. Suddenly it is and

what actions those connections let them perform. Cell phone companies

figured that out a long time ago, which is why cell phones are cheap and

the service, plans are expensive. It is not the phone itself that matters,

but the connectivity to a vast network of other phones, other people

and the internet. Until you download software that lets you find a local

restaurant or mange your finances. Let say you make freezers the big,

expensive kind that grocery stores buy. You sell ne and you are done

with that customer. When it brakes the customer calls a service person,

who probably comes from somewhere other than your company. But let

us say that freezer knows that it is about to go on the fritz. Let say three

refrigerator alerts the customer before it breaks. Better yet, let us say

the freezer alerts the manufacturer and you are able to send a service

person to do preventative work and save a lot of haagen- dazs from

melting. Embedded technology allows all of that to happen. You, the

freezer company have

Page 4: Off. No. 46, 1st Floor, Kadamba Complex Gamma-I, Greater ...docshare02.docshare.tips/files/12910/129106400.pdf · The Microcontroller AT89S52 is used to control all ... We are using

transformed yourself from a product company to product and services

company. The possibilities go beyond that programming device to

communicate with businesses can eliminate the need for costly call

centers. Copy machines that can order their own replacement cartridges

will save businesses time and money. Remember, the fact the

technology is embedded is not what important, and neither is the

device.

Page 5: Off. No. 46, 1st Floor, Kadamba Complex Gamma-I, Greater ...docshare02.docshare.tips/files/12910/129106400.pdf · The Microcontroller AT89S52 is used to control all ... We are using
Page 6: Off. No. 46, 1st Floor, Kadamba Complex Gamma-I, Greater ...docshare02.docshare.tips/files/12910/129106400.pdf · The Microcontroller AT89S52 is used to control all ... We are using

APPLICATIONS

Telecom

• Mobile phone systems (handsets and base stations), modems,

routers

• Automotive application

• Braking system, Traction control, Airbag release system,

Management units, and Steer-by-wire systems.

Domestic application

• Dishwasher, television, washing machines, microwave ovens,

Video recorders, Security system, Garage door controllers,

Calculators, Digital watches, VCRs, Digital cameras, Remote

Controls, Treadmills

Robotic

• Fire fighting robot, Automatic floor cleaner, robotic arm

Aerospace application

• Flight control system, Engine controllers, Autopilots, Passenger

entertainment system

Medical equipment

• Anesthesia monitoring system, ECG monitors, Pacemakers, Drug

delivery systems, MRI scanners

Defense system

• Radar systems, Fighter aircraft flight control system, Radio system,

Missile guidance systems

Office automation

• Laser printers, Fax machines, Pagers, Cash registers, Gas pumps,

Credit /Debit card readers, Thermostats, Grain analyzers.

Page 7: Off. No. 46, 1st Floor, Kadamba Complex Gamma-I, Greater ...docshare02.docshare.tips/files/12910/129106400.pdf · The Microcontroller AT89S52 is used to control all ... We are using

COMPONENTS

LIST OF COMPONENTS USED

AUTOMATIC COLLEGE BELL

Name Capacity Quantity Codes

Regulators 7805 1 U1

7812 1 U3

Capacitor 1000µf 1 C1

Capacitor 10µf 1 C2

Ceramic

Capacitor

22pf 2 C3,C4

Diode 4 D1,D2,D3,D4

Push Button 5 SW1,SW2,SW3,SW4,SW7

40 Pin Base 1 U2

8 Pin Base 1 U4

8051 (AT89S52) 1 U2

RTC DS1307 1 U4

Oscillator 11.0592mhz 1 XTL1

Oscillator 32.768khz 1 XTL2

LCD 16*2 1 LCD

LED 3 D5,D6,D7

Resistance 220Ω 6 R4,R1,R6,R7,R5,R8

Resistance 1k 1 R3

Resistance 10k 4 R2,R9,R11,R10

Battery 3V 1 BT1

Transistors BC547 3 Q1,Q2,Q3

BUZZER 1 BUZ

3V cell holder

base

BT1

2 pin SCREW

connector

1 J1

Page 8: Off. No. 46, 1st Floor, Kadamba Complex Gamma-I, Greater ...docshare02.docshare.tips/files/12910/129106400.pdf · The Microcontroller AT89S52 is used to control all ... We are using

COMPONENT DESCRIPTION

MICRO-CONTROLLER 8051 DESCRIPTION

The IC 8051 is a low-power; high-performance CMOS 8-bit

microcomputer with 4K bytes of Flash programmable and erasable read

only memory (PEROM). The device is manufactured using Atmel’s high-

density nonvolatile memory technology and is compatible with the

industry-standard MCS-51 instruction set and pin out. The on-chip Flash

allows the program memory to be reprogrammed in-system or by a

conventional nonvolatile memory programmer. By combining a versatile

8-bit CPU with Flash on a monolithic chip, the Atmel IC 8051 is a

powerful microcomputer which provides a highly-flexible and cost-

effective solution to many embedded control applications. The IC 8051

provides the following standard features: 4K bytes of Flash, 128 bytes of

RAM, 32 I/O lines, two 16-bit timer/counters, a five vector two-level

interrupt architecture, full duplex serial port, on-chip oscillator and clock

circuitry. In addition, the IC 8051 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.

Transformer 12-0-12 1

Printed PCB 1

Relays 2 RL1,RL2

2pin connectors male 2 J5,J6

16pin connector male 1 LCD

Page 9: Off. No. 46, 1st Floor, Kadamba Complex Gamma-I, Greater ...docshare02.docshare.tips/files/12910/129106400.pdf · The Microcontroller AT89S52 is used to control all ... We are using

Pin Description of the 8051

1234567891011121314151617181920

4039383736353433323130292827262524232221

P1.0P1.1P1.2P1.3P1.4P1.5P1.6P1.7RST

(RXD)P3.0(TXD)P3.1

(T0)P3.4(T1)P3.5

XTAL2XTAL1

GND

(INT0)P3.2(INT1)P3.3

(RD)P3.7(WR)P3.6

VccP0.0(AD0)P0.1(AD1)P0.2(AD2)P0.3(AD3)P0.4(AD4)P0.5(AD5)P0.6(AD6)P0.7(AD7)EA/VPPALE/PROGPSENP2.7(A15)P2.6(A14)P2.5(A13)P2.4(A12)P2.3(A11)P2.2(A10)P2.1(A9)P2.0(A8)

8051(8031)

Figure No. 1.1: Pin Diagram of 8051

Page 10: Off. No. 46, 1st Floor, Kadamba Complex Gamma-I, Greater ...docshare02.docshare.tips/files/12910/129106400.pdf · The Microcontroller AT89S52 is used to control all ... We are using

PROCESSOR

A processor is an electronic device capable of manipulating data in a way

specified by a sequence of instructions.

INSTRUCTIONS

Instructions in a computer are binary numbers just like data. Different

numbers, when read and executed by a processor, cause different things

to happen. The instructions are also called opcodes or machine codes.

Different bit patterns activate or deactivate different parts of the

processing core. Every processor has its own instruction set varying in

number, bit pattern and functionality.

PROGRAM

The sequence of instructions is what constitutes a program. The

sequence of instructions may be altered to suit the application.

ASSEMBLY LANGUAGE

Writing and understanding such programs in binary or hexadecimal

form is very difficult ,so each instructions is given a symbolic notation in

English language called as mnemonics. A program written in mnemonics

Form is called an assembly language program. But it must be converted

into machine language for execution by processor.

ASSEMBLER

An assembly language program should be converted to machine

language for execution by processor. Special software called ASSEMBLER

converts a program written in mnemonics to its equivalent machine

opcodes.

HIGH LEVEL LANGUAGE

A high level language like C may be used to write programs for

processors. Software called compiler converts this high level language

program down to machine code. Ease of programming and portability.

Page 11: Off. No. 46, 1st Floor, Kadamba Complex Gamma-I, Greater ...docshare02.docshare.tips/files/12910/129106400.pdf · The Microcontroller AT89S52 is used to control all ... We are using

PIN DESCRIPTION

VCC (Pin 40)

Provides voltage to the chip . +5V

GND (Pin 20)

Ground

XTAL1 (Pin 19) and XTAL2 (Pin 18)

Crystal Oscillator connected to pins 18, 19.Two capacitors of 30pF value.

Time for one machine cycle:11.0592/12=1.085 µ secs

RST (Pin 9)

RESET pin

1.Active high. On applying a high pulse to this pin, microcontroller will

reset and terminate all activities.

2.INPUT pin

3.Minimum 2 machine cycles required to make RESET

4.Value of registers after RESET

Page 12: Off. No. 46, 1st Floor, Kadamba Complex Gamma-I, Greater ...docshare02.docshare.tips/files/12910/129106400.pdf · The Microcontroller AT89S52 is used to control all ... We are using

External Access: EA 31

•Connected to VCC for on chip ROM

•Connected to Ground for external ROM containing the code Input Pin

Program Store Enable: PSEN 29

•Output Pin

•In case of external ROM with code it is connected to the OE pin of the

ROM

Address Latch Enable: ALE 30

• Output Pin. Active high

•In case of external ROM ,ALE is used to de multiplex (PORT 0) the

address and data bus by connecting to the G pin of 74LS373 chip

I/O Port Pins and their Functions:

•Four ports P0,P1,P2,P3 with 8 pins each, making a total of 32

input/output pins

•On RESET all ports are configured as output. They need to be

programmed to make them function as inputs

PORT 0

•Pins 32-39

•Can be used as both Input or Output

•External pull up resistors of 10K need to be connected

•Dual role: 8051 multiplexes address and data through port 0 to save

pins .AD0-AD7

•ALE is used to de multiplex data and address bus

Page 13: Off. No. 46, 1st Floor, Kadamba Complex Gamma-I, Greater ...docshare02.docshare.tips/files/12910/129106400.pdf · The Microcontroller AT89S52 is used to control all ... We are using

PORT 1

•Pins 1 through 8

•Both input or output

•No dual function

•Internal pull up registers

•On RESET configured as output

PORT 2

•Pins 21 through 28

•No external pull up resistor required

•Both input or output

•Dual Function: Along with Port 0 used to provide the 16-Bit address for

external memory. It provides higher address A8-A16

PORT 3

•Pins 10 through 17

•No external pull up resistors required

Page 14: Off. No. 46, 1st Floor, Kadamba Complex Gamma-I, Greater ...docshare02.docshare.tips/files/12910/129106400.pdf · The Microcontroller AT89S52 is used to control all ... We are using

PROCESSOR ARCHITECTURE

Block Diagram

CPU

On-chip RAM

On-chip ROM for program code

4 I/O Ports

Timer 0

Serial PortOSC

Interrupt Control

External interrupts

Timer 1

Timer/Counter

Bus Control

TxD RxDP0 P1 P2 P3

Address/Data

Counter Inputs

Page 15: Off. No. 46, 1st Floor, Kadamba Complex Gamma-I, Greater ...docshare02.docshare.tips/files/12910/129106400.pdf · The Microcontroller AT89S52 is used to control all ... We are using

Figure No. 1.3: Block Diagram of Microcontroller

Page 16: Off. No. 46, 1st Floor, Kadamba Complex Gamma-I, Greater ...docshare02.docshare.tips/files/12910/129106400.pdf · The Microcontroller AT89S52 is used to control all ... We are using

ALU

The Arithmetic Logic Unit (ALU) performs the internal arithmetic

manipulation of data line processor. The instructions read and executed

by the processor decide the operations performed by the ALU and also

control the flow of data between registers and ALU. Operations

performed by the

ALU are Addition , Subtraction , Not , AND , NAND , OR , NOR , XOR ,

Shift Left/Right , Rotate Left/right , Compare etc. Some ALU supports

Multiplication and Division. Operands are generally transferred from

two registers or from one register and memory location to ALU data

inputs. The result of the operation is the placed back into a given

destination register or memory location from ALU output.

REGISTERS

Registers are the internal storage for the processor. The number of

registers varies significantly between processor architectures.

•WORKING REGISTERS

Temporary storage during ALU Operations and data transfers.

•INDEX REGISTERS

Points to memory addresses.

•STATUS REGISTERS

Stores the current status of various flags denoting conditions resulting

from various operations.

•CONTROL REGISTERS

Contains configuration bits that affect processor operation and the

operating modes of various internal subsystems.

Page 17: Off. No. 46, 1st Floor, Kadamba Complex Gamma-I, Greater ...docshare02.docshare.tips/files/12910/129106400.pdf · The Microcontroller AT89S52 is used to control all ... We are using

Memory Organization

Program Memory

Data Memory

The right half of the internal and external data memory spaces available on Atmel’s Flash microcontrollers. Hardware configuration for accessing up to 2K bytes of external RAM. In this case, the CPU executes from internal Flash. Port 0 serves as a multiplexed address/data bus to the RAM, and 3 lines of Port 2 are used to page the RAM. The CPU generates RD and WR signals as needed during external RAM accesses. You can assign up to 64K bytes of external data memory. External data memory addresses can be either 1 or 2 bytes wide. One-byte addresses are often used in conjunction with one or more other I/O lines to page the RAM. Two-byte addresses can also be used, in which case the high address byte is emitted at Port 2.

Internal data memory addresses are always 1 byte wide, which implies an address space of only 256 bytes. However, the addressing modes for internal RAM can in fact accommodate 384 bytes. Direct addresses higher than 7FH access one memory space, and indirect addresses higher than 7FH access a different memory space. Thus, the Upper 128 and SFR space occupying the same block of addresses, 80H through FFH, although they are physically separate entities. The lowest 32 bytes are grouped into 4 banks of 8 registers. Program instructions call out these registers as R0 through R7. Two bits in the Program Status Word (PSW) select which register bank is in use. This architecture allows more efficient use of code space, since register instructions are shorter than instructions that use direct addressing.

Page 18: Off. No. 46, 1st Floor, Kadamba Complex Gamma-I, Greater ...docshare02.docshare.tips/files/12910/129106400.pdf · The Microcontroller AT89S52 is used to control all ... We are using
Page 19: Off. No. 46, 1st Floor, Kadamba Complex Gamma-I, Greater ...docshare02.docshare.tips/files/12910/129106400.pdf · The Microcontroller AT89S52 is used to control all ... We are using

Programming Status Word:

The Instruction Set

All members of the Atmel microcontroller family execute the same instruction set. This instruction set is optimized for 8- bit control applications and it provides a variety of fast addressing modes for accessing the internal RAM to facilitate byte operations on small data structures. The instruction set provides extensive support for 1-bit variables as a separate data type, allowing direct bit manipulation in control and logic systems that require Boolean processing. The following overview of the instruction set gives a brief description of how certain instructions can be used.

Program Status Word

The Program Status Word (PSW) contains status bits that reflect the current state of the CPU. The PSW, shown in Figure 11, resides in SFR space. The PSW contains the Carry bit, the Auxiliary Carry (for BCD operations), the tworegister bank select bits, the Overflow flag, a Parity bit, and two user-definable status flags. The Carry bit, in addition to serving as a Carry bit in arithmetic operations, also serves as the “Accumulator” for a number of Boolean operations.

The bits RS0 and RS1 select one of the four register banks shown in Figure 8. A number of instructions refer to these RAM locations as R0 through R7. The status of the RS0 and RS1 bits at execution time determines which of the four banks is selected. The Parity bit reflects the number of 1s in the Accumulator: P=1 if the Accumulator contains an odd number of 1s, and P=0 if the Accumulator contains an even number of 1s.

Page 20: Off. No. 46, 1st Floor, Kadamba Complex Gamma-I, Greater ...docshare02.docshare.tips/files/12910/129106400.pdf · The Microcontroller AT89S52 is used to control all ... We are using

Thus, the number of 1s in the Accumulator plus P is always even. Two bits in the PSW are uncommitted and can be used as general purpose status flags.

Addressing Modes

The addressing modes in the Flash microcontroller instruction set are as follows.

Direct Addressing

In direct addressing, the operand is specified by an 8-bit address field in the instruction. Only internal data RAM and SFRs can be directly addressed.

Indirect Addressing

In indirect addressing, the instruction specifies a register that contains the address of the operand. Both internal and external RAM can be indirectly addressed. The address register for 8-bit addresses can be either the Stack Pointer or R0 or R1 of the selected register bank. The address register for 16-bit addresses can be only the 16-bit data pointer register, DPTR.

Register Instructions

The register banks, which contain registers R0 through R7, can be accessed by instructions whose opcodes carry a 3- bit register specification. Instructions that access the registers this way make efficient use of code, since this mode eliminates an address byte. When the instruction is executed, one of the eight registers in the selected bank is accessed. One of four banks is selected at execution time by the two bank select bits in the PSW.

Register-Specific Instructions

Some instructions are specific to a certain register. For example, some instructions always operate on the Accumulator, so no address byte is needed to point to it. In these cases, the opcode itself points to the correct register. Instructions that refer to the Accumulator as A assemble as Accumulator-specific opcodes.

Indexed Addressing

Program memory can only be accessed via indexed addressing. This addressing mode is intended for reading look-up tables in program memory. A 16-bit base register (either DPTR or the Program Counter) points to the base of the table, and the Accumulator is set up with the table entry number. The address of the table entry in program memory is

Page 21: Off. No. 46, 1st Floor, Kadamba Complex Gamma-I, Greater ...docshare02.docshare.tips/files/12910/129106400.pdf · The Microcontroller AT89S52 is used to control all ... We are using

formed by adding the Accumulator data to the base pointer. Another type of indexed addressing is used in the “case jump” instruction. In this case the dest ination address of a jump instruction is computed as the sum of the base pointer and the Accumulator data.

•SRAM

Volatile, fast, low capacity, expensive, requires lesser external support circuitry.

•DRAM

Volatile, relatively slow, highest capacity needs continuous refreshing. Hence

require external circuitry.

•OTP ROM

One time programmable, used for shipping in final products.

•EPROM

Erasable programmable, UV Erasing, Used for system development and

debugging.

•EEPROM

Electrically erasable and programmable, can be erased programmed in- circuit,

Used for storing system parameters.

•FLASH

Electrically programmable & erasable, large capacity, organized as sectors.

BUSES

A bus is a physical group of signal lines that have a related function. Buses allow

for the transfer of electrical signals between different parts of the processor

Processor buses are of three types:

Page 22: Off. No. 46, 1st Floor, Kadamba Complex Gamma-I, Greater ...docshare02.docshare.tips/files/12910/129106400.pdf · The Microcontroller AT89S52 is used to control all ... We are using

•Data bus

•Address bus

•Control bus

CONTROLLER LOGIC

Processor brain decodes instructions and generate control signal for various sub

units. It has full control over the clock distribution unit of processor.

I/O Peripherals

The I/O devices are used by the processor to communicate with the external

world

•Parallel Ports.

•Serial Ports.

•ADC/DAC.

About Keil uVision 3

Keil Software to provide you with software development tools for 8051

based microcontrollers. With the Keil tools, you can generate

embedded applications for virtually every 8051 derivative. The

supported microcontrollers are listed in the µVision

Device Database™. The Keil Software 8051 development tools are

designed for the professional software developer, but any level of

programmer can use them to get the most out of the 8051

microcontroller architecture.

Keil software converts the C-codes into the Intel Hex code.

Page 23: Off. No. 46, 1st Floor, Kadamba Complex Gamma-I, Greater ...docshare02.docshare.tips/files/12910/129106400.pdf · The Microcontroller AT89S52 is used to control all ... We are using

A view of Keil uVision 3

Page 24: Off. No. 46, 1st Floor, Kadamba Complex Gamma-I, Greater ...docshare02.docshare.tips/files/12910/129106400.pdf · The Microcontroller AT89S52 is used to control all ... We are using

8051 Burner Software

51 BURNER provides you with software burning tools for 8051 based

Microcontrollers in there Flash memory. The 51 BURNER tools, you can burn

AT89SXXXX series of ATMEL microcontrollers .

Page 25: Off. No. 46, 1st Floor, Kadamba Complex Gamma-I, Greater ...docshare02.docshare.tips/files/12910/129106400.pdf · The Microcontroller AT89S52 is used to control all ... We are using

DESCRIPTION OF

DESCRIPTION OF REAL –TIME CLOCKTIME CLOCK

Page 26: Off. No. 46, 1st Floor, Kadamba Complex Gamma-I, Greater ...docshare02.docshare.tips/files/12910/129106400.pdf · The Microcontroller AT89S52 is used to control all ... We are using

DETAILED DESCRIPTION The DS1307 is a low-power clock/calendar with 56 bytes of batteryclock/calendar provides seconds, minutes, hours, day, date, month, and year information. The date at the end of the month is automatically adjusted foincluding corrections for leap year. The DS1307 operates as a slave device on the I2C bus. Access is obtained by implementing a START condition and providing a device identification code followed by a register address. SubSTOP condition is executed. When VCC falls below 1.25 x VBAT, the device terminates an access in progress and resets the device address counter. Inputs to the device will not be recognized at this time to prevent erroneous data from being written to the device from an outtolerance system. When VCC falls below VBAT, the device switches into a lowbackup mode. Upon power-up, the device switches from battery to VCC when VCC is greater

DETAILED DESCRIPTION

power clock/calendar with 56 bytes of batteryclock/calendar provides seconds, minutes, hours, day, date, month, and year information. The date at the end of the month is automatically adjusted for months with fewer than 31 days, including corrections for leap year. The DS1307 operates as a slave device on the I2C bus. Access is obtained by implementing a START condition and providing a device identification code followed by a register address. Subsequent registers can be accessed sequentially until a STOP condition is executed. When VCC falls below 1.25 x VBAT, the device terminates an access in progress and resets the device address counter. Inputs to the device will not be

to prevent erroneous data from being written to the device from an outtolerance system. When VCC falls below VBAT, the device switches into a low

up, the device switches from battery to VCC when VCC is greater

power clock/calendar with 56 bytes of battery-backed SRAM. The clock/calendar provides seconds, minutes, hours, day, date, month, and year information. The

r months with fewer than 31 days, including corrections for leap year. The DS1307 operates as a slave device on the I2C bus. Access is obtained by implementing a START condition and providing a device identification

sequent registers can be accessed sequentially until a STOP condition is executed. When VCC falls below 1.25 x VBAT, the device terminates an access in progress and resets the device address counter. Inputs to the device will not be

to prevent erroneous data from being written to the device from an out-of-tolerance system. When VCC falls below VBAT, the device switches into a low-current battery-

up, the device switches from battery to VCC when VCC is greater

Page 27: Off. No. 46, 1st Floor, Kadamba Complex Gamma-I, Greater ...docshare02.docshare.tips/files/12910/129106400.pdf · The Microcontroller AT89S52 is used to control all ... We are using

than VBAT +0.2V and recognizes inputs when VCC is greater than 1.25 x VBAT. The block diagram in Figure 1 shows the main elements of the serial RTC.

OSCILLATOR CIRCUIT The DS1307 uses an external 32.768kHz crystal. The oscillator circuit does not require any external resistors or capacitors to operate. Table 1 specifies several crystal parameters for the external crystal. Figure 1 shows a functional schematic of the osciwith the specified characteristics, the startup time is usually less than one second. CLOCK ACCURACY The accuracy of the clock is dependent upon the accuracy of the crystal and the accuracy of the match between the capacitive load of the oscillator circuit and the capacitive load for which the crystal was trimmed. Additional error will be added by crystal frequency drift caused by temperature shifts. External circuit noise coupled into the oscillator circuit may resultclock running fast. Refer to Application Note 58: Clocks for detailed information

han VBAT +0.2V and recognizes inputs when VCC is greater than 1.25 x VBAT. The block diagram in Figure 1 shows the main elements of the serial RTC.

The DS1307 uses an external 32.768kHz crystal. The oscillator circuit does not require any external resistors or capacitors to operate. Table 1 specifies several crystal parameters for the external crystal. Figure 1 shows a functional schematic of the oscillator circuit. If using a crystal with the specified characteristics, the startup time is usually less than one second.

The accuracy of the clock is dependent upon the accuracy of the crystal and the accuracy of the pacitive load of the oscillator circuit and the capacitive load for which the

crystal was trimmed. Additional error will be added by crystal frequency drift caused by temperature shifts. External circuit noise coupled into the oscillator circuit may resultclock running fast. Refer to Application Note 58: Crystal Considerations with Dallas Real

for detailed information

han VBAT +0.2V and recognizes inputs when VCC is greater than 1.25 x VBAT. The block

The DS1307 uses an external 32.768kHz crystal. The oscillator circuit does not require any external resistors or capacitors to operate. Table 1 specifies several crystal parameters for the

llator circuit. If using a crystal with the specified characteristics, the startup time is usually less than one second.

The accuracy of the clock is dependent upon the accuracy of the crystal and the accuracy of the pacitive load of the oscillator circuit and the capacitive load for which the

crystal was trimmed. Additional error will be added by crystal frequency drift caused by temperature shifts. External circuit noise coupled into the oscillator circuit may result in the

Crystal Considerations with Dallas Real-Time

Page 28: Off. No. 46, 1st Floor, Kadamba Complex Gamma-I, Greater ...docshare02.docshare.tips/files/12910/129106400.pdf · The Microcontroller AT89S52 is used to control all ... We are using

RTC AND RAM ADDRESS MAP Table 2 shows the address map for the DS1307 RTC and RAM registers. The RTC registers are located in address locations 00h to 07h. The RAM registers are located in address locations 08h to 3Fh. During a multibyte access, when the address pointer reaches 3Fh, the end of RAM space, it wraps around to location 00h, the beginning of the clock space.

CLOCK AND CALENDAR The time and calendar information is obtained by reading the appropriate register bytes. Table 2 shows the RTC registers. The time and calendar are set or initialized by writing the appropriate register bytes. The contents of the time and calendar registers are in the BCD format. The day-of-week register increments at midnight. Values that correspond to the day of week are user-defined but must be sequential (i.e., if 1 equals Sunday, then 2 equals Monday, and so on.) Illogical time and date entries result in undefined operation. Bit 7 of Register 0 is the clock halt (CH) bit. When this bit is set to 1, the oscillator is disabled. When cleared to 0, the oscillator is enabled. On first application of power to the device the time and date registers are typically reset to 01/01/00 01 00:00:00 (MM/DD/YY DOW HH:MM:SS). The CH bit in the seconds register will be set to a 1. The clock can be halted whenever the timekeeping functions are not required, which minimizes current (IBATDR). The DS1307 can be run in either 12-hour or 24-hour mode. Bit 6 of the hours register is defined as the 12-hour or 24-hour mode-select bit. When high, the 12-hour mode is selected. In the 12-hour mode, bit 5 is the AM/PM bit with logic high being PM. In the 24-hour mode, bit 5 is the second 10-hour bit (20 to 23 hours). The hours value must be re-entered whenever the 12/24-hour mode bit is changed. When reading or writing the time and date registers, secondary (user) buffers are used to prevent errors when the internal registers update. When reading the time and date registers, the user buffers are synchronized to the internal registers on any I2C START. The time information is read from these secondary registers while the clock continues to run. This eliminates the need to re-read the registers in case the internal registers update during a read. The divider chain is reset whenever the seconds register is written. Write transfers occur on the I2C acknowledge from the DS1307. Once the divider chain is reset, to avoid rollover issues, the remaining time and date registers must be written within one second.

Page 29: Off. No. 46, 1st Floor, Kadamba Complex Gamma-I, Greater ...docshare02.docshare.tips/files/12910/129106400.pdf · The Microcontroller AT89S52 is used to control all ... We are using

VOLAGE REGULATOR

Voltage regulator ICs are 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 (over load protection)

and overheating (thermal protection). Many of fixed voltage regulator ICs has 3

leads. They include a hole for attaching a heat sink if necessary.

Figure No. 1.5: 7805 Voltage Regulator

Page 30: Off. No. 46, 1st Floor, Kadamba Complex Gamma-I, Greater ...docshare02.docshare.tips/files/12910/129106400.pdf · The Microcontroller AT89S52 is used to control all ... We are using

DESCRIPTION

These voltage regulators are monolithic circuit integrated circuit designed as

fixed voltage regulators for a wide variety of applications including local, on card

regulation. These regulators employ internal current limiting, thermal shutdown,

and safe-area compensation. With adequate heat sinking they can deliver output

current in excess of 1.0 A. Although designed primarily as a fixed voltage

regulator, these devices can be used with external components to obtain

adjustable voltage and current.

FEATURES

•Output current in Excess of 1.0 A

•No external component required

•Internal thermal overload protection

•Internal short circuit current limiting

•Output transistor safe-area compensation

•Output voltage offered in 2% and 4% tolerance

•Available I n surface mount D2PAK and standard 3-lead transistor packages

•Previous commercial temperature range has been extended to a junction

temperature range of -40 degree C to +125 degree C.

LCD DISPLAY

DESCRIPTION OF LCD DISPLAY

This is the first interfacing example for the Parallel Port. We will start with

something simple. 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. These LCD Modules are very

Page 31: Off. No. 46, 1st Floor, Kadamba Complex Gamma-I, Greater ...docshare02.docshare.tips/files/12910/129106400.pdf · The Microcontroller AT89S52 is used to control all ... We are using

common these days, and are quite simple to work with, as all the logic required to

run them is on board.

SCHEMATIC DIAGRAM

Figure No. 1.8: Schematic Diagram of LCD Display

CIRCUIT DESCRIPTION

Above is the quite simple schematic. The LCD panel's Enable and Register Select

is connected to the Control Port. The Control Port is an open collector / open

drain output. While most Parallel Ports have internal pull-up resistors, there is a

few which don't. Therefore by incorporating the two 10K external pull up

resistors, the circuit is more portable for a wider range of computers, some of

which may have no internal pull up resistors. We make no effort to place the

Data bus into reverse direction. Therefore we hard wire the R/W line of the LCD

panel, into write mode. This will cause no bus conflicts on the data lines. As a

result we cannot read back the LCD's internal Busy Flag which tells us if the LCD

Page 32: Off. No. 46, 1st Floor, Kadamba Complex Gamma-I, Greater ...docshare02.docshare.tips/files/12910/129106400.pdf · The Microcontroller AT89S52 is used to control all ... We are using

has accepted and finished processing the last instruction. This problem is

overcome by inserting known delays into our program. The 10k Potentiometer

controls the contrast of the LCD panel. Nothing fancy here. As with all the

examples, I've left the power supply out. You can use a bench power supply set to

5v or use an onboard +5 regulator. Remember a few de-coupling capacitors,

especially if you have trouble with the circuit working properly. The 2 line x 16

character LCD modules are available from a wide range of manufacturers and

should all be compatible with the HD44780. The diagram to the right shows the

pin numbers for these devices. When viewed from the front, the left pin is pin 16

and the right pin is pin 1.

Figure No. 1.9: LCD Display

Figure 1 shows how to inte ace 7-seg display to a microcontroller. Now we create

a lookup table containing the seven segment pattern to display the corresponding

hex digits. e.g. consider we have to display '1' from the above figure we come to

know that turning ON segment B & C will show '1' on the 7-seg display so P2.1 &

P2.2 should be LOGIC 0 whereas rest of the pins should be LOGIC 1. FIGURE 2

shows the lookup table for CA display.

Page 33: Off. No. 46, 1st Floor, Kadamba Complex Gamma-I, Greater ...docshare02.docshare.tips/files/12910/129106400.pdf · The Microcontroller AT89S52 is used to control all ... We are using

POWER SUPPLY

BRIDGE RECTIFIER

Bridge rectifier circuit consists of four diodes arranged in the form of a bridge as

shown in figure.

Page 34: Off. No. 46, 1st Floor, Kadamba Complex Gamma-I, Greater ...docshare02.docshare.tips/files/12910/129106400.pdf · The Microcontroller AT89S52 is used to control all ... We are using

OPERATION

During the positive half cycle of the input supply, the upper end A of the

transformer secondary becomes positive with respect to its lower point B. This

makes Point1 of bridge Positive with respect to point 2. The diode D1 & D2

become forward biased & D3 & D4 become reverse biased. As a result a current

starts flowing from point1, through D1 the load & D2 to the negative end. During

negative half cycle, the point2 becomes positive with respect to point1. Diodes D1

& D2 now become reverse biased. Thus a current flow from point 2 to point1.

TRANSFORMER

Transformer is a major class of coils having two or more windings usually

wrapped around a common core made from laminated iron sheets. It has two cols

named primary and secondary. If the current flowing through primary is

fluctuating, then a current will be inducted into the secondary winding. A steady

current will not be transferred from one coil to other coil.

Transformers are of two types:

1.Step up transformer

2.Step down transformer

In the power supply we use step down transformer. We apply 220V AC on the

primary of step down transformer. This transformer step down this voltages to 6V

AC. We Give 6V AC to rectifier circuit, which convert it to 5V DC.

Page 35: Off. No. 46, 1st Floor, Kadamba Complex Gamma-I, Greater ...docshare02.docshare.tips/files/12910/129106400.pdf · The Microcontroller AT89S52 is used to control all ... We are using

DIODE

The diode is a p-n junction device. Diode is the component used to control the

flow of the current in any one direction. The diode widely works in forward bias.

Diode When the current flows from the P to N direction. Then it is in forward

bias. The Zener diode is used in reverse bias function i.e. N to P direction. Visually

the identification of the diode`s terminal can be done by identifying he

silver/black line. The silver/black line is the negative terminal (cathode) and the

other terminal is the positive terminal (cathode).

APPLICATION

•Diodes: Rectification, free-wheeling, etc

•Zener diode: Voltage control, regulator etc.

•Tunnel diode: Control the current flow, snobbier circuit, etc

RESISTORS

The flow of charge through any material encounters an opposing force similar in

many respects to mechanical friction .this opposing force is called resistance of

the material .in some electric circuit resistance is deliberately introduced in form

of resistor. Resistor used fall in three categories , only two of which are color

coded which are metal film and carbon film resistor .the third category is the wire

wound type ,where value are generally printed on the vitreous paint finish of the

component. Resistors are in ohms and are represented in Greek letter omega,

looks as an upturned horseshoe. Most electronic circuit require resistors to make

Page 36: Off. No. 46, 1st Floor, Kadamba Complex Gamma-I, Greater ...docshare02.docshare.tips/files/12910/129106400.pdf · The Microcontroller AT89S52 is used to control all ... We are using

them work properly and it is obliviously important to find out something about

the different types of resistors available. Resistance is measured in ohms, the

symbol for ohm is an omega ohm. 1 ohm is quite small for electronics so

resistances are often given in kohm and Mohm.

Resistors used in electronics can have resistances as low as 0.1 ohm or as high as

10 Mohm.

FUNCTION

Resistor restrict the flow of electric current, for example a resistor is placed in

series with a light-emitting diode(LED) to limit the current passing through the

LED.

TYPES OF RESISTORS

FIXED VALUE RESISTORS

It includes two types of resistors as carbon film and metal film .These two types

are explained under

1. CARBON FILM RESISTORS

During manufacture, at in film of carbon is deposited onto a small ceramic rod.

The resistive coating is spiraled away in an automatic machine until the resistance

between there two ends of the rods is as close as possible to the correct value.

Metal leads and end caps are added, the resistors is covered with an insulating

coating and finally painted with colored bands to indicate the resistor value

Page 37: Off. No. 46, 1st Floor, Kadamba Complex Gamma-I, Greater ...docshare02.docshare.tips/files/12910/129106400.pdf · The Microcontroller AT89S52 is used to control all ... We are using

Figure No. 1.15: Carbon Film Resistors

Another example for a Carbon 22000 Ohms or 22 Kilo-Ohms also known as 22K

at 5% tolerance: Band 1 = Red, 1st digit Band 2 = Red, 2nd digit Band 3 = Orange,

3rd digit, multiply with zeros, in this case 3 zero's Band 4 = Gold, Tolerance, 5%

METAL FILM RESISTORS

Metal film and metal oxides resistors are made in a similar way, but can be made

more accurately to within ±2% or ±1% of their nominal vale there are some

difference in performance between these resistor types, but none which affects

their use in simple circuit.

WIRE WOUND RESISTOR

A wire wound resistor is made of metal resistance wire, and because of this, they

can be manufactured to precise values. Also, high wattage resistors can be made

by using a thick wire material. Wire wound resistors cannot be used for high

frequency circuits. Coils are used in high frequency circuit. Wire wound resistors

Page 38: Off. No. 46, 1st Floor, Kadamba Complex Gamma-I, Greater ...docshare02.docshare.tips/files/12910/129106400.pdf · The Microcontroller AT89S52 is used to control all ... We are using

in a ceramic case, strengthened with special cement. They have very high power

rating, from 1 or 2 watts to dozens of watts. These resistors can become

extremely hot when used for high power application, and this must be taken into

account when designing the circuit.

TESTING

Resistors are checked with an ohm meter/millimeter. For a defective resistor the

ohm-meter shows infinite high reading.

CAPACITORS

In a way, a capacitor is a little like a battery. Although they work in completely

different ways, capacitors and batteries both store electrical energy. If you have

read How Batteries Work , then you know that a battery has two terminals. Inside

the battery, chemical reactions produce electrons on one terminal and absorb

electrons at the other terminal.

BASIC

Like a battery, a capacitor has two terminals. Inside the capacitor, the terminals

connect to two metal plates separated by a dielectric. The dielectric can be air,

paper, plastic or anything else that does not conduct electricity and keeps the

plates from touching each other. You can easily make a capacitor from two pieces

of aluminum foil and a piece of paper. It won't be a particularly good capacitor in

terms of its storage capacity, but it will work.

In an electronic circuit, a capacitor is shown like this:

Page 39: Off. No. 46, 1st Floor, Kadamba Complex Gamma-I, Greater ...docshare02.docshare.tips/files/12910/129106400.pdf · The Microcontroller AT89S52 is used to control all ... We are using

Figure No. 1.17: Symbol of Capacitor

When you connect a capacitor to a battery, here’s what happens:

•The plate on the capacitor that attaches to the negative terminal of the battery

accepts electrons that the battery is producing.

•The plate on the capacitor that attaches to the positive terminal of the battery

loses electrons to the battery.

Page 40: Off. No. 46, 1st Floor, Kadamba Complex Gamma-I, Greater ...docshare02.docshare.tips/files/12910/129106400.pdf · The Microcontroller AT89S52 is used to control all ... We are using

TESTING

To test the capacitors, either analog meters or specia

l digital meters with the specified function are used. The non-electrolyte capacitor

can be tested by using the digital meter.

Multi – meter mode : Continuity Positive probe : One end Negative probe :

Second end Display : `0`(beep sound occur) `OL` Result : Faulty OK

LED

LED falls within the family of P-N junction devices. The light emitting diode (LED) is

a diode that will give off visible light when it is energized. In any forward biased

P-N junction there is, with in the structure and primarily close to the junction, a

recombination of hole and electrons. This recombination requires that the energy

possessed by the unbound free electron be transferred to another state. The

process of giving off light by applying an electrical source is called

electroluminescence.

Page 41: Off. No. 46, 1st Floor, Kadamba Complex Gamma-I, Greater ...docshare02.docshare.tips/files/12910/129106400.pdf · The Microcontroller AT89S52 is used to control all ... We are using

LED is a component used for indication. All the functions being carried out are

displayed by led .The LED is diode which glows when the current is being flown

through it in forward bias condition. The LEDs are available in the round shell and

also in the flat shells. The positive leg is longer than negative leg.

CHAPTER 2 LITERATURE REVIEW

PREHISTORY: 8048

In fact, it should have started with chapter -2, the invention of microprocessor.

Intel introduced a single-chip processor, the 4004, in 1971. It was a 4-bit

microprocessor, with whopping processing speed of 100 thousand operations per

second, and was meant for an electronic calculator. There is a lot of 4-bit

processing in calculators, especially if the software is based on BCD arithmetics.

Later Intel introduced the 8-bitter 8008 and it's grown-up brother - the famous

8080 (which then was perfected by an ex-Intel employee as Zilog Z80, one of the

best 8-bit microprocessors of all times). In 1976, Intel introduced its first

microcontroller, 8048. It integrated the processing core with code and data

memory and certain peripherals. The code memory was a 1kB mask ROM (defined

by the last metallisation mask during the chip processing) or EPROM (after all,

Page 42: Off. No. 46, 1st Floor, Kadamba Complex Gamma-I, Greater ...docshare02.docshare.tips/files/12910/129106400.pdf · The Microcontroller AT89S52 is used to control all ... We are using

Intel invented EPROM), the data memory was 64 bytes of RAM (including the 8-

level stack and two pages of eight general purpose registers). Besides general-

purpose I/O (see below), peripherals included a timer and an external interrupt

(plus the necessary interrupt system). Although the 8048 is clearly an 8-bit

architecture, it is said to be an ancestor of the 4-bit 4004 rather than the 8080.

Also it is said to bear remarkable similarities to Fairchild F8 microprocessor.

Today, it is hard to say whether something of this is true, but one thing is sure,

the 8048 has a couple of strange features. Using four of its general purpose

input/output ports, and adding one or more 8243-type chip - and the I/O expand

into another four 4-bit ports. This expansion has not only support in the hardware

- dedicated pins on 8048 - but also in the instruction set, having dedicated

instructions for I/O operations (including AND and OR(!)) via the expander.

The 8048 already had a lot of useful features known well to 8051-users: external

code memory support; external data memory support (inherently only 256 bytes

addressed indirectly by R0 and R1 as there is no 16 bit pointer register such as the

DPTR in 8051 - the 8051 inherited this 8-bit external data access);

quasibidirectional I/O ports. Maximum clock is 11MHz, but an instruction cycle

takes 15 oscillator clocks. The "A" version (advanced) introduced powerdown

mode There were multiple variations of the 8048 around, mostly with different

numbering, but generally denoted as the MCS-48 family. 8048 itself denoted a

mask-ROM part, 8748 an EPROM part - windowed (CERDIP - erasable) for

development, and unwindowed (PDIP) OTP. The romless part was a bit

surprisingly marked 8035 (probably most of the parts sold as romless were parts

with unusable ROM, due to error in the "programmed" firmware). There was a

low-cost version with reduced pin count and omitted some of the features as

8021, and versions with more ROM and RAM as 8049 (2kB ROM/128B RAM) and

8050 (4kB ROM/256B RAM); with ROMless versions as 8039 and 8040; and 8049

had also an EPROM version 8749 (the funny thing is, that 8749 came in 1981, one

year after 8051/8751). 8048's were second sourced by a number of

manufacturers, including NEC, Toshiba, and were cloned also behind the then iron

curtain in Czechoslovakia (Tesla MHB8048/8035) and USSR. Application specific

versions of 8048 were also built quite early, with adding of various peripherals,

Page 43: Off. No. 46, 1st Floor, Kadamba Complex Gamma-I, Greater ...docshare02.docshare.tips/files/12910/129106400.pdf · The Microcontroller AT89S52 is used to control all ... We are using

such as 8-bit ADC in 8022 and a parallel-bus slave interface in 8041/8042. The

MCS-48 family was used in a quite wide range of applications. One of the first

applications of 8048 was in a gaming console (Magnavox Odyssey2), but there

were also more "serious" applications, for example in one of the first car engine

"computerized" control units. But the biggest hit came when IBM decided to use

8048 in its original PC keyboard. Although in the AT keyboard IBM used the

(presumably cheaper) 6805, it used 8042 as a co-processor on the mainboard,

communicating with the keyboard. The 8042 is still present in almost each and

every PC even today, but don't search for a chip with "8042" on it - it is integrated

in the chipset. It may come as a surprise to somebody, but thanks to this fact the

8048 with its derivatives is most probably the most widespread microcontroller at

all.

As in the 70s there were no pdf-s and no world-wide web, datasheets and other

documentation is hardly available over the internet. I believe Intel will give out a

copy if one really wants it (there is a "literature request" form at their "museum"

pages). However, there seems to be a couple of enthusiastic people, one of the

maintaining a wonderful document called “Grokking the MCS-48 System” at

http://home.mnet-online.de/al/mcs-48/mcs-48.pdf .

8051: THE CLASSICS

In 1980, Intel introduced the successor to 8048, the 8051. Intel made sure that

the transition from the already successful model will be as smooth as possible.

Architecturally, the 8051 is an extension to 8048. Almost every feature and

resource of 8048 is present in 8051 in same or superior form. 4kB ROM and 128B

RAM on chip. Pin compatibility was not maintained, but it was not a real issue.

Software compatibility is not binarywise but source-wise, but that is also

acceptable. The preliminary datasheet read: "Enhanced MCS-48 Architecture".

The extensions included code and data memory extended to 64kB with

appropriate support in instruction set and registers (DPTR), relative conditional

and unconditional jumps (conditionals and DJNZ were constrained within a 256-

byte page in 8048), four register banks instead of two, "unlimited" stack (8048

had stack limited to 16 bytes), multiple and divide instructions. As for peripherals,

Page 44: Off. No. 46, 1st Floor, Kadamba Complex Gamma-I, Greater ...docshare02.docshare.tips/files/12910/129106400.pdf · The Microcontroller AT89S52 is used to control all ... We are using

second timer was added and both were extended to 16 bits with multiple modes

(including 8-bit autoreload mode), and an UART (which was a luxury that many

lower-end microcontrollers didn't have even a couple of years ago). The raw clock

frequency did not increase considerably, being 12MHz, but an instruction cycle is

12 clocks now. Similarly to 8048, also the 8051 had variants, but there was no

cut-down "low-cost" version (presumably because of the cost of ROM/RAM and

the DIP40 package went low enough). The romless version was 8031 and the

EPROM version was 8751. The "extended" version - 8052 (with 8032 and 8752)

came 3 years later and featured besides 8kB ROM and 256B RAM also an extra

16-bit timer. An unusual chip was the 8052AH-BASIC, which according to Intel was

"software-onsilicon version of the 8052 microcontroller with a BASIC interpreter

on-chip in 8K ROM". The whole family was eventually called MCS-51 and was

manufactured in NMOS, since 1986 in CMOS. Intel provided all the needed initial

tools and support with the 8051 - assembler, application notes, example

software, in-circuit emulator. Some of the appnotes and software still can be

found on Intel's webpages and are of excellent quality. The basic datasheet set -

dubbed in the community as "the bible" - is still THE reference source of

information on 8051 and its derivatives, even today. So, Intel did its job,

providing everything needed to make 8051 successful, and the rest is history.

THE BIRDS ARE OUT OF

THE NEST

Similar to 8048, also the 8051 has been licensed to various manufacturers

worldwide. Some of the early adopters include Philips, Signetics, MHS (Matra) and

Siemens. Most of these companies don't exist any more, some have been taken

over, others have been renamed; but most of them still manufacture some

derivative of 8051. The licensees started to make fully compatible models.

Naturally, they took over also the datasheets, for example the "bible" is better

used in the Philips version, which is a verbatim copy of the Intel version, except

that it is a true searchable pdf, while the Intel is a scanned copy of paper

document, unsearchable. More than that, the manufacturers took over the

Page 45: Off. No. 46, 1st Floor, Kadamba Complex Gamma-I, Greater ...docshare02.docshare.tips/files/12910/129106400.pdf · The Microcontroller AT89S52 is used to control all ... We are using

annoying practice of Intel to include in datasheets only the specific differences to

the "bible", very confusing for the newbies (but there are opinions on this, some

of the users consider this arrangement better than having huge datasheets

containing all the “common” details). The manufacturers published their own

appnotes, which all together form a huge knowledge base and code library, but...

due to competition it is scattered across the manufacturers' sites, an another

confusing fact for the newbies. Later, the manufacturers rolled out their own

derivatives and variants with varying marking - there is no real standard in it

(although there are some idiosyncrasies present in the marking of most

manufacturers). All types of modifications described in the following chapters

were applied; but the compatibility to the original 8051 was usually maintained.

This, together with the availability of second-, third-,...,35th-,...-source of 8051 is

the true source of its immortality.

EMBEDDED IN EMBEDDED

Intel and the licensees soon realized that 8051 is a nice core that can be

embedded in various ASIC chips to perform setup and control tasks. Typically, the

resources of the ASIC are mapped as external data memory, as if the ASIC would

be connected to a conventional 8051 chip. This approach allows to use an

unmodified core, which speeds up the chip development and decreases the

chance for error; also the ASIC could be breadboard-prototyped in this form

easily. As an example, Intel produced 80C51SL, a descendant of 8042. Philips has

a line of 8051-based teletext controllers. In a particular USB webcamera, the chip

interfacing the CCD and USB was controlled by an embedded 8051. There are

probably much more examples around, but most of them never get public. In

spite of this, the 8051 in this form is produced probably in much higher volumes

than as general-purpose microcontrollers.

Page 46: Off. No. 46, 1st Floor, Kadamba Complex Gamma-I, Greater ...docshare02.docshare.tips/files/12910/129106400.pdf · The Microcontroller AT89S52 is used to control all ... We are using

EXTRAS

Besides application-specific, also general purpose derivatives have been

introduced by Intel and the licensees, with enhanced features and increased code

and data memories. In contrast with the ASICs mentioned above, these chips tend

to implement the extra features in the core itself, acces allows faster code as SFRs

are accessed by all the instructions using direct addressing (mov, logic), and some

of them by the bit-manipulation instructions, too. One of the first such derivative

by Intel was the 80C51FA, which introduced the programmable counter array

(PCA) (and was a 8052 otherwise). It was intended for automotive applications

(brake control). Soon, FB and FC continued, with more and more code memory.

80C51RA/RB/RC followed, with added "internal external" data memory. These

were the basis for the today's 89C51RD2 "sub-family", produced by Philips, Atmel

(as ex-Temic), SST and Winbond.

FAT BOYS: 16-BIT EXTENSIONS

When the 8051 was accepted widely enough, some of the applications started to

grow and soon required more power than the 8051 even with enhancements

could provide. There were 16-bit microcontrollers around (e.g. Intel had it's

80C196 line), but it seemed a good idea to provide a more natural migration path

by creating a 16-bit version of 8051. Intel addressed the problem by introducing

80C251. It went all the way to achieve compatibility - it was able to run 8051

binary code (being able to switch to native 16-bit 251-mode) and had a package

pin-compatible with 8051. It was not a big success, most probably for bad market

timing (although it is second sourced by Temic/Atmel). Philips on the other hand

employed source-compatibility for its XA family, which seems to be adequate for

most of the applications, where legacy code has to be maintained or parallel

development with 8051 is needed; and poses little constraint on the chip design

itself. All in all, the 16-bit versions of 8051 gained far less popularity than the

8051 and are less widespread.

Page 47: Off. No. 46, 1st Floor, Kadamba Complex Gamma-I, Greater ...docshare02.docshare.tips/files/12910/129106400.pdf · The Microcontroller AT89S52 is used to control all ... We are using

FLASH FOR THE MASSES

In the 90s, Atmel introduced a derivative of 8051 with Flash code memory,

enabling fast erasure and reprogramming. It enabled to use the production-grade

chip in development, and enabled the chips used in the product to be

reprogrammed when upgrade or a bugfix was needed, cutting down costs. It

brought down the 8051 to the masses - the small "garage" companies and

hobbyists. Besides that, Atmel introduced also 89C2051 with decreased pin count

(and price).This was a smart move, the chip proved to be extremely popular in

many small applications. Today, virtually all manufacturers produce 8051

derivatives with Flash, most of them able to be programmed via some few-pin

serial interface (called in-situ programming (ISP), SPI-style or UART-style) and the

higher-end versions also able to reprogram themselves (in-application

programming, IAP). MaskROM and EPROM - windowed or OTP - seems to become

extinct, at least in the mainstream applications.

NEED FOR SPEED

The need for higher processing power, addressed unsuccessfully by the 16-bit

versions, has been solved by introducing the high speed derivatives of 8051. The

original 12-clock instruction cycle scheme is obviously inefficient and also the

technology progressed enough to achieve higher clock rates than the original

12MHz. The first derivative addressing this in a radical way is the now legendary

Dallas DS80C320. It featured a 4-clocker core with incompatible timing, and could

be clocked as high as 33MHz. Unfortunately, it was produced as ROMless only.

The following step was taken by Cygnal, where a single-clock core has been

developed. In the top-range models, the clocking is as high as 100MHz, being the

fastest 8051s around.

Page 48: Off. No. 46, 1st Floor, Kadamba Complex Gamma-I, Greater ...docshare02.docshare.tips/files/12910/129106400.pdf · The Microcontroller AT89S52 is used to control all ... We are using

Today, there are many 8051 derivatives with sped-up cores available. They can be

divided into two groups: the 6-clockers (e.g. the 8xC51RD2) and 2-clockers

(Philips LPC9xx) have the same number of instruction cycle per instruction as the

original; while the 4-clockers and singleclockers are incompatible in this way,

requiring recalculation of timing loops if used.

WHERE IS IT GOING?

The 8051 is a sound mcu core with rich history. However, it seems that it is

already over its peak, although it might take quite a lot of time until it will be

completely replaced by most modern microcontrollers. So we now have

superfast 8051 derivatives with loads of internal FLASH and RAM. ISP and IAP

seems to be the standard these days. There are the 8051s built around advanced

analog circuits, mainly high resolution ADC. There are derivatives suitable for

extreme applications – high temperature, radiation hardened. There are softcores

around, tuned up, and even open source. There is a wealth of knowledge and

experience, however, it is scattered around and the newbies tend to get the

easier path - competing 8-bit microcontrollers usually do have a single-stop

information resource site, so this knowledge and experience seems to die out as

the "old boys" retire gradually. The price difference between the high-end 8-

bitters and the much more powerful low-end 32-bit RISCs (such as the ARMs)

seems to decrease rapidly and will change eventually, as the 32-bitters are

becoming the standard in all but the least demanding applications.So there is

perhaps still a need for the 8051s, but this need is decreasing and 8051s life cycle

is slowly approaching its end.

Page 49: Off. No. 46, 1st Floor, Kadamba Complex Gamma-I, Greater ...docshare02.docshare.tips/files/12910/129106400.pdf · The Microcontroller AT89S52 is used to control all ... We are using

CHAPTER 3

P.C.B. DESIGNING & WORKING

P.C.B. DESIGNING

P.C.B. LAYOUT

The entire circuit can be easily assembled on a general purpose P.C.B. board

respectively. Layout of desired diagram and preparation is first and most

important operation in any printed circuit board manufacturing process. First of

all layout of component side is to be made in accordance with available

components dimensions. The following points are to be observed while forming

the layout of P.C.B.

1.Between two components, sufficient space should be maintained.

2.High voltage/max dissipated components should be mounted at sufficient

distance from semiconductor and electrolytic capacitors.

3.The most important points are that the components layout is making proper

compromise with copper side circuit layout. Printed circuit board (P.C.B.s) is used

to avoid most of all the disadvantages of conventional breadboard. These also

avoid the use of thin wires for connecting the components; they are small in size

and efficient in performance.

PREPARING CIRCUIT LAYOUT

First of all the actual size circuit layout is to be drawn on the copper side of the

copper clad board. Then enamel paint is applied on the tracks of connection with

the help of a shade brush. We have to apply the paints surrounding the point at

which the connection is to be made. It avoids the disconnection between the leg

of the component and circuit track. After completion of painting work, it is

allowed to dry.

Page 50: Off. No. 46, 1st Floor, Kadamba Complex Gamma-I, Greater ...docshare02.docshare.tips/files/12910/129106400.pdf · The Microcontroller AT89S52 is used to control all ... We are using

DRILLING

After completion of painting work, holes 1/23inch(1mm) diameter are drilled at

desired points where we have to fix the components.

ETCHING

The removal of excess of copper on the plate apart from the printed circuit is

known as etching. From this process the copper clad board wit printed circuit is

placed in the solution of FeCl with 3-4 drops of HCL in it and is kept so for about

10 to 15 minutes and is taken out when all the excess copper is removed from the

P.C.B. After etching, the P.C.B. is kept in clean water for about half an hour in

order to get P.C.B. away from acidic, field, which may cause poor performance of

the circuit. After the P.C.B. has been thoroughly washed, paint is removed by soft

piece of cloth dipped I thinner or turbine. Then P.C.B. is checked as per the layout,

now the P.C.B. is ready for use.

SOLDERING

Soldering is the process of joining two metallic conductor the joint where two

metal conductors are to be join or fused is heated with a device called soldering

iron and then as allow of tin and lead called solder is applied which melts and

converse the joint. The solder cools and solidifies quickly to ensure is good and

durable connection between the jointed metal converting the joint solder also

present oxidation.

SOLDERING AND DESOLDERING TECHIQUES:

These are basically two soldering techniques.

•Manual soldering with iron.

•Mass soldering.

SOLDERING WITH IRON

The surface to be soldered must be cleaned & fluxed. The soldering iron switched

on and bellowed to attain

Page 51: Off. No. 46, 1st Floor, Kadamba Complex Gamma-I, Greater ...docshare02.docshare.tips/files/12910/129106400.pdf · The Microcontroller AT89S52 is used to control all ... We are using

soldering temperature. The solder in form of wire is allied hear the component

to be soldered and heated with iron. The surface to be soldered is filled, iron is

removed and joint is cold without disturbing.

SOLDER JOINT ARE SUPPOSED TO

1.Provide permanent low resistance path.

2.Make a robust mechanical link between P.C.B. and leads of components.

3.Allow heat flow between component, joining elements and P.C.B.

4.Retain adequate strength with temperature variation. The following precaution

should be taken while soldering:

1.Use always an iron plated copper core tip for soldering iron.

2.Slightly for the tip with a cut file when it is cold.

3.Use a wet sponge to wipe out dirt from the tip before soldering instead of

asking the iron.

4.Tighten the tip screw if necessary before iron is connected to power supply.

5.Clean component lead and copper pad before soldering.

6.Apply solder between component leads, P.C.B. pattern and tip of soldering iron.

7.Iron should be kept in contact with the joint for 2-3 seconds only instead of

keeping for very long or very small time.

8.Use optimum quantity of solder

WORKING

This project uses a stepper motor to control the position of solar energy

collectors, using Intel 8051 .

Page 52: Off. No. 46, 1st Floor, Kadamba Complex Gamma-I, Greater ...docshare02.docshare.tips/files/12910/129106400.pdf · The Microcontroller AT89S52 is used to control all ... We are using

PROBLEM FACED

•First problem that was in making the circuit of SOLAR TRACER that, it

is difficult to match time with rotation of stepper motor & LCD.

•Second problem is faced due to redundancy in handling the rotation

of STEPPER MOTOR

•We have to take extra care while soldering 2 line LCD

•During soldering, many of the connection become short cktd. So we

desolder the connection and did soldering again.

•A leg of the crystal oscillator was broken during mounting. So it has to

be replaced.

•LED`s get damaged when we switched ON the supply so we replace it

by the new one.

TROUBLESHOOT

•Care should be taken while soldering. There should be no shorting of

joints.

•Proper power supply should maintain.

•Project should be handled with care since IC are delicate

•Component change and check again circuit

Page 53: Off. No. 46, 1st Floor, Kadamba Complex Gamma-I, Greater ...docshare02.docshare.tips/files/12910/129106400.pdf · The Microcontroller AT89S52 is used to control all ... We are using