06-10-2016, 03:29 PM
1458069876-CHAPTER1.docx (Size: 759.44 KB / Downloads: 5)
INTRODUCTION
A microcontroller is a single chip microprocessor system which consists of cpu, data and program memory , serial and parallel i/o ports, timers and external as well as internal interrupts. It can also be called as a entire computer manufactured on a single chip.
The Intel MCS-51 (commonly termed 8051) is an internally Harvard architecture,complex instruction set computing (CISC) instruction set, single chip microcontroller(µC) series developed by Intel in 1980 for use in embedded systems.
8051 CENTRAL PROCESSING UNITS.4k *8 ROM 128*8 RAM three 16 bit counters/timers, Full duplex serials channels, Boolean processor full static operation, MEMORY ADDRESSING CAPABILITY, 64k ROM and 64k RAM.
1.2 FEATURES
4 KB on chip program memory.
128 bytes on chip data memory(RAM).
4 reg banks.
128 user defined software flags.
8-bit data bus.
16-bit address bus.
32 general purpose registers each of 8 bits.
16 bit timers .
3 internal and 2 external interrupts.
Bit as well as byte addressable RAM area of 16 bytes.
Four 8 bit ports.
16-bit program counter and data pointer.
1 microsecond instruction cycle with 12 MHz crystal.
1.3 ARCHITECTURE
POWER CONTROL MODES: - Idle mode, power down mode, CMOS and TTL compatible, frequency range of 0 to 33 MHz, 4 level priority interrupts, 6 interrupt services, four 8-bit i/o ports.
ACCUMULATOR(ACC):- It is used for data transfer and arithmetic operations. After any operations result is stored in Acc and can be accessed through its SFR address of 0E0H.
A REGISTER:- It is located in the SFR memory location 0xE0. The A register works in similar fashion to the AX register of x86 processors. The A register is called the accumulator, and by default it receives result of all arithmetic operations.
B REGISTER:- It is used to store the upper 8-bit result of multiplication and divisions. It is used as temporary register and can be accessed through its SFR address of 0F0H.
PROGRAM STATUS WORD(PSW):- This SFR consists of different status bits that reflect the current state of microcontroller. It contains carry(CY), auxiliary carry(AC), two register bank select bits(RS1 And RS0), overflow flag(OV), parity bit(P), two user defined status flags.
STACK POINTER(SP) :- This is an 8-bit register . SP is incremented before the data is stored onto stack using PUSH/CALL instructions execution. During PUSH, first SP is incremented and then copy data. In the POP operation, initially copy the data and then decrement the SP.
DATA POINTER(DPTR):- DPTR is a 16-bit registers. It consists of higher byte(DPH) and a lower byte(DPL). DPTR is very useful fo string operations and look up table operations. With a 16-bit DPTR, a maximum of 64k of off chip data memory and 64k of off chip memory can be addressed.
1.4 PIN DETAILS
There are four 8-bits ports: p0,p1,p2& p3.
PORT P1(Pins 1-8): The port P1 is a general purpose i/o port which can be used for a variety of interfacing tasks. The other ports P0, P2 & P3 have dual roles or additional functions associated with them based upon the context of their usage. The pot 1 output buffers can sink/source four TTL inputs. When 1s are written to pot 1 pins are pulled high by internal pull-ups and can be used as inputs.
PORT P1(PINS 10-17): PORT P3 acts as a normal IO port, but port P3 has additional functions such as serial transmit and receive pins, 2 external interrupt pins, 2external counter inputs, read and write pins for memory access.
PORT P2(PINS 21-28): PORT P2 can also be used as a general purpose 8 bit port when no external memory is present, but if external memory access is required then PORT P2 will accts as an address bus in conjunction with PORT P0 to access external memory.
PORT P0(PINS 32-39): PORT P0 can be used as a general purpose 8 bit port when no external memory is present, but if external memory access is required then PORT P0 acts as a multiplexed address and data bus that can be used to access external memory in conjunction with PORT P2.
PORT P10: Asynchronous communication input or serial synchronous communication output.
1.5 EMBEDDED C
Embedded C is a set of language extensions for the C Programming language by the C Standards committee to address commonality issues that exist between C extensions for different embedded systems. Historically, embedded C programming requires nonstandard extensions to the C language in order to support exotic features such as fixed-point arithmetic, multiple distinct memory banks, and basic I/O operations.
In 2008, the C Standards Committee extended the C language to address these issues by providing a common standard for all implementations to adhere to. It includes a number of features not available in normal C, such as, fixed-point arithmetic, named address spaces, and basic I/O hardware addressing.
Embedded C uses most of the syntax and semantics of standard C, e.g., main() function, variable definition, datatype declaration, conditional statements (if, switch, case), loops (while, for), functions, arrays and strings, structures and union, bit operations, macros, etc.
1.6 PROPOSED SYSTEM
This proposed system uses an ultrasonic transducer comprising of transmitter and receiver are used for the project. Then distance is calculated by a program running on a microcontroller and displayed on an LCD screen. The ultrasonic sensor produces 40 KHz sound waves.
A power supply is an electronic device that supplies electric energy to an electrical load. The primary function of a power supply is to convert one form of electrical energy to another and, as a result, power supplies are sometimes referred to as electric power converters.
Power supply has following units:
1. Step down transformer
2. Rectifier unit
3. Input filter
4. Regulator unit
5. Output filter
2.1.2 STEP DOWN TRANSFORMER
Is one whose secondary voltage is less than its primary voltage. It is designed to reduce the voltage from the primary winding to the secondary winding. This kind of transformer “steps down” the voltage applied to it.
As a step-down unit, the transformer converts high-voltage, low-current power into low voltage, high current power. The larger-gauge wire used in the secondary winding is necessary due to the increase in current. The primary winding, which doesn’t have to conduct as much current, may be made of smaller-gauge wire.
2.1.3 RECTIFIER UNIT
A rectifier is an electrical device that converts alternating current (AC), which periodically reverses direction, to direct current (DC), which flows in only one direction. The process is known as rectification. Physically, rectifiers take a number of forms, including vacuum tube diodes, mercury-arc valves, copper and selenium oxide rectifiers, semiconductor diodes, silicon-controlled rectifiers and other silicon-based semiconductor switches.
Rectifiers have many uses, but are often found serving as components of DC power supplies and high-voltage direct current power transmission systems. Rectification may serve in roles other than to generate direct current for use as a source of power.
2.1.4 INPUT FILTER
The capacitor-input filter, also called the pi filter due to its shape that looks like the Greek letter, is a type of electronic filter. Filter circuits are used to remove unwanted or undesired frequencies from a signal.
A typical capacitor input filter consists of a filter or reservoir capacitor C1, connected across the rectifier output, an inductor L, in series and another filter or smoothing capacitor, C2, connected across the load, RL. A filter of this sort is designed for use at a particular frequency, generally fixed by the AC line frequency and rectifier configuration. When used in this service, filter performance is often characterized by its regulation and ripple.
2.1.5 REGULATION UNIT
A regulator is an embedded circuit.It converts unregulated AC into a constant DC. With the help of a rectifier it converts AC supply into DC. Its function is to supply a stable voltage (or less often current), to a circuit or device that must be operated within certain power supply limits. The output from the regulator may be alternating or unidirectional, but is nearly always DC (Direct Current).
2.1.6 IC VOLTAGE REGULATORS
A voltage regulator is one of the most widely used electronic circuitry in any device. A regulated voltage (without fluctuations & noise levels) is very important for the smooth functioning of many digital electronic devices. A common case is with micro controllers, where a smooth regulated input voltage must be supplied for the micro controller to function smoothly.
The 78xx (sometimes L78xx, LM78xx, MC78xx...) is a family of self-contained fixed linear voltage regulator integrated circuits. The 78xx family is commonly used in electronic circuits requiring a regulated power supply due to their ease-of-use and low cost. For ICs within the family, the xx is replaced with two digits, indicating the output voltage (for example, the 7805 has a 5-volt output, while the 7812 produces 12 volts). The 78xx line are positive voltage regulators: they produce a voltage that is positive relative to a common ground. There is a related line of 79xx devices which are complementary negative voltage regulators. 78xx and 79xx ICs can be used in combination to provide positive and negative supply voltages in the same circuit.
FEATURES
1. Output current up to 1A.
2. Output voltages of 5,6,8,9,10,11,12,15,18,24v.
3. Thermal overload protection.
4. Short circuit protection.
2.1.7 OUTPUT FILTER
Filter circuit is often fixed after the regulator circuit. Capacitor is most often used as a filter. The principle of capacitor is to charge and discharge. It charges during the positive half cycle of AC voltage and discharges during negative half cycle. So it allows AC voltage and not DC voltage.
2.2 CIRCUIT DIAGRAM
2.3 BLOCK DIAGRAM OF PIC 16f877a
PIC 16f877a MICROCONTROLLER
Overview of PIC 16F877
PIC 16F877 is one of the most advanced microcontroller from Microchip. This controller is widely used for experimental and modern applications because of its low price, wide range of applications, high quality, and ease of availability. It is ideal for applications such as machine control applications, measurement devices, study purpose, and so on. The PIC 16F877 features all the components which modern microcontrollers normally have. The figure of a PIC16F877 chip is shown below.
Features of PIC16F877
The PIC16FXX series has more advanced and developed features when compared to its previous series. The important features of PIC16F877 series is given below.
General Features
o High performance RISC CPU.
o ONLY 35 simple word instructions.
o All single cycle instructions except for program branches which are two cycles.
o Operating speed: clock input (200MHz), instruction cycle (200nS).
o Up to 368×8bit of RAM (data memory), 256×8 of EEPROM (data memory), 8k×14 of flash memory.
o Pin out compatible to PIC 16C74B, PIC 16C76, PIC 16C77.
o Eight level deep hardware stack.
o Interrupt capability (up to 14 sources).
o Different types of addressing modes (direct, Indirect, relative addressing modes).
o Power on Reset (POR).
o Power-Up Timer (PWRT) and oscillator start-up timer.
o Low power- high speed CMOS flash/EEPROM.
o Fully static design.
o Wide operating voltage range (2.0 – 5.56)volts.
o High sink/source current (25mA).
o Commercial, industrial and extended temperature ranges.
o Low power consumption (<0.6mA typical @3v-4MHz, 20µA typical @3v-32MHz and <1 A typical standby).
Peripheral Features
o Timer 0: 8 bit timer/counter with pre-scalar.
o Timer 1:16 bit timer/counter with pre-scalar.
o Timer 2: 8 bit timer/counter with 8 bit period registers with pre-scalar and post-scalar.
o Two Capture (16bit/12.5nS), Compare (16 bit/200nS), Pulse Width Modules (10bit).
o 10bit multi-channel A/D converter
o Synchronous Serial Port (SSP) with SPI (master code) and I2C (master/slave).
o Universal Synchronous Asynchronous Receiver Transmitter (USART) with 9 bit address detection.
o Parallel Slave Port (PSP) 8 bit wide with external RD, WR and CS controls (40/46pin).
o Brown Out circuitry for Brown-Out Reset (BOR).
Key Features
o Maximum operating frequency is 20MHz.
o Flash program memory (14 bit words), 8KB.
o Data memory (bytes) is 368.
o EEPROM data memory (bytes) is 256.
o 5 input/output ports.
o 3 timers.
o 2 CCP modules.
o 2 serial communication ports (MSSP, USART).
o PSP parallel communication port
o 10bit A/D module (8 channels)
Analog Features
o 10bit, up to 8 channel A/D converter.
o Brown Out Reset function.
o Analog comparator module.
Special Features
o 100000 times erase/write cycle enhanced memory.
o 1000000 times erase/write cycle data EEPROM memory.
o Self programmable under software control.
o In-circuit serial programming and in-circuit debugging capability.
o Single 5V,DC supply for circuit serial programming
o WDT with its own RC oscillator for reliable operation.
o Programmable code protection.
o Power saving sleep modes.
o Selectable oscillator options
2.4 PIN DIAGRAM