Sie sind auf Seite 1von 38

Department of Electronic & Communication

Engineering

CERTIFICATE

This is to certify that Nikhil Agrawal, student of fourth


year in Electronics and Communication Branch has
successfully completed his Industrial training on
“Embedded System Design Using 8-Bit
Microcontroller & PCB Designing” at PLC Institute of
Electronics, New Delhi, during the 2009 – 2010 session.
I hereby approve his training work and report.

Mr.Jitendra Mishra Dr. L.D. BALANI


Prof. Sameena Zaafar
Lecture of Electronics & Director PCST-Bhopal .
H.O.D. of Electronics & Communication
Department.
Communication Department.
Training Incharge.
4
DECLARATION

I hereby declare that the work that is being presented in the Major

training report entitled Embedded System Design Using 8-Bit


Microcontroller in partial fulfillment of the requirement for the award
of degree of Bachelor of Engineering in Electronics & Communication
Engineering is an authentic record of our work carried out under the
guidance of PLC Institute of Electronics . The training has been carried
out at PLC Institute of Electronics, New Delhi.

The matter embodied in the report has not been submitted for the
award of any other degree or diploma.

Nikhil
Agrawal.
4
ACKNOWLEDGEMENT

We express our deep senses of gratitude to our respected and


learned guide Mr. B.P Arun, for their valuable help and guidance. We
are thankful to them for the encouragement they have given us in
completing the training.
I am also grateful to respected Mr. Subrato Howlader
Training Officer, for permitting us to utilize all the necessary
facilities of the organization.
I am also graceful to the college and Dept. of Electronics and
Communication for their valuable guidance and permission for taking
this training.
4
Lastly, we would like to express our deep appreciation towards
our batch mates for providing us the moral support and
encouragement.

Introduction-
An embedded system is a computer system designed to perform one
or a few dedicated functions, often with real-time computing constraints. It
is embedded as part of a complete device often including hardware and
mechanical parts. In contrast, a general-purpose computer, such as a
personal computer, is designed to be flexible and to meet a wide range of
an end-user's needs. Embedded systems control many of the common
devices in use today.

Embedded systems are controlled by a main processing core that is


typically either a microcontroller or a digital signal processor (DSP).

Since the embedded system is dedicated to specific tasks, design


engineers can optimize it reducing the size and cost of the product and
increasing the reliability and performance. Some embedded systems are
mass-produced, benefiting from economies of scale.

Physically, embedded systems range from portable devices such as


digital watches and MP3 players, to large stationary installations like traffic
lights, factory controllers, or the systems controlling nuclear power plants.
Complexity varies from low, with a single microcontroller chip, to very high
with multiple units, peripherals and networks mounted inside a large chassis
or enclosure.

In general, "embedded system" is not an exactly defined term, as many


systems have some element of programmability. For example, handheld
computers share some elements with embedded systems such as the
4
operating systems and microprocessors which power them, but are not truly
embedded systems, because they allow different applications to be loaded
and peripherals to be connected.

Variety of Embedded System- Embedded systems span all aspects of


modern life and there are many examples of their use.
Telecommunications systems employ numerous embedded systems
from telephone switches for the network to mobile phones at the end-user.
Computer networking uses dedicated routers and network bridges to route
data.
Consumer electronics include personal digital assistants (PDAs), mp3
players, mobile phones, videogame consoles, digital cameras, DVD
players, GPS receivers, and printers. Many household appliances, such
as microwave ovens, washing machines and dishwashers, are including
embedded systems to provide flexibility, efficiency and features.
Advanced HVAC systems use networked thermostats to more accurately
and efficiently control temperature that can change by time of day
and season. Home automation uses wired- and wireless-networking that can
be used to control lights, climate, security, audio/visual, surveillance, etc.,
all of which use embedded devices for sensing and controlling.
Transportation systems from flight to automobiles increasingly use
embedded systems. New airplanes contain advanced avionics such
as inertial guidance systems and GPS receivers that also have considerable
safety requirements. Various electric motors — brushless DC
motors, induction motors and DC motors — are using
electric/electronic motor controllers. Automobiles, electric vehicles,
and hybrid vehicles are increasingly using embedded systems to maximize
efficiency and reduce pollution. Other automotive safety systems
include anti-lock braking system (ABS), Electronic Stability
Control (ESC/ESP), traction control (TCS) and automatic four-wheel drive.
Medical equipment is continuing to advance with more embedded
systems for vital signs monitoring, electronic stethoscopes for amplifying
sounds, and various medical imaging (PET, SPECT, CT, MRI) for non-invasive
internal inspections.
Characteristics-1 Embedded systems are designed to do some specific
task, rather than be a general-purpose computer for multiple tasks. Some
also have real-time performance constraints that must be met, for reasons
such as safety and usability; others may have low or no performance
requirements, allowing the system hardware to be simplified to reduce
costs.

2. Embedded systems are not always standalone devices. Many embedded


systems consist of small, computerized parts within a larger device that
serves a more general purpose. For example, the Gibson Robot
Guitar features an embedded system for tuning the strings, but the overall
purpose of the Robot Guitar is, of course, to play music.[5] Similarly, an
embedded system in an automobile provides a specific function as a
subsystem of the car itself.
4
3. The program instructions written for embedded systems are referred to
as firmware, and are stored in read-only memory or Flash memory chips.
They run with limited computer hardware resources: little memory, small or
non-existent keyboard and/or screen.

Processors in Embedded Systems-

Embedded processors can be broken into two broad categories:


ordinary microprocessors (μP) and microcontrollers (μC), which have many
more peripherals on chip, reducing cost and size. Contrasting to the
personal computer and server markets, a fairly large number of basic CPU
architectures are used; there are Von Neumann as well as various degrees
of Harvard architectures, RISC as well as non-RISC and VLIW; word lengths
vary from 4-bit to 64-bits and beyond (mainly in DSP processors) although
the most typical remain 8/16-bit. Most architectures come in a large number
of different variants and shapes, many of which are also manufactured by
several different companies.
A long but still not exhaustive list of common architectures
are: 65816, 65C02, 68HC08, 68HC11, 68k, 8051, ARM, AVR, AVR32, Blackfin
, C167, Coldfire, COP8, CortusAPS3, eZ8, eZ80, FRV, H8, HT48, M16C,M32C,
MIPS, MSP430, PIC, PowerPC, R8C, SHARC, ST6, SuperH, TLCS-47, TLCS-870,
TLCS-900, Tricore, V850, x86, XE8000, Z80, AsAP etc
In general life number of tasks can be performed by using a 8- bit
microcontroller, for example the filling machine we see at fuel station, car
security system is another best example of the embedded system design.

8-Bit Microcontroller-
A microcontroller (also microcontroller unit, MCU or µC) is a small
computer on a single integrated circuit consisting of a relatively simple CPU
combined with support functions such as a crystal oscillator, timers,
watchdog timer, serial and analog I/O etc. Programmed memory in the form
of NOR flash or OTP ROM is also often included on chip, as well as a typically
small amount of RAM. Microcontrollers are designed for small or dedicated
applications. Thus, in contrast to the microprocessors used in personal
computers and other high-performance or general purpose applications,
simplicity is emphasized. Some microcontrollers may operate at clock rate
frequencies as low as 4 kHz, as this is adequate for many typical
applications, enabling low power consumption (mill watts or microwatts).
They will generally have the ability to retain functionality while waiting for
an event such as a button press or other interrupt; power consumption
while sleeping (CPU clock and most peripherals off) may be just nano watts,
making many of them well suited for long lasting battery applications. 8051
is one of the famous architecture of 8-Bit Microcontroller.

8051 Description-
4
Brief History-In 1981, Intel Cooperation introduced an 8-bit
microcontroller called the 8051.this microcontroller had 128 byte of Ram,
4K byte of on chip Rom, two timer, one serial port, and four ports (each 8-
bits wide) all on a single chip. At the it is also referred to as a ”system on
chip”. The 8051 is 8-bit processor, meaning that CPU can work on only 8
bits of data at a time. Data greater than 8- bit has to be broken into 8-bits
pieces to be produced by the CPU

The 8051 became widely popular after Intel allowed other manufactures to
make and market any flavor of the 8051 they please with the condition that
they remain code compatible with the 8051. This led to many versions of
the 8051 with different speed, ROM, and amount of the on chip ROM. It
should be noticed that, although new versions are different in speed,
memory but all are compatible with the original 8051 as war as the
instruction are concerned.

8051 is a CISC type of microcontroller. The CISC stands for complex


instruction set computer. It means that the set of instructions in 8051 can
be developed by using the different combination of logics. There are about
150 types of mode of addressing possible in CISC processors. This makes
easily to design the compiler for the compilation of code developed in
higher language into assembly language.
There microcontroller introduce after 8051 are introduced in table
given below.

Feature 8051 8052 8031


ROM (on-chip 4K 8K 0K
program space in
byte)
RAM (bytes) 128 256 128
Timers 2 3 2
I/O Pins 32 32 32
Serial Port 1 1 1
Interrupt Source 6 8 6

8051- Architecture-
Block Diagram-
4
8051 Microcontroller Memory-

Types of Memory- as three very general types of memory. To effectively


program the 8051 it is necessary to have a basic understanding of these
memory types. The memory types are illustrated in the following graphic.
They are: On-Chip Memory, External Code Memory, and External RAM.

 On-Chip Memory refers to any memory (Code, RAM, or other) that


physically exists on the microcontroller itself. On-chip memory can be
of several types, but we'll get into that shortly.
 External Code Memory is code (or program) memory that resides
off-chip. This is often in the form of an external EPROM.
 External RAM is RAM memory that resides off-chip. This is often in
the form of standard static RAM or flash RAM.

Code Memory-Code memory is the memory that holds the actual 8051
program that is to be run. This memory is limited to 64K and comes in many
shapes and sizes: Code memory may be found on-chip, either burned into
4
the microcontroller as ROM or EPROM. Code may also be stored completely
off-chip in an external ROM or, more commonly, an external EPROM. Flash
RAM is also another popular method of storing a program. Various
combinations of these memory types may also be used--that is to say, it is
possible to have 4K of code memory on-chip and 64k of code memory off-
chip in an EPROM.

When the program is stored on-chip the 64K maximum is often reduced to
4k, 8k, or 16k. This varies depending on the version of the chip that is being
used. Each version offers specific capabilities and one of the distinguishing
factors from chip to chip is how much ROM/EPROM space the chip has.

However, code memory is most commonly implemented as off-chip EPROM.


This is especially true in low-cost development systems and in systems
developed by students.

External RAM- As an obvious opposite of Internal RAM, the 8051 also


supports what is called External RAM.

As the name suggests, External RAM is any random access memory which is
found off-chip. Since the memory is off-chip it is not as flexible in terms of
accessing, and is also slower. For example, to increment an Internal RAM
location by 1 requires only 1 instruction and 1 instruction cycle. To
increment a 1-byte value stored in External RAM requires 4 instructions and
7 instruction cycles. In this case, external memory is 7 times slower!

On-Chip Memory- As mentioned at the beginning of this chapter, the 8051


includes a certain amount of on-chip memory. On-chip memory is really one
of two types: Internal RAM and Special Function Register (SFR) memory. The
layout of the 8051's internal memory is presented in the following memory
map:

As is illustrated in this map, the 8051 has a bank of 128 bytes of Internal
RAM. This Internal RAM is found on-chip on the 8051 so it is the fastest RAM
available, and it is also the most flexible in terms of reading, writing, and
modifying its contents. Internal RAM is volatile, so when the 8051 is reset
this memory is cleared.
4
The 128 bytes of internal ram is subdivided as shown on the memory map.
The first 8 bytes (00h - 07h) are "register bank 0". By manipulating certain
SFRs, a program may choose to use register banks 1, 2, or 3. These
alternative register banks are located in internal RAM in addresses 08h
through 1Fh. We'll discuss "register banks" more in a later chapter. For now
it is sufficient to know that they "live" and are part of internal RAM.

Bit Memory also lives and is part of internal RAM. We'll talk more about bit
memory very shortly, but for now just keep in mind that bit memory actually
resides in internal RAM, from addresses 20h through 2Fh.

The 80 bytes remaining of Internal RAM, from addresses 30h through 7Fh,
may be used by user variables that need to be accessed frequently or at
high-speed. This area is also utilized by the microcontroller as a storage
area for the operating stack. This fact severely limits the 8051s stack since,
as illustrated in the memory map, the area reserved for the stack is only 80
bytes--and usually it is less since this 80 bytes has to be shared between
the stack and user variables.

Register Banks- The 8051 uses 8 "R" registers which are used in many of
its instructions. These "R" registers are numbered from 0 through 7 (R0, R1,
R2, R3, R4, R5, R6, and R7). These registers are generally used to assist in
manipulating values and moving data from one memory location to another.
For example, to add the value of R4 to the Accumulator, we would execute
the following instruction. However, as the memory map shows, the "R"
Register R4 is really part of Internal RAM. Specifically, R4 is address 04h.
This can be see in the bright green section of the memory map. Thus the
above instruction accomplishes the same thing as the following operation.

The concept of register banks adds a great level of flexibility to the 8051,
especially when dealing with interrupts (we'll talk about interrupts later).
However, always remember that the register banks really reside in the first
32 bytes of Internal RAM.

Bit Memory- The 8051, being a communications-oriented microcontroller,


gives the user the ability to access a number of bit variables. These
variables may be either 1 or 0.

There are 128 bit variables available to the user, numbered 00h through
7Fh. The user may make use of these variables with commands such as
SETB and CLR. For example, to set bit number 24 (hex) to 1 you would
execute the instruction:

Special Function Register (SFR) Memory- Special Function Registers


(SFRs) are areas of memory that control specific functionality of the 8051
processor. For example, four SFRs permit access to the 8051s 32
input/output lines. Another SFR allows a program to read or write to the
8051s serial port. Other SFRs allow the user to set the serial baud rate,
control and access timers, and configure the 8051s interrupt system.
4
The Accumulator- If you’ve worked with any other assembly languages
you will be familiar with the concept of an Accumulator register.

The Accumulator, as its name suggests, is used as a general register to


accumulate the results of a large number of instructions. It can hold an 8-bit
(1-byte) value and is the most versatile register the 8051 has due to the
shear number of instructions that make use of the accumulator. More than
half of the 8051s 255 instructions manipulate or use the accumulator in
some way.

For example, if you want to add the number 10 and 20, the resulting 30 will
be stored in the Accumulator. Once you have a value in the Accumulator
you may continue processing the value or you may store it in another
register or in memory.

The "R" Registers- The "R" registers are a set of eight registers that are
named R0, R1, etc. up to and including R7.

These registers are used as auxiliary registers in many operations. To


continue with the above example, perhaps you are adding 10 and 20. The
original number 10 may be stored in the Accumulator whereas the value 20
may be stored in, say, register R4. To process the addition you would
execute the command:

The "B" Register- The "B" register is very similar to the Accumulator in the
sense that it may hold an 8-bit (1-byte) value.

The "B" register is only used by two 8051 instructions: MUL AB and DIV AB.
Thus, if you want to quickly and easily multiply or divide A by another
number, you may store the other number in "B" and make use of these two
instructions.

Aside from the MUL and DIV instructions, the "B" register is often used as
yet another temporary storage register much like a ninth "R" register.

The Data Pointer (DPTR)- The Data Pointer (DPTR) is the 8051s only user-
accessible 16-bit (2-byte) register. The Accumulator, "R" registers, and "B"
register are all 1-byte values.

DPTR, as the name suggests, is used to point to data. It is used by a number


of commands which allow the 8051 to access external memory. When the
8051 accesses external memory it will access external memory at the
address indicated by DPTR.

While DPTR is most often used to point to data in external memory, many
programmers often take advantage of the fact that its the only true 16-bit
register available. It is often used to store 2-byte values which have nothing
to do with memory locations.
4
The Program Counter (PC)- The Program Counter (PC) is a 2-byte
address which tells the 8051 where the next instruction to execute is found
in memory. When the 8051 is initialized PC always starts at 0000h and is
incremented each time an instruction is executed. It is important to note
that PC isn’t always incremented by one. Since some instructions require 2
or 3 bytes the PC will be incremented by 2 or 3 in these cases.

The Program Counter is special in that there is no way to directly modify its
value. That is to say, you cant do something like PC=2430h. On the other
hand, if you execute LJMP 2430h you’ve effectively accomplished the same
thing.

The Stack Pointer (SP) - The Stack Pointer, like all registers except DPTR
and PC, may hold an 8-bit (1-byte) value. The Stack Pointer is used to
indicate where the next value to be removed from the stack should be
taken from.

When you push a value onto the stack, the 8051 first increments the value
of SP and then stores the value at the resulting memory location.

When you pop a value off the stack, the 8051 returns the value from the
memory location indicated by SP, and then decrements the value of SP.

Pin Diagram of 8051 & Description-

Pin and Ports Description of 8051-

 Pins 1-8: Port 1 Each of these pins can be configured as an input


or an output.
 Pin 9: RS A logic one on this pin disables the microcontroller and
clears the contents of most registers. In other words, the positive
voltage on this pin resets the microcontroller. By applying logic
zero to this pin, the program starts execution from the beginning.
 Pins10-17: Port 3 Similar to port 1, each of these pins can serve
as general input or output. Besides, all of them have alternative
functions:
4
 Pin 10: RXD Serial asynchronous communication input or Serial
synchronous communication output.
 Pin 11: TXD Serial asynchronous communication output or Serial
synchronous communication clock output.
 Pin 12: INT0 Interrupt 0 input.
 Pin 13: INT1 Interrupt 1 input.
 Pin 14: T0 Counter 0 clock input.
 Pin 15: T1 Counter 1 clock input.
 Pin 16: WR Write to external (additional) RAM.
 Pin 17: RD Read from external RAM.
 Pin 18, 19: X2, X1 Internal oscillator input and output. A quartz
crystal which specifies operating frequency is usually connected to
these pins. Instead of it, miniature ceramics resonators can also
be used for frequency stability. Later versions of microcontrollers
operate at a frequency of 0 Hz up to over 50 Hz.
 Pin 20: GND Ground.
 Pin 21-28: Port 2 If there is no intention to use external memory
then these port pins are configured as general inputs/outputs. In
case external memory is used, the higher address byte, i.e.
addresses A8-A15 will appear on this port. Even though memory
with capacity of 64Kb is not used, which means that not all eight
port bits are used for its addressing, the rest of them are not
available as inputs/outputs.
 Pin 29: PSEN If external ROM is used for storing program then a
logic zero (0) appears on it every time the microcontroller reads a
byte from memory.
 Pin 30: ALE Prior to reading from external memory, the
microcontroller puts the lower address byte (A0-A7) on P0 and
activates the ALE output. After receiving signal from the ALE pin,
the external register (usually 74HCT373 or 74HCT375 add-on chip)
memorizes the state of P0 and uses it as a memory chip address.
Immediately after that, the ALU pin is returned its previous logic
state and P0 is now used as a Data Bus. As seen, port data
multiplexing is performed by means of only one additional (and
cheap) integrated circuit. In other words, this port is used for both
data and address transmission.
 Pin 31: EA By applying logic zero to this pin, P2 and P3 are used
for data and address transmission with no regard to whether there
is internal memory or not. It means that even there is a program
written to the microcontroller, it will not be executed. Instead, the
program written to external ROM will be executed. By applying
logic one to the EA pin, the microcontroller will use both
memories, first internal then external (if exists).
 Pin 32-39: Port 0 Similar to P2, if external memory is not used,
these pins can be used as general inputs/outputs. Otherwise, P0 is
configured as address output (A0-A7) when the ALE pin is driven
high (1) or as data output (Data Bus) when the ALE pin is driven
low (0).
 Pin 40: VCC +5V power supply.
4
Input/output Ports (I/O Ports)-
All 8051 microcontrollers have 4 I/O ports each comprising 8 bits which can
be configured as inputs or outputs. Accordingly, in total of 32 input/output
pins enabling the microcontroller to be connected to peripheral devices are
available for use.

Pin configuration, i.e. whether it is to be configured as an input (1) or an


output (0), depends on its logic state. In order to configure a microcontroller
pin as an input, it is necessary to apply a logic zero (0) to appropriate I/O
port bit. In this case, voltage level on appropriate pin will be 0.

Similarly, in order to configure a microcontroller pin as an input, it is


necessary to apply a logic one (1) to appropriate port. In this case, voltage
level on appropriate pin will be 5V (as is the case with any TTL input). This
may seem confusing but don't loose your patience. It all becomes clear after
studying simple electronic circuits connected to an I/O pin.

Input/output (I/O) pin-Figure above illustrates a simplified schematic of


all circuits within the microcontroller connected to one of its pins. It refers to
all the pins except those of the P0 port which do not have pull-up resistors
built-in.

Output pin-A logic zero (0) is applied to a bit of the P register. The output
FE transistor is turned on, thus connecting the appropriate pin to ground.

Input pin-A logic one (1) is applied to a bit of the P register. The output FE
transistor is turned off and the appropriate pin remains connected to the
power supply voltage over a pull-up resistor of high resistance.

Port 0-The P0 port is characterized by two functions. If external memory is


used then the lower address byte (addresses A0-A7) is applied on it.
Otherwise, all bits of this port are configured as inputs/outputs.

The other function is expressed when it is configured as an output. Unlike


other ports consisting of pins with built-in pull-up resistor connected by its
4
end to 5 V power supply, pins of this port have this resistor left out. This
apparently small difference has its consequences. If any pin of this port is
configured as an input then it acts as if it “floats”. Such an input has
unlimited input resistance and undetermined potential. When the pin is
configured as an output, it acts as an “open drain”. By applying logic 0 to a
port bit, the appropriate pin will be connected to ground (0V). By applying
logic 1, the external output will keep on “floating”. In order to apply logic 1
(5V) on this output pin, it is necessary to built in an external pull-up resistor.

Only in case P0 is used for addressing external memory, the microcontroller


will provide internal power supply source in order to supply its pins with
logic one. There is no need to add external pull-up resistors.

Port 1 -P1 is a true I/O port, because it doesn't have any alternative
functions as is the case with P0, but can be configured as general I/O only. It
has a pull-up resistor built-in and is completely compatible with TTL circuits.

Port 2- P2 acts similarly to P0 when external memory is used. Pins of this


port occupy addresses intended for external memory chip. This time it is
about the higher address byte with addresses A8-A15. When no memory is
added, this port can be used as a general input/output port showing
features similar to P1.

Port 3-All port pins can be used as general I/O, but they also have an
alternative function. In order to use these alternative functions, a logic one
(1) must be applied to appropriate bit of the P3 register. In terms of
hardware, this port is similar to P0, with the difference that its pins have a
pull-up resistor built-in.

Pin's Current limitations- When configured as outputs (logic zero


(0)), single port pins can receive a current of 10mA. If all 8 bits of a port are
active, a total current must be limited to 15mA (port P0: 26mA). If all ports
(32 bits) are active, total maximum current must be limited to 71mA. When
these pins are configured as inputs (logic 1), built-in pull-up resistors
provide very weak current, but strong enough to activate up to 4 TTL inputs
of LS series.

8051-Microcontroller Programming-
There are many ways to program a microcontroller, for example we can
develop a program in Assembly language and burn into microcontroller IC
by the use of Assembler. Now a day the codes of the program are
developed in “c” language. Now this code which is encoded in “c” is
converted into Assembly language and then transferred to microcontroller.

For the training session I have use the microcontroller “P89V51RD2BN”,


which is a product of Philips. This microcontroller have the core of 8051
4
micro processor, so any program of 8051 can be developed and tested on it.
The specialty of this microcontroller is that it is in circuit programmable. By
it means that we can develop our code in PC and can directly transfer into
microcontroller by a means of Serial port. It have 2 timers, total of 64K total
ROM, and 128K of ROM.

The IED used for this purpose is KEIL. It is a 8051 developing tool and used
for developing code using “c language”. By the term IDE we understand
integrated development environment, it provides the facility of developing a
code, debugging and simulation of the developed code. After the
compilation of the code the keil develops a .hex file at defined destination
and this hex file is actually burned into microcontroller. For burning purpose
we use new software known as “Flash Magic”. This software is used to
download the code in microcontroller.

Why use of C?
Compiler produces hex files that we download into the ROM of the
microcontroller. The size of the hex file produced by the compiler is on of
the main concern of the microcontroller programming, for two reasons:

1. Microcontrollers have limited on-chip ROM. Is limited to


2. The code space for the 64K bytes.

While working on Assembly language, it produces the hex file that is much
smaller than C, but programming in Assembly Language is tedious and time
consuming. C programming, on the other hand, is less time consuming and
much easier to write, but the hex file produced is much larger than if we
use Assembly language.

Following advantages of programming in C:

1. It is easier and less time consuming to write in C than Assembly.


2. C is easier to modify and update.
3. We can use code available in function libraries.
4. C code is portable to other microcontroller with little or no
modification.

Data Types in C- There are some specific C Data types that are most
useful and widely used for 8051 microcontroller.

1. Unsigned char- it is an 8-bit data type that takes a value in range of 0-


255(00-FFH). It also stores the ASCII values of the characters.

2. Signed char- it is also a 8 bit data type that uses the most significant bit
D7 to represent the – or + value. As a result, we have only 7 bits for
magnitude to the signed number, giving us the value from -128 to +128. It
also stores the ASCII values of all characters.
4
3. Unsigned int- this is 16 bit data type which only takes the integer value
and it ranges from 0 to 65535(0000-FFFFH).

4. Signed int- this is similar to signed char, but the only difference is that it
take sonly the integer value which ranges from -32,768 to +32767.

5. Sbit (single bit)- this sbit is widely used for accessing the single- bit
addressable registers.

The programming in c will we explained with the example during the


explanation of interfacing of microcontroller with different elements.

Interfacing of Microcontroller-
1. Interfacing with LED- This comes under the port programming
concept. The output voltage of pin of microcontroller can be upto 5 V.
We directly connect the LED to the pin, but doing so can damage the
LED. That’s why we use to connect a resistor in series with it and
microcontroller. The connectional block diagram is shown in the
figure in next page.

First program of the training is to produce the alternate chaser of the


LEDs. It means the LEDs must glow in alternate pattern. The program is as
follow.

2. Interfacing with Switch- Microcontroller can be directly connected


with switch. Switches are used for execution of particular task of users
choose at a given instate.
4
For example we want to on fan so we just put on the switch, in similar
way we can do with microcontroller. For this the port pin by which the
switch is connected is set to 1 (high), and when the switch is pressed this
port get grounded and become zero and this logic can be used to do any
task.

3. Serial port Connection- This very important interfacing regarding


to my industrial training program, since I have programmed the
microcontroller through serial port. The 3.0 (10th pin) and 3.1 (11th pin)
of 8051. Used for the serial port communication. This is used for the
interfacing of the microcontroller based board with PC. The
microcontroller uses the 11.80MHz
fr. for the operation. For the serial port communication we required the IC
known as MAX 232 or 233. Since the microcontroller uses the TTL logic and
the serial port transmission logic is different. That’s for the conversion of
logics this IC is used.

4. Interfacing with LCD - This section covers the real-world application


of the 8051. In this I will explain, how to interface the 8051 to devices
such as LCD and Seven Segment. Now question arises which is better
one, LCD or seven Segment. The recent development has made the
LCD operation better than 7 Segment.

5. Interfacing with Seven Segment- Segment displays are basically


7 LED's. It will be much easier to understand if you first
read Interfacing LED's to Microcontroller.
4
Basically there are two types of 7-Seg display's:

 Common Cathode where all the segments share the same


Cathode.
 Common Anode where all Segments share the same Anode.

Here we will be only discussing the Common Anode type. In common Anode
in order to turn ON a segment the corresponding pin must be set to 0. And
to turn it OFF it is set to 1.

Figure 1 shows how to interface 7-seg display to a microcontroller. Now we


create a lookup table containing the seven segment pattern to display the
corresponding hex digits. e.g. consider we have to display '1' from the
above figure we come to know that turning ON segment B & C will show '1'
on the 7-seg display so P2.1 & P2.2 should be LOGIC 0 whereas rest of
the pins should be LOGIC 1. FIGURE 2 shows the lookup table for CA
display.
4
We can now interface a single 7-Seg to the microcontroller but for
interfacing multiple 7-seg's we use Scanning Principle where One 7-seg is
displayed after another but this process is very fast hence the flickering
cannot be seen by human eye. Figure 3shows the circuit for interfacing two
7 segment displays.

When interfacing more than one 7-seg display the segment's (A-G) of all
displays are connected together whereas their ANODE (Cathode in case of
CC displays) are switched ON one after another. Consider we have to
display '31' on the above 7-seg display so we TURN ON the first transistor
by setting its corresponding pin to 1 & then give the 7-seg equivalent code
for '3' which is 4fh. Then we TURN OFF the first transistor & TURN ON the
second & output its corresponding 7-seg equivalent code of '1' i.e. 06h.Then
we again go back to display '3' this is a never ending loop.

6. ADC, DAC, & SENSOR INTERFACING- Analog signals are very


common inputs to embedded systems .Most transducers and sensors
such as temperature, pressure, velocity, humidity are
analog. Therefore we need to convert these analog signals in to digital
so that 8051 can read it.

ANALOG DIGITAL TO CONVERTER (ADC)-Commonly used ADC device


– ADC804.

ABOUT IC

Pin out-

 CS – Chip Select , active low.


 RD – Read Digital data from ADC, H-L edge triggered.
 WR -- Start conversion, L-H pulse edge triggered.
 INTR -- end of conversion, Goes low to indicate conversion done.
 Data bits -- D0-D7.
 CLK IN & CLK R.
CLK IN is an input pin connected to an external clock source when an
external clock is used for timing. However, ADC804 has an internal
clock generator.
To use the internal clock generator of the ADC804, the CLK IN and CLK
4
R pins are connected to a capacitor and a resistor. In that case, the
clock frequency is determined by the equation.
f=1/1.1RC R=10K and C=150pF f=606Hz the conversion time is 110us.

Input Voltage range-

Vref/2 Vin
Step size
(Volts (Volts
(mV)
) )
Open 5/256 =
0 to 5
(2.5) 19.53
0 to 5.12/256
2.56
5.12 =20
0 to 2.56/256 =
1.28
2.56 10
0.5 0 to 1 1/256=3.90

 Default 0-5V. Can be changed by setting different value for Vref/2 pin.
Vin =Vin(+) – Vin (-)
 Range=0 to 2x Vref/2. For Vin = 2x Vref/2. We get 256 as a digital output
on D0-D7. (Refer Table)
 Step Size Smallest change– (2 x Vref/2)/ 256 for ADC804, for eg.
for step size 10mv ,digital output on D0-D7 changes by one count for
every 10mv change of the input analog voltage.

Data Out- Dout = Vin / Step Size. For input voltage of 2.56 volts (Vref=1.28
volts) and step size of 10mv Dout =2560/10 =256 or FF that is full scale
output.

Conversion-Time Greater than 110us for ADC804

Resolution-8 bits for ADC804.

INTERFACING ADC804 TO 8051- Signals to be interfaced (on the


ADC804).
D0-D7, RD, WR, INTR, CS Can do both Memory mapping and IO mapping.

Memory Mapping (timing is critical)- Connect D0-D7 of ADC804 to


the data bus of the8051 system. Connect RD, WR of the ADC804 to the
8051 system (ensure polarity).Connect CS of ADC804 to an appropriate
address decoder output. Connect INTR of ADC804 to an external
interrupt Pin on the 8051 (INT0 or INT1)
4
IO Mapping (easiest-I prefer)- Connect D0-D7, RD, WR, CS, INTR to
some port bits on the 8051 (12 in all).

Algorithm-1.Make CS=0 and send a low-to-high to pin WR to start the


conversion.
2. Keep monitoring INTR. If INTR =0, the conversion is finished and we
can go to the next step. If INTR=1, keep polling until it goes low.
3. After INTR=0, we make CS=0 and send a high-to-low pulse to RD to
get the data out of the ADC804 chip.

INTERFACING ADC804 TO 8051-


1. ADC808/809 Chip with 8 analog channels. This means this kind of chip
allows to monitor 8 different transducers.
2. ADC804 has only ONE analog input: Vin(+).
3. ALE: Latch in the address.
4. Start: Start of conversion (same as WR in 804).
5. OE: output enable (same as RD in 804).
6. EOC: End of Conversion (same as INTR in 804).

Channel CBA
IN0 000
IN1 001
IN2 010
IN3 011
IN4 100
IN5 101
IN6 110
IN7 111 DIGITAL TO ANALOG
CONVERTER (DAC)-

 Commonly used DAC808 (MC1408).


 R/2R ladder.
 Iout = Iref (D7/2 + D6/4 + D5/8 + …… + D0/256).
 Iout converted to voltage by a resistive load or op-amp based isolator
(Rf from Vout to V- and V+ to GND).
4
PinOut-
 D0-D7 à Connected to the Processor’s IO port.
 Vref+, Vref-, Vee

Usage- Just write a byte to the IO port and the DAC converts it to an
analog value Some 8051 clones have ADCs and DACs in built.

SENSOR- With the advancement in technology, the new variety of


sensors is available. The output of these sensors is already calibrated
and after converting into digital form we can directly feed into
microprocessor for processing.

7. Interface with DC Motor- L293D is a dual H-Bridge motor driver, so


with one IC we can interface two DC motors which can be controlled in
both clockwise and counter clockwise direction and if you have motor
with fix direction of motion then you can make use of all the four I/Os
to connect up to four DC motors. L293D has output current of 600mA
and peak output current of 1.2A per channel.

Moreover for protection of circuit from back EMF output diodes are included
within the IC. The output supply (VCC2) has a wide range from 4.5V to 36V,
which has made L293D a best choice for DC motor driver. A simple
schematic for interfacing a DC motor using L293D is shown below.

As you can see in the circuit, three pins are needed for interfacing a
DC motor (A, B, Enable). If you want the o/p to be enabled completely then
4
you can connect Enable to VCC and only 2 pins needed from controller to
make the motor work.

As per the truth mentioned in the image above its fairly simple to
program the microcontroller. It’s also clear from the truth table of BJT circuit
and L293D the programming will be same for both of them, just keeping in
mind the allowed combinations of A and B. We will discuss about
programming in C as well as assembly for running motor with the help of a
microcontroller

8. Interface with Stepper Motor- here are actually many ways you can
interface a stepper motor to your controller, out of them the most used
interfaces are:

1. Interface using L293D - H-Bridge Motor Driver

2. Interface using ULN2003/2004 - Darlington Arrays

We will discuss both connection techniques one by one. The above


mentioned methods need 4 controller pins for interface.

 Connecting Uni-polar stepper using L293D.-

As you see in the circuit above the four pins "Controller pin 1",2,3 and 4
will control the motion and direction of the stepper motor according to
the step sequence programmed in the controller.

 Connecting Unipolar stepper using ULN2003/2004.-

As already discussed in case of L293D, Here in this circuit too the four
pins "Controller pin 1",2,3 and 4 will control the motion and direction of
the stepper motor according to the step sequence sent by the controller.
4
 2wire connection for Unipolar Stepper Motor.-

We have seen the generally used 4-wire connection method for


interfacing unipolar stepper motor, but we can simplify the design to
make controller use less pins with the help of 2-wire connection method.
The circuit for 2-wire connection is shown below.

PIC Microcontroller-
1.Introduction-PIC is a family of Harvard
architecture microcontrollers made by Microchip Technology, derived from
the PIC1640 originally developed by General Instrument's Microelectronics
Division. The name PIC initially referred to "Peripheral Interface
Controller".
PICs are popular with both industrial developers and hobbyists alike due to
their low cost, wide availability, large user base, extensive collection of
application notes, availability of low cost or free development tools, and
serial programming (and re-programming with flash memory) capability.
4
Microchip announced on February 2008 the shipment of its six billionth PIC
processor.
2. Core Architecture- The PIC architecture is distinctively minimalist. It is
characterized by the following features:

 Separate code and data spaces (Harvard architecture).


 A small number of fixed length instructions.
 Most instructions are single cycle execution (4 clock cycles), with
single delay cycles upon branches and skips.
 A single accumulator (W), the use of which (as source operand) is
implied (i.e. is not encoded in the opcode).
 All RAM locations function as registers as both source and/or
destination of math and other functions.
 A hardware stack for storing return addresses.
 A fairly small amount of addressable data space (typically 256
bytes), extended through banking.
 Data space mapped CPU, port, and peripheral registers.
 The program counter is also mapped into the data space and
writable (this is used to implement indirect jumps).

3. Data space (RAM)-PICs have a set of registers that function as general


purpose RAM. Special purpose control registers for on-chip hardware
resources are also mapped into the data space. The addressability of
memory varies depending on device series, and all PIC devices have some
banking mechanism to extend the addressing to additional memory. Later
series of devices feature move instructions which can cover the whole
addressable space, independent of the selected bank. In earlier devices
(i.e., the baseline and mid-range cores), any register move had to be
achieved via the accumulator.
4. Code space-All PICs feature Harvard architecture, so the code space and
the data space are separate. PIC code space is generally implemented
as EPROM, ROM, or flash ROM.
In general, external code memory is not directly addressable due to the lack
of an external memory interface. The exceptions are PIC17 and select high
pin count PIC18 devices.
5. Word size- The word size of PICs can be a source of confusion. All
PICs handle (and address) data in 8-bit chunks, so they should be called 8-
bit microcontrollers. However, the unit of addressability of the code space is
not generally the same as the data space. For example, PICs in the baseline
and mid-range families have program memory addressable in the same
word size as the instruction width, ie. 12 or 14 bits respectively. In contrast,
in the PIC18 series, the program memory is addressed in 8-bit increments
(bytes), which differs from the instruction width of 16 bits.
In order to be clear, the program memory capacity is usually stated in
number of (single word) instructions, rather than in bytes.
4
6. Stacks-PICs have a hardware call stack, which is used to save return
addresses. The hardware stack is not software accessible on earlier devices,
but this changed with the 18 series devices.
Hardware support for a general purpose parameter stack was lacking in
early series, but this greatly improved in the 18 series, making the 18 series
architecture more friendly to high level language compilers.
7. Instruction set-A PIC's instructions vary from about 35 instructions for
the low-end PICs to over 80 instructions for the high-end PICs. The
instruction set includes instructions to perform a variety of operations on
registers directly, the accumulator and a literal constant or the
accumulator and a register, as well as for conditional execution, and
program branching.

PIC Programming-
During the training module we have use the PIC16F876. It is a product
of microchip cooperation. KIEL is used for programming the 8051, like in
same way microC is a IDE for the code development of PIC microcontroller.

MicroC- mikroC is a powerful, feature rich development tool for PIC micros.
It is designed to provide the programmer with the easiest possible solution
for developing applications for embedded systems, without compromising
performance or control.

mikroC IDE

PIC and C fit together well: PIC is the most popular 8-bit chip in the world,
used in a wide variety of applications, and C, prized for its efficiency, is the
natural choice for developing embedded systems. mikroC provides a
successful match featuring highly advanced IDE, ANSI compliant compiler,
broad set of hardware libraries, comprehensive documentation, and plenty
of ready-to-run examples.
4
Features- mikroC allows you to quickly develop and deploy
complex applications:

• Write your C source code using the built-in Code Editor (Code and
Parameter Assistants, Syntax Highlighting, Auto Correct, Code
Templates, and more…)
• Use the included mikroC libraries to dramatically speed up the
development: data acquisition, memory, displays, conversions,
communications… Practically all P12, P16, and P18 chips are
supported.
• Monitor your program structure, variables, and functions in the Code
Explorer.
• Generate commented, human-readable assembly, and standard HEX
compatible with all programmers.
• Inspect program flow and debug executable logic with the integrated
Debugger.
• Get detailed reports and graphs: RAM and ROM map, code statistics,
assembly listing, calling tree, and more…
• We have provided plenty of examples for you to expand, develop, and
use as building bricks in your projects. Copy them entirely if you deem
fit – that’s why we included them with the compiler.

PCB Designing-

1. Introduction- We have designed our circuit, perhaps even bread


boarded a working prototype, and now it's time to turn it into a nice Printed
Circuit Board (PCB) design. For some designers, the PCB design will be a
natural and easy extension of the design process. But for many others the
process of designing and laying out a PCB can be a very daunting task.
There are even very experienced circuit designers who know very little
about PCB design, and as such leave it up to the "expert" specialist PCB
designers. Many companies even have their own dedicated PCB design
departments. This is not surprising, considering that it often takes a great
deal of knowledge and talent to position hundreds of components and
thousands of tracks into an intricate (some say artistic) design that meets a
whole host of physical and electrical requirements. Proper PCB design is
very often an integral part of a design. In many designs (high speed digital,
low level analog and RF to name a few) the PCB layout may make or break
the operation and electrical performance of the design. It must be
remembered that PCB traces have resistance, inductance, and capacitance,
just like your circuit does. This article is presented to hopefully take some of
the mystery out of PCB design. It gives some advice and “rules of thumb”
on how to design and lay out your PCBs in a professional manner. It is,
however, quite difficult to try and “teach” PCB design. There are many basic
rules and good practices to follow, but apart from that PCB design is a
highly creative and individual process. It is like trying to teach someone how
4
to paint a picture. Everyone will have their own unique style, while some
people may have no creative flair at all! Indeed, many PCB designers like to
think of PCB layouts as works of art, to be admired for their beauty and
elegance. “If it looks good, it’ll work good.” is an old catch phrase.

2. Standards- There are industry standards for almost every aspect of PCB
design. These standards are controlled by the former Institute for
Interconnecting and Packaging Electronic Circuits, who are now known
simply as the IPC (www.ipc.org). There is an IPC standard for every aspect
of PCB design, manufacture, testing, and anything else that you could ever
need.
Local countries also have their own various standards for many aspects of
PCB design and manufacture, but by and large the IPC standards are the
accepted industry standard around the world. Printed Circuit Boards are also
known (some would say, more correctly known) as Printed Wiring Boards, or
simply Printed Boards. But we will settle on the more common term PCB for
this article.

3. The Schematic- Before we even begin to lay out our PCB, you MUST
have a complete and accurate schematic diagram. Many people jump
straight into the PCB design with nothing more than the circuit in their head,
or the schematic drawn on loose post-it notes with no pin numbers and no
order. This just isn’t good enough, if you don’t have an accurate schematic
then your PCB will most likely end up a mess, and take you twice as long as
it should.

4. Working To Grids- The second major rule of PCB design, and the one
most often missed by beginners, is to lay out our board on a fixed grid. This
is called a “snap grid”, as our cursor, components and tracks will “snap”
into fixed grid positions. Not just any size grid minds, but a fairly coarse
one. 100 thou is a standard placement grid for very basic through hole
work, with 50 thou being a standard for general tracking work, like running
tracks between through hole pads. For even finer work we may use a 25
thou snap grid or even lower. Many designers will argue over the merits of a
20 thou grid vs. a 25 thou grid for instance. In practice, 25 thou is often
more useful as it allows you to go exactly half way between 50 thou spaced
pads.

5. Working From The Top- PCB design is always done looking from the
top of our board, looking through the various layers as if they were
transparent. This is how all the PCB packages work. The only time we will
look at our board from the bottom is for manufacturing or checking
purposes. This “through the board” method means that we will have to get
used to reading text on the bottom layers as a mirror image, get used to it.

6. Tracks- There is no recommended standard for track sizes. What size


track we use will depend upon (in order of Importance) the electrical
requirements of the design, the routing space and clearance we have
available, and we own personal preference. Every design will have a
4
different set of electrical requirements which can vary between tracks on
the board. All but basic non-critical designs will require a mixture of track
sizes. As a general rule though, the bigger the track width, the better.
Bigger tracks have lower DC resistance, lower inductance, can be easier and
cheaper for the manufacturer to etch, and are easier to inspect and rework.

7. Vias- Vias connect the tracks from one side of our board to another, by
way of a hole in our board. On all but cheap homemade and low end
commercial prototypes, vias are made with electrically plated holes, called
Plated through Holes (PTH). Plated through holes allow electrical connection
between different layers on your board.

8. Polygons- Polygons are available on many PCB packages. A polygon


automatically fills in (or “floods”) a desired area with copper, which “flows”
around other pads and tracks. They are very useful for laying down ground
planes. Make sure you place polygons after you have placed all of your
tacks and pads.

An example of a “Solid Polygon Fill” (Left), and a “Hatched Polygon Fill”


(Right).

9. Clearances-Electrical clearances are an important requirement for all


boards. Too tight a clearance between tracks and pads may lead to
“hairline” shorts and other etching problems during the manufacturing
process. These can be very hard to fault find once your board is assembled.
Once again, don’t “push the limits” of your manufacturer unless you have
4
to, stay above their recommended minimum spacing if at all possible. At
least 15 thou is a good clearance limit for basic through hole designs, with
10 thou or 8 thou being used for more dense surface mount layouts. If you
go below this, it’s a good idea to consult with your PCB manufacturer first.
For 240V mains on PCB’s there are various legal requirements, and you’ll
need to consult the relevant standards if you are doing this sort of work. As
a rule of thumb, an absolute minimum of 8mm (315 thou) spacing should be
allowed between 240V tracks and isolated signal tracks. Good design
practice would dictate that you would have much larger clearances than
this anyway.
For non-mains voltages, the IPC standard has a set of tables that
define the clearance required for various voltages. A simplified table is
shown here. The clearance will vary depending on whether the tracks are on
an internal layers or the external surface. They also vary with the
operational height of the board above sea level, due to the thinning of the
atmosphere at high altitudes. Conformal coating also improves these figures
for a given clearance, and this is often used on military spec PCBs.

10. Basic Routing- Now it’s time for some basic routing rules. Routing is
also known as “tracking”. Routing is the process of laying down tracks to
connect components on your board. An electrical connection between two
or more pads is known as a “net”.
 Keep nets as short as possible. The longer your total track length, the
greater it’s resistance, Capacitance and Inductance. All of which can
be undesirable factors.
 Tracks should only have angles of 45 degrees. Avoid the use of right
angles, and under no circumstances use an angle greater than 90
degrees. This is important to give a professional and neat appearance
to your board. PCB packages will have a mode to enforce 45 degree
movements, make use of it. There should never be a need to turn it
off. Contrary to popular belief, sharp right angle corners on tracks
don’t produce measurable EMI or other problems. The reasons to
avoid right angles are much simpler - it just doesn’t look good, and it
may have some manufacturing implications.
 Forget nice rounded track corners, they are harder and slower to
place and have no real advantage. Stick to 45 degree increments.
Rounded track bends belong to the pre-CAD taped artwork era.
 “Snake” your tracks around the board, don’t just go “point to point”.
Point to point tracking may look more efficient to a beginner at first,
but there are a few reasons you shouldn’t use it. The first is that it’s
ugly, always an important factor in PCB design! The second is that it is
not very space efficient when you want to run more tracks on other
layers.
 Enable your Electrical grid, which is sometimes referred to as a “snap
to center” or “snap to nearest” option. Let the software find the
centers of pads and ends of tracks automatically for you. This is great
for when you have pads and tracks which aren’t lined up to your
current snap grid. If you don’t have these options enabled then you
may have to keep reducing your snap grid until you find one that fits.
4
Far more trouble than it’s worth. There is almost never a reason to
have these options disabled.
 Always take your track to the center of the pad, don’t make your track
and pad “just touch”. There are few reasons for this. The first is that
it’s sloppy and unprofessional. The second is that your program may
not think that the track is making electrical connection to the pad.
Proper use of a snap grid and electrical grid will avoid problems here.
 Use a single track, not multiple tracks tacked together end to end. It
may make no difference to the look of your final board, but it can be a
pain for future editing. Often you’ll have to extend a track a bit. In this
case it’s best to delete the old one and place a new one. It may take a
few extra seconds, but it’s worth it. People looking at your finished
board may not know, but YOU’LL know! It’s the little touches like this
that set good PCB designers apart.
 Make sure your tracks go right through the exact center of pads and
components, and not off to one side. Use of the correct snap grid will
ensure that you get this right every time. If your track doesn’t go
through the exact center then you are using the wrong snap grid. Why
do you need to do this? It makes your board neater and more
symmetrical, and it gives you the most clearance.
 Only take one track between 100 thou pads unless absolutely
necessary. Only on large and very dense designs should you consider
two tracks between pads. Three tracks between pads is not unheard
of, but we are talking seriously fine tolerances here.
 For high currents, use multiple vias when going between layers. This
will reduce your track impedance and improve the reliability. This is a
general rule whenever you need to decrease the impedance of your
track or power plane.
 Don’t “drag” tracks to angles other than 45 degrees
 “Neck down” between pads where possible. Eg, a 10 thou track
through two 60 thou pads gives a generous 15 thou clearance
between track and pad.
 If your power and ground tracks are deemed to be critical, then lay
them down first. Also, make your power tracks as BIG as possible.

4
An example of GOOD power routing (Left) and BAD power routing
(Right).

An example of GOOD routing (Left) and BAD routing (Right).

11. Finishing Touches- Once we have finished all our routing, our board
isn’t done quite yet. There are a few last minute checks and finishing
touches you should do.
 If we have thin tracks (<25 thou) then it’s nice to add a “chamfer” to
any “T” junctions, thus eliminating any 90 degree angles. This makes
the track more physically robust, and prevents any potential
manufacturing etching problems. But most importantly, it looks nice.
4
 Check that we have any required mounting holes on the board. Keep
mounting holes well clear of any components or tracks. Allow room
for any washers and screws.
 Minimize the number of hole sizes. Extra hole sizes cost you money,
as the manufacturer will charge you based on not only the number of
holes in your boards, but the number of different hole sizes you have.
It takes time for the very high speed drill to spin down, change drill
bits, and then spin up again. Check with your manufacturer for these
costs, but you can’t go wrong by minimizing the number of hole sizes.
 Double check for correct hole sizes on all your components. Nothing is
more annoying than getting your perfectly laid out board back from
the manufacturer, only to find that a component won’t fit in the
holes! This is a very common problem, don’t get caught out.
 Ensure that all our vias are identical, with the same pad and hole
sizes. Remember our pad to hole ratio. Errors here can cause
“breakouts” in our via pad, where the hole, if shifted slightly can be
outside of your pad. With plated through holes this is not always fatal,
but without a complete annular ring around your hole, your via will be
mechanically unreliable.
 Check that there is adequate physical distance between all our
components. Watch out for components with exposed metal that can
make electrical contact with other components, or exposed tracks
and pads.
 Change our display to “draft” mode, which will display all your tracks
and pads as outlines. This will allow us to see your board “warts and
all”, and will show up any tracks that are tacked on or not ending on
pad centers.
 If we wish, add “teardrops” to all your pads and vias. A teardrop is a
nice “smoothing out” of the junction between the track and the pad,
not surprisingly, shaped like a teardrop. This gives a more robust and
reliable track to pad interface, better than the almost right angle
between a standard track and pad. Don’t add teardrops manually
though, it’s a waste of time. But if your program supports automatic
teardrop placement, feel free to use it.

12. Single Sided Design- Single sided design can greatly reduce the cost
of our board. If we can fit our design on a single sided board then it is
preferable to do so. Look inside many of today’s consumer items like TV’s
and DVD players, and we will almost certainly find some single sided
boards. They are still used because they are so cheap to manufacture.
Single sided design however requires some unique techniques which are
aren’t required once we go to doubled sided and multi-layer design. It is
certainly more challenging than a double sided layout. In fact, a single sided
board design will be regarded inversely proportional to the number of
jumper links used. No jumper links earns the admiration of many peers!
It is all about a balance between board size and the number of jumper
links required. Almost every single sided board will require some jumper
links, so it is important to minimize these.
4
Component placement is even more critical on a single sided board, so
this is no time to make all our components nice and neatly aligned. Arrange
your components so that they give the shortest and most efficient tracking
possible. It is like playing a game Chess, if we don’t think many moves
ahead then we will get our self in a corner pretty quickly. Having just one
track running from one side of your board to the other can ruin your whole
layout, as it makes routing any other perpendicular tracks impossible.
Many people will route their board as though it is a double sided board,
but only with straight tracks on the top layer. Then when the board is to be
manufactured, the top layer tracks are replaced with jumper links. This can
be a rather inefficient way to approach single sided design, and is not
recommended. We must be frugal in our placement, and don’t be afraid to
rip everything up and try again if you see a better way to route something.
With experience, we will be able to tell before we even start, if a design if
worth trying to route on a single sided board.

13. Rats Nest-

A Typical “Rats Nest” Display.

Our job of component placement will be made infinitely easier by


having a “rats nest” display enabled. If there is one reason for going to the
trouble of drawing up an accurate schematic and importing a netlist, this is
surely it. For large designs, a rats nest display is essential.
A rats nest display is one where the program will draw a straight line
(not a track) between the pads of components which are connected on the
schematic. In effect, it shows the connectivity of your circuit before we start
laying out tracks. At the start of your board layout, with all your components
placed down randomly, this will appear as a huge and complicated random
maze of lines. Hence the name rats nest.
The rats nest may look very daunting at first, but when we move each
component the lines will automatically move with them. In this way we can
4
see instantly which components are connected to which, without having to
refer back to the schematic and constantly cross reference component
designators. Once we have used this feature once, you won’t want to live
without it. Even when doing simple designs with a few dozen components,
we will miss this functionality.
With the rats nest display enabled, it will be almost possible to lay out
all of our components optimally in no time, without having to lay down one
single track. The rats nest display will effectively show us what our tracks
will connect to. The rats nest lines should disappear when we route your
tracks between components, so our design will get less and less
“complicated looking” as we go along. When all the rats nest lines
disappear, our board is fully routed.

14. PCB Designing Tools- There are many tools available in maket for the
designing of PCB. For example, PCB Express, Orcade, Dip Trace, and many
more. During the training module we have trained on Dip Trace software. It
is good and much easier to work when you are beginner.
First we develop a schematic diagramed of the circuit in schematic
editor.

Schematic Editor- After developing the schematic diagram we use


to convert it into the PCB. For this we go to the “File” in menu bar and
select “Convert to PCB”. Now a new window appears known as PCB
Editor.

Schematic Editor Window


4
PCB Editor- As soon the new window opens you can see that Rats
net will

PCB Editor Window.

be appear in front of us. Now the new task of placing the components and
to arrange the component in systematically arranged manner, in order to
get good PCB. The picture in next page will show how it appears.

Now after completion of placement, tracking and routing the PCB appears
as.

4
FINAL PCB LAYOUT.

Das könnte Ihnen auch gefallen