Hardware Requirements
Hardware Requirements
Hardware Requirements
HARDWARE REQUIREMENTS
1. Microcontroller PIC16F877A
2. RFID Transponder
3. Power Supply
4. USART
5. LCD
6.1.5. ARCHITECTURE:
6.1.6.
PIN DESCRIPTION:
OSC1/CLKI:
Oscillator crystal or external clock input. Oscillator crystal input or external clock source
input. ST buffer when configured in RC mode; otherwise CMOS. External clock source input.
Always associated with pin function OSC1 (see OSC1/CLKI, OSC2/CLKO pins).
OSC2/CLKO:
Oscillator crystal or clock output. Oscillator crystal output. Connects to The crystal or
resonator in Crystal Oscillator mode. In RC mode, OSC2 pin outputs CLKO, which has 1/4 the
frequency of OSC1 and denotes the instruction cycle rate.
MCLR/VPP:
Master Clear (input) or programming voltage (output). Master Clear (Reset) input. This
pin is an active low Reset to the device. Programming voltage input.
RA0/AN0.
RA1/AN1.
RA2/AN2/VREF-/CVREF.
VREFCVREF.
RA3/AN3/VREF+.
VREF+.
RA4/T0CKI/C1OUT.
T0CKI.
C1OUT.
RA5/AN4/SS/C2OUT/SS/C2OUT.
I/O PORTS:
Some pins for these I/O ports are multiplexed with an alternate function for the peripheral
features on the device. In general, when a peripheral is enabled, that pin may not be used as a
general purpose I/O pin.
PORTA AND TRISA REGISTER:
PORTA is a 6-bit wide, bidirectional 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 High – 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.
Pin RA4 is multiplexed with the Timer0 module clock input to become the RA4/T0CKI
pin. The RA4/T0CKI pin is a Schmitt Trigger input and an open-drain output. All other PORTA
pins have TTL input levels and full CMOS output drivers. Other PORTA pins are multiplexed
with analog inputs and the analog VREF input for both the A/D converters and the comparators.
The operation of each pin is selected by clearing/setting the appropriate control bits in the
ADCON1 and/or CMCON registers. The TRISA register controls the direction of the port pins
even when they are being used as analog inputs. The user must ensure the bits in the TRISA
register are maintained set when using them as analog inputs.
Note: On a Power-on Reset, these pins are configured as analog inputs and read as ‘0’. The
comparators are in the off (digital).
PORT B AND TRISB REGISTER:
PORTB is an 8-bit wide, bidirectional 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 High-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). Three pins of PORTB are multiplexed with the In-Circuit Debugger and Low-Voltage
Programming function: RB3/PGM, RB6/PGC and RB7/PGD.
Four of the PORTB pins, RB7:RB4, have an interruption- change feature. Only pins
configured as inputs can cause this interrupt to occur (i.e., any RB7:RB4 pin configured as an
output is excluded from the interruption- change comparison). The input pins (of RB7:RB4) are
compared with the old value latched on the last read of PORTB. The “mismatch” outputs of
RB7:RB4 are OR’ed together to generate the RB port change interrupt with flag bit RBIF
(INTCON<0>).
This interrupt can wake the device from Sleep. The user, in the Interrupt Service
Routine, can clear the interrupt in the following manner:
a) Any read or write of PORTB. This will end the mismatch condition.
b) Clear flag bit RBIF.
A mismatch condition will continue to set flag bit RBIF. Reading PORTB will end
the mismatch condition and allow flag bit RBIF to be cleared. The interrupt-on-change feature is
recommended for wake-up on key depression operation and operations where PORTB is only
used for the interrupt-on-change feature. Polling of PORTB is not recommended while using the
interrupt-on- change feature. This interrupt-on-mismatch feature, together with software
configurable pull-ups on these four pins, allow easy interface to a keypad and make it possible
for wake-up on key depression.
TIMER1 MODULE:
The Timer1 module is a 16-bit timer/counter consisting of two 8-bit registers (TMR1H
and TMR1L) which are readable and writable. The TMR1 register pair (TMR1H:TMR1L)
increments from 0000h to FFFFh and rolls over to 0000h. The TMR1 interrupt, if enabled, is
generated on overflow which is latched in interrupt flag bit, TMR1IF (PIR1<0>). This interrupt
can be enabled/disabled by setting or clearing TMR1 interrupt enable bit, TMR1IE (PIE1<0>).
Timer1 can operate in one of two modes:
• As a Timer
• As a Counter
The operating mode is determined by the clock select bit, TMR1CS (T1CON<1>).
In Timer mode, Timer1 increments every instruction cycle. In Counter mode, it increments on
every rising edge of the external clock input. Timer1 can be enabled/disabled by setting/clearing
control bit, TMR1ON (T1CON<0>).Timer1 also has an internal “Reset input”. This Reset can be
generated by either of the two CCP modules. Shows the Timer1 Control register. When the
Timer1 oscillator is enabled (T1OSCEN is set), the RC1/T1OSI/CCP2 and RC0/T1OSO/T1CKI
pins become inputs. That is, the TRISC<1:0> value is ignored and these pins read as ‘0’.
TIMER2 MODULE:
Timer2 is an 8-bit timer with a prescaler and a postscaler. It can be used as the PWM
time base for the PWM mode of the CCP module(s). The TMR2 register is readable and writable
and is cleared on any device Reset. The input clock (FOSC/4) has a prescale option of 1:1, 1:4 or
1:16, selected by control bits T2CKPS1:T2CKPS0 (T2CON<1:0>). The Timer2 module has an
8-bit period register, PR2. Timer2 increments from 00h until it matches PR2 and then resets to
00h on the next increment cycle. PR2 is a readable and writable register. The PR2 register is
initialized to FFh upon Reset. The match output of TMR2 goes through a 4-bit postscaler (which
gives a 1:1 to 1:16 scaling inclusive) to generate a TMR2 interrupt (latched in flag bit, TMR2IF
(PIR1<1>)). Timer2 can be shut-off by clearing control bit, TMR2ON (T2CON<2>), to
minimize power consumption.
IN-CIRCUIT DEBUGGER:
PIC16F87XA devices have a Watchdog Timer which can be shut-off only through
configuration bits. It runs off its own RC oscillator for added reliability. There are two timers
that offer necessary delays on power-up. One is the Oscillator Start-up Timer (OST), intended to
keep the chip in Reset until the crystal oscillator is stable. The other is the Power-up Timer
(PWRT), which provides a fixed delay of 72 ms (nominal) on power-up only. It is designed to
keep the part
In Reset while the power supply stabilizes. With these two timers on-chip, most applications
need no external Reset circuitry. Sleep mode is designed to offer a very low current power-down
mode. The user can wake-up from Sleep through external Reset, Watchdog Timer wake-up or
through an interrupt. Several oscillator options are also made available to allow the part to fit the
application. The RC oscillator option saves system cost while the LP crystal option saves power.
A set of configuration bits is used to select various options.
6.2 RFID TRANSPONDER
6.2.1 OVERVIEW
Radio-frequency identification (RFID) is an automatic identification method, relying
on storing and remotely retrieving data using devices called RFID tags or transponders. The
technology requires some extent of cooperation of an RFID reader and an RFID tag.
An RFID tag is an object that can be applied to or incorporated into a product, animal, or
person for the purpose of identification and tracking using radio waves. Some tags can be read
from several meters away and beyond the line of sight of the reader.
Most RFID tags contain at least two parts. One is an integrated circuit for storing and
processing information, modulating and demodulating a radio-frequency (RF) signal, and other
specialized functions. The second is an antenna for receiving and transmitting the signal.
There are generally two types of RFID tags:
Active RFID tags, which contain a battery, and
Passive RFID tags, which have no battery.
Future Chip less RFID allows for discrete identification of tags without an integrated circuit,
thereby allowing tags to be printed directly onto assets at a lower cost than traditional tags.
RFID tags come in three general varieties:- passive, active, or semi-passive (also known
as battery-assisted or semi-active) and beacon types. Passive tags require no internal power
source, thus being pure passive devices (they are only active when a reader is nearby to power
them by wireless illumination), whereas semi-passive and active tags require a power source,
usually a small battery. Beacon tags transmit autonomously with a certain blink pattern and do
not respond to interrogation.
6.2.2.1 Passive
Passive RFID tags have no internal power supply. The minute electrical current induced
in the antenna by the incoming radio frequency signal provides just enough power for the CMOS
integrated circuit in the tag to power up and transmit a response. Most passive tags signal by
backscattering the carrier wave from the reader. This means that the antenna has to be designed
both to collect power from the incoming signal and also to transmit the outbound backscatter
signal. The response of a passive RFID tag is not necessarily just an ID number; the tag chip can
contain non-volatile data, possibly writable EEPROM for storing data.
6.2.2.2 Active
Unlike passive RFID tags, active RFID tags have their own internal power source, which
is used to power the integrated circuits and to broadcast the response signal to the reader.
Communications from active tags to readers is typically much more reliable (i.e. fewer errors)
than those from passive tags due to the ability for active tags to conduct a "session" with a
reader.
Active tags, due to their onboard power supply, also may transmit at higher power levels
than passive tags, allowing them to be more robust in "RF challenged" environments with
humidity and spray or with RF-dampening targets (including humans and cattle, which contain
mostly water), reflective targets from metal (shipping containers, vehicles), or at longer
distances. In turn, active tags can be larger (due to battery size) and more expensive to
manufacture (due to price of the battery). However, the potential shelf life of an active tag can be
many years.
Many active tags today have operational ranges of hundreds of meters, and a battery life
from several months to 10 years. Active tags may include larger memories than passive tags, and
may include the ability to store additional information received from the reader.
Special active RFID tags may include specialized sensors. For example, a temperature
sensor can be used to record the temperature profile during the transportation and storage of
perishable goods. Other sensor types used include humidity, shock/vibration, light, nuclear
radiation, pressure and concentrations of gases such as ethylene.
Increasingly, active tags on the market today are internationally standardized according to
the ISO 18000-7 air interface standard, which operates at the 433 MHz frequency. In addition,
active tags that are sold in the form of an electronic seal are standardized according to the ISO
18185 standard.
6.2.2.3 Semi-passive
Semi-passive tags are similar to active tags in that they have their own power source, but
the battery only powers the microchip and does not power the broadcasting of a signal. The
response is usually powered by means of backscattering the RF energy from the reader, where
energy is reflected back to the reader as with passive tags. An additional application for the
battery is to power data storage.
If energy from the reader is collected and stored to emit a response in the future, the tag is
operating active.
Whereas in passive tags the power level to power up the circuitry must be 100 times
stronger than with active or semi-active tags, also the time consumption for collecting the energy
is omitted and the response comes with shorter latency time. The battery-assisted reception
circuitry of semi-passive tags leads to greater sensitivity than passive tags, typically 100 times
more. The enhanced sensitivity can be leveraged as increased range (by one magnitude) and/or
as enhanced read reliability (by reducing bit error rate at least one magnitude).
The enhanced sensitivity of semi-passive tags places higher demands on the reader
concerning separation in denser population of tags. Because an already weak signal is
backscattered to the reader from a larger number of tags and from longer distances, the
separation requires more sophisticated anti-collision concepts, better signal processing and some
more intelligent assessment of which tag might be where. For passive tags, the reader-to-tag link
usually fails first. For semi-passive tags, the reverse (tag-to-reader) link usually collides first.
Semi-passive tags have three main advantages: greater sensitivity than passive tags;
longer battery powered life cycle than active tags; they can perform active functions (such as
temperature logging) under their own power, even when no reader is present for powering the
circuitry.
Most semi-passive tags use the 2.4Ghz frequency which has shown to be less reliable in
"RF challenged" environments where frozen items, dense metal, and other elements that are
hostile to RF are found. This is far less common with fully active tags that broadcast at the 433
Mhz frequency.
Beacon tags blink the coded identity signal at a regular pattern. This may be a constant
blink rate or a blink rate with stochastic shift or some triggered blinking. Not to activate the
responder function in a tag first prevents from limiting the speed capabilities and improves the
availability of the identification information under noisy conditions. Therefore the beacon
concept appliers to very robust processes: The regular availability of the coded signal reduces
latency and allows for low power levels, as with active tags. However, the permanent talk of
many tags may pollute the frequency channel and therefore prevent from operating in denser
populations. The design of the blinking scheme must take the battery life cycle into account.
Currently (2008) none of the offered products follows any known line of international
standardization. However, all blinking must obey the national wireless communications
regulations concerning power level and channel occupation.
The antenna used for an RFID tag is affected by the intended application and the
frequency of operation. Low-frequency is 30–300 kHz. LFID or Low FID passive tags are
normally inductively coupled, and because the voltage induced is proportional to frequency,
many coil turns are needed to produce enough voltage to operate an integrated circuit. Compact
Low FID tags, like glass-encapsulated tags used in animal and human identification, use a
multilayer coil (3 layers of 100–150 turns each) wrapped around a ferrite core.
High frequency is 3-30 MHz At 13.56 MHz, a HFID or High FID tag, using a planar
spiral with 5–7 turns over a credit-card-sized form factor can be used to provide ranges of tens of
centimeters. These coils are less costly to produce than LF coils, since they can be made using
lithographic techniques rather than by wire winding, but two metal layers and an insulator layer
are needed to allow for the crossover connection from the outermost layer to the inside of the
spiral where the integrated circuit and resonance capacitor are located.
Ultrahigh-frequency or UHF is 300 MHz-3 GHz. UHFID and microwave passive tags are
usually radiatively-coupled to the reader antenna and can employ conventional dipole-like
antennas. Only one metal layer is required, reducing cost of manufacturing. Dipole antennas,
however, are a poor match to the high and slightly capacitive input impedance of a typical
integrated circuit. Folded dipoles, or short loops acting as inductive matching structures, are
often employed to improve power delivery to the IC. Half-wave dipoles (16 cm at 900 MHz) are
too big for many applications; for example, tags embedded in labels must be less than 10 cm (4
inches) in extent. To reduce the length of the antenna, antennas can be bent or meandered, and
capacitive tip-loading or bowtie-like broadband structures are also used. Compact antennas
usually have gain less than that of a dipole — that is, less than 2 dBi — and can be regarded as
isotropic in the plane perpendicular to their axis.
Dipoles couple to radiation polarized along their axes, so the visibility of a tag with a
simple dipole-like antenna is orientation-dependent. Tags with two orthogonal or nearly-
orthogonal antennas, often known as dual-dipole tags, are much less dependent on orientation
and polarization of the reader antenna, but are larger and more expensive than single-dipole tags.
Patch antennas are used to provide service in close proximity to metal surfaces, but a
structure with good bandwidth is 3–6 mm thick, and the need to provide a ground layer and
ground connection increases cost relative to simpler single-layer structures.
HFID and UHFID tag antennas are usually fabricated from copper or aluminum.
Conductive inks have seen some use in tag antennas but have encountered problems with IC
adhesion and environmental stability.
There are three different kinds of RFID tags based on their attachment with identified
objects, i.e. attachable, implantable and insertion tags [10]. In addition to these conventional
RFID tags, Eastman Kodak Company has filed two patent applications for monitoring ingestion
of medicine based on a digestible RFID tag.
To communicate, tags respond to queries generating signals that must not create
interference with the readers, as arriving signals can be very weak and must be differentiated.
Besides backscattering, load modulation techniques can be used to manipulate the reader's field.
Typically, backscatter is used in the far field, whereas load modulation applies in the near field,
within a few wavelengths from the reader.
Step down transformers can step down incoming voltage, which enables you to have the correct
voltage input for your electrical needs. For example, if our equipment has been specified for input
voltage of 12 volts, and the main power supply is 230 volts, we will need a step down transformer,
which decreases the incoming electrical voltage to be compatible with your 12 volt equipment.
A full-wave rectifier converts the whole of the input waveform to one of constant polarity
(positive or negative) at its output. Full-wave rectification converts both polarities of the input
waveform to DC (direct current), and is more efficient. However, in a circuit with a non-center
tapped transformer, four diodes are required instead of the one needed for half-wave rectification.
A full-wave rectifier uses a diode bridge, made of four diodes, like this:
At first, this may look just as confusing as the one-way streets of Boston. The thing to realize is
that the diodes work in pairs. As the voltage of the signal flips back and forth, the diodes shepard
the current to always flow in the same direction for the output.
Here's what the circuit looks like to the signal as it alternates:
So, if we feed our AC signal into a full wave rectifier, we'll see both halves of the wave above 0
Volts. Since the signal passes through two diodes, the voltage out will be lower by two diode drops, or
1.2 Volts.
AC wave input
A bridge rectifier makes use of four diodes in a bridge arrangement to achieve full-wave
rectification. This is a widely used configuration, both with individual diodes wired as shown and
with single component bridges where the diode bridge is wired internally.
A diode bridge or bridge rectifier is an arrangement of four diodes in a bridge configuration that
provides the same polarity of output voltage for either polarity of input voltage. When used in its
most common application, for conversion of alternating current (AC) input into direct current (DC)
output, it is known as a bridge rectifier. A bridge rectifier provides full-wave rectification from a two-
wire AC input, resulting in lower cost and weight as compared to a center-tapped transformer design.
The Forward Bias is achieved by connecting the diode’s positive with positive of the
battery and negative with battery’s negative. The efficient circuit used is the Full wave Bridge
rectifier circuit. The output voltage of the rectifier is in rippled form, the ripples from the obtained
DC voltage are removed using other circuits available. The circuit used for removing the ripples is
called Filter circuit.
One way to understand this circuit is to focus on the time the capacitor takes to charge. It
takes time to charge or discharge the capacitor through that resistor:
At low frequencies, there is plenty of time for the capacitor to charge up to practically
the same voltage as the input voltage.
At high frequencies, the capacitor only has time to charge up a small amount before
the input switches direction. The output goes up and down only a small fraction of the amount the
input goes up and down. At double the frequency, there's only time for it to charge up half the
amount.
Another way to understand this circuit is with the idea of reactance at a particular frequency:
Since DC cannot flow through the capacitor, DC input must "flow out" the path
marked Vout (analogous to removing the capacitor).
Since AC flows very well through the capacitor — almost as well as it flows through
solid wire — AC input "flows out" through the capacitor, effectively short circuiting to ground
(analogous to replacing the capacitor with just a wire).
It should be noted that the capacitor is not an "on/off" object (like the block or pass fluidic
explanation above). The capacitor will variably act between these two extremes. It is the Bode plot
and frequency response that show this variability.
The basic quantities which describe this circuit are similar to those used for the Low Pass
Filter. In effect, this circuit is just a simple low-pass filter with the components swapped over.
The action of the circuit can also be described in terms of a related quantity, the Turn over
Frequency, f0, which has a value
As with the low-pass filter, the circuit's behavior we can be understood as arising due to the
time taken to change the capacitor's charge when we alter the applied input voltage. It always takes a
finite (i.e. non-zero) time to change the amount of charge stored by the capacitor. Hence it takes time
to change the potential difference across the capacitor. As a result, any sudden change in the input
voltage produces a similar sudden change on the other side of the capacitor. This produces a voltage
across the resistor and causes a current to flow thorough it, charging the capacitor until all the voltage
falls across it instead of the resistor. The result is that steady (or slowly varying) voltages appear
mostly across the capacitor and quick changes appear mostly across the resistor. Since we're using the
voltage across the resistor as out output the main properties of the circuit are
therefore
Try using the above experimental system to collect results and plot a graph of how the voltage
gain, Av, (and the phase change) depend upon the input frequency and if we check result agrees with
the above formulae. Compare this with a low-pass filter that uses the same component values and you
should see that they give 'opposite' results. In the high-pass filter, the output waveform 'leads' the
input waveform - i.e. it peaks before the input.
7805 Regulator
Regulator regulates the output voltage to be always constant. The output voltage is maintained
irrespective of the fluctuations in the input AC voltage. As and then the AC voltage changes, the DC
voltage also changes. Thus to avoid this Regulators are used. Also when the internal resistance of the
power supply is greater than 30 ohms, the output gets affected. Thus this can be successfully reduced
here. The regulators are mainly classified for low voltage and for high voltage. Further they can also
be classified as:
i) Positive regulator
1---> input pin
2---> ground pin
3---> output pin
It regulates the positive voltage.
ii) Negative regulator
1---> ground pin
2---> input pin
3---> output pin
It regulates the negative voltage.
6.3.5.1 FIXED REGULATORS
An assortment of 78xx series ICs
"Fixed" three-terminal linear regulators are commonly available to generate fixed voltages of plus 3
V, and plus or minus 5 V, 9 V, 12 V, or 15 V when the load is less than about 7 amperes.
The 7805 provides circuit designers with an easy way to regulate DC voltages to 5v.
Encapsulated in a single chip/package (IC), the 7805 is a positive voltage DC regulator that has only
3 terminals. They are: Input voltage, Ground, Output Voltage.
General Features:
Output Current up to 1A
Output Voltages of 5, 6, 8, 9, 10, 12, 15, 18, 24V
Thermal Overload Protection
Short Circuit Protection
Output Transistor Safe Operating Area Protection
The 7812 fixed voltage regulator is a monolithic integrated circuit in a TO220 type package
designed for use in a wide variety of applications including local, onboard regulation. This regulator
employs internal current limiting, thermal shutdown, and safe area compensation.
With adequate heat-sinking it can deliver output currents in excess of 1.0 ampere. Although
designed primarily as a fixed voltage regulator, this device can be used with external components to
obtain adjustable voltages and currents.
Ei = 1/2*(L*Ii^2 + C*Vi^2)
Ef = 1/2*(L*If^2 = C*Vf^2)
The two energies are equal when the load is removed, since the load is no longer taking
energy from the system. Equating the two energies, substituting zero current for the final inductor
current, then the solution for the final voltage Vf is:
Vf = (Vi^2 + (Ii*Zo)^2)^1/2
This is the orthogonal vector sum of the output voltage and the load current times the
characteristic impedance and is illustrated in Figure 1.
The problem becomes worse if the current in the inductor is established by a short circuit on
the output and the short circuit clears. In this case, the initial voltage is zero (short circuit) and the
overshoot is I*Zo, where I can be very large, resulting in a ruinous overshoot.
6.4. USART
6.4.1 SERIAL COMMUNICATION
A serial port sends and receives data one bit at a time over one wire. While it takes eight
times as long as to transfer each byte of data this way, only a few wires are required. In fact, two-
way (full duplex) communications is possible with only three separate wires- one to send, one to
receive, and a common signal ground wire.
Bi-directional communications
Communicating by wires
The Parity Bit
Cable lengths
MAX-232C
DCE And DTE devices
Synchronous and Asynchronous Communications
>Bi-directional Communications
The serial port on your PC is a full-duplex device meaning that it can send and receive
data at the same time. In order to be able to do this, it uses separate lines for transmitting and
receiving data. Some types of serial devices support only one-way communications and therefore
use only two-wires in the cable – the transmit line and the signal ground.
>Communicating by bits
Once the start bit has been sent, the transmitter sends the actual data bits. There may
either be 5,6,7, or 8 data bits, depending on the number you have selected. Both receiver and the
transmitter must agree on the number of data bits, as well as the baud rate. Almost all devices
transmit data using either 7 or 8 data bits. Notice that when only 7 data bits are employed, you
cannot send ASCII values greater than 127. Likewise, using 5 bits limits the highest possible
value to 31. After the data has been transmitted, a stop bit is sent. A stop bit has a value of 1- or a
mark state- and it can be detected correctly even if the previous data bit also had a value of 1.
This is accomplished by the stop bit’s duration.
>The Parity Bit
Besides the synchronization provided by the use of start and stop bits, an additional bit
called a parity bit may optionally be transmitted along with the data. A parity bit affords a small
amount of error checking, to help detect data corruption that might occur during transmission.
>Cable Lengths
The MAX-232 standard imposes a cable length limit of 50 feet. You can usually ignore
this “standard”, since a cable can be as long as 10000 feet at baud rates up to 19200 if you use a
high quality, well shielded cable. The external environment has a large effect on lengths for
unshielded cables.
>MAX232 (Voltage Converter)
Since the RS232 is not compatible with todays microprocessors and micro controller, we
need line driver to convert the RS232 signals to TTL voltage levels that will be acceptable to the
8051’s TXD and RXD pins. One example of such a converter is MAX 232 from maxim corp.
The MAX 232 converts from RS232 voltage levels to TTL voltage levels, and vice versa. One
advantage of MAX232 chip is that it uses a +5V power source, which is the same as the source
voltage for the PIC 16f877A micro controller. In other words, with a single +5v power supply
we can power both the PIC and MAX 232, with no need of for the dual power supplies that are
common in many older systems. The MAX 232 requires four capacitors ranging from 1 to 22
microfarad. The most widely used value for this capacitor is 22microfarad.
PIN DIAGRAM OF MAX232:
More microcontroller devices are using 'smart LCD' displays to output visual
information. The following discussion covers the connection of a Hitachi LCD display to a PIC
microcontroller. LCD displays designed around Hitachi's LCD HD44780 module, are
inexpensive, easy to use, and it is even possible to produce a readout using the 8 x 80 pixels of
the display. Hitachi LCD displays have a standard ASCII set of characters plus Japanese, Greek
and mathematical symbols.
For an 8-bit data bus, the display requires a +5V supply plus 11 I/O lines. For a 4-bit data
bus it only requires the supply lines plus seven extra lines. When the LCD display is not enabled,
data lines are tri-state which means they are in a state of high impedance (as though they are
disconnected) and this means they do not interfere with the operation of the microcontroller
when the display is not being addressed.
RS 0 Instruction
1 Character
Before we access DD RAM after defining a special character, the program must set the
DD RAM address. Writing and reading data from any LCD memory is done from the last
address which was set up using set-address instruction. Once the address of DD RAM is set, a
new written character will be displayed at the appropriate place on the screen. Until now we
discussed the operation of writing and reading to an LCD as if it were an ordinary memory. But
this is not so. The LCD controller needs 40 to 120 microseconds (uS) for writing and reading.
Other operations can take up to 5 mS. During that time, the microcontroller can not access the
LCD, so a program needs to know when the LCD is busy. We can solve this in two ways.
One way is to check the BUSY bit found on data line D7. This is not the best method
because LCD's can get stuck, and program will then stay forever in a loop checking the BUSY
bit. The other way is to introduce a delay in the program. The delay has to be long enough for the
LCD to finish the operation in process.
At the beginning we mentioned that we needed 11 I/O lines to communicate with an LCD.
However, we can communicate with an LCD through a 4-bit data bus. Thus we can reduce the
total number of communication lines to seven. The wiring for connection via a 4-bit data bus is
shown in the diagram below. In this example we use an LCD display with 2x16 characters,
labeled LM16X212 by Japanese maker SHARP. The message 'character' is written in the first
row: and two special characters '~' and '}' are displayed. In the second row we have produced the
word 'mikroElektronika'.
7. SOFTWARE REQUIREMENT
7.1 SOFTWARE TOOLS
MPLAB
Protel
Propic
HI-Tech PIC C Compiler
7.2 MPLAB INTEGRATION
MPLAB Integrated Development Environment (IDE) is a free, integrated toolset for the
development of embedded applications employing Microchip's PIC micro and dsPIC
microcontrollers. MPLAB IDE runs as a 32-bit application on MS Windows, is easy to use and
includes a host of free software components for fast application development and super-charged
debugging. MPLAB IDE also serves as a single, unified graphical user interface for additional
Microchip and third party software and hardware development tools. Moving between tools is a
snap, and upgrading from the free simulator to MPLAB ICD 2 or the MPLAB ICE emulator is
done in a flash because MPLAB IDE has the same user interface for all tools.
Choose MPLAB C18, the highly optimized compiler for the PIC18 series
microcontrollers, or try the newest Microchip's language tools compiler, MPLAB C30, targeted
at the high performance PIC24 and dsPIC digital signal controllers. Or, use one of the many
products from third party language tools vendors. They integrate into MPLAB IDE to function
transparently from the MPLAB project manager, editor and compiler.
7.3 INTRODUCTION TO EMBEDDED ‘C’:
Ex: Hitec – c, Keil – c
HI-TECH Software makes industrial-strength software development tools and C
compilers that help software developers write compact, efficient embedded processor code.
For over two decades HI-TECH Software has delivered the industry's most reliable
embedded software development tools and compilers for writing efficient and compact code to
run on the most popular embedded processors. Used by tens of thousands of customers including
General Motors, Whirlpool, Qualcomm, John Deere and many others, HI-TECH's reliable
development tools and C compilers, combined with world-class support have helped serious
embedded software programmers to create hundreds of breakthrough new solutions.
Whichever embedded processor family you are targeting with your software, whether it is
the ARM, PICC or 8051 series, HI-TECH tools and C compilers can help you write better code
and bring it to market faster.
HI-TECH PICC is a high-performance C compiler for the Microchip PIC micro
10/12/14/16/17 series of microcontrollers. HI-TECH PICC is an industrial-strength ANSI C
compiler - not a subset implementation like some other PIC compilers. The PICC compiler
implements full ISO/ANSI C, with the exception of recursion. All data types are supported
including 24 and 32 bit IEEE standard floating point. HI-TECH PICC makes full use of specific
PIC features and using an intelligent optimizer, can generate high-quality code easily rivaling
hand-written assembler. Automatic handling of page and bank selection frees the programmer
from the trivial details of assembler code.
7.4 EMBEDDED “C” COMPILER
ANSI C - full featured and portable
Reliable - mature, field-proven technology
Multiple C optimization levels
An optimizing assembler
Full linker, with overlaying of local variables to minimize RAM usage
Comprehensive C library with all source code provided
Includes support for 24-bit and 32-bit IEEE floating point and 32-bit long data types
Mixed C and assembler programming
Unlimited number of source files
Listings showing generated assembler
Compatible - integrates into the MPLAB IDE, MPLAB ICD and most 3rd-party
development tools
Runs on multiple platforms: Windows, Linux, UNIX, Mac OS X, Solaris
7.5 EMBEDDED DEVELOPMENT ENVIRONMENT
This environment allows you to manage all of your PIC projects. You can compile,
assemble and link your embedded application with a single step.
Optionally, the compiler may be run directly from the command line, allowing you to
compile, assemble and link using one command. This enables the compiler to be integrated into
third party development environments, such as Microchip's MPLAB IDE.
The speed, UMPS can run as fast as 1/5 the real microcontroller speed. No need to wait 2
days to see the result of a LCD routine access. All the microcontroller parts are simulated,
interrupts, communication protocol, parallel handshake, timer and so on.
UMPS have an integrated assembler/disassembler and debugger. It is able to accept an
external assembler or compiler. It has a text editor which is not limited to 64K-bytes and shows
keyword with color. It can also communicate with an external compiler to integrate all the debug
facilities you need.
UMPS is universal, it can easily be extended to other microcontroller with a library. Ask
us for toolkit development.
External resource simulation is not limited. It can be extended to your proper needs by
writing your own DLL.
UMPS allows you to evaluate at the lowest cost the possibility to build a microcontroller
project without any cable. - UMPS include a complete documentation on each microcontroller
which describe special registers and each instruction
7.6.6COMPILER
A compiler is a program that reads a program in one language, the source language and
translates into an equivalent program in another language, the target language. The translation
process should also report the presence of errors in the source program.
Source Target
→ Compiler →
Program Program
↓
Error
Messages
There are two parts of compilation. The analysis part breaks up the source program into
constant piece and creates an intermediate representation of the source program. The synthesis
part constructs the desired target program from the intermediate representation.
7.6.7 COUSINS OF THE COMPILER ARE
1. Preprocessor.
2. Assembler.
3. Loader and Link-editor.
A naive approach to that front end might run the phases serially.
1. Lexical analyzer takes the source program as an input and produces a long string of
tokens.
2. Syntax Analyzer takes an out of lexical analyzer and produces a large tree.
Semantic analyzer takes the output of syntax analyzer and produces another tree.
Similarly, intermediate code generator takes a tree as an input produced by semantic analyzer
and produces intermediate code
7.6.8 PHASES OF COMPILER
The compiler has a number of phases plus symbol table manager and an error handler.
Input Source
Program
↓
Lexical
Analyzer
↓
Syntax
Analyzer
↓
Symbol
Semantic Error
Table
Analyzer Handler
Manager
↓
Intermediate
Code
Generator
↓
Code
Optimizer
↓
Code
Generator
↓
Out Target
Program
FABRICATION DETAILS
The fabrication of one demonstration unit is carried out in the following sequence.
Finalizing the total circuit diagram, listing out the components and sources of
procurement.
Procuring the components, testing the components and screening the components.
Making layout, repairing the interconnection diagram as per the circuit diagram.
Assembling the components as per the component layout and circuit diagram and
soldering components.
Integrating the total unit, interwiring the unit and final testing the unit.
7.7 DESIGN OF EMBEDDED SYSTEM
Like every other system development design cycle embedded system too have a design
cycle. The flow of the system will be like as given below. For any design cycle these will be the
implementation steps. From the initial state of the project to the final fabrication the design
considerations will be taken like the software consideration and the hardware components,
sensor, input and output. The electronics usually uses either a microprocessor or a
microcontroller. Some large or old systems use general-purpose mainframe computers or
minicomputers.
7.8 USER INTERFACES
User interfaces for embedded systems vary widely, and thus deserve some special
comment. User interface is the ultimate aim for an embedded module as to the user to check the
output with complete convenience. One standard interface, widely used in embedded systems,
uses two buttons (the absolute minimum) to control a menu system (just to be clear, one button
should be "next menu entry" the other button should be "select this menu entry").
Another basic trick is to minimize and simplify the type of output. Designs sometimes
use a status light for each interface plug, or failure condition, to tell what failed. A cheap
variation is to have two light bars with a printed matrix of errors that they select- the user can
glue on the labels for the language that he speaks. For example, most small computer printers use
lights labeled with stick-on labels that can be printed in any language. In some markets, these are
delivered with several sets of labels, so customers can pick the most comfortable language.
In many organizations, one person approves the user interface. Often this is a
customer, the major distributor or someone directly responsible for selling the system.
7.9 PLATFORM
There are many different CPU architectures used in embedded designs such as ARM,
MIPS, Coldfire/68k, PowerPC, X86, PIC, 8051, Atmel AVR, H8, SH, V850, FR-V, M32R etc.
This in contrast to the desktop computer market, which as of this writing (2003) is limited
to just a few competing architectures, mainly the Intel/AMD x86, and the Apple/Motorola/IBM
PowerPC, used in the Apple Macintosh. With the growing acceptance of Java in this field, there
is a tendency to even further eliminate the dependency on specific CPU/hardware (and OS)
requirements.
Standard PC/104 is a typical base for small, low-volume embedded and ruggedized
system design. These often use DOS, Linux or an embedded real-time operating system such as
QNX or Inferno.
A common configuration for very-high-volume embedded systems is the system on a
chip, an application-specific integrated circuit, for which the CPU was purchased as intellectual
property to add to the IC's design. A related common scheme is to use a field-programmable gate
array, and program it with all the logic, including the CPU. Most modern FPGAs are designed
for this purpose.
7.10 TOOLS
Like typical computer programmers, embedded system designers use compilers,
assemblers, and debuggers to develop embedded system software. However, they also use a few
tools that are unfamiliar to most programmers.
Software tools can come from several sources: