Data

Published on November 2016 | Categories: Documents | Downloads: 50 | Comments: 0 | Views: 346
of 35
Download PDF   Embed   Report

pic microtorrler AF16

Comments

Content


1

CHAPTER-1
ABOUT THE INSTITUTION
1.1 VISION:
With a vision to train and mold the best IT professionals, Netmax Technologies has
established itself as a leading Hardware and Networking training institute. Netmax
Technologies has a strong focus on quality training and has pioneered a unique way to
groom students with its Smart lab Plus training methodology. The programme trains
students in soft skills, presentation skills, fluency in English, personality development
training and even yoga which allows students to develop great focus and
concentration. NetmaxTechnologies‟s students walk out with an extra edge and leave
as industry ready professionals.
1.2 KEY FEATURES:
 Only Institute having a Heritage of 20 year.
 Netmax Technologies Chandigarh is an ISO 9001:2008 Certified Centre.
 Only institute having Placements Record in companies like,Dell ,Wipro
,HCL,HP,Microtek ,Zenith ,IT&T ,IBM ,Novell,& many others.
 Only institute having certified and Experienced Technically strong team of 30
trainers.
 Institute having tie ups with Red Hat, Prometric, Vue, Microsoft Certified
Technical Education Centre &Comptia.
1.3 FUTURE SCOPES WITH NETMAX
TECHNOLOGIES:
Netmax Technologies offers courses geared towards internationally renowned
certifications for Undergraduates, Graduates, Engineers & Diploma holders as well as
working professionals. Their Academic partnerships with leading companies as
2

Microsoft, CompTIA, Linux, Novell and Pearson VUE enabled us to provide the
latest courseware and technologies.
Netmax Technologies Chandigarh makes summer training so simple even a non -
technical student can become a Computer Hardware and Networking Engineer in just
one year.
Design Services (Embedded systems)
a) AVR family
b) PIC16FX family
c) ELECTRONIC SYSTEM DESIGN
Network Training
a) CISCO CCNA, CCNP
b) RED HAT LINUX
c) SUN SOLARIS

Fig.1.3-Logo ofinstitute





3

CHAPTER-2
EMBEDDED SYSTEMS


Fig.2 -Introductory image of embedded systems

Until the late eighties, information processing was associated with large mainframe
computers and huge tape drives. During the nineties, this shifted towards information
processing being associated with personal computers, PCs.The trend towards
miniaturization continues and the majority of information processing devices will be
small portable computers integrated into larger products. Hence, the new trend has
also been called the disappearing computer. However, with this new trend, the
computer will actually not disappear, it will be everywhere. Embedded systems
provide a major part of the necessary technology. Embedded systems are
informationprocessing systems that are embedded into a larger product andare
normally not directly visible to the user. Examples of embedded systems include
information processing systems in telecommunication equipment, in transportation
systems, in fabrication equipment and in consumer electronics.
2.1 COMMON CHARACTERISTICS OF EMBEDDED
SYSTEMS:
Frequently, embedded systems are connected to the physical environment through
sensors collecting information about that environment and act for controlling that
4

environment.Embedded systems have to be dependable. Many embedded systems are
safety-critical and therefore have to be dependable. Nuclear power plants are an
example of extremely safety-critical systems that are at least partially controlled by
software. Dependability is, however, also important in other systems, such as cars,
trains, airplanes etc. A key reason for being safety-critical is that these systems are
directly connected to the environment and have an immediate impact on the
environment. Dependability encompasses the following aspects of a system:
1. Reliability: Reliability is the probability that a system will not fail.
2. Maintainability: Maintainability is the probability that a failing system can be
repaired within a certain time-frame.
3.Availability: Availability is the probability that the system is available. Both the
reliability and the maintainability must be high in order to achieve a high availability.
4.Safety: This term describes the property that a failing system will not cause any
harm.
5.Security: This term describes the property that confidential data remains
confidential and that authentic communication is guaranteed. Embedded systems have
to be efficient.
Many embedded systems must meet real-time constraints. Not completing
computations within a given time-frame can result in a serious loss of the quality
provided by the system (for example, if the audio or video quality is affected) or may
cause harm to the user (for example, if cars, trains or planes do not operate in the
predicted way). Many of today‟s information processing systems are using techniques
for speeding-up information processing on the average. For example, caches improve
the average performance of a system. In other cases, reliable communication is
achieved by repeating certain transmissions. For example, Internet protocols typically
rely on resending messages in case the original messages have been lost.
Typically, embedded systems are reactive systems. They can be defined as follows: A
reactive system is one that is in continual interaction with itsenvironment and
executes at a pace determined by that environment. Real embedded systems are very
complex and hence difficult to teach. Due to this set of common characteristics, it
does make sense to analyze common approaches for designing embedded systems,
instead of looking at the different application areas only in isolation. “Embedded
5

system” is Informationprocessing system meeting most of the characteristics listed
above. Most of the characteristics of embedded systems can also be found in a
recently introduced type of computing: pervasive computing, also called ambient
intelligence.
2.2 APPLICATION AREAS:
Embedded systems have proved changing face of today's industrial scenario.
An embedded system is a system is a special-purpose computer system designed to
perform one or a few dedicated functions often with real-time computing constraints.
It is usually embedded as part of a complete device including hardware and
mechanical parts. In contrast, a general-purpose computer, such as a personal
computer, can do many different tasks depending on programming.
The following list comprises key areas in which embedded systems are used:
 Automotive electronics: Modern cars can be sold only if they contain a significant
amount of electronics. These include air bag control systems, engine control
systems, anti-braking systems (ABS), air-conditioning, GPS systems, safety
features, etc.
 Aircraft electronics: A significant amount of the total value of airplanes is due to
the information processing equipment, including flight control systems, anti-
collision systems, pilot information systems, and others.
 Trains: For trains, the situation is similar to cars and airplanes. Safety features
contribute significantly to the total value of trains, and dependability is extremely
important.
 Telecommunication: Mobile phones have been one of the fastest growing markets
in the recent years. For mobile phones, radio frequency (RF) design, digital signal
processing and low power design are key aspects.
 Medical systems: There is a huge potential for improving the medical service by
taking advantage of information processing taking place within medical
equipment.
 Military applications: Information processing has been used in military equipment
for many years. Some of the very first computers analyzed military radar signals.
6

Consumer electronics: Video and audio equipment is a very important sector of the
electronics industry. The information processing integrated into such equipment is
steadily growing. New services and better quality are implemented using advanced
digital signal processing techniques. Many TV sets, multimedia phones, and game
consoles comprise high performance processors and memory systems. They represent
special cases of embedded systems.
Embedded systems control many of the common devices in use today. Fuelling in
unbridled power into industrial computers to tackle the most complex applications,
they have made quite an impression with a lot of the leading industrial sectors.
Backed with the most durable components and peripherals sticking to the highest
quality standards, the next generation embedded computers have what it to endure
highly trying and harsh work environments. Multifunctional ability is the highlight of
these systems even as they comprise a uniquely designed combination of software and
hardware to perform highly challenging tasks that are a far cry for the common
personal computers. This combination happens to be a programmed platform that is
assigned with specific applications for the task and goes through various tests to make
sure the systems offer long-life performance.
2.3 EXAMPLES OF EMBEDDED SYSTEMS:
 Automated tiller machines (ATMS).
 Cellular telephones and telephonic switches.
 Computer network equipment, including routers timeservers and firewalls.
 Computer printers, Copiers.
 Disk drives (floppy disk drive and hard disk drive).
 Engine controllers and antilock brake controllers for automobiles.
 Home automation products like thermostat, air conditioners sprinkles and
 security monitoring system.
 House hold appliances including microwave ovens, washing machines, TV sets
DVD players/recorders.
 Medical equipment.
 Measurement equipment such as digital storage oscilloscopes, logic analyzers and
spectrum analyzers.
7

 Multimedia appliances: internet radio receivers, TV set top boxes.
 Stationary video game controllers.
2.4 MICROPROCESSORS (MPU):
A microprocessor is a general-purpose digital computer central processing unit
(CPU). Although popularly known as a “computer on a chip” is in no sense a
complete digital computer. The block diagram of a microprocessor CPU is shown,
which contains an arithmetic and logical unit (ALU), a program counter (PC), a
stack pointer (SP),some working registers, a clock timing circuit, and interrupt
circuits.

Fig.2.4-BLOCK DIAGRAM OF A MICROPROCESSOR
2.5 MICROCONTROLLERS (MCU):
Figure2.5 shows the block diagram of a typical microcontroller, which is a true
computer on a chip. The design incorporates all of the features found in micro-
processor CPU, ALU, PC, SP, and registers. It also added the other features needed to
make a complete computer: ROM, RAM, parallel I/O,serial I/O, counters, and clock
circuit.

CPU
RAM ROM I/O
Port

Timer
Serial
COM
Port
Data Bus
8


Fig.2.5-Block diagram of microcontroller
2.5.1COMPARISON BETWEEN MICROPROCESSORS AND
MICROCONTROLLERS:
The microprocessor must have many additional parts to be operational as a computer
whereas microcontroller requires no additional external digital parts.
The prime use of microprocessor is to read data, perform extensive calculations on
that data and store them in the mass storage device or display it. The prime functions
of microcontroller is to read data, perform limited calculations on it, control its
environment based on these data. Thus the microprocessor is said to be general-
purpose digital computers whereas the microcontroller are intend to be special
purpose digital controller.
Microprocessor is concerned with the rapid movement of the code and data from the
external addresses to the chip, microcontroller is concerned with the rapid movement
of the bits within the chip.
2.6 MICROCONTROLLER PIC16F73:
PICs are popular with 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.
RAM ROM
I/O Port Timer
Serial
COM
Port
CPU
A single chip
9


Fig.2.6-Microcontroller PIC16F73
2.6.1SPECIAL MICROCONTROLLER FEATURES:
• High performance RISC CPU.
• Only 35 single word instructions to learn.
• All single cycle instructions except for program branches which are two-cycle.
• Operating speed: DC - 20 MHz clock input DC - 200 ns instruction cycle.
• Up to 8K x 14 words of FLASH Program Memory, Up to 368 x 8 bytes of
Data Memory (RAM).
• Interrupt capability (up to 12 sources).
• Eight level deep hardware stack.
• Direct, Indirect and Relative Addressing modes.
• Processor read access to program memory.
• Power-on Reset (POR).
• Power-up Timer (PWRT) and Oscillator Start-up Timer (OST).
• Power saving SLEEP mode
• Selectable oscillator options
• In-
2.6.2 PERIPHERAL FEATURES
• Timer0: 8-bit timer/counter with 8-bit prescaler.
10

• Timer1: 16-bit timer/counter with prescaler, can be incremented during
SLEEP via external crystal/clock.
• Timer2: 8-bit timer/counter with 8-bit period register, prescaler and postscaler.
• Two Capture, Compare, PWM modules
• Capture is 16-bit, max. resolution is 12.5 ns
• Compare is 16-bit, max. resolution is 200 ns
• PWM max. resolution is 10-bit.
• 8-bit, up to 8-channel Analog-to-Digital converter.
• Synchronous Serial Port (SSP) with SPI (Master mode) and I2C(Slave).
2.6.3 CMOS TECHONOLOGY:
• Low power, high speed CMOS FLASH technology.
• Fully static design.
• Wide operating voltage range: 2.0V to 5.5V.
• High Sink/Source Current: 25 Ma.
• Industrial temperature range.
• Low power consumption.
2.7 PIN DESCRIPTION:
 MCLR-(pin 1):
PIC16F7X devices have a noise filter in the MCLR Reset path. The filter will
detect and ignore small pulses. It should be noted that a WDT Reset does not drive
MCLR pin low. The behavior of the ESD protection on the MCLR pin has been
altered from previous devices of this family. Voltages applied to the pin that
exceed its specification can result in both MCLR Resets and excessive current
beyond the device specification during the ESD event. For this reason, Microchip
recommends that the MCLR pin no longer be tied directly to VDD.


11

Fig.2.7-
Pin Diagram Of PIC16F73
 RESET:
The PIC16F73 differentiates between various kinds of RESET:
• Power-on Reset (POR)
• MCLR Reset during normal operation
12

• MCLR Reset during SLEEP
• WDT Reset (during normal operation)
• WDT Wake-up (during SLEEP)
• Brown-out Reset (BOR)
Some registers are not affected in any RESET condition. Their status is unknown
on POR and unchanged n any other RESET. Most other registers are reset to a
RESET state” on Power-on Reset (POR), on the MCLR and WDT Reset, on
MCLR Reset during LEEP, and Brown-out Reset (BOR). They are not affected by
a WDT Wake-up, which is viewed as the resumption of normal operation. The TO
and PD bits are set or cleared differently in different RESET situations, as
indicated.
 PORTA –(pin 2 to 7)and the TRISA Register:
PORTA is a 6-bit wide, bi-directional port. The corresponding data direction
register is TRISA. Setting a TRISA bit (= „1‟) will make the corresponding
PORTA pin an input (i.e., put the corresponding output driver in a Hi-Impedance
mode). Clearing a TRISA bit (= „0‟) will make the corresponding PORTA pin an
output (i.e., put the contents of the output latch on the selected pin).Reading the
PORTA register reads the status of the pins, whereas writing to it will write to the
port latch. All write operations are read-modify-write operations. Therefore, a
write to a port implies that the port pins are read, the value is modified and then
written to the port data latch.
 GND –(pin 8):
Provide Ground to it.
 OSC1/CLKIN-(pin 9):
Oscillator crystal input/external clock source input
 OSC2/CLKOUT-(pin 10):
Oscillator crystal output. Connects to crystal or resonator in Crystal Oscillator
mode. In RC mode, the OSC2 pin outputs CLKOUT which has 1/4 the frequency
of OSC1, and denotes the instruction cycle rate.
13

OSCILLATOR TYPES
The PIC16F7X can be operated in four different oscillator modes:
• LP Low Power Crystal
• XT Crystal/Resonator
• HS High Speed Crystal/Resonator
• RC Resistor/Capacitor
• PORTC and the TRISC Register(pin 11 to 18):
PORTC is an 8-bit wide, bi-directional port. The corresponding data direction
register is TRISC. Setting a TRISC bit (= „1‟) will make the corresponding
PORTC pin an input (i.e., put the corresponding output driver in a Hi-Impedance
mode). Clearing a TRISC bit (= „0‟) will make the corresponding PORTC pin an
output (i.e., put the contents of the output latch on the selected pin).
PORTC is multiplexed with several peripheral functions PORTC pins have
Schmitt Trigger input buffers. When enabling peripheral functions, care should be
taken in defining TRIS bits for each PORTC pin.
 Vss(pin 19):
Ground reference for logic and I/O pins.
 Vdd(pin 20):
Positive supply for logic and I/O pins.
 PORTB and the TRISB Register(pin 21 to 28):
PORTB is an 8-bit wide, bi-directional port. The corresponding data direction
register is TRISB. Setting a TRISB bit (= „1‟) will make the corresponding
PORTB pin an input (i.e., put the corresponding output driver in a Hi-
Impedance mode). Clearing a TRISB bit (= „0‟) will make the corresponding
PORTB pin an output (i.e., put the contents of the output latch on the selected
pin).Each of the PORTB pins has a weak internal pull-up. A single control bit
can turn on all the pull-ups. The weak pull-up is automatically turned off when
the port pin is configured as an output. The pull-ups are disabled on a Power-on
Reset.

14

2.8 CORE ARCHITECTURE:

Fig.2.8-Internal 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, 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
15

 The program counter is also mapped into the data space and writable (this is used
to implement indirect jumps).
Unlike most other CPUs, there is no distinction between memory space and register
space because the RAM serves the job of both memory and registers, and the RAM is
usually just referred to as the register file or simply as the registers.




16



17

CHAPTER-3
PCB DESIGNING
PCB stands for “PRINTED CIRCUIT BOARD”. Printed circuit board (PCB)
provides both the physical structure for mounting and holding the components as well
as the electrical interconnection between the components. That means a PCB = PWB
(printed wiring board) is the platform upon which electronic components such as
integrated circuit chips and other components are mounted. A PCB consists of a non-
conducting substrate (typically fiber glass with epoxy as resin) upon which the
conductive pattern or circuitry is formed. Copper is the most prevalent conductor
although nickel, silver and tin are also used in some cases.
3.1 Types of PCB:
PCB may be of different types:-
1) Single-sided
2) Double-sided
3) Multilayer
Single sided PCBs: - As the name suggest in these designs the conductive pattern is
only at in one side. And also the size is large in these case but these are cheap.
Double sided PCBs: - These are the PCBs on which the conductive pattern is in on
both sides. The size of board is small in this case but it is costlier than that of above.
Multilayer PCBs: - In this case the board consists of alternating layers of conducting
pattern and insulating material. The conductive material is connected across the layers
through plated through holes. The size of this PCB is smaller than that of double sided
PCB but it is very costly.
PCBs may also be either rigid, flexible, or the combination of two (rigid-flex). When
the electronic components have been mounted on the PCB, the combination of PCB
and components is an electronic assembly, also called PRINTED CIRCUIT
ASSEMBLY. This assembly is the basic building block for all the electronic
appliances such as television, computer and other goods.
18

3.2 TECHNIQUES USED FOR PCB DESIGN:
There mainly two techniques which are use for the PCB designs.
1. Hand Taping
2. Computer Aided Design

3.2.1 PCBs using Hand Taping:
PCB design using hand PCB stands for “PRINTED CIRCUIT BOARD”. Printed
circuit board (PCB) provides both the physical structure for mounting and holding the
components as well as the electrical interconnection between the components. That
means a PCB = PWB (printed wiring board) is the platform upon which electronic
components such as integrated circuit chips and other components are mounted. A
PCB consists of a non-conducting substrate (typically fiber glass with epoxy as resin)
upon which the conductive pattern or circuitry is formed. Copper is the most prevalent
conductor although nickel, silver and tin are also used in some cases.
 Taping is the process of technical drawing.
 In hand taping method layout should be prepared on grid paper.
 In hand taping, components pads can be prepared by using black pads.
 Routing of the board can be done by tapes with different widths.Each layer (top,
bottom) has to prepare separately.
3.2.2 DISADVANTAGES OF HAND-TAPING FOR PCB
DESIGNING:
 Each layer has to be designed separately.
 We cannot generate NCD files for CNC drilling.
 Difficult to modify the design in the designing process or after designing.
 Difficult to get good design overview.
3.2.3 PCB DESIGNING USING CAD:
CAD system for PCB designing requires following:
 A computer system.
 PCB design software like OrCad, CADSTAR, Protel, TANGO, Mentor etc.
19

 A photo plotter for art work generation.
There are many enhanced features in electronics design automation tools which not
possible in the hand taping. The main advantages are given below:
 Auto placement
 Auto routing
 After routing, optimization of tracks can be done.
 Provides physical design reuse modules
 Electrical rule check (ERC)
 All the layers are generated from the same design by giving different options.
 Bill of material can be generated which contains number of different components
used.
 We can draw conductors as an arc, semi-circular at different angles.
 Design Rule Check
 Advanced CAD systems have high speed analysis.
 CAD system provides all NCD files and Gerber data files for photo plotting.
3.3 BASIC DESIGN STEPS IN CAD- SYSTEM:
The following design steps are very common while designing a PCB in CAD:
 Entry the schematic diagram.
 Net list file creation.
 Placement of components manually or automatically.
 Routing of the board using manual routing tools or auto router
 Design rule check physical and electrical.
 Artwork generation.
We have used ORCAD10.5 in our Summer Training.






20


CHAPTER-4
PROGRAMMING OF PIC USING MIKROC
4.1 INTRODUCTION TO MIKROC:
MikroC is a powerful, feature rich development tool for PICmicros. It is designed to
provide the programmer with the easiest possible solution for developing applications
for embedded systems, without compromising performance or control.
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.2 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.
21

4.3 PROJECTS:
MikroC organizes applications into projects, consisting of a single project file
(extension .ppc) and one or more source files (extension .c). You can compile source
files only if they are part of a project.
The project file carries the following information:
 project name and optional description,
 target device,
 device flags (config word),
 device clock
4.3.1 New Project:
The easiest way to create project is by means of New Project Wizard, drop-down
menu Project › New Project. Just fill the dialog with desired values (project name and
description, location, device, clock, config word) and mikroC will create the
appropriate project file. Also, an empty source file named after the project will be
created by default. MikroC does not require you to have source file named same as
the project, it‟s just a matter of convenience.
4.3.2Edit Project:
Later, you can change project settings from the drop-down menu Project › Edit
Project. You can rename the project, modify its description, change chip, clock,
config word, etc.
4.3.3 Programming And Interfacing:
Advantages of C over Assembly language programming:
 Knowledge of the processor instruction set is not required.
 Details like register allocation and addressing of memory and data is managed by
the compiler.

22


Fig.4.3-Screenshot Of MikroC
 Programs get a formal structure and can be divided into separate functions.
 Programming and program test time is drastically reduced, this increases
efficiency.
 Keywords and operational functions can be used that come closer to how
humans think.
 The supplied and supported C libraries contain many standard routines such as
numeric conversions.
 Reusable code: Existing program parts can be more easily included into new
programs, because of the comfortable modular program construction techniques.
 The C language based on the ANSI standard is very portable. Existing programs
can be quickly adapted to other processors as needed.
23

4.3.3(a) PROJECT-1:LED INTERFACING AND ITS BLINKING(PORT
PROGRAMMING)
A light-emitting diode (LED) is a semiconductor light source. LEDs are used as
indicator lamps in many devices and are increasingly used for other lighting.
Appearing as practical electronic components in 1962,early LEDs emitted low-
intensity red light, but modern versions are available across the visible, ultraviolet,
and infrared wavelengths, with very high brightness.
When a light-emitting diode is forward-biased (switched on), electrons are able
to recombine with electron holes within the device, releasing energy in the form
of photons. This effect is called electroluminescence and the color of the light
(corresponding to the energy of the photon) is determined by the energy gap of the
semiconductor. An LED is often small in area (less than 1 mm
2
), and integrated
optical components may be used to shape its radiation pattern. LEDs present
many advantages over incandescent light sources including lower energy
consumption, longer lifetime, improved physical robustness, smaller size, and faster
switching. LEDs powerful enough for room lighting are relatively expensive and
require more precise current and heat management than compact fluorescent
lamp sources of comparable output. The first commercial LEDs were commonly used
as replacements for incandescent and neon indicator lamps, and in seven-segment
displays, first in expensive equipment such as laboratory and electronics test
equipment, then later in such appliances as TVs, radios, telephones, calculators, and
even watches.
Also a darling on pair IC is also used i.e. ULN 2803 which shift the dc level of
voltage coming from port of PIC microcontroller.
Now to glow the desired LED, proper hexadecimal code for its binary is programmed
in pic.eg.to glow alternative LED‟s the binary code will be10101010 and its
corresponding hexadecimal code will be 0xAA.
So,0xAA is fed to controller with coding.Also PIC has a internal TRIS register which
controls the flow of instructions from the corresponding port i.ee PORT will behave
as input(if =1) and as output(if=0).
24


Fig.4.3.3(a)-LED Interfacing
For Coding refer to Appendix.
4.3.3(b) PROJECT-2:SEVEN SEGMENT INTERFACING AND DISPLAY
A Seven segment display consists of seven LED‟s arranged in pattern of digit like 8.








Fig.4.3.3(b)-Pin diagram of seven segments displays
We use a bcd to seven segment decoder which saves pin of microcontroller from
seven(one for each Led) to four. So we have to give bcd code for desired digit to be
displayed on it.
25

Now also we can display more than one seven segment display simultaneously. But it
will take a number of pins of controller. So we use two pins from controller to control
the display of seven segment one by one from same port such that it appears to be
displaying simultaneously. This is done by providing a very small delay such that our
eyes can‟t even detect the change over from one display to another.
Seven segments are basically of two types:
 Common Cathode (CC):All the 8 anode legs uses only one cathode, which is
common.
 Common Anode (CA):The common leg for all the cathode is of Anode type. We
are using common anode (CA) 7-segment display.
Table.4.3.3(a)-Truth table of Seven Segment Display


For Coding refer to Appendix.
4.3.3(c) PROJECT-3:INTERFACING AND CONTROL OF STEPPER MOTOR
WITH PIC 16F73
Stepper motors are those which rotate in steps. Like all motors it is also based on
electromagnetic induction i.e. electric field produces a magnetic field whose variation
causes a torque which rotates the motor.

26


Fig.-4.3.3(c)-Stepper Motor
A stepper motor is a brushless, synchronous electric motor that can divide a full
rotation into a large number of steps. The motor's position can be controlled precisely,
without any feedback mechanism (see open loop control). Stepper motors are similar
to switched reluctance motors, which are very large stepping motors with a reduced
pole count, and generally are closed-loop commutated.
Fundamentals of Operation:
Stepper motors operate much differently from normal DC motors, which rotate when
voltage is applied to their terminals. Stepper motors, on the other hand, effectively
have multiple "toothed" electromagnets (a.k.a. phases) arranged around a central gear-
shaped piece of iron. The electromagnets are energized by an external control circuit,
such as a microcontroller. To make the motor shaft turn, first one electromagnet is
given power, this makes the gear‟s teeth magnetically attracted to the electromagnet‟s
teeth. When the gear's teeth are thus aligned to the first electromagnet, they are
slightly offset from the next electromagnet. So when the next electromagnet is turned
on and the first is turned off. The gear rotates slightly to align with the next one, and
from there the process is repeated. Each of those slight rotations is called a "step." In
that way, the motor can be turned a precise angle.
Now to run the motor we have to feed the binary code to turn on the current of that
winding.
For pair 1
st
-00000011(binary)-0x03
For pair 2
nd
-00000110(binary)-0x06
27

For pair 3
rd
-000001100(binary)-0x0c
For pair 4
th
-00011000(binary)-0x09


Fig.4.3.3(d)-Working Of Stepper Motor
For Coding refer to Appendix.
4.3.3(d) PROJECT-4:LCD INTERFACING AND DISPLAY
A liquid crystal display (LCD) is a thin, flat panel used for electronically displaying
information such as text, images, and moving pictures. Its uses include monitors for
computers, televisions, instrument panels, and other devices ranging from aircraft
cockpit displays, to every-day consumer devices such as video players, gaming
devices, clocks, watches, calculators, and telephones. Among its major features are its
lightweight construction, its portability, and its ability to be produced in much larger
screen sizes than are practical for the construction of cathode ray tube (CRT) display
technology. Its low electrical power consumption enables it to be used in battery-
powered electronic equipment. It is an electronically-modulated optical device made
up of any number of pixels filled with liquid crystals and arrayed in front of a light
source (backlight) or reflector to produce images in color or monochrome. The
earliest discoveries leading to the development of LCD technology date from 1888.
28

To run it via PIC 16F73, we need command signals and Vcc to drive it. Now the
signal that is required to display character is produced by an IC which is already
embedded on it. Its name is HD44780.


Fig.4.3.3(e)-LCD


Table.4.3.3(b)-Pin description of LCD


For Coding refer to Appendix.
4.3.3(e) PROJECT-5:TO STUDY SWITCHING ACTION OF PIC PINS
Syntax:
PORT(NAME).F(0 to 7)
Now pin can be put ON or OFF according to via resistor.
29

Internally,when pin is high its flip flop is sat. When external switch is closed,it forces
no current or voltage to enter to pin and also lowers the pin from 1 to 0.Thus when
switch is pressed,the pin becomes zero.

Fig.4.3.3(f)-Interfacing Of Switches
For Coding refer to Appendix.
4.3.3(f)PROJECT-6: SERIAL COMMUNICATION(BETWEEN PC AND
MICROCONTROLLER)
To send data via single line through a bit stream is known as serial communication.
Reception is of type SIPO-Serial Input Parallel Output.
Transmission is of type PISO-Parallel Input Serial Output.
Clock used in serial communication is called BAUD RATE.
30


Fig.4.3.3(g)-Serial Communication Between PC And Microcontroller
PIC has two buffers and it allows full duplex communication to change settings we
have to re configure TXSTA register. The Universal Synchronous Asynchronous
Receiver Transmitter (USART) module is one of the two serial I/O modules. (USART
is also known as a Serial Communications Interface or SCI.) The USART can be
configured as a full duplex asynchronous system that can communicate with
peripheral devices, such as CRT terminals and personal computers, or it can be
configured as a half duplex synchronous system that can communicate with peripheral
devices, such as A/D or D/A integrated circuits, serial EEPROMs, etc.
The USART can be configured in the following modes:
• Asynchronous (full duplex)
• Synchronous - Master (half duplex)
• Synchronous - Slave (half duplex)


31

CHAPTER-5
PIC MICROCONTROLLER CONTROLLED GATE
WITH INFRARED SENSORS AND DC GEARED
SYSTEM
5.1 AIM OF PROJECT:
The aim of the project is to control a DC geared motor with the help of PIC
microcontroller also, we can use IR circuit for the purpose of switching the gate ON
and OFF .

5.2 BLOCK DIAGRAM:


Fig 5.1 Block diagram of gate control system


5.2 BRIEF DESCRIPTION:

IR Transmitter
IR Receiver section
Microcontroller Unit
dc drive h-bridge section
Bluetooth camera unit
32

Dual dc motor chassis with gear
GSM interface with dtmf decoder
Description of some part is given below:


IR Transmitter:
IR Transmitters continuously transmits the infrared rays through a IR LED up to 38
KHz. We will use 555 timer to generate 38 KHz.

IR Receiver:
IR Receiver receive the reflected infrared rays through IR Receiver (HIM702).The
output of IR Receiver is normally high but when it detects the IR rays this output
becomes low or we can say it is active low. The output of IR receiver is connected
with pin of microcontroller. When microcontroller detects this active low signal it
increments or decrements the counter on entry and exit of human being.

Microcontroller Unit
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. Microcontrollers are used in automatically controlled products and devices, such
as automobile engine control systems, remote controls, office machines, appliances,
power tools, and toys. By reducing the size and cost compared to a design that uses a
separate microprocessor, memory, and input/output devices, microcontrollers make it
economical to digitally control even more devices and processes. Mixed signal
microcontrollers are common, integrating analog components needed to control non-
digital electronic systems.
In our system we will use atmel at89s52 microcontroller Uc and it will be
programmed using embedded C.

Dc drive h-bridge section
An H-bridge is an electronic circuit which enables a voltage to be applied across a
load in either direction. These circuits are often used in robotics and other applications
to allow DC motors to run forwards and backwards. H-bridges are available as
integrated circuits, or can be built from discrete components.
33


CODE:-
void main()
{
lcd_init(&portb);
lcd_cmd(lcd_clear);
lcd_cmd(lcd_cursor_off);
trisc=0b00001111;
lcd_out(1,1,"GATE CLOSE");
for(;;)
{
if(portc.f0==0)
{
lcd_out(1,1,"GATE OPEN ");
portc.f6=1;
portc.f7=0;
delay_ms(500);
portc.f6=0;
portc.f7=0;
delay_ms(3000);
lcd_out(1,1,"GATE CLOSE");
portc.f6=0;
portc.f7=1;
delay_ms(500);
}
lcd_out(1,1,"GATE CLOSE");
portc.f6=0;
portc.f7=0;
}
}
34

CHAPTER-6
RESULT
Microcontrollers can be used in various operations and it has its applications with
LED‟s, Seven Segment Display, DC Motor, Stepper Motor and Liquid Crystal
Display.
1.) With using PIC16F73 Microcontroller, we found that results are accurate.
2.) The working principles of PIC16F73 microcontrollers are much more simpler than
microprocessors.
Here in embedded system, the common aims of using microcontrollers are:
1.) Reliability.
2.) Portability.
3.) Maintainability.
4.) Testability.
5.) Reusability.
6.) Extensibility.
7.) Readability.
CONCLUSION:
For using embedded system programming, you have to be much more aware of the
resources used in embedded systems programming than you have to in “ordinary”
programs:
1.) Time.
2.) Space.
3.) Communication channels.
4.) Files.
5.) Flash memory.
6.) ROM (Read-Only Memory)



35

REFRENCES

Websites:
 MikroC Manuals
 http://www.microchip.com/wwwproducts/Devices.aspx?dDocName=en010218
 http://www.alldatasheet.com/datasheet-pdf/pdf/99935/MICROCHIP/PIC16F73-
I/SO.html







Sponsor Documents

Or use your account on DocShare.tips

Hide

Forgot your password?

Or register your new account on DocShare.tips

Hide

Lost your password? Please enter your email address. You will receive a link to create a new password.

Back to log-in

Close