CHAPTER 1 MICROCONTROLLER INTRODUCTION : The microcontroller 89C51 is manufactured by Atmel, MC, USA. This is the advanced version of 8031. This Micro controller have inbuilt 4K bytes of flash ROM, 256 bytes of RAM, 32 I/O lines (4 bit ports) and 6 vectored interrupts. CMOS technology is used in this micro controller. FEATURES : •
Extensive Boolean processing (Single - bit Logic) Capabilities.
•
8 Bit CPU optimized for control applications.
•
On - Chip Flash Program Memory.
•
On - Chip Data RAM.
•
Bi-directional and Individually Addressable I/O Lines.
•
Multiple 16-Bit Timer/Counters.
•
Full Duplex UART.
•
On - Chip Oscillator and Clock circuitry.
•
On - Chip EEPROM.
PIN DIAGRAM:
INPUT/ OUTPUT PORTS: There are four I/O ports available in AT89C51. They are port 0, port 1, port 2, and port 3. All these ports are eight bit ports. All these ports can be controlled as eight-bit port or it can be controlled individually. One of the main feature of this micro controller is it can control the port pins individually. In 89C51 port 1 is available for user, Port 3 is combined with interrupts. This can be used as interrupts (or) I/O ports, ports 2 & port 0 is combined with address bus & data bus. All these port lines are available with internal pull-ups except port 0. If we want to use port 0 as I/O port we have to use pull up resistors. This Micro controller is working at a maximum speed of 24MHz. This micro controller is available with inbuilt oscillator; just crystal has to be connected to its terminal. MEMORY ORGANIZATION:
All Atmel Flash micro controllers have separate address spaces for program and data memory. The logical separation of program and data memory allows the data memory to be accessed by 8 bit addresses. Program memory can only be read. There can be up to 64K bytes of directly addressable program memory. The read strobe for external program memory is the Program Store Enable Signal (PSEN). Data memory occupies a separate address space from program memory. Up to 64K bytes of external memory can be directly addressed in the external data memory space. The CPU generates read and write signals, RD and WR, during external data memory accesses. External program memory and external data memory can be combined by applying the RD and PSEN signal to the inputs of AND gate and using the output of the fate as the read strobe to the external program/data memory. PROGRAM MEMORY: After reset, the CPU begins execution from location 0000h. Each interrupt is assigned a fixed location in program memory. The interrupt causes the CPU to jump to that location, where it executes the service routine. If external Interrupt 0 is used, its service routine must begin at location 0003h. If the interrupt is not used its service location is available as general-purpose program memory. The interrupt service locations are spaced at 8 byte intervals 0003h for External interrupt 0, 000Bh for Timer 0, 0013h for External interrupt 1,001Bh for Timer1, and so on. If an Interrupt service routine is short enough it can reside entirely within that 8-byte interval. Longer service routines can use a jump instruction to skip over subsequent interrupt locations. The lowest addresses of program memory can be either in the on-chip Flash or in an external memory. To make this selection, strap the External Access (EA) pin to either Vcc or GND. DATA MEMORY:
The Internal Data memory is divided into three blocks namely, The lower 128 Bytes of Internal RAM. The Upper 128 Bytes of Internal RAM. Special Function Register. 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 accommodate 384 bytes. Direct addresses higher than 7Fh access one memory space and indirect addresses higher than 7Fh access a different Memory Space. 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. The next 16-bytes above the register banks form a block of bit addressable memory space. The micro controller instruction set includes a wide selection of single - bit instructions and this instruction can directly address the 128 bytes in this area. These bit addresses are 00h through 7Fh The Special Function Register includes Port latches, timers, peripheral controls etc., direct addressing can only access these register. In general, all Atmel micro controllers have the same SFRs at the same addresses. However, upgrades to the AT89C51 have additional SFRs. Sixteen addresses in SFR space are both byte and bit Addressable. The bit Addressable SFRs are those whose address ends in 000B. The bit addresses in this area are 80h through FFh.
OSCILLATOR AND CLOCK CIRCUIT:
XTAL1 and XTAL2 are the input and output respectively of an inverting amplifier which is used as a crystal oscillator in the frequency range of 1.2 Mhz to 12 Mhz. XTAL2 is also used as the input to the internal clock generator. To drive the chip with an internal oscillator XTAL1 and XTAL2 are grounded. Since the input to the clock generator is divided by two flip flop there are no requirements on the duty cycle of the external oscillator signal. However, minimum high and low times must be observed. The clock generator divides the oscillator frequency by 2 and provides a two phase clock signal to the chip. The phase 1 signal is active during the first half of each clock period and the phase 2 signals are active during the second half of each clock period. CPU TIMING: A machine cycle consists of 6 states. Each state is divided into a phase / half, during which the phase 1 clock is active and phase 2 half. Arithmetic and Logical operations take place during phase1 and internal register to register transfer take place during phase 2. FLASH ROM: 4-kilo byte ROM is available in the Micro controller. It can be erased and reprogrammed. If the available memory is not enough for program, it can be interfaced with external ROM .It has 16 address lines, so maximum of (2^16) i.e. 64 bytes of ROM can be interfaced with this Micro controller. Both internal and external ROM cannot be used simultaneously. For external accessing of ROM, a pin is provided in Micro controller itself i.e. pin no.31 EA. It should be high to use internal ROM, low to use external ROM
RAM:
Internal 256 bytes of RAM are available for user. These 256 bytes of RAM can be used along with the external RAM. Externally 64-kilo bytes of RAM can be connected with micro controller. In internal RAM first 128 bytes of RAM is available for user and the remaining 128 bytes are used as special function registers (SFR). These SFR’s are used as control registers for timer, serial port etc. PROGRAMS: To program microcontrollers, the trend is to use the C language, due to its efficiency and ease of use relative to the Assembly language makes most things possible using the least amount of memory (code and date) and time, and offers increased productivity. Typically, a software developer can write more codes to do more things using C than when using Assembly. This is important because at least half the cost of developing an MCU application is in paying people to develop the software. Since C source code is standardized and portable, many people know hoe to program in C. it can be written anywhere and then complied for the target processor of choice. Writing microcontroller software often requires knowledge of bits, registers, etc. C is considered to be a good language for real-time control applications, as it has more or less compactness and speed features of the highlevel language features of portability. Also flow control is more flexible and easy to use. A micro controller unit (MCU) uses the microprocessor as its central processing unit (CPU) and incorporates memory, timing reference, I/O peripherals, etc on the same chip. Limited computational capabilities and enhanced I/O are special features. The micro controller is the most essential IC for continuous processbased applications in industries like chemical, refinery, pharmaceutical automobile, steel, and electrical, employing programmable logic systems (DCS). PLC and DCS thrive on the programmability of an MCU.
There are many MCU manufacturers. To understand and apply general concepts, it is necessary to study one type in detail. This specific knowledge can be used to understand similar features of other MCU. INTERFACING OF 89C51 TO 74HC541
CHAPTER 2 TRANSMITTER UNIT INTRODUCTION:
Radio frequency (RF) transmitters are widely used in radio frequency communications systems. With the increasing availability of efficient, low cost electronic modules, mobile communication systems are becoming more and more widespread. A terminal apparatus used in the radio communications system receives a radio frequency signal transmitted from a base station, by an antenna, inputs the signal to a receiving radio-frequency unit via an antenna duplexer, high frequency amplifies the signal, removes unnecessary waves outside the receiving band from the signal, converts the signal to an intermediate frequency signal, demodulates the intermediate frequency signal by a demodulator, and converts the signal into a baseband signal. Generally, a radio transmitter is used for performing a radio transmission operation, whereby a high frequency signal outputted from a modulator is transmitted to an antenna of the radio transmitter and is transmitted there from to a remote radio transmitter thereby a signal is transmitted. The transmitting baseband signal is subjected to a predetermined signal process, input to a modulator, which modulates a carrier wave signal. The modulated carrier wave signal is converted into a radio frequency by a transmitting radio-frequency circuit and amplified to a predetermined transmitting power, and transmitted to the base station from the antenna via the duplexer. Communication systems are known to support wireless and wire lined communications between wireless and/or wire lined communication devices.
The function of a radio frequency (RF) transmitter is to modulate, upconvert, and amplify signals for transmission into free space. An RF transmitter generally includes a modulator that modulates an input signal and a radio frequency power amplifier that is coupled to the modulator to amplify the
modulated input signal. The radio frequency power amplifier is coupled to an antenna that transmits the amplified modulated input signal. Power amplifiers are required in radio telecommunication systems to amplify signals before transmitting, because a radio signal attenuates on the radio path.
CIRCUIT OF TRANSMITTER UNIT
For efficiency, the amplifier is often a non-linear amplifier operated near its peak capacity. To avoid distortion of the transmitted signals due to the nonlinearity, the signals are pre-distorted by a predistorter before they are transmitted. The predistortion is required to prevent transmitter from transmitting signals on channel bands other than the band assigned to the transmitter. The predistortion values are chosen such that the product values entering the power
amplifier will be distorted by the power amplifier to return to a substantially linear amplification of the modulated signals. A direct conversion transmitter system to produce a transmission signal is generally comprised of a low oscillator (LO), a phase locked loop (PLL), a quadrature generator, a modulator, a power amplifier (PA), and one or more filters. The low oscillator, coupled to the PLL, produces a signal with a frequency that is substantially equal to the frequency of a desired RF transmission signal. The quadrature generator is coupled to the low oscillator and the modulator. The PA is coupled to the quadrature generator, and receives the transmission signal and amplifies it. The amplified signal may go through a filter to reduce noise or spurious outputs outside of the transmission band. High quality RF transmitters typically include bandpass filters, such as surface acoustic wave (SAW) filters provide excellent performance. A typical system may employ a bandpass filter following the power amplifier to reduce undesired noise present at the antenna in different portion of RF spectrum to meet various standards' regulations and specifications.
TRANSMITTER MODULE TXC1: The TXC1 is an ASK transmitter module .The result is excellent performance in a simple-to-use .The TXC1 is designed specifically for remotecontrol , wireless mouse and car alarm system operating at 315/433.92 MHz in the USA under FCC Part 15 regulation. These are pre-built 433MHz wireless transmitter / receiver modules. They feature ASK encoding, and perform very
well. They are ideal for devices using short data bursts such as remote controls, trigger pulses etc.
SPECIFICATIONS: •
Output power: 3dBm.
•
Supply voltage: 3V.
•
Supply current: 10mA max.
•
Data rate: 300bps to 10kbps.
•
PCB measures: 18.5(H) x 14.5(W) mm (excluding pins).
•
Transmitter Module: ZW-3100
•
Receiver Module:
•
Ideal for 315/433.92MHz remote keyless-entry transmitter
•
By SAW resonator
•
ASK modulation
•
315/433.92MHz
ZW-3102
PIN ASSIGNMENT: pin 1 2 3 4
Connections GND DATA VCC ANT
ABSOLUTE MAXIMUM RATINGS
PARAMETER
VALUE
UNITS
Power supply
3
V
Operating temperature
-20 to +60
°c
RECEIVER CHARACTERISTICS:
PARAMETER Output power
SYMBOL -
CONDITION Vcc=30V,
315
TA-27°c ,
MHz
50Ωload
434
VALUE
UNIT
min
typ
max
2
3
6
dBm
1
3
6
dBm
MHz Supply current
Icc
-
9
10
19
mA
Supply voltage
Vcc
-
-
3
-
V
-
-
300
1K
10K
bps
range Data rate
TYPICAL TEST CIRCUIT
TYPICAL TRANSMITTER APPLICATION
REMARK: Antenna Length: 22.6cm for 315 MHz 17.2 cm for 434 MHz APPLICATIONS: Specifically for remote-control, wireless mouse and car alarm system operating at 315/433.92MHz in the USA under FCC Part 15 regulation
CHAPTER 3 RECEIVER UNIT INTRODUCTION: Receivers for communication systems generally are designed such that they are tuned to receive one of a multiplicity of signals having widely varying bandwidths and which may fall within a particular frequency range. The RF receiver receives an RF signal, converts the RF signal to an IF signal, and then converts the IF signal to a base band signal, which it then provides to the base band processor. As is also known, RF transceivers typically include sensitive components susceptible to noise and interference with one another and with external sources. The RF receiver is coupled to the antenna and includes a low noise amplifier, one or more intermediate frequency stages, a filtering stage, and a data recovery stage. The low noise amplifier receives an inbound RF signal via the antenna and amplifies it.
The one or more intermediate frequency stages mix the amplified RF signal with one or more local oscillations to convert the amplified RF signal into a base band signal or an intermediate frequency (IF) signal.
CIRCUIT DIAGRAM OF RECEIVER UNIT:
RECEIVER MODULE RXB1: The receiver module used in our project is ASK Super Heterodyne Receiver Module, belongs to the category ST-RXB1. The ST- RX04-ASK is an
Ask Super Heterodyne Receiver Module with PLL Synthesizer and Crystal Oscillator. The circuit shape is PLL.
ST- RX04
PIN DIAGRAM
SPECIFICATIONS: •
Frequency Range : 315/434 MHz
•
Operation Voltage: 5V
•
IF Frequency: 500k
•
Typical sensitivity: -105dBm
•
Supply Current: 2.3Ma
FEATURES: •
Low power consumption.
•
Easy for application.
•
On-chip VCO with integrated PLL using crystal oscillator reference.
•
Integrated IF and data filters.
•
Operation temperature range : -40 °c to +80 °c
MECHANICAL DIMENSIONS:
ELECTRICAL CHARACTERISTICS:
CHARACTERISTIC
MIN
TYP
MAX
UNIT
VCC Supply voltage
-
5
-
VDC
Is Supply Current
-
2.3
3
mA
Fr Receiver
-
315/434
-
MHz
Frequency RF Sensitivity
-
-105
-
dBm
Max Data Rate
0.3
1
3
Kbit/s
Voh High Level
0.7Vcc
-
-
VDC
Output Vol Low Level
-
-
0.3Vcc
VDC
Output Turn On Time
25
30
-
ms
Top Operating
-40
-
80
Temperature Range Output Duty
40
-
60
TYPICAL APPLICATION:
°c %
REMARK: Antenna length about: •
23cm for 315 MHz
•
17 cm for 434 MHz
APPLICATIONS: •
Car security system
•
Wireless security systems
•
Sensor reporting
•
Automation system
•
Remote Keyless entry
CHAPTER 4
ENCODER INTRODUCTION: An encoder can be a device used to change a signal (such as a bitstream) or data into a code. The code serves any of a number of purposes such as compressing information for transmission or storage, encrypting or adding redundancies to the input code, or translating from one code to another. This is usually done by means of a programmed algorithm, especially if any part is digital, while most analog encoding is done with analog circuitry. ENCODER HT12E: The HT12E encoder is a CMOS IC built especially for remote control system applications. It is capable of encoding 8 bits of address (A0-A7) and 4 bits of data (AD8-AD11) information. Each address/data input can be set to one of the two logic states, 0 or 1. Grounding the pins is taken as a 0 while a high can be given by giving +5V or leaving the pins open (no connection). Upon reception of transmit enable (TE-active low), the programmed address/data are transmitted together with the header bits via an RF medium.
PIN DIAGRAM:
PIN DESCRIPTION: Pin Name A0-A7
AD8-AD11
I/O I
I
Internal Connection NMOS
Description Input pins for address A0-A7
TRANSMISSION
setting. They can be externally
GATE NMOS
set to VDD or VSS. Input pins for data AD8-AD11
TRANSMISSION
setting. They can be externally
DOUT
O
CMOS OUT
set to VDD or VSS. Encoder data serial transmission
TE OSC 1 OSC2 VSS VDD
I I O I I
CMOS IN pull-high OSCILLATOR 1 OSCILLATOR 2 -
output Transmission Enable, active low Oscillator input pin Oscillator output pin Negative power supply(GND) Positive power supply
CIRCUIT DIAGRAM OF ENCODER HT12E:
FEATURES OF HT12E: • 2.4-12V Operation • Low power, high noise immunity CMOS technology • Low standby current of < 1μA at 5V supply • Built-in oscillator with only a 5% resister • Minimal external components ELECTRICAL CHARACTERISTICS ENCODER:
ENCODER OPERATION: The encoder starts a 4 word transmission cycle upon reception of a transmit enable (TE active low). This cycle repeats itself as long as TE is held low. Once the TE goes high,the encoder completes its final cycle and stops as shown in Fig below. ENCODER CYCLE TIMING:
As soon as a transmit enable occurs, the encoder scans and transmits the status of the 12 bits of address/data serially in the order A0 to AD11.
ENCODER OPERATION FLOWCHART:
Encoder operation can be represented by a flowchart as shown in Fig .As an illustration of the way the data is sent serially, if all the 8 address lines were left open (no connection) and all 4 data lines were grounded, then the serial output would look like all open circuit address lines will be read as logic high and all 4 data bits will be read as 0 since they were grounded.
ENCODER OSCILLATION FREQUENCY:
Since the encoder comes with a built in RC oscillator, its oscillation frequency can be set by connecting a resistor between OSC1 (pin 16) and OSC2 (pin15). The oscillation frequency depends on the resistor value as well as the supply voltage, as shown in Fig. ENCODER OSCILLATION GRAPH:
CHAPTER 5 DECODER
INTRODUCTION: A decoder is a device which does the reverse of an encoder, undoing the encoding so that the original information can be retrieved. The same method used to encode is usually just reversed in order to decode. In digital electronics this would mean that a decoder is a multiple-input, multiple-output logic circuit that converts coded inputs into coded outputs. Enable inputs must be on for the decoder to function, otherwise its outputs assume a single "disabled" output code word. Decoding is necessary in applications such as data multiplexing, 7 segment display and memory address decoding.
HT12D: The HT12D is a decoder IC made especially to pair with the HT12E encoder.it is a CMOS IC made for remote control system application. The decoder is capable of decoding 8 bits of address (A0-A7) and 4 bits of data (AD8-AD11) information. For proper operation, a pair of encoder/decoder with the same number of addresses and data format should be chosen. The decoders receive serial addresses and data from a programmed encoders that are transmitted by a carrier using an RF or an IR transmission medium. They compare the serial input data three times continuously with their local addresses. If no error or unmatched codes are found, the input data codes are decoded and then transferred to the output pins. The VT pin also goes high to indicate a valid transmission. The decoders are capable of decoding information that consists of N bits of address and 12_N bits of data. Of this series, the HT12D is arranged to provide 8 address bits and 4 data bits, and HT12F is used to decode 12 bits of address information.
PIN DESCRIPTION: Pin Name A0-A11
I/O I
Internal Connection NMOS
Description Input pins for address A0-A7
TRANSMISSION
setting. They can be externally set to VSS or left open. Output data pins, power on-state is low. Serial data input pin. Valid Transmission, active high Oscillator input pin Oscillator output pin Negative power supply(GND) Positive power supply
D8-D11
O
GATE CMOS OUT
DIN VT OSC 1 OSC2 VSS VDD
I O I O I I
CMOS IN CMOS OUT OSCILLATOR 1 OSCILLATOR 2 -
ELECTRICAL CHARACTERISTICS:
DECODER OPERATION: HT12D receives digital serial data from its DIN(pin14). A signal in the DIN activates the oscillator which then decodes the incoming address and data. Decoder Timing
After decoding, it checks the serial input data three times continuously with its local addresses. If no error or unmatched codes are found, the input data codes are decoded and then transferred to the data output pins.This pin remains high
for 214=16384 decoder clocks after the encoder’s DOUT pin goes low. Since the decoder operates at 150KHz, it takes 150000*16384=0.1 seconds for the VT pin to go low. This pin also goes low if the address code is incorrect or no signal is received. The 4 data pins are latched to their respective pins, meaning that the previous data remains on the pins unless a new data arrives to replace the existing one. FEATURES: •
Operating voltage: 2.4V~12V
•
Low power and high noise immunity CMOS Technology
•
Low standby current
•
Capable of decoding 12 bits of information
•
Binary address setting
•
Received codes are checked 3 times
•
Address/Data number combination HT12D: 8 address bits and 4 data bits HT12F: 12 address bits only
•
Built-in oscillator needs only 5% resistor
•
Valid transmission indicator
•
Easy interface with an RF or an infrared transmission medium
•
Minimal external components
FLOWCHART: The oscillator is disabled in the standby state and activated when a logic highsignal applies to the DIN pin. That is to say, the DIN should be kept low if there is no signal input.
The decoder operation can be represented by a flowchart as shown above. DECODER OSCILLATION FREQUENCY: The decoder has a built in oscillator hence its clock can be set by connecting a resistor between OSC1 (pin 16) and OSC2 (pin 15). The oscillation frequency depends on the resistor value as well as the power supply as shown below. This project uses a 5V supply and it is recommended by the Holtek that oscillator frequency of decoder = 50*oscillator frequency of encoder. Since the HT12E encoder works at 3KHz, the decoder frequency has to be 150KHz. This requires a 51k resistor.
Fosc vs supply voltage
APPLICATIONS: •
Burglar alarm system
•
Smoke and fire alarm system
•
Garage door controllers
•
Car door controllers
•
Car alarm system
•
Security system
•
Cordless telephones
•
Other remote control systems
CHAPTER 6 LCD DISPLAY
INTRODUCTION: A liquid crystal display (LCD) is an electronically-modulated optical device shaped into a thin, flat panel made up of any number of color or monochrome pixels filled with liquid crystals and arrayed in front of a light source (backlight) or reflector. It is often utilized in battery-powered electronic devices because it uses very small amounts of electric power. LCD has material, which continues the properties of both liquids and crystals. Rather than having a melting point, they have a temperature range within which the molecules are almost as mobile as they would be in a liquid, but are grouped together in an ordered from similar to a crystal. LCD consists of two glass panels, with the liquid crystal materials sandwiched in between them. The inner surface of the glass plates is coated with transparent electrodes which define in between the electrodes and the crystal, which makes the liquid crystal molecules to maintain a defined orientation angle. When a potential is applied across the cell, charge carriers flowing through the liquid will disrupt the molecular alignment and produce turbulence. When the liquid is not activated, it is transparent. When the liquid is activated the molecular turbulence causes light to be scattered in all directions and the cell appears to be bright.Thus the required message is displayed. When the LCD is in the off state, the two polarizer’s and the liquid crystal rotate the light rays, such that they come out of the LCD without any orientation, and hence the LCD appears transparent. When sufficient voltage is applied to the electrodes the liquid crystal molecules would be aligned in a specific direction. The light rays passing through the LCD would be rotated by the polarizer, which would result in activating/highlighting the desired characters.
The power supply should be of +5v, with maximum allowable transients of 10mv. To achieve a better/suitable contrast for the display the voltage (VL) at pin 3 should be adjusted properly. A module should not be removed from a live circuit. The ground terminal of the power supply must be isolated properly so that voltage is induced in it. The module should be isolated properly so that stray voltages are not induced, which could cause a flicking display. LCD is lightweight with only a few, millimeters thickness since the LCD consumes less power, they are compatible with low power electronic circuits, and can be powered for long durations. LCD does not generate light and so light is needed to read the display. By using backlighting, reading is possible in the dark. LCDs have long life and a wide operating temperature range. Before LCD is used for displaying proper initialization should be done. LCDs with a small number of segments, such as those used in digital watches and pocket calculators, have individual electrical contacts for each segment. An external dedicated circuit supplies an electric charge to control each segment. This display structure is unwieldy for more than a few display elements. Small monochrome displays such as those found in personal organizers, or older laptop screens have a passive-matrix structure employing super-twisted nematic (STN) or double-layer STN (DSTN) technology—the latter of which addresses a color-shifting problem with the former—and color-STN (CSTN)— wherein color is added by using an internal filter. Each row or column of the display has a single electrical circuit. The pixels are addressed one at a time by row and column addresses. This type of display is called passive-matrix addressed because the pixel must retain its state between refreshes without the benefit of a steady electrical charge. As the number of pixels (and, correspondingly, columns and rows) increases, this type of display becomes less feasible. Very slow response times and poor contrast are typical of passivematrix addressed LCDs. High-resolution color displays such as modern LCD computer monitors and televisions use an active matrix structure. A matrix of thin-film transistors
(TFTs) is added to the polarizing and color filters. Each pixel has its own dedicated transistor, allowing each column line to access one pixel. When a row line is activated, all of the column lines are connected to a row of pixels and the correct voltage is driven onto all of the column lines. The row line is then deactivated and the next row line is activated. All of the row lines are activated in sequence during a refresh operation. Active-matrix addressed displays look "brighter" and "sharper" than passive-matrix addressed displays of the same size, and generally have quicker response times, producing much better images. A general purpose alphanumeric LCD, with two lines of 16 characters. So the type of LCD used in this project is16 characters * 2 lines with 5*7 dots with cursor, built in controller, +5v power supply, 1/16 duty cycle. In this project LCD is used to display the following messages: i) Device (1,2,3,4) is located. ii) Ready to detect. Fig. LCD
PIN DESCRIPTION FOR LCD:
Pin
Symbol
i/o
Description
1
VSS
--
Ground
2
VCC
--
+5v Power Supply
3
VEE
--
Power Supply To Control Contrast
4
RS
I
RS=0 to select command register, RS=1 to select data register
5
R/W
I
R/W=0 for Write, R/W=1 for Read
6
E
I/O
Enable
7
DB0
I/O
The 8-bit data bus
8
DB1
I/O
The 8-bit data bus
9
DB2
I/O
The 8-bit data bus
10
DB3
I/O
The 8-bit data bus
11
DB4
I/O
The 8-bit data bus
12
DB5
I/O
The 8-bit data bus
13
DB6
I/O
The 8-bit data bus
14
DB7
I/O
The 8-bit data bus
LCD PIN DESCRIPTIONS: The function of each pins of LCD is described below VCC, VSS and VEE While v and v provide +5v and ground, respectively, v is used for controlling LCD contrast. RS, register select There are two very important registers inside the LCD. The RS pin is used for their selection as follows. If RS=0, the instruction code register is selected, allowing the user to send a command such as clear display, cursor at home,etc.if RS=1 the data register is selected, allowing the user to send data to be displayed on the LCD. R/W, read/write R/W input allows the user to write information to the LCD or read information from it. R/W=1 when reading; R/W=0 when writing. E, enable
The enable pin is used by the LCD to latch information presented on its data pins. when data is supplied to data pins, a high to low pulse must be applied to this pin in order for the LCD to latch in the data present at the data pins. D0 - D7 The 8-bit data pins, D0 – D7, are used to send information to the LCD or read contents of the LCD’S internal registers. There are also instruction codes that can be sent to the LCD to clear the display or force the cursor to the home position or blink the cursor. RS=0 is used to check the busy flag bit to see if the LCD is ready to receive information. The busy flag is D7 and can be read when R/W=1 and RS=0, as follows: if R/W=1,RS=0.when D7=1,the LCD is busy taking care of internal operation and will not accept any new information, when D7=0, the LCD is ready to receive new information. LCD CONNECTION:
LCD COMMAND CODES: Code 1 2 4 6 5 7
Command to LCD Instruction Clear Display Screen Return Home Decrement cursor Increment cursor Shift display right Shift display left
8 A C E F 10 14 18 1C 80
Display off, cursor off Display off, cursor on Display on, cursor off Display on, cursor blinking Display on, cursor blinking Shift cursor position to left Shift cursor position to right Shift the entire display to left Shift the entire display to right Force cursor to beginning of first
C0
line Force cursor to beginning of second
38
line 2 lines and 5x7 matrix
CHAPTER 7 POWER SUPPLY INTRODUCTION: Power supply is a reference to a source of electrical power. A device or system that supplies electrical or other types of energy to an output load or group of loads is called a power supply unit or PSU. Fig Block diagram of a basic power supply The first section is the TRANSFORMER. The transformer steps up or steps down the input line voltage and isolates the power supply from the power line. The RECTIFIER section converts the alternating current input signal to a pulsating direct current. A FILTER section is used to convert pulsating dc to a purer, more desirable form of dc voltage. The final section is the REGULATOR. It maintains the output of the power supply at a constant level.
In fig 3, an input signal of 115 volts ac is applied to the primary of the transformer. The transformer is a step-up transformer with a turns ratio of 1:3. The output for this transformer can be found by multiplying the input voltage by the ratio of turns in the primary to the ratio of turns in the secondary; therefore, 115 volts ac
3 = 345 volts ac (peak-to- peak) at the output.
Because each diode in the rectifier section conducts for 180 degrees of the 360-degree input, the output of the rectifier will be one-half, or approximately 173 volts of pulsating dc. The filter section, a network of resistors, capacitors, or inductors, controls the rise and fall time of the varying signal; consequently, the signal remains at a more constant dc level. The output of the filter is a signal of 110 volts dc, with ac ripple riding on the dc.
TYPES OF POWER SUPPLY: There are many types of power supply. Most are designed to convert high voltage AC mains electricity to a suitable low voltage supply for electronics circuits and other devices. A power supply can be broken down into a series of blocks, each of which performs a particular function. For example a 5V regulated supply:
Block diagram of regulated power supply Each of the blocks are described below: •
Transformer - steps down high voltage AC mains to low voltage AC.
•
Rectifier - converts AC to DC, but the DC output is varying.
•
Smoothing - smoothes the DC from varying greatly to a small ripple.
•
Regulator - eliminates ripple by setting DC output to a fixed voltage.
Power supplies made from these blocks are described below with a circuit diagram and a graph of their output: •
Transformer only
•
Transformer + Rectifier
•
Transformer + Rectifier + Smoothing
•
Transformer + Rectifier + Smoothing + Regulator
Transformer only The low voltage AC output is suitable for lamps, heaters and special AC motors. It is not suitable for electronic circuits unless they include a rectifier and a smoothing capacitor.
Transformer Transformer + Rectifier The varying DC output is suitable for lamps, heaters and standard motors. It is not suitable for electronic circuits unless they include a smoothing capacitor.
Transformer + rectifier Transformer + Rectifier + Smoothing
Transformer + rectifier + smoothing The smooth DC output has a small ripple. It is suitable for most electronic circuits. Transformer + Rectifier + Smoothing + Regulator The regulated DC output is very smooth with no ripple. It is suitable for all electronic circuits.
Transformer + rectifier + smoothing + regulator Dual Supplies Some electronic circuits require a power supply with positive and negative outputs as well as zero volts (0V). This is called a 'dual supply' because it is like two ordinary supplies connected together as shown in the diagram. Dual supplies have three outputs, for example a ±9V supply has +9V, 0V and -9V outputs. Dual Simple 5V digital
supplies power supply for circuits
Summary of circuit features •
Brief description of operation: Gives out well regulated +5V output, output current capability of 100 mA
•
Circuit protection: Built-in overheating protection shuts down output when regulator IC gets too hot
•
Circuit complexity: Very simple and easy to build
•
Circuit performance: Very stable +5V output voltage, reliable operation
•
Design testing: Based on datasheet example circuit, I have used this circuit successfully as part of many electronics projects
•
Applications: Part of electronics devices, small laboratory power supply
•
Power supply voltage: Unregulated DC 8-18V power supply
•
Power supply current: Needed output current + 5 mA
Circuit description This circuit is a small +5V power supply, which is useful when experimenting with digital electronics. This circuit can give +5V output at about 150 mA current, but it can be increased to 1 A when good cooling is added to 7805 regulator chip. The circuit has overload and terminal protection.
Circuit diagram of 5V power supply The capacitors must have enough high voltage rating to safely handle the input voltage feed to circuit. Component list •
7805 regulator IC
•
100 uF electrolytic capacitor, at least 25V voltage rating
•
10 uF electrolytic capacitor, at least 6V voltage rating
•
100 nF ceramic or polyester capacitor
CHAPTER 8 PRINTED CIRCUIT BOARD INTRODUCTION: A printed circuit board, or PCB, is used to mechanically support and electrically connect electronic components using conductive pathways, or traces, etched from copper sheets laminated onto a non-conductive substrate. Alternative names are printed wiring board (PWB),and etched wiring board. A
PCB populated with electronic components is a printed circuit assembly (PCA), also known as a printed circuit board assembly (PCBA).
Printed circuit board PCBs are rugged, inexpensive, and can be highly reliable. They require much more layout effort and higher initial cost than either wire-wrapped or point-to-point constructed circuits, but are much cheaper and faster for highvolume production. MANUFACTURING MATERIALS Conducting layers are typically made of thin copper foil. Insulating materials have a wider scale: phenolic paper, glass fibre and different plastics are commonly used. Other widely used materials are polyimide, teflon and some ceramics. The PCB board is double sided, with through-hole plating, green solder resist, and white silkscreen printing. Both surface mount and through-hole components have been used. PATTERNING (ETCHING) The majority of printed circuit boards are made by bonding a layer of copper over the entire substrate, then removing unwanted copper after applying a temporary mask (eg. by etching), leaving only the desired copper traces. Photoengraving uses a photomask and chemical etching to remove the copper foil from the substrate. LAMINATION
Some PCBs have trace layers inside the PCB and are called multi-layer PCBs. These are formed by bonding together separately etched thin boards. DRILLING Holes are typically drilled with tiny drill bits made of solid tungsten carbide. The drilling is performed by automated drilling machines with placement controlled by a drill tape or drill file.The drill file describes the location and size of each drilled hole. EXPOSED CONDUCTOR PLATING AND COATING The places to which components will be mounted are typically plated, because bare copper oxidizes quickly, and therefore is not readily solderable. Exposed copper was plated with solder by hot air solder levelling and this solder is a tin-lead alloy. Edge connectors, placed along one edge of some boards, are often gold plated. SOLDER RESIST Areas that should not be soldered to may be covered with a polymer solder resist (solder mask) coating. The solder resist prevents solder from bridging between conductors and thereby creating short circuits. Solder resist also provides some protection from the environment. SCREEN PRINTING Line art and text may be printed onto the outer surfaces of a PCB by screen printing. When space permits, the screen print text can indicate component designators, switch setting requirements, test points, and other features helpful in assembling, testing, and servicing the circuit board. Screen print is also known as the silk screen, or, in one sided PCBs, the red print. TEST Unpopulated boards may be subjected to a bare-board test where each circuit connection (as defined in a netlist) is verified as correct on the finished board. A computer will instruct the electrical test unit to send a small amount of current through each contact point.
After the printed circuit board (PCB) is completed, electronic components must be attached to form a functional printed circuit assembly, or PCA.
CHAPTER 9 BUFFER INTRODUCTION:
The 74HC/HCT541 are high-speed Si-gate CMOS devices and are pin compatible with low power Schottky TTL (LSTTL). They are specified in compliance with JEDEC standard no. 7A. The 74HC/HCT541 are octal noninverting buffer/line drivers with 3-state outputs. The 3-state outputs are controlled by the output enable inputs OE1 and OE2. A HIGH on OEn causes the outputs to assume a high impedance OFF-state. The “541” is identical to the “540” but has non-inverting outputs. GENERAL DESCRIPTION: TYPICAL SYMBOL
PARAMETER
CONDITIONS
PHL/ propagation delay An to Yn CL = 15 pF; VCC PLH =5V input capacitance CI power dissipation capacitance notes 1 and 2 CPD per buffer REMARK: t
t
1. CPD
is used to determine the
dynamic power dissipation (PD in W) 2. CL = output load capacitance in pF 3. VCC = supply voltage in V
HC
10 3.5 37
UNIT HCT 12 ns 3.5 pF 39 pF
4. For HC the condition is
VI = GND to VCC 5. For HCT the condition
is VI = GND to VCC 1.5 V
FEATURES: •
Non-inverting outputs
•
Output capability: bus driver
•
ICC category: MSI
PIN DIAGRAM;:
PIN DESCRIPTION:
PIN NO.
SYMBOL
NAME AND FUNCTION
1, 19 2, 3, 4, 5, 6, 7, 8, 9 10 18, 17, 16, 15, 14, 13, 12, 11 20
OE1, OE2 A0to A7 GND Y0toY7 VCC
output enable input (active LOW) data inputs ground (0 V) bus outputs positive supply voltage
CHAPTER 10 BUZZER INTRODUCTION: A buzzer or beeper is a signaling electronic device typically used in automobiles, household appliances such as a microwave oven, or game shows. It commonly consists of a number of switches or sensors connected to a control unit that determines if and which button was pushed or a preset time has lapsed. It illuminates a light on the appropriate button or control panel, and sounds a warning in the form of a continuous or intermittent buzzing or beeping sound.
This device is based on an electromechanical system which is identical to an electric bell without the metal gong which makes the ringing noise. these units are anchored to a wall or ceiling and used the ceiling or wall as a sounding board. Another implementation with some AC-connected devices is to implement a circuit to make the AC current into a noise loud enough to drive a loudspeaker. ceramic-based piezoelectric sounder is a very popular buzzer which makes a
high-pitched tone. The buzzers are hooked up to "driver" circuits which varied the pitch of the sound or pulsed the sound on and off. The word "buzzer" comes from the rasping noise that buzzers made when they were electromechanical devices, operated from stepped-down AC line voltage at 50 or 60 cycles. Other sounds commonly used to indicate that a button has been pressed are a ring or a beep.
The buzzer circuit uses a couple of resistors, a capacitor and 555 timer IC. The 555 is setup as an astable multivibrator operating at a frequency of about 1kHz that produces a shrill noise when switched on. The frequency can be changed by varying the 10K resistor.
This novel buzzer circuit uses a relay in series with a small audio transformer and speaker. When the switch is pressed, the relay will operate via the transformer primary and closed relay contact. As soon as the relay operates the normally
closed contact will open, removing power from the relay, the contacts close and the sequence repeats, all very quickly...so fast that the pulse of current causes fluctuations in the transformer primary, and hence secondary. The speakers tone is thus proportional to relay operating frequency. The capacitor C can be used to "tune" the note. The nominal value is 0.001uF, increasing capacitance lowers the buzzers tone.
PROGRAM OF MICROCONTROLLER AT89C51
bzled1 equ 90h bzled2 equ 91h
Assigning address for led and buzzer.
bzled3 equ 92h bzled4 equ 93h prs
equ 0a0h
prw
equ 0a1h
Assigning address for pins (registerselect,
pen
equ 0a2h
read/write,enable)
lcdd4 equ 0a4h lcdd5 equ 0a5h lcdd6 equ 0a6h
Assigning address for lcd,data,andcommand.
lcdd7 equ 0a7h data
equ 70h
digit1 equ 51h digit0 equ 50h
org 0000h
Program initiallisation
mov p0,#0ffh mov p1,#00h mov p2,#00h mov p3,#0ffh mov a,#2ch acall command mov a,#0ch acall command mov a,#06h acall command mov a,#01h
Lcd commands.
acall command mov a,#80h acall command mov dptr,#wel acall cont mainloop: mov a,p3 swap a anl a,#0fh
Main program.
mov 50h,a cjne a,#01h,ed1 mov dptr,#device1 acall cont setb bzled1 acall delay sjmp mainloop ed1:
cjne a,#02h,ed2
mov dptr,#device2 acall cont setb bzled2 acall delay sjmp mainloop
ed2:
cjne a,#04h,ed3
mov dptr,#device3 acall cont setb bzled3 acall delay sjmp mainloop
Program subroutines including buzzer and led commands.
ed3:
cjne a,#08h,ed4
mov dptr,#device4 acall cont setb bzled4 acall delay sjmp mainloop ed4:
mov dptr,#devicen
acall cont mov p1,#00h sjmp mainloop
cont: mov a,#00h movc a,@a+dptr inc dptr cjne a,#80h,d1 acall command sjmp cont d1
cjne a,#0c0h,d2 acall command sjmp cont
d2
cjne a,#0ffh,d3 ret
d3
acall display sjmp cont
command acall ready clr prs clr prw acall succes ret
display acall ready clr prw setb prs acall succes ret ready: mov 75h,#00h go:
djnz 75h,go ret
succes clr prw mov data,a mov a,data swap a mov c,acc.0 mov lcdd4,c mov c,acc.1
Lcd commands.
mov lcdd5,c mov c,acc.2 mov lcdd6,c mov c,acc.3 mov lcdd7,c setb pen clr pen mov a,data mov c,acc.0 mov lcdd4,c mov c,acc.1 mov lcdd5,c mov c,acc.2 mov lcdd6,c mov c,acc.3 mov lcdd7,c setb pen clr pen ret
delay
Process delay commands.
mov r1,#10h loop3 mov r2,#00h loop2 mov r3,#00h loop1 djnz r3,loop1 djnz r2,loop2 djnz r1,loop3 ret
txdelay: mov r2,#03h tldy3: mov r3,#00h
Transmitter delay commands.
tldy2: mov r4,#00h tldy1: djnz r4,tldy1 djnz r3,tldy2 djnz r2,tldy3 ret
sdelay: mov r2,#01h dly3:
mov r3,#0fh
dly2:
mov r4,#10h
dly1:
djnz r4,dly1 djnz r3,dly2 djnz r2,dly3 ret
wel db 80h," Device Locator ",0ffh device1: db 0c0h,"Device 1 Located",0ffh
Assgning address for characters to display in lcd.
device2: db 0c0h,"Device 2 Located",0ffh device3: db 0c0h,"Device 3 Located",0ffh
device4: db 0c0h,"Device 4 Located",0ffh devicen: db 0c0h,"Ready to detect ",0ffh