Professional Documents
Culture Documents
ON
LASER COMMUNICATION
Bachelor of Technology
In
Electronics & Communication
2011-2012
As per the candidates declaration this work has not been submitted
elsewhere for the award of any other degree.
The task of developing this system would not have been possible
without the constant help of our mentors. We take this opportunity to
express our profound sense of gratitude and respect to those who helped us
throughout the duration of this project.
INTRODUCTION
PLATFORM USED
BLOCK DIAGRAM
CIRCUIT DIAGRAM
COMPONENT LIST
CIRCUIT DESCRIPTION
PCB LAYOUT
PROGRAMMING
SENSING UNIT DESCRIPTION
COMPONENTS DESCRIPTION
APPLICATION
CONCLUSION
REFERENCE
Introduction
INTRODUCTION:
Platform used
Hardware requirements:
1) Microcontroller AT89C51
2) LDR
3) LM7805 Regulator
4) Power Supply
5) Resistors
6) Capacitors
7) Transistors
8) LIQUID CRYSTAL DISPLAY
9) Transformer
10) Connectors
Software requirements:
TRANSMITTER
DISPLAY SECTION
USING
LCD
SUPPLY Communicatio
MICRO
SECTION n
CONTROLLER
89C51
TRANSMITTER
LASER DIODE
Receiver
DISPLAY SECTION
USING
SUPPLY MICRO CONTROLLER LCD
SECTION 89C51
RECEIVER
LDR
WORKING OF
THE PROJECT
There are two microcontroller one at sending end and the other at
receiving end .Laser transmitter is connected to the pin of the
microcontroller at the sending end and the LASER receiver is
connected to microcontroller at receiver end.whenever a person is
wishing to send the data the microcontroller make the laser transmitter
to send the frequency corresponding to that data and at receiver end
that frequency can change to the original data form which will display
on the lcd connected to the pin of the microcontroller.in this way the
function of transmitting the data through laser receiver and
transmitter have been completed.
CIRCUIT
DIAGRAM
Attach the hard
copy of the ckt
diagram
Component list
Attach hard copy of
Component list
CIRCUIT
DESCRIPTION
POWER SUPPLY SECTION:
Consists of:
1. RLMT Connector--- It is a connector used to connect
the step down transformer to the bridge rectifier.
DISPLAY SECTION:
LCD(LIQUID CRYSTAL DISPLAY)
MICROCONTROLLER BASED LCD DISPLAY ,this project is an embedded
project . Embedded is the combination of software and hardware before
designing any embedded project it is the first step to design the proper
hardware for the desired application. Here we are interfacing the LCD,
LIQUID CRYSTAL DISPLAY with the Microcontroller, we are using ATMEL
series 51 controller 89c51 controller. It is a 40 pin IC, the first step while
designing hardware is to design the required power supply as the
controller operates on +5 v supply so first we have to design the
regulated supply with the help of transformer, regulator and filtering
capacitor.
Next step is the necessary connections of the controller like reset and
the crystal oscillator for resetting and speed respectively.
Then comes the LCD interfacing ,we are using 16x2 LCD for display, pin
no. 7 to 14 are the data lines of the LCD which has to be interfaced with
the microcontroller input/output pins. Port p0 has been used for the
interfacing of data lines.
Since the display becomes very easy when we use microcontroller hence
we have made this project and we have tried to show different display
using the switch.
RELAY SECTION:
PCB LAYOUT
Attach the hard
copy of the
component
layout
Now clean the film by placing it in the tray containing water for
1 min.
After this, dip the film in the fixer solution for 1 min. now the
negative of the
Circuit is ready.
Take the PCB board of the size of the layout and clean it with
steel wool to make the surface smooth.
Now dip the PCB in the liquid photoresist, with the help of dip
coat machine.
Now clip the PCB next to the negative in the photo cure
machine, drying for approximate 10-12 minute.
Now place the negative on the top of the PCB in the UV
machine, set the timer for about 2.5 minute and switch on the
UV light at the top.
Now clamp the PCB in the etching machine that contains ferric
chloride solution for about 10 minutes.
After etching, wash the PCB with water, wipe it a dry cloth
softly.
Finally rub the PCB with a steel wool, and the PCB is ready.
Programming
Attach hard
copy of
programming
SENSING UNIT
DESCRIPTION
Laser transmitter
Laser receiver
A laser diode is a laser where the active medium is a semiconductor similar
to that found in a light-emitting diode. The most common and practical type
of laser diode is formed from a p-n junction and powered by injected electric
current. These devices are sometimes referred to as injection laser diodes to
distinguish them from (optically) pumped laser diodes, which are more
easily manufactured in the laboratory.
Theory of operation
Due to diffraction, the beam diverges (expands) rapidly after leaving the
chip, typically at 30 degrees vertically by 10 degrees laterally. A lens must
be used in order to form a collimated beam like that produced by a laser
pointer. If a circular beam is required, cylindrical lenses and other optics are
used. For single spatial mode lasers, using symmetrical lenses, the
collimated beam ends up being elliptical in shape, due to the difference in
the vertical and lateral divergences. This is easily observable with a red laser
pointer.
The simple diode described above has been heavily modified in recent years
to accommodate modern technology, resulting in a variety of types of laser
diodes, as described below.
MICROCONTROLLER AT89C51
Features
Flash programmable and erasable read only memory (PEROM). The device is
compatible with the industry standard 80C51 and 80C52 instruction set and pin out.
The AT89C52 provides the following standard features: 8K bytes of Flash, 256
bytes of RAM, 32 I/O lines, three 16-bit timer/counters, a six-vector two-level
interrupt architecture, a full-duplex serial port, on-chip oscillator, and clock
circuitry. In addition, the AT89C52 is designed with static logic for operation down
to zero frequency and supports two software selectable power saving modes. The
Idle Mode tops the CPU while allowing the RAM; timer/counters, serial port, and
interrupt system to continue functioning.
The Power-down mode saves the RAM contents but Freezes the
oscillator, disabling all other chip functions until the next hardware reset
.
Pin Description
VCC
Supply voltage.
GND
Ground.
Port 0
Port 0 is an 8-bit open drain bi-directional I/O port. As an output port, each pin can
sink eight TTL inputs. When 1s are written to port 0 pins, the pins can be used as
high impedance inputs.
Port 1
Port 1 is an 8-bit bi-directional I/O port with internal pull-ups. The Port 1
output buffers can sink/source four TTL inputs. When 1s are written to Port
1 pins, they are pulled high by the internal pull-ups and can be used as
inputs. As inputs, Port 1 pins that are externally being pulled low will source
current (IIL) because of the internal pull-ups.
In addition, P1.0 and P1.1 can be configured to be the timer/counter 2 external count input
(P1.0/T2) and the timer/counter 2 trigger input (P1.1/T2EX), respectively, as shown in the
following table.
Port 2 is an 8-bit bi-directional I/O port with internal pull-ups. The Port 2
output buffers can sink/source four TTL inputs. When 1s are written to Port
2 pins, they are pulled high by the internal pull-ups and can be used as
inputs. As inputs, Port 2 pins that are externally being pulled low will source
current (IIL) because of the internal pull-ups. Port 2 emits the high-order
address byte during fetches from external program memory and during
accesses to external data memory that use 16-bit addresses (MOVX @
DPTR). In this application, Port 2 uses strong internal pull-ups when
emitting 1s. During accesses to external data memory that use 8-bit
addresses (MOVX @ RI), Port 2 emits the contents of the P2 Special
Function Register. Port 2 also receives the high-order address bits and some
control signals during Flash programming and verification.
Port 3
Port 3 is an 8-bit bi-directional I/O port with internal pull-ups. The Port 3
output buffers can sink/source four TTL inputs. When 1s are written to Port
3 pins, they are pulled high by the internal pull-ups and can be used as
inputs. As inputs, Port 3 pins that are externally being pulled low will source
current (IIL) because of the pull-ups. Port 3 also serves the functions of
various special features of the AT89C51, as shown in the following table.
Port 3 also receives some control signals for Flash programming.
RST
Reset input. A high on this pin for two machine cycles while the oscillator is running
resets the device.
ALE/PROG
Address Latch Enable is an output pulse for latching the low byte of the address during
accesses to external memory. This pin is also the program pulse input (PROG) during Flash
programming. In normal operation, ALE is emitted at a constant rate of 1/6 the oscillator
frequency and may be used for external timing or clocking purposes. Note, however, that
one ALE pulse is skipped during each access to external data memory. If desired, ALE
operation can be disabled by setting bit 0 of SFR location 8EH. With the bit set, ALE is
active only during a MOVX or MOVC instruction. Otherwise, the pin is weakly pulled
high. Setting the ALE-disable bit has no effect if the micro controller is in external
execution mode.
PSEN
Program Store Enable is the read strobe to external program memory. When the AT89C52
is executing code from external program memory, PSEN is activated twice each machine
cycle, except that two PSEN activations are skipped during each access to external data
memory.
EA/VPP
XTAL1
Input to the inverting oscillator amplifier and input to the internal clock operating circuit.
XTAL2
A map of the on-chip memory area called the Special Function Register
(SFR) space is shown in Table 1.
Note that not all of the addresses are occupied, and unoccupied addresses may not
be implemented on the chip. Read accesses to these addresses will in general return
random data, and write accesses will have an indeterminate effect. User software
should not write 1s to these unlisted locations, since they may be used in future prod
new features. In that case, the reset or inactive values of the new bits will always be
0.
Timer 2 Registers
Control and status bits are contained in registers T2CON (shown in Table 2)
and T2MOD (shown in Table 4) for Timer 2. The register pair (RCAP2H,
RCAP2L) are the Capture/Reload registers for Timer 2 in 16-bit capture
mode or 16-bit auto-reload mode.
Interrupt Registers
The individual interrupt enable bits are in the IE register. Two priorities can be set for each
of the six interrupt sources in the IP register. Instructions that use indirect addressing
access the upper 128 bytes of RAM. For example, the following indirect addressing
instruction, where R0 contains 0A0H, accesses the data byte at address 0A0H, rather than
P2 (whose address is 0A0H).
MOV @R0, #data
Note that stack operations are examples of indirect addressing, so the upper 128 bytes of
data RAM are avail available as stack space.
Timer 0 and 1
Timer 0 and Timer 1 in the AT89C52 operate the same way as Timer 0 and Timer 1 in the
T89C51.
Timer 2
Capture Mode
In the capture mode, two options are selected by bit EXEN2 in T2CON. If EXEN2 = 0,
Timer 2 is a 16-bit timer or counter which upon overflow sets bit TF2 in T2CON.This bit
can then be used to generate an interrupt. If EXEN2 = 1, Timer 2 performs the same
operation, but a 1-to-0 transition at external input T2EX also causes the current value in
TH2 and TL2 to be captured into CAP2H and RCAP2L, respectively. In addition, the
transition at T2EX causes bit EXF2 in T2CON to be set. The EXF2 bit, like TF2, can
generate an interrupt. The capture mode is illustrated in Figure 1.
Auto-reload (Up or Down Counter)
Timer 2 can be programmed to count up or down when configured in its 16-bit auto-reload
mode. This feature is invoked by theDCEN (Down Counter Enable) bit located in the SFR
T2MOD (see Table 4). Upon reset, the DCEN bit is set to 0 so that timer 2 will default to
count up. When DCEN is set, Timer 2 can count up or down, depending on the value of the
T2EX pin.
Figure 2 shows Timer 2 automatically counting up when DCEN = 0. In this mode, two
options are selected by bitEXEN2 in T2CON. If EXEN2 = 0, Timer 2 counts up to
0FFFFH and then sets the TF2 bit upon overflow. The overflow also causes the timer
registers to be reloaded with the 16-bit value in RCAP2H and RCAP2L. The values in
Timer in Capture ModeRCAP2H and RCAP2L are preset by software. If EXEN2 = 1, a 16-
bit reload can be triggered either by an overflow or by a 1-to-0 transition at external input
T2EX. This transition also sets the EXF2 bit. Both the TF2 and EXF2 bits can generate an
interrupt if enabled. Setting the DCEN bit enables Timer 2 to count up or down, as shown
in Figure 3. In this mode, the T2EX pin controls
the direction of the count. A logic 1 at T2EX makes Timer 2 count up. The
timer will overflow at 0FFFFH and set the TF2 bit. This overflow also
causes the 16-bit value in RCAP2H and RCAP2L to be reloaded into the
timer registers, TH2 and TL2, respectively. A Logic 0 at T2EX makes Timer
2 count down. The timer underflows when TH2 and TL2 equal the values
stored in RCAP2H and RCAP2L. The underflow sets the TF2 bit and causes
0FFFFH to be reloaded into the timer Registers. The EXF2 bit toggles
whenever Timer 2 overflows or underflows and can be used as a 17th bit of
resolution. In this operating mode, EXF2 does not flag an interrupt.
Baud Rate Generator
Timer 2 is selected as the baud rate generator by setting TCLK and/or RCLK
in T2CON (Table 2). Note that the baud rates for transmit and receive can be
different if Timer 2 is used for the receiver or transmitter and Timer 1 is
used for the other function. Setting RCLK and/or TCLK puts Timer 2 into
its baud rate generator mode, as shown in Figure4. The baud rate generator
mode is similar to the auto-reload mode, in that a rollover in TH2 causes the
Timer 2 registers to be reloaded with the 16-bit value in registers RCAP2H
and RCAP2L, which are preset by software.
The baud rates in Modes 1 and 3 are determined by Timer2s overflow rate according to
the following equation.
The Timer can be configured for either timer or counter operation. In most applications, it
is configured for timer operation (CP/T2 = 0). The timer operation is different for Timer 2
when it is used as a baud rate generator. Normally, as a timer, it increments every machine
cycle (at 1/12 the oscillator frequency). As a baud rate generator, however, it increments
every state time (at 1/2 the oscillator frequency). The baud rate formula is given below.
where (RCAP2H, RCAP2L) is the content of RCAP2H and RCAP2L taken as a 16-bit
unsigned integer. Timer 2 as a baud rate generator is shown in Figure 4. This figure is valid
only if RCLK or TCLK = 1 in T2CON. Note that a rollover in TH2 does not set TF2 and
will not generate an interrupt. Note too, that if EXEN2 is set, a 1-to-0 transition in T2EX
will set EXF2 but will not cause a reload from (RCAP2H, RCAP2L) to (TH2, TL2). Thus
when Timer 2 is in use as a baud rate generator, T2EX can be used as an extra external
interrupt.
Note that when Timer 2 is running (TR2 = 1) as a timer in the baud rate
generator mode, TH2 or TL2 should not be read from or written to. Under
these conditions, the Timer is incremented every state time, and the results
of a read or write may not be accurate. The RCAP2 registers may be read
but should not be written to, because a write might overlap a reload and
cause write and/or reload errors. The timer should be turned off (clear TR2)
before accessing the Timer 2 or RCAP2 registers.
Programmable Clock Out
A 50% duty cycle clock can be programmed to come out on P1.0, as shown
in Figure 5. This pin, besides being a regular I/O pin, has two alternate
functions. It can be programmed to input the external clock for
Timer/Counter 2 or to output a 50% duty cycle clock ranging from 61 Hz to
4 MHz at a 16 MHz operating frequency. To configure the Timer/Counter 2
as a clock generator, bit C/T2 (T2CON.1) must be cleared and bit T2OE
(T2MOD.1) must be set. Bit TR2 (T2CON.2) starts and stops the timer. The
clock-out frequency depends on the oscillator frequency and the reload value
of Timer 2 capture registers (RCAP2H, RCAP2L), as shown in the
following equation.
In the clock-out mode, Timer 2 roll-overs will not generate an interrupt. This
behavior is similar to when Timer 2 is used as a baud-rate generator. It is
possible to use Timer 2 as a baud-rate generator and a clock generator
simultaneously. Note, however, that the baud-rate and clock-out
Frequencies cannot be determined independently from one another since
they both use RCAP2H and RCAP2L.
UART
The UART in the AT89C52 operates the same way as the UART in the AT89C51.
Interrupts
The AT89C52 has a total of six interrupt vectors: two external interrupts (INT0 and INT1),
three timer interrupts (Timers 0, 1, and 2), and the serial port interrupt. These interrupts are
all shown in Figure 6.Each of these interrupt sources can be individually enabled or
disabled by setting or clearing a bit in Special Function Register IE. IE also contains a
global disable bit, EA, which disables all interrupts at once.
Note that Table shows that bit position IE.6 is unimplemented. In the
AT89C51, bit position IE.5 is also unimplemented. User software should not
write 1s to these bit positions, since they may be used in future AT89
products. Timer 2 interrupt is generated by the logical OR of bits TF2 and
EXF2 in register T2CON. Neither of these flags is cleared by hardware
when the service routine is vectored to. In fact, the service routine may have
to determine whether it was TF2 or EXF2 that generated the interrupt, and
that bit will have to be cleared in software. The Timer 0 and Timer 1 flags,
TF0 and TF1, are set at S5P2 of the cycle in which the timers overflow. The
values are then polled by the circuitry in the next cycle. However, the Timer
2 flag, TF2, is set at S2P2 and is polled in the same cycle in which the timer
overflows.
Oscillator Characteristics
XTAL1 and XTAL2 are the input and output, respectively, of an inverting amplifier
that can be configured for use as an on-chip oscillator, as shown in Figure 7. Either
a quartz crystal or ceramic resonator may be used. To drive the device from an
external clock source, XTAL2 should be left
Un connected while XTAL1 is driven, as shown in Figure 8.There are no requirements on
the duty cycle of the external clock signal, since the input to the internal clocking circuitry
is through a divide-by-two flip-flop, but minimum and maximum voltage high and low
time specifications must be observed.
Idle Mode
In idle mode, the CPU puts itself to sleep while all the on chip peripherals
remain active. The mode is invoked by software. The content of the on-chip
RAM and all the special functions registers remain unchanged during this
mode. The idle mode can be terminated by any enabled interrupt or by a
hardware reset.
Note that when idle mode is terminated by a hardware reset, the device
normally resumes program execution from where it left off, up to two
machine cycles before the internal reset algorithm takes control. On-chip
hardware inhibits access to internal RAM in this event, but access to the port
pins is not inhibited. To eliminate the possibility of an unexpected write to a
port pin when idle mode is terminated by a reset, the instruction following
the one that invokes idle mode should not write to a port pin or to external
memory.
Power-down Mode
In the power-down mode, the oscillator is stopped, and the instruction that
invokes power-down is the last instruction executed. The on-chip RAM and
Special Function Registers retain their values until the power-down mode is
terminated. The only exit from power-down is a hardware reset. Reset
redefines the SFR s but does not change the on-chip RAM. The reset should
not be cultivated before VCC is restored to its normal operating level and
must be held active long enough to allow the oscillator to restart and
stabilize.
AC Characteristics
Float Waveforms(1)
2.8.1Basic principle
and
where:
and are the induced EMFs across primary and secondary windings,
and are the numbers of turns in the primary and secondary windings,
and are the time derivatives of the flux linking the primary and
secondary windings.
In the ideal transformer, all flux produced by the primary winding also links
the secondary, and so , from which the well-known transformer
equation follows:
The ratio of primary to secondary voltage is therefore the same as the ratio
of the number of turns; alternatively, that the volts-per-turn is the same in
both windings. The conditions that determine Transformer working in STEP
UP or STEP DOWN mode are:
Ns > Np
Rectifier
The essential feature of this arrangement is that for both polarities of the
voltage at the bridge input, the polarity of the output is constant.
When the input connected at the left corner of the diamond is positive with
respect to the one connected at the right hand corner, current flows to the
right along the upper colored path to the output, and returns to the input
supply via the lower one.
When the right hand corner is positive relative to the left hand corner,
current flows along the upper colored path and returns to the supply via the
lower colored path.
Figure 10: AC, half-wave and full wave rectified signals
Description
The LM317 is an adjustable three-terminal positive-voltage
regulator capable of supplying more than 1.5 A over an
output-voltage range of 1.2 V to 37 V. It is exceptionally easy
to use and requires only two external resistors to set the
output voltage. Furthermore, both line and load regulation
are better than standard fixed
regulators. The LM317 is packaged in the KC (TO-220AB) and
KTE packages, which are easy to handle and use. In addition
to having higher performance than fixed regulators, this
device includes on-chip current limiting, thermal overload
protection, and safe-operating-area protection. All overload
protection remains fully functional, even if the ADJUST
terminal is disconnected.
Features
Output Current up to 1A
Output Voltages of 5, 6, 8, 9, 10, 12, 15, 18, 24V
Thermal Overload Protection
Short Circuit Protection
Output Transistor Safe Operating Area Protection
Liquid crystal display(LCD)
Both the liquid crystal material and the alignment layer material contain
ionic compounds. If an electric field of one particular polarity is applied for
a long period of time, this ionic material is attracted to the surfaces and
degrades the device performance. This is avoided by applying either an
alternating current, or by reversing the polarity of the electric field as the
device is addressed (the response of the liquid crystal layer is identical,
regardless of the polarity of the applied field). When a large number of
pixels is required in a display, it is not feasible to drive each directly since
then each pixel would require independent electrodes. Instead, the display is
multiplexed. In a multiplexed display, electrodes on one side of the display
are grouped and wired together (typically in columns), and each group gets
its own voltage source. On the other side, the electrodes are also grouped
(typically in rows), with each group getting a voltage sink. The groups are
designed so each pixel has a unique, unshared combination of source and
sink. The electronics or the software driving the electronics then turns on
sinks in sequence, and drives sources for the pixels of each sink.
Figure 20:LCD Pictorial View
Frequently, an 8051 program must interact with the outside world using
input and output devices that communicate directly with a human being. One
of the most common devices attached to an 8051 is an LCD display. Some
of the most common LCDs connected to the 8051 are 16x2 and 20x2
displays. This means 16 characters per line by 2 lines and 20 characters per
line by 2 lines, respectively. Fortunately, a very popular standard exists
which allows us to communicate with the vast majority of LCDs regardless
of their manufacturer. The standard is referred to as HD44780U, which
refers to the controller chip which receives data from an external source (in
this case, the 8051) and communicates directly with the LCD.
The 44780 standard requires 3 control lines as well as either 4 or 8 I/O lines
for the data bus. The user may select whether the LCD is to operate with a 4-
bit data bus or an 8-bit data bus. If a 4-bit data bus is used the LCD will
require a total of 7 data lines (3 control lines plus the 4 lines for the data
bus). If an 8-bit data bus is used the LCD will require a total of 11 data lines
(3 control lines plus the 8 lines for the data bus).
The three control lines are referred to as EN, RS, and RW.
The EN line is called "Enable." This control line is used to tell the LCD that
you are sending it data. To send data to the LCD, your program should make
sure this line is low (0) and then set the other two control lines and/or put
data on the data bus. When the other lines are completely ready, bring EN
high (1) and wait for the minimum amount of time required by the LCD
datasheet (this varies from LCD to LCD), and end by bringing it low (0)
again.
The RS line is the "Register Select" line. When RS is low (0), the data is to
be treated as a command or special instruction (such as clear screen, position
cursor, etc.). When RS is high (1), the data being sent is text data which
sould be displayed on the screen. For example, to display the letter "T" on
the screen you would set RS high.
The RW line is the "Read/Write" control line. When RW is low (0), the
information on the data bus is being written to the LCD. When RW is high
(1), the program is effectively querying (or reading) the LCD. Only one
instruction ("Get LCD status") is a read command. All others are write
commands--so RW will almost always be low.Finally, the data bus consists
of 4 or 8 lines (depending on the mode of operation selected by the user). In
the case of an 8-bit data bus, the lines are referred to as DB0, DB1, DB2,
DB3, DB4, DB5, DB6, and DB7.
As you can see, we've established a 1-to-1 relation between a pin on the
8051 and a line on the 44780 LCD. Thus as we write our assembly program
to access the LCD, we are going to equate constants to the 8051 ports so that
we can refer to the lines by their 44780 name as opposed to P0.1, P0.2, etc.
Let's go ahead and write our initial equates:
DB0 EQU P1.0
DB1 EQU P1.1
DB2 EQU P1.2
DB3 EQU P1.3
DB4 EQU P1.4
DB5 EQU P1.5
DB6 EQU P1.6
DB7 EQU P1.7
EN EQU P3.7
RS EQU P3.6
RW EQU P3.5
DATA EQU P1
Having established the above equates, we may now refer to our I/O lines by
their 44780 name. For example, to set the RW line high (1), we can execute
the following insutrction:
SETB RW
As we mentioned above, the EN line is used to tell the LCD that you are
ready for it to execute an instruction that you've prepared on the data bus and
on the other control lines. Note that the EN line must be raised/lowered
before/after each instruction sent to the LCD regardless of whether that
instruction is read or write, text or instruction. In short, you must always
manipulate EN when communicating with the LCD. EN is the LCD's way of
knowing that you are talking to it. If you don't raise/lower EN, the LCD
doesn't know you're talking to it on the other lines.
Thus, before we interact in any way with the LCD we will always bring the
EN line low with the following instruction:
CLR EN
And once we've finished setting up our instruction with the other control
lines and data bus lines, we'll always bring this line high:
SETB EN
The line must be left high for the amount of time required by the LCD as
specified in its datasheet. This is normally on the order of about 250
nanoseconds, but check the datasheet. In the case of a typical 8051 running
at 12 MHz, an instruction requires 1.08 microseconds to execute so the EN
line can be brought low the very next instruction. However, faster
microcontrollers (such as the DS89C420 which executes an instruction in 90
nanoseconds given an 11.0592 Mhz crystal) will require a number of NOPs
to create a delay while EN is held high. The number of NOPs that must be
inserted depends on the microcontroller you are using and the crystal you
have selected. The instruction is executed by the LCD at the moment the EN
line is brought low with a final CLR EN instruction.
Programming Tip: The LCD interprets and executes our command at the
instant the EN line is brought low. If you never bring EN low, your
instruction will never be executed. Additionally, when you bring EN low
and the LCD executes your instruction, it requires a certain amount of time
to execute the command. The time it requires to execute an instruction
depends on the instruction and the speed of the crystal which is attached to
the 44780's oscillator input.
Thus, our standard practice will be to send an instruction to the LCD and
then call our WAIT_LCD routine to wait until the instruction is completely
executed by the LCD. This will assure that our program gives the LCD the
time it needs to execute instructions and also makes our program compatible
with any LCD, regardless of how fast or slow it is.
Programming Tip: The above routine does the job of waiting for the LCD,
but were it to be used in a real application a very definite improvement
would need to be made: as written, if the LCD never becomes "not busy" the
program will effectively "hang," waiting for DB7 to go low. If this never
happens, the program will freeze. Of course, this should never happen and
won't happen when the hardware is working properly. But in a real
application it would be wise to put some kind of time limit on the delay--for
example, a maximum of 256 attempts to wait for the busy signal to go low.
This would guarantee that even if the LCD hardware fails, the program
would not lock up.
Before you may really use the LCD, you must initialize and configure it.
This is accomplished by sending a number of initialization instructions to the
LCD. The first instruction we send must tell the LCD whether we'll be
communicating with it with an 8-bit or 4-bit data bus. We also select a 5x8
dot character font. These two options are selected by sending the command
38h to the LCD as a command. As you will recall from the last section, we
mentioned that the RS line must be low if we are sending a command to the
LCD. Thus, to send this 38h command to the LCD we must execute the
following 8051 instructions:
CLR RS
MOV DATA, #38h
SETB EN
CLR EN
LCALL WAIT_LCD
Programming Tip: The LCD command 38h is really the sum of a number
of option bits. The instruction itself is the instruction 20h ("Function set").
However, to this we add the values 10h to indicate an 8-bit data bus plus 08h
to indicate that the display is a two-line display.
We've now sent the first byte of the initialization sequence. The second byte
of the initialization sequence is the instruction 0Eh. Thus we must repeat the
initialization code from above, but now with the instruction.
Programming Tip: The command 0Eh is really the instruction 08h plus 04h
to turn the LCD on. To that an additional 02h is added in order to turn the
cursor on.
Programming Tip: The command 06h is really the instruction 04h plus 02h
to configure the LCD such that every time we send it a character, the cursor
position automatically moves to the right.
When the LCD is first initialized, the screen should automatically be cleared
by the 44780 controller. However, it's always a good idea to do things
yourself so that you can be completely sure that the display is the way you
want it. Thus, it's not a bad idea to clear the screen as the very first opreation
after the LCD has been initialiezd.
Now we get to the real meat of what we're trying to do: All this effort is
really so we can display text on the LCD. Really, we're pretty much done.
Once again, writing text to the LCD is something we'll almost certainly want
to do over and over--so let's make it a subroutine.
WRITE_TEXT:
SETB RS
MOV DATA, A
SETB EN
CLR EN
LCALL WAIT_LCD
RET
The WRITE_TEXT routine that we just wrote will send the character in the
accumulator to the LCD which will, in turn, display it. Thus to display text
on the LCD all we need to do is load the accumulator with the byte to
display and make a call to this routine. Pretty easy, huh?
Now that we have all the component subroutines written, writing the classic
"Hello World" program--which displays the text "Hello World" on the LCD
is a relatively trivial matter. Consider:
LCALL INIT_LCD
LCALL CLEAR_LCD
MOV A,#'H'
LCALL WRITE_TEXT
MOV A,#'E'
LCALL WRITE_TEXT
MOV A,#'L'
LCALL WRITE_TEXT
MOV A,#'L'
LCALL WRITE_TEXT
MOV A,#'O'
LCALL WRITE_TEXT
MOV A,#' '
LCALL WRITE_TEXT
MOV A,#'W'
LCALL WRITE_TEXT
MOV A,#'O'
LCALL WRITE_TEXT
MOV A,#'R'
LCALL WRITE_TEXT
MOV A,#'L'
LCALL WRITE_TEXT
MOV A,#'D'
LCALL WRITE_TEXT
The above "Hello World" program should, when executed, initialize the
LCD, clear the LCD screen, and display "Hello World" in the upper left-
hand corner of the display.
2.5.10 Cursor Positioning
The above "Hello World" program is simplistic in the sense that it prints its
text in the upper left-hand corner of the screen. However, what if we wanted
to display the word "Hello" in the upper left-hand corner but wanted to
display the word "World" on the second line at the tenth character? This
sounds simple--and actually, it is simple. However, it requires a little more
understanding of the design of the LCD.
The 44780 contains a certain amount of memory which is assigned to the
display. All the text we write to the 44780 is stored in this memory, and the
44780 subsequently reads this memory to display the text on the LCD itself.
This memory can be represented with the following "memory map":
In the above memory map, the area shaded in blue is the visible display. As
you can see, it measures 16 characters per line by 2 lines. The numbers in
each box is the memory address that corresponds to that screen position.
Thus, the first character in the upper left-hand corner is at address 00h. The
following character position (character #2 on the first line) is address 01h,
etc. This continues until we reach the 16th character of the first line which is
at address 0Fh. However, the first character of line 2, as shown in the
memory map, is at address 40h. This means if we write a character to the last
position of the first line and then write a second character, the second
character will not appear on the second line. That is because the second
character will effectively be written to address 10h--but the second line
begins at address 40h. Thus we need to send a command to the LCD that
tells it to position the cursor on the second line. The "Set Cursor Position"
instruction is 80h. To this we must add the address of the location where we
wish to position the cursor. In our example, we said we wanted to display
"World" on the second line on the tenth character position. Referring again
to the memory map, we see that the tenth character position of the second
line is address 4Ah. Thus, before writing the word "World" to the LCD, we
must send a "Set Cursor Position" instruction--the value of this command
will be 80h (the instruction code to position the cursor) plus the address
4Ah. 80h + 4Ah = CAh. Thus sending the command CAh to the LCD will
position the cursor on the second line at the tenth character position:
CLR RS
MOV DATA,#0CAh
SETB EN
CLR EN
LCALL WAIT_LCD
The above code will position the cursor on line 2, character 10. To display
"Hello" in the upper left-hand corner with the word "World" on the second
line at character position 10 just requires us to insert the above code into our
existing "Hello World" program.
LCALL INIT_LCD
LCALL CLEAR_LCD
MOV A,#'H'
LCALL WRITE_TEXT
MOV A,#'E'
LCALL WRITE_TEXT
MOV A,#'L'
LCALL WRITE_TEXT
MOV A,#'L'
LCALL WRITE_TEXT
MOV A,#'O'
LCALL WRITE_TEXT
CLR RS
MOV DATA,#0CAh
SETB EN
CLR EN
LCALL WAIT_LCD
MOV A,#'W'
LCALL WRITE_TEXT
MOV A,#'O'
LCALL WRITE_TEXT
MOV A,#'R'
LCALL WRITE_TEXT
MOV A,#'L'
LCALL WRITE_TEXT
MOV A,#'D'
LCALL WRITE_TEXT
RELAYS
Relays
Photographs Rapid Electronics
A relay is an electrically operated switch. Current flowing through the coil
of the relay creates a magnetic field, which attracts a lever and changes the
switch contacts. The coil current can be on or off so relays have two switch
positions and they are double throw (changeover) switches.
Relays allow one circuit to switch a second circuit that can be completely
separate from the first. For example a low voltage battery circuit can use a
relay to switch a 230V AC mains circuit. There is no electrical connection
inside the relay between the two circuits, the link is magnetic and
mechanical.
The coil of a relay passes a relatively large current, typically 30mA for a
12V relay, but it can be as much as 100mA for relays designed to operate
from lower voltages. Most ICs (chips) cannot provide this current and a
transistor is usually used to amplify the small IC current to the larger value
required for the relay coil. The maximum output current for the popular 555
timer IC is 200mA so these devices can supply relay coils directly without
amplification.
Relays are usually SPDT or DPDT but they can have many more sets
of switch contacts, for example relays with 4 sets of changeover contacts are
readily available. For further information about switch contacts and the
terms used to describe them please see the page on switches.
Most relays are designed for PCB mounting but you can solder wires
directly to the pins providing you take care to avoid melting the plastic case
of the relay.
The supplier's catalogue should show you the relay's connections. The coil
will be obvious and it may be connected either way round. Relay coils
produce brief high voltage 'spikes' when they are switched off and this can
destroy transistors and ICs in the circuit. To prevent damage you must
connect a protection diode across the relay coil.
The animated picture shows a working relay with its coil and switch
contacts. You can see a lever on the left being attracted by magnetism when
the coil is switched on. This lever moves the switch contacts. There is one
set of contacts (SPDT) in the foreground and another behind them, making
the relay DPDT.
The relay's switch connections are usually labeled COM, NC and NO:
COM = Common, always connect to this, it is the moving part of the
switch.
NC = Normally Closed, COM is connected to this when the relay coil
is off.
NO = Normally Open, COM is connected to this when the relay coil is
on.
Connect to COM and NO if you want the switched circuit to be on
when the relay coil is on.
Connect to COM and NC if you want the switched circuit to be on
when the relay coil is off.
Choosing a relay
2. Coil voltage
The relay's coil voltage rating and resistance must suit the circuit
powering the relay coil. Many relays have a coil rated for a 12V
supply but 5V and 24V relays are also readily available. Some relays
operate perfectly well with a supply voltage which is a little lower
than their rated value.
3. Coil resistance
The circuit must be able to supply the current required by the relay
coil. You can use Ohm's law to calculate the current:
Supply voltage
Relay coil current =
Coil resistance
For example: A 12V supply relay with a coil resistance of 400 passes a
current of 30mA. This is OK for a 555 timer IC (maximum output current
200mA), but it is too much for most ICs and they will require a transistor to
amplify the current.
Advantages of relays:
Relays can switch AC and DC, transistors can only switch DC.
Relays can switch high voltages, transistors cannot.
Relays are a better choice for switching large currents (> 5A).
Relays can switch many contacts at once.
Disadvantages of relays:
Crystal Oscillator
CAPACITOR
Theory of operation
Main article: Capacitance
Energy storage
Current-voltage relation
The dual of the capacitor is the inductor, which stores energy in the
magnetic field rather than the electric field. Its current-voltage relation is
obtained by exchanging current and voltage in the capacitor equations and
replacing C with the inductance L.
DC circuits
As the capacitor reaches equilibrium with the source voltage, the voltage
across the resistor and the current through the entire circuit decay
exponentially. The case of discharging a charged capacitor likewise
demonstrates exponential decay, but with the initial capacitor voltage
replacing V0 and the final voltage being zero.
RESISTOR
Resistors are used to limit the value of current in a circuit. Resistors offer
opposition to the flow of current. They are expressed in ohms for which the
symbol is . Resistors are broadly classified as
(1) Fixed Resistors
(2) Variable Resistors
Fixed Resistors :
The most common of low wattage, fixed type resistors is the molded-carbon
composition resistor. The resistive material is of carbon clay composition.
The leads are made of tinned copper. Resistors of this type are readily
available in value ranging from few ohms to about 20M, having a
tolerance range of 5 to 20%. They are quite inexpensive. The relative size of
all fixed resistors changes with the wattage rating.
Another variety of carbon composition resistors is the metalized
type. It is made by deposition a homogeneous film of pure carbon over a
glass, ceramic or other insulating core. This type of film-resistor is
sometimes called the precision type, since it can be obtained with an
accuracy of 1%.
Fixed Resistor
Coding Of Resistor :
Some resistors are large enough in size to have their resistance printed on
the body. However there are some resistors that are too small in size to have
numbers printed on them. Therefore, a system of colour coding is used to
indicate their values. For fixed, moulded composition resistor four colour
bands are printed on one end of the outer casing. The colour bands are
always read left to right from the end that has the bands closest to it. The
first and second band represents the first and second significant digits, of the
resistance value. The third band is for the number of zeros that follow the
second digit. In case the third band is gold or silver, it represents a
multiplying factor of 0.1to 0.01. The fourth band represents the
manufactures tolerance.
RESISTOR COLOUR CHART
For example, if a resistor has a colour band sequence: yellow, violet, orange
and gold
The standard colour code cannot show values of less than 10 . To show
these small values two special colours are used for the third band: gold,
which means 0.1 and silver which means 0.01. The first and second
bands represent the digits as normal.
For example:
The fourth band of the colour code shows the tolerance of a resistor.
Tolerance is the precision of the resistor and it is given as a percentage. For
example a 390 resistor with a tolerance of 10% will have a value within
10% of 390 , between 390 - 39 = 351 and 390 + 39 = 429 (39 is 10% of
390).
Resistor shorthand:
Resistor values are often written on circuit diagrams using a code system
which avoids using a decimal point because it is easy to miss the small dot.
Instead the letters R, K and M are used in place of the decimal point. To read
the code: replace the letter with a decimal point, then multiply the value by
1000 if the letter was K, or 1000000 if the letter was M. The letter R means
multiply by 1.
For example:
560R means 560
2K7 means 2.7 k = 2700
39K means 39 k
1M0 means 1.0 M = 1000 k
Power Ratings of Resistors
Examples:
A 470 resistor with 10V across it, needs a power rating P = V/R =
10/470 = 0.21W.
In this case a standard 0.25W resistor would be suitable.
A 27 resistor with 10V across it, needs a power rating P = V/R =
10/27 = 3.7W.
A high power resistor with a rating of 5W would be suitable.
TRANSISTORS
Emitter : The section on one side that supplies charge carriers is called
emitter. The emitter is always forward biased w.r.t. base.
Collector : The section on the other side that collects the charge is called
collector. The collector is always reversed biased.
Base : The middle section which forms two pn-junctions between the
emitter and collector is called base.
Heat sink
LED Materials:
One of the first materials used for LED is GaAs. This is a direct band
gap material, i.e., it exhibits very high probability of direct transition
of electron from conduction band to valence band. GaAs has E= 1.44
eV. This works in the infrared region.
GaP and GaAsP are higher band gap materials. Gallium phosphide is an
indirect band gap semiconductor and has poor efficiency because band to
band transitions are not normally observed.
Gallium Arsenide Phosphide is a tertiary alloy. This material has a special
feature in that it changes from being direct band gap material.
Blue LEDs are of recent origin. The wide band gap materials such as GaN
are one of the most promising LEDs for blue and green emission. Infrared
LEDs are suitable for optical coupler applications.
ADVANTAGES OF LEDs:
Typical uses of buzzers and beepers include alarms, timers and confirmation
of user input such as a mouse click or keystroke.
2.9.1Types of Buzzers
The different types of buzzers are electric buzzers, electronic buzzers,
mechanical buzzers, electromechanical, magnetic buzzers, piezoelectric
buzzers and piezo buzzers.
A piezo buzzer is made from two conductors that are separated by Piezo
crystals. When a voltage is applied to these crystals, they push on one
conductor and pull on the other. The result of this push and pull is a sound
wave. These buzzers can be used for many things, like signaling when a
period of time is up or making a sound when a particular button has been
pushed. The process can also be reversed to use as a guitar pickup. When a
sound wave is passed, they create an electric signal that is passed on to an
audio amplifier.
Piezo buzzers are small electronic devices that emit sounds when driven by
low voltages and currents. They are also called piezoelectric buzzers. They
usually have two electrodes and a diaphragm. The diaphragm is made from a
metal plate and piezoelectric material such as a ceramic plate.
Pressure sensors can be classified in term of pressure ranges they measure, temperature
ranges of operation, and most importantly the type of pressure they measure. In terms of
pressure type, pressure sensors can be divided into five categories:
1) Absolute pressure sensor
This sensor measures the pressure relative to perfect vaccum pressure.
This sensor is used to measure pressure less than the atmospheric pressure at a given
location.
4) Differential pressure sensor
This sensor measures the difference between two or more pressures introduced as inputs to
the sensing unit.
Active component are those component for not any other component
are used its operation. I used in this project only function diode, these
component description are described as bellow.
SEMICONDUCTOR DIODE-
2. Sometimes red and blue marks are on the body of the crystal
diode. Red mark do not arrow wheres blue mark indicates bar e .g
oa80 crystal diode.
ZENER DIODE-
It has been already discussed that when the reverse bias on a crystal diode is
increased a critical voltage, called break down voltage. The break down or
zener voltage depends upon the amount of doping. If the diode is heavily
doped depletion layer will be thin and consequently the break down of he
junction will occur at a lower reverse voltage. On the other hand, a lightly
doped diode has a higher break down voltage, it is called zener diode
A properly doped crystal diode, which has a sharped break down voltage, is
known as a zenor diode.
APPLICATION:
Laser data transfer is used to transfer the data successfully
via two microcontrollers while displaying the data using the
LCD screen so anywhere where data is to be transfer we can
use this technology
But due to its range limitation we cannot send the data for a
long
range , only when receiver and transmitter are close to each
other
then only data can be transmitted.
CONCLUSION:
This project gave us the understanding of microcontroller and made
us realize the power of microcontroller and help us understand how
to use the laser.
The developing of this project has been a learning experience for all team
members and would prove as a milestone in their academic career. The
achievement of this project are
i. The project has achieved its set target well in Time and
Budget.
iii. The product developed is ready for implementation and can bring
financial benefits too by sale in the market.
So, we conclude that the LASER communicationis still far away from the
perfect, but we believe we have laid the groundwork to enable it to improve
out of sight.
References
3. Some Websites :
www.alldatasheets.com
www.datasheetcatalog.com
www.electronicscircuits.com
www.scielectronics.com
www.parallax.com