Professional Documents
Culture Documents
Automation of Industries, Automation of home appliances has been rapidly developing these
days. The concept of automation was implemented to the Hospitals also. Automation plays an
important role in monitoring the patient’s status.
Nowadays, the average lifespan has increased, due to the improvement of medical care, resulting
in an increase of the disabled population. Also, due to social development, the number of
disabilities as a result of various diseased or due to accidents is increasing. So the needs for a
rehabilitation system to assist patients in developing their physical, mental, social ability and
independence increased. And it is common that rehabilitation patients’ vital signs are not
monitored during physical therapy in a rehabilitation center.
The purpose of this study is to develop a monitoring system that can monitor heart rates of
rehabilitation patients’ who are taking physical therapy inside a rehabilitation center so that it
gives physical therapist early warning if necessary.
This system transmits the patient's heart rate to the (Central Monitoring System) CMS’s PC
through wireless communication. Therefore, patients are not restricted in their movements
during treatment.
The whole system consists of the patient’s side device (PSD) and central monitoring
system (CMS). The PSD was designed to be wearable and low power consumption. The CMS
was designed to monitor multiple patients simultaneously and generate a warning signal if
necessary. The CMS and PSDs are linked by a wireless network using Control Area Network
(CAN) protocol.
The PSD consists of a contact-type microphone to detect patient's heart sound, a signal
processing hardware for signal conditioning of heart sound and calculating heart rate. The PSB’s
connected using CAN protocol for serial communication uses radio-frequency (RF) transmitter
and receiver module to communicate with the CMS periodically.
A small foot-print microcontroller with a built-in analog-to-digital converter (ADC) and low-
power consumption was incorporated in the PSD. The heart sound signal captured by the
contact-type microphone is filtered by a band pass filter and amplified to the level which
corresponds to a full-scale input voltage range of the ADC built-in a microcontroller. The CMS
was designed to monitor multiple patients simultaneously and generate a warning signal if
necessary.
It consists of an RF transmitter and receiver module to communicate with all PSDs
periodically through serial communication and a Microsoft Windows- based personal computer
(PC). The heart rate information for each patient are collected by an RF module and transferred
to monitoring software in the PC that displays the heart rates for all patients and generates
warning signal if the heart rate is out of pre-defined range.
Since the embedded system is dedicated to specific tasks, design engineers can optimize
it, reducing the size and cost of the product, or 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 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.
Certain operating systems or language platforms are tailored for the embedded market,
such as Embedded Java and Windows XP Embedded. However, some low-end consumer
products use very inexpensive microprocessors and limited storage, with the application and
operating system both part of a single program. The program is written permanently into the
system's memory in this case, rather than being loaded into RAM (random access memory), as
programs on a personal computer are.
We are living in the Embedded World. You are surrounded with many embedded
products and your daily life largely depends on the proper functioning of these gadgets.
Television, Radio, CD player of your living room, Washing Machine or Microwave Oven in
your kitchen, Card readers, Access Controllers, Palm devices of your work space enable you to
do many of your tasks very effectively. Apart from all these, many controllers embedded in your
car take care of car operations between the bumpers and most of the times you tend to ignore all
these controllers.
In recent days, you are showered with variety of information about these embedded
controllers in many places. All kinds of magazines and journals regularly dish out details about
latest technologies, new devices; fast applications which make you believe that your basic
survival is controlled by these embedded products. Now you can agree to the fact that these
embedded products have successfully invaded into our world. You must be wondering about
these embedded controllers or systems. What is this Embedded System?
The computer you use to compose your mails, or create a document or analyze the
database is known as the standard desktop computer. These desktop computers are manufactured
to serve many purposes and applications.
You need to install the relevant software to get the required processing facility. So, these
desktop computers can do many things. In contrast, embedded controllers carryout a specific
work for which they are designed. Most of the time, engineers design these embedded controllers
with a specific goal in mind. So these controllers cannot be used in any other place.
In the 8 bit segment, the most popular and used architecture is Intel's 8031. Market
acceptance of this particular family has driven many semiconductor manufacturers to develop
something new based on this particular architecture. Even after 25 years of existence,
semiconductor manufacturers still come out with some kind of device using this 8031 core.
The LynxOS-178 RTOS for software certification, based on the RTCA DO-178B standard,
assists developers in gaining certification for their mission- and safety-critical systems. Real-time
systems programmers get a boost with LynuxWorks' DO-178B RTOS training courses.
Communications applications
"Five-nines" availability, CompactPCI hot swap support, and hard real-time response—
LynxOS delivers on these key requirements and more for today's carrier-class systems. Scalable
kernel configurations, distributed computing capabilities, integrated communications stacks, and
fault-management facilities make LynxOS the ideal choice for companies looking for a single
operating system for all embedded telecommunications applications—from complex central
controllers to simple line/trunk cards.
The Lynx Certifiable Stack (LCS) is a secure TCP/IP protocol stack designed especially for
applications where standards certification is required.
And as the wireless appliance revolution rolls on, web-enabled navigation systems, radios,
personal communication devices, phones and PDAs all benefit from the cost-effective
dependability, proven stability and full product life-cycle support opportunities associated with
BlueCat embedded Linux. BlueCat has teamed up with industry leaders to make it easier to build
Linux mobile phones with Java integration.
For makers of low-cost consumer electronic devices who wish to integrate the LynxOS real-
time operating system into their products, we offer special MSRP-based pricing to reduce royalty
fees to a negligible portion of the device's MSRP.
Designers of industrial and process control systems know from experience that LynuxWorks
operating systems provide the security and reliability that their industrial applications require.
From ISO 9001 certification to fault-tolerance, POSIX conformance, secure partitioning and
high availability, we've got it all. Take advantage of our 20 years of experience.
In many applications, for example a TV remote control, there is no need for the
computing power of a 486 or even an 8086 microprocessor. These applications most often
require some I/O operations to read signals and turn on and off certain bits.
MICROCONTROLLERS FOR EMBEDDED SYSTEMS
In the Literature discussing microprocessors, we often see the term Embedded System.
Microprocessors and Microcontrollers are widely used in embedded system products. An
embedded system product uses a microprocessor (or Microcontroller) to do one task only. A
printer is an example of embedded system since the processor inside it performs one task only;
namely getting the data and printing it. Contrast this with a Pentium based PC. A PC can be used
for any number of applications such as word processor, print-server, bank teller terminal, Video
game, network server, or Internet terminal. Software for a variety of applications can be loaded
and run. Of course the reason a pc can perform myriad tasks is that it has RAM memory and an
operating system that loads the application software into RAM memory and lets the CPU run it.
In an Embedded system, there is only one application software that is typically burned
into ROM. An x86 PC contains or is connected to various embedded products such as keyboard,
printer, modem, disk controller, sound card, CD-ROM drives, mouse, and so on. Each one of
these peripherals has a Microcontroller inside it that performs only one task. For example, inside
every mouse there is a Microcontroller to perform the task of finding the mouse position and
sending it to the PC. Table 1-1 lists some embedded products.
BLOCK DIAGRAM:
PSD1
POWER
SUPPLY LCD
MICROCONTROLLER
TEMP A
SENSOR
D
POWER
SUPPLY LCD
MICROCONTROLLER
TEMP
A
SENSOR
D
CAN BUS
C
HUMIDITY
SENSOR
A ZIGBEE
RECEIVER:
ZIGBEE MAX23 D
PC
2 B
C
BLOCK DIAGRAM EXPLINATION
In the above block diagram we can see the block of can, MICRO CONTROLLER, SENSORS
and POWER SUPPLY.
POWER SUPPLY
A variable regulated power supply, also called a variable bench power supply, is one where you
can continuously adjust the output voltage to your requirements. Varying the output of the power
supply is the recommended way to test a project after having double checked parts placement
against circuit drawings and the parts placement guide. This type of regulation is ideal for having
a simple variable bench power supply. Actually this is quite important because one of the first
projects a hobbyist should undertake is the construction of a variable regulated power supply.
While a dedicated supply is quite handy e.g. 5V or 12V, it's much handier to have a
variable supply on hand, especially for testing. Most digital logic circuits and processors need a 5
volt power supply. To use these parts we need to build a regulated 5 volt source. Usually you
start with an unregulated power supply ranging from 9 volts to 24 volts DC (A 12 volt power
supply is included with the Beginner Kit and the Microcontroller Beginner Kit.). To make a 5
volt power supply, we use a LM7805 voltage regulator IC.
The LM7805 is simple to use. You simply connect the positive lead of your unregulated
DC power supply (anything from 9VDC to 24VDC) to the Input pin, connect the negative lead to
the Common pin and then when you turn on the power, you get a 5 volt supply from the Output
pin.
SENSORS:
A sensor is a device that measures a physical quantity and converts it into a signal which can be
read by an observer or by an instrument. For example, a mercury-in-glass thermometer converts
the measured temperature into expansion and contraction of a liquid which can be read on a
calibrated glass tube. A thermocouple converts temperature to an output voltage which can be
read by a voltmeter. For accuracy, most sensors are calibrated against known standards.
CAN:
CAN is a message based protocol, designed specifically for automotive applications but now also
used in other areas such as industrial automation and medical equipment.
Development of the CAN-bus started originally in 1983 at Robert Bosch GmbH.[1] The protocol
was officially released in 1986 at the Society of Automotive Engineers (SAE) congress in
Detroit, Michigan. The first CAN controller chips, produced by Intel and Philips, came on the
market in 1987. Bosch published the CAN 2.0 specification in 1991.
MAX- 232
So here we are using this MAX-232 to have compatibility between the zigbee and
microcontroller.
ZIGBEE:
ZigBee is a specification for a suite of high level communication protocols using small,
low-power digital radios based on the IEEE 802.15.4-2003 standard for Low-Rate Wireless
Personal Area Networks (LR-WPANs), such as wireless light switches with lamps, electrical
meters with in-home-displays, consumer electronics equipment via short-range radio needing
low rates of data transfer. The technology defined by the ZigBee specification is intended to be
simpler and less expensive than other WPANs, such as Bluetooth. ZigBee is targeted at radio-
frequency (RF) applications that require a low data rate, long battery life, and secure networking
SCHEMATIC:
HARD WARE COMPONENTS EXPLANATION:
Power supply
The power supplies are designed to convert high voltage AC mains electricity to a
suitable low voltage supply for electronics circuits and other devices. A power supply can by
broken down into a series of blocks, each of which performs a particular function. A d.c power
supply which maintains the output voltage constant irrespective of a.c mains fluctuations or load
variations is known as “Regulated D.C Power Supply”
Transformer:
A transformer is an electrical device which is used to convert electrical power from one
Transformers convert AC electricity from one voltage to another with little loss of power.
Transformers work only with AC and this is one of the reasons why mains electricity is AC.
Step-up transformers increase in output voltage, step-down transformers decrease in output
voltage. Most power supplies use a step-down transformer to reduce the dangerously high mains
voltage to a safer low voltage. The input coil is called the primary and the output coil is called
the secondary. There is no electrical connection between the two coils; instead they are linked by
an alternating magnetic field created in the soft-iron core of the transformer. The two lines in the
middle of the circuit symbol represent the core. Transformers waste very little power so the
power out is (almost) equal to the power in. Note that as voltage is stepped down current is
stepped up. The ratio of the number of turns on each coil, called the turn’s ratio, determines the
ratio of the voltages. A step-down transformer has a large number of turns on its primary (input)
coil which is connected to the high voltage mains supply, and a small number of turns on its
secondary (output) coil to give a low output voltage.
RECTIFIER:
TYPES OF RECTIFIERS:
Full-wave Rectifier:
From the above comparison we came to know that full wave bridge rectifier as more
advantages than the other two rectifiers. So, in our project we are using full wave bridge rectifier
circuit.
Bridge Rectifier: 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 wiredinternally.
Filter:
Capacitor Filter:
We have seen that the ripple content in the rectified output of half wave rectifier is 121%
or that of full-wave or bridge rectifier or bridge rectifier is 48% such high percentages of ripples
is not acceptable for most of the applications. Ripples can be removed by one of the following
methods of filtering.
(a) A capacitor, in parallel to the load, provides an easier by –pass for the ripples voltage though
it due to low impedance. At ripple frequency and leave the d.c.to appears the load.
(b) An inductor, in series with the load, prevents the passage of the ripple current (due to high
impedance at ripple frequency) while allowing the d.c (due to low resistance to d.c)
(c) various combinations of capacitor and inductor, such as L-section filter section filter,
multiple section filter etc. which make use of both the properties mentioned in (a) and (b) above.
Two cases of capacitor filter, one applied on half wave rectifier and another with full wave
rectifier.
Regulator:
Voltage regulator ICs is available with fixed (typically 5, 12 and 15V) or variable output
voltages. The maximum current they can pass also rates them. Negative voltage regulators are
available, mainly for use in dual supplies. Most regulators include some automatic protection
from excessive current ('overload protection') and overheating ('thermal protection'). Many of
the fixed voltage regulator ICs have 3 leads and look like power transistors, such as the 7805
+5V 1A regulator shown on the right. The LM7805 is simple to use. You simply connect the
positive lead of your unregulated DC power supply (anything from 9VDC to 24VDC) to the
Input pin, connect the negative lead to the Common pin and then when you turn on the power,
you get a 5 volt supply from the output pin.
78XX:
The Bay Linear LM78XX is integrated linear positive regulator with three terminals. The
LM78XX offer several fixed output voltages making them useful in wide range of applications.
When used as a zener diode/resistor combination replacement, the LM78XX usually results in an
effective output impedance improvement of two orders of magnitude, lower quiescent current.
The LM78XX is available in the TO-252, TO-220 & TO-263packages,
Features:
• No External Component
• Output Voltage 5.0V, 6V, 8V, 9V, 10V,12V, 15V, 18V, 24V
INTRODUCTION:
It does not mean that any micro controller should have all the above said
features on chip, Depending on the need and area of application for which it is
designed, The ON-CHIP features present in it may or may not include all the
individual section said above.
ON-
CHIP
EXTERNAL
INTERRUPTS
TIMER COUNTER
1
INPUTS
TIMER
0
ON-CHIP
ON-CHIP
INTERRUP
T FLASH
CPU
PO P2 P1 P3 TXD RXD
Fig.1 Oscillator Connection.
The P89C51 provides the following standard features: 4K bytes of Flash, 128
bytes of RAM, 32 I/O lines, two 16-bit timer/counters, five vector two-level interrupt
architecture, a full duplex serial port, and on-chip oscillator and clock circuitry. In
addition, the P89C51 is designed with static logic for operation down to zero
frequency and supports two software selectable power saving modes. The Idle Mode
stops the CPU while allowing the RAM, timer/counters, serial port and interrupt
system to continue functioning. The Power-down Mode saves the RAM contents but
freezes the oscillator disabling all other chip functions until the next hardware reset.
Memory Organization
Program Memory
Below Fig shows a map of the lower part of the program memory. After
reset, the CPU begins execution from location 0000H. As shown in fig.4, each
interrupt is assigned a fixed location in program memory. The interrupt causes the
CPU to jump to that location, where it executes the service routine. External
Interrupt 0, for example, is assigned to location 0003H. If External Interrupt 0 is
used, its service routine must begin at location 0003H. If the interrupt is not used,
its service location is available as general purpose.
(0033)
H
002BH
0023H
INTERRUPT 001BH
LOCATION 8 bytes
S
0013H
RESE
T
000BH
Program Memory.
0003H
Program memory addresses are always 16 bits wide, even though the actual
amount o program memory used may be less than 64Kbytes. External program
0000H
execution sacrifices two of the 8-bit ports, P0 and P2, to the function of addressing
the program memory.
Data Memory
The right half of Figure 3 shows the internal and external data memory
spaces available on Philips Flash microcontrollers. Fig.6 shows a hardware
configuration for accessing up to 2K bytes of external RAM. In this case, the CPU
executes from internal flash. Port0 serves as a multiplexed address/data bus to the
RAM, and 3 lines of Port 2 are used to page the RAM. The CPU generates RD and WR
signals as needed during external RAM accesses. You can assign up to 64K bytes of
external data memory. External data memory addresses can be either 1 or 2bytes
wide.
Internal data memory addresses are always 1 byte wide, which implies an
address space of only 256bytes. However, the addressing modes for internal RAM
can infact accommodate 384 bytes. Direct addresses higher than 7FH access one
memory space and indirect addresses higher than 7FH access a different memory
space. Thus, Figure.7 shows the Upper 128 and SFR space occupying the same
block of addresses, 80H through FFH, although they are physically separate entities.
The lowest 32 bytes are grouped into 4 banks of 8 registers. Program instructions
call out these registers as R0 through R7.
The next 16 bytes above the register banks form a block of bit-addressable
memory space. The microcontroller instruction set includes a wide selection of
single-bit instructions, and these instructions can directly address the 128 bits in
this area. These bit addresses are 00H through 7FH. All of the bytes in the Lower
128 can be accessed by either direct or indirect addressing.
REGISTERS:
D7 D6 D5 D4 D3 D2 D1 D0
The most widely used registers of the 8051 are A(accumulator), B, R0, R1,
R2, R3, R4, R5, R6, R7, DPTR(data pointer), and PC(program counter). All of the
above registers are 8-bits, except DPTR and the program counter. The
accumulator, register A, is used for all arithmetic and logic instructions.
PIN CONFIGURATION:
Pin Description
VCC: Pin 40 provides supply voltage to the chip. The voltage source is +5v.
Ports 0, 1, 2 and 3
As shown in pin diagram, the four ports P0, P1, P2, and P3 each use of 8 pins,
making the 8-bit ports. All the ports upon Reset are configured as input, since P0-
P3 have FFH on them.
Port 0
Port 0 occupies a total of 8 pins (pins 32-33). It can be used for input or output. Port0 is
also designated as AD0-AD7, allowing it to be used for both address and data. When connecting
an 8051/31 to an external memory, port 0 provides both address and data. The 8051 multiplexes
address and data through port 0 to save pins. ALE=0, it provides data D0-D7, but when ALE=1,
it has address A0-A7. Therefore, ALE is used for demultiplexing address address and data with
the help of a 74LS373 latch. In the 8051-based systems where there is no external memory
connection, the pins of P0 must be connected externally to a 10k –ohm pull-up resistor.
This is due to the fact that P0 is an Open drain, Unlike P1, P2, P3. Open drain is a term
used for Mos chips in the same way that open collector is used for TTL chips. In many systems
usig the 8751, 89C51, or DS89C4x0 chips, we normally connect P0 to pull-up resistors. With
external pull-up resistors connected to P0, it can be used as a simple I/O port, just like P1 and P2.
In contrast to Port 0, ports p1, p2, and p3 do not need any pull-up resistors since they already
have pull-up resistors internally. Upon reset, ports p1, p2, ad p3 are configured as input ports.
Port 1
Port 2
Port 2 occupies a total 8 pins (pins 21-28). It can be used as input or output. However, in
8031-based systems, port2 is also designated as A8-A15, indicating its dual function. Since an
8051/31 is capable of accessing 64K bytes of external memory, it needs a path for the 16 bits of
the address. While P0 provides the lower 8 bits via A0-A7, it is the job of p2 is used for the
upper 8 bits of the 16-bit address, and it cannot be used for I/O. Just like P1, port 2 does not
need any pull-up resistors since it already has pull-up resistors internally. Upon reset, port2 is
configured as an input port.
Port 3
Port 3 also receives some control signals for Flash programming and verification.
RST
Reset input. A high on this pin for two machine cycles while the oscillator is running
resets the device.
ALE/PROG
Prior to each reading from external memory, the microcontroller will set the
lower address byte (A0-A7) on P0 and immediately after that activates the output
ALE. Upon receiving signal from the ALE pin, the external register (74HCT373 or
74HCT375 circuit is usually embedded ) memorizes the state of P0 and uses it as an
address for memory chip. In the second part of the microcontroller’s machine cycle,
a signal on this pin stops being emitted and P0 is used now for data transmission
(Data Bus). In this way, by means of only one additional (and cheap) integrated
circuit, data multiplexing from the port is performed. This port at the same time
used for data and address transmission.
PSEN
Program Store Enable is the read strobe to external program memory. When the
AT89C51 is executing code from external program memory, PSEN is activated twice
each machine cycle, except that two PSEN activations are skipped during each
access to external data memory.
EA/VPP
The 8051 has an on-chip oscillator but requires an external clock to run it.
Most often a quartz crystal oscillator is connected to inputs XTAL1 (pin19) and
XTAL2 (pin18). The quartz crystal oscillator connected to XTAL1 and XTAL2 also
needs two capacitors of 30pf value. One side of each capacitor is connected to the
ground as shown in fig1.
It must be noted that there are various speeds of the 8051 family. Speed
refers to the maximum oscillator frequency connected to XTAL. For example, a 12-
MHz chip must be connected to a crystal with 12 MHz frequency of no more than 20
MHz. When the 8051 is connected to a crystal oscillator and is powered up, we can
observe the frequency on the XTAL2 pin using the oscilloscope.
TIMERS
Both Timer 0 and Timer 1 are 16 bits wide. Since the 8051 has an 8-bit
architecture, each 16-bit timer is accessed as two separate registers of low byte
and high byte.
TIMER 0 REGISTERS
The 16-bit register of Timer 0 is accessed as low byte and high byte. the
low byte register is called TL0(Timer 0 low byte)and the high byte register is
referred to as TH0(Timer 0 high byte).These register can be accessed like any other
register, such as A,B,R0,R1,R2,etc.for example, the instruction ”MOV TL0,
#4F”moves the value 4FH into TL0,the low byte of Timer 0.These registers can also
be read like any other register.
TIMER 1 REGISTERS
Timer 1 is also 16-bit register is split into two bytes, referred to as TL1
(Timer 1 low byte) and TH1(Timer 1 high byte).these registers are accessible n the
same way as the register of Timer 0.
TMOD (timer mode) REGISTER
Both timers 0 and 1 use the same register, called TMOD, to set the various
timer operation modes. TMOD is an 8-bit register in which the lower 4 bits are set
aside for Timer 0 and the upper 4 bits for Timer 1.in each case; the lower 2 bits are
used to set the timer mode and the upper 2 bits to specify the operation.
TCON Register:
TCON controls the timer/counter operations. The lower four bits of TCON cater to
interrupt functions, but the upper four bits are for timer operations. The details of
the TCON register are shown below.
MSB LSB
INTERRUPTS:
A single microcontroller can serve several devices. There are two ways to do that:
INTERRUPTS or POLLING.
POLLING:
INTERRUPTS:
In the interrupts method, whenever any device needs its service, the device
notifies the microcontroller by sending it an interrupts signal. Upon receiving an
interrupt signal, the microcontroller interrupts whatever it is doing and serves the
device. The program associated with the interrupts is called the interrupt service
routine (ISR).or interrupt handler.
In reality, only five interrupts are available to the user in the 8051, but many
manufacturers’ data sheets state that there are six interrupts since they include
reset .the six interrupts in the 8051 are allocated as above.
1. Reset. When the reset pin is activated, the 8051 jumps to address location
0000.this is the power-up reset.
2. Two interrupts are set aside for the timers: one for Timer 0 and one for Timer
1.Memory location 000BH and 001BH in the interrupt vector table belong to
Timer 0 and Timer 1, respectively.
3. Two interrupts are set aside for hardware external harder interrupts. Pin
number 12(P3.2) and 13(P3.3) in port 3 are for the external hardware
interrupts INT0 and INT1,respectively.These external interrupts are also
referred to as EX1 and EX2.Memory location 0003H and 0013H in the
interrupt vector table are assigned to INT0 and INT1, respectively.
4. Serial communication has a single interrupt that belongs to both receive and
transmit. The interrupt vector table location 0023H belongs to this interrupt.
SERIAL COMMUNICATION
Computers can transfer data in two ways: parallel and serial. In
parallel data transfers, often 8 or more lines (wire conductors) are used to transfer
data to a device that is only a few feet away. An example of parallel transfers a
printers and hard disks; each uses cables with many wire strips. Although in such
cases a lot of data can be transferred in a short amount of time by using many
wires in parallel, the distance cannot be great.
To transfer to a device located many meters away, the serial method is used.
In serial communication, the data is sent one bit at a time, in contrast to parallel
communication, in which the data is sent a byte or more at a time. Serial
communication of the 8051 is the topic of this chapter. The 8051 has serial
communication capability built into it, there by making possible fast data transfer
using only a few wires.
The data coming in at the receiving end of the data line in a serial data
transfer is all 0s and 1s; it is difficult to make sense of the data unless the sender
and receiver agree on a set of rules, a protocol, on how the data is packed, how
many bits constitute a character, and when the data begins and ends.
The rate of data transfer in serial data communication is stated in bps (bits
per second). Another widely used terminology for bps is baud rate. The data
transfer rate of given computer system depends on communication ports
incorporated into that system. For example, the early IBMPC/XT could transfer data
at the rate of 100 to 9600 bps. In recent years, however, Pentium based PCS
transfer data at rates as high as 56K bps. It must be noted that in asynchronous
serial data communication, the baud rate is generally limited to 100,000bps.
The 8051 transfers and receives data serially at many different baud rates.
The baud rate in the 8051 is programmable. The is done with the help of Timer1.
The 8051 divides the crystal frequency by 12 to get the machine cycle frequency.
In the case of XTAL=11.0592MHZ, the machine cycle frequency is 921.6 KHz
(11.0592MHz/12=921.6KHz). the 8051’s serial communication UART circuitry
divides the machine cycle frequency of 921.6khz divided by 32 once more before it
is used by Timer 1 to set the Baud rate. Therefore, 921.6 kHz divided by 32 gives
28,800 Hz. This is the number well use to find the Timer 1 value to set baud rate.
NOTE: XTAL=11...592MHz
SBUF register
SBUF is an 8-bit register used solely for serial communication in the 8051. for
a byte of data to be transferred via the TXD line, it must be placed in the SBUF
register. Similarly, SBUF holds the byte of data when it is received by the 8051’s
RXD line. SBUF can be accessed like any other register in the 8051. Look at the
following the examples of how this register is accessed.
The moment a byte is written into SBUF, it is framed with the start and stop
bits and transferred serially via the TXD pin. Similarly, when the bits are received
serially via RXD, the 8051 defames it by eliminating the stop and start bits, making
a byte out of the data received, and then placing it in the SBUF.
The SCON register is an 8-bit register used to program the start bit, stop bit,
and data bits of data framing, among other things.
The following describes various bits of the SCON register.
SM0, SM1
SM0 and SM1 are D7 and D6 of the SCON register, respectively. These two
bits determine the framing of data by specifying the number of bits per character
and the start and stop bits. They take the following combinations.
SM0 SM1 FUNCTION
0 0 Serial Mode 0
1 0 Serial Mode 2
1 1 Serial Mode 3
Of the 4 serial modes, only mode 1 is of interest to us. In the SCON register,
when serial mode 1 is chosen, the data framing is 8 bits, 1 stop bit, and 1 start bit,
which makes it compatible with the COM port of IBM/compatible PCs. More
importantly, serial mode 1 allows the baud rate to be variable and is set by Timer 1
of the 8051. In serial mode 1, for each character a total of 10 bits are transferred,
where the first bit is the start bit, followed by 8 bits of data, and finally 1 stop bit.
MAX-232:
The MAX232 from Maxim was the first IC which in one package contains the necessary
drivers (two) and receivers (also two), to adapt the RS-232 signal voltage levels to TTL logic. It
became popular, because it just needs one voltage (+5V) and generates the necessary RS-232
voltage levels (approx. -10V and +10V) internally. This greatly simplified the design of circuitry.
Circuitry designers no longer need to design and build a power supply with three voltages (e.g.
-12V, +5V, and +12V), but could just provide one +5V power supply, e.g. with the help of a
simple 78x05 voltage converter.
The MAX232 has a successor, the MAX232A. The ICs are almost identical, however, the
MAX232A is much more often used (and easier to get) than the original MAX232, and the
MAX232A only needs external capacitors 1/10th the capacity of what the original MAX232
needs.
The MAX232 and MAX232A were once rather expensive ICs, but today they are cheap.
It has also helped that many companies now produce clones (ie. Sipex). The original
manufacturer (and now some clone manufacturers, too) offers a large series of similar ICs, with
different numbers of receivers and drivers, voltages, built-in or external capacitors, etc. E.g. The
MAX232 and MAX232A need external capacitors for the internal voltage pump, while the
MAX233 has these capacitors built-in. The MAX233 is also between three and ten times more
expensive in electronic shops than the MAX232A because of its internal capacitors. It is also
more difficult to get the MAX233 than the garden variety MAX232A.
A Typical Application
The MAX 232(A) has two receivers (converts from RS-232 to TTL voltage levels) and
two drivers (converts from TTL logic to RS-232 voltage levels). This means only two of the RS-
232 signals can be converted in each direction. The old MC1488/1498 combo provided four
drivers and receivers.
• TX and RX
There are not enough drivers/receivers in the MAX232 to also connect the DTR, DSR, and
DCD signals. Usually these signals can be omitted when e.g. communicating with a PC's serial
interface. If the DTE really requires these signals either a second MAX232 is needed, or some
other IC from the MAX232 family can be used (if it can be found in consumer electronic shops
at all).
An alternative for DTR/DSR is also given below.Maxim's data sheet explains the MAX232
family in great detail, including the pin configuration and how to connect such an IC to external
circuitry. This information can be used as-is in own design to get a working RS-232 interface.
Maxim's data just misses one critical piece of information: How exactly to connect the RS-232
signals to the IC. So here is one possible example
In addition one can directly wire DTR (DB9 pin 4) to DSR (DB9 pin 6) without going
through any circuitry. This gives automatic (brain dead) DSR acknowledgment of an incoming
DTR signal.
Sometimes pin 6 of the MAX232 is hard wired to DCD (DB9 pin 1). This is not
recommended. Pin 6 is the raw output of the voltage pump and inverter for the -10V voltage.
Drawing currents from the pin leads to a rapid breakdown of the voltage, and as a consequence
to a breakdown of the output voltage of the two RS-232 drivers. It is better to use software which
doesn't care about DCD, but does hardware-handshaking via CTS/RTS only.
• +5V: Pin 16
• GND: Pin 15
Description/ordering information
Introduction:
A program must interact with the outside world using input and
output devices that communicate directly with a human being. One of the most
common devices attached to an controller is an LCD display. Some of the most
common LCDs connected to the contollers are 16X1, 16x2 and 20x2 displays. This
means 16 characters per line by 1 line 16 characters per line by 2 lines and 20
characters per line by 2 lines, respectively.
(3) 80x8
bits (80 characters).
(7) 8
different user programmed 5 7
dot-matrix patterns.
Data can be placed at any location on the LCD. For 16×1 LCD, the address
locations are:
Fig : Address locations for a 1x16 line LCD
PIN DESCRIPTION:
Most LCDs with 1 controller has 14 Pins and LCDs with 2 controller has 16
Pins (two pins are extra in both for back-light LED connections).
EN:
Line is called "Enable." This control line is used to tell the LCD that you are sending it
data. To send data to the LCD, your program should make sure this line is low (0) and then set
the other two control lines and/or put data on the data bus. When the other lines are completely
ready, bring EN high (1) and wait for the minimum amount of time required by the LCD
datasheet (this varies from LCD to LCD), and end by bringing it low (0) again.
RS:
Line is the "Register Select" line. When RS is low (0), the data is to be treated as a
command or special instruction (such as clear screen, position cursor, etc.). When RS is high (1),
the data being sent is text data which sould be displayed on the screen. For example, to display
the letter "T" on the screen you would set RS high.
RW:
Line is the "Read/Write" control line. When RW is low (0), the information on the data
bus is being written to the LCD. When RW is high (1), the program is effectively querying (or
reading) the LCD. Only one instruction ("Get LCD status") is a read command. All others are
write commands, so RW will almost always be low.
Finally, the data bus consists of 4 or 8 lines (depending on the mode of operation selected
by the user). In the case of an 8-bit data bus, the lines are referred to as DB0, DB1, DB2, DB3,
DB4, DB5, DB6, and DB7.
• RS - 0 Instructions
- 1 Character
Entering Text:
First, a little tip: it is manually a lot easier to enter characters and commands
in hexadecimal rather than binary (although, of course, you will need to translate
commands from binary couple of sub-miniature hexadecimal rotary switches is a
simple matter, although a little bit into hex so that you know which bits you are
setting). Replacing the d.i.l. switch pack with a of re-wiring is necessary.
The switches must be the type where On = 0, so that when they are turned to
the zero position, all four outputs are shorted to the common pin, and in position “F”,
all four outputs are open circuit.
All the available characters that are built into the module are shown in Table
3. Studying the table, you will see that codes associated with the characters are
quoted in binary and hexadecimal, most significant bits (“left-hand” four bits) across
the top, and least significant bits (“right-hand” four bits) down the left.
Most of the characters conform to the ASCII standard, although the Japanese
and Greek characters (and a few other things) are obvious exceptions. Since these
intelligent modules were designed in the “Land of the Rising Sun,” it seems only fair
that their Katakana phonetic symbols should also be incorporated. The more
extensive Kanji character set, which the Japanese share with the Chinese, consisting
of several thousand different characters, is not included!
Using the switches, of whatever type, and referring to Table 3, enter a few
characters onto the display, both letters and numbers. The RS switch (S10) must be
“up” (logic 1) when sending the characters, and switch E (S9) must be pressed for
each of them. Thus the operational order is: set RS high, enter character, trigger E,
leave RS high, enter another character, trigger E, and so on.
The first 16 codes in Table 3, 00000000 to 00001111, ($00 to $0F) refer to the
CGRAM. This is the Character Generator RAM (random access memory), which can
be used to hold user-defined graphics characters. This is where these modules really
start to show their potential, offering such capabilities as bar graphs, flashing
symbols, even animated characters. Before the user-defined characters are set up,
these codes will just bring up strange looking symbols.
Codes 00010000 to 00011111 ($10 to $1F) are not used and just display
blank characters. ASCII codes “proper” start at 00100000 ($20) and end with
01111111 ($7F). Codes 10000000 to 10011111 ($80 to $9F) are not used, and
10100000 to 11011111 ($A0 to $DF) are the Japanese characters.
Initialization by Instructions:
If the power conditions for the normal operation of the internal
reset circuit are not satisfied, then executing a series of instructions must
initialize LCD unit. The procedure for this initialization process is as above
show.
SENSORS:
A sensor is a device that measures a physical quantity and converts it into a signal which can be
read by an observer or by an instrument. For example, a mercury-in-glass thermometer converts
the measured temperature into expansion and contraction of a liquid which can be read on a
calibrated glass tube. A thermocouple converts temperature to an output voltage which can be
read by a voltmeter. For accuracy, most sensors are calibrated against known standards.
Use
Sensors are used in everyday objects such as touch-sensitive elevator buttons (tactile sensor) and
lamps which dim or brighten by touching the base. There are also innumerable applications for
sensors of which most people are never aware. Applications include cars, machines, aerospace,
medicine, manufacturing and robotics.
A sensor is a device which receives and responds to a signal. A sensor's sensitivity indicates how
much the sensor's output changes when the measured quantity changes. For instance, if the
mercury in a thermometer moves 1 cm when the temperature changes by 1 °C, the sensitivity is
1 cm/°C (it is basically the slope Dy/Dx assuming a linear characteristic). Sensors that measure
very small changes must have very high sensitivities. Sensors also have an impact on what they
measure; for instance, a room temperature thermometer inserted into a hot cup of liquid cools the
liquid while the liquid heats the thermometer. Sensors need to be designed to have a small effect
on what is measured, making the sensor smaller often improves this and may introduce other
advantages. Technological progress allows more and more sensors to be manufactured on a
microscopic scale as microsensors using MEMS technology. In most cases, a microsensor
reaches a significantly higher speed and sensitivity compared with macroscopic approaches.
Ideal sensors are designed to be linear or linear to some simple mathematical function of the
measurement, typically logarithmic. The output signal of such a sensor is linearly proportional to
the value or simple function of the measured property. The sensitivity is then defined as the ratio
between output signal and measured property. For example, if a sensor measures temperature
and has a voltage output, the sensitivity is a constant with the unit [V/K]; this sensor is linear
because the ratio is constant at all points of measurement.
Sensor deviations
• The sensitivity may in practice differ from the value specified. This is called a sensitivity
error, but the sensor is still linear.
• Since the range of the output signal is always limited, the output signal will eventually
reach a minimum or maximum when the measured property exceeds the limits. The full
scale range defines the maximum and minimum values of the measured property.
• If the output signal is not zero when the measured property is zero, the sensor has an
offset or bias. This is defined as the output of the sensor at zero input.
• If the sensitivity is not constant over the range of the sensor, this is called nonlinearity.
Usually this is defined by the amount the output differs from ideal behavior over the full
range of the sensor, often noted as a percentage of the full range.
• If the deviation is caused by a rapid change of the measured property over time, there is a
dynamic error. Often, this behaviour is described with a bode plot showing sensitivity
error and phase shift as function of the frequency of a periodic input signal.
• If the output signal slowly changes independent of the measured property, this is defined
as drift (telecommunication).
• Long term drift usually indicates a slow degradation of sensor properties over a long
period of time.
• Noise is a random deviation of the signal that varies in time.
• Hysteresis is an error caused by when the measured property reverses direction, but there
is some finite lag in time for the sensor to respond, creating a different offset error in one
direction than in the other.
• If the sensor has a digital output, the output is essentially an approximation of the
measured property. The approximation error is also called digitization error.
• If the signal is monitored digitally, limitation of the sampling frequency also can cause a
dynamic error, or if the variable or added noise noise changes periodically at a frequency
near a multiple of the sampling rate may induce aliasing errors.
• The sensor may to some extent be sensitive to properties other than the property being
measured. For example, most sensors are influenced by the temperature of their
environment.
All these deviations can be classified as systematic errors or random errors. Systematic errors
can sometimes be compensated for by means of some kind of calibration strategy. Noise is a
random error that can be reduced by signal processing, such as filtering, usually at the expense of
the dynamic behaviour of the sensor.
Resolution
The resolution of a sensor is the smallest change it can detect in the quantity that it is measuring.
Often in a digital display, the least significant digit will fluctuate, indicating that changes of that
magnitude are only just resolved. The resolution is related to the precision with which the
measurement is made. For example, a scanning tunneling probe (a fine tip near a surface collects
an electron tunnelling current) can resolve atoms and molecules.actuator is something that
converts energy into motion
Types
Sensors in Nature
All living organisms contain biological sensors with functions similar to those of the mechanical
devices described. Most of these are specialized cells that are sensitive to:
Biosensor
Features:
Pin diagram:
Applications:
The LM35 can be applied easily in the same way as other integrated-circuit
temperature sensors. It can be glued or cemented to a surface and its temperature
will be within about 0.01°C of the surface temperature. This presumes that the
ambient air temperature is almost the same as the surface temperature; if the air
temperature were much higher or lower than the surface temperature, the actual
temperature of the LM35 die would be at an intermediate temperature between the
surface temperature and the air temperature. This is expecially true for the TO-92
plastic package, where the copper leads are the principal thermal path to carry heat
into the device, so its temperature might be closer to the air temperature than to
the surface temperature. To minimize this problem, be sure that the wiring to the
LM35, as it leaves the device, is held at the same temperature as the surface of
interest. The easiest way to do this is to cover up these wires with a bead of epoxy
which will insure that the leads and wires are all at the same temperature as the
surface, and that the LM35 die’s temperature will not be affected by the air
temperature. The TO-46 metal package can also be soldered to a metal surface or
pipe without damage. Of course, in that case the V- terminal of the circuit will be
grounded to that metal. Alternatively, the LM35 can be mounted inside a sealed-end
metal tube, and can then be dipped into a bath or screwed into a threaded hole in a
tank. As with any IC, the LM35 and accompanying wiring and circuits must be kept
insulated and dry, to avoid leakage and corrosion. This is especially true if the
circuit may operate at cold temperatures where condensation can occur. Printed-
circuit coatings and varnishes such as Humiseal and epoxy paints or dips are often
used to insure that moisture cannot corrode the LM35 or its connections. These
devices are sometimes soldered to a small light-weight heat fin, to decrease the
thermal time constant and speed up the response in slowly-moving air. On the other
hand, a small thermal mass may be added to the sensor, to give the steadiest
reading despite small deviations in the air temperature.
CAN is a message based protocol, designed specifically for automotive applications but now also
used in other areas such as industrial automation and medical equipment.
Development of the CAN-bus started originally in 1983 at Robert Bosch GmbH.[1] The protocol
was officially released in 1986 at the Society of Automotive Engineers (SAE) congress in
Detroit, Michigan. The first CAN controller chips, produced by Intel and Philips, came on the
market in 1987. Bosch published the CAN 2.0 specification in 1991.
CAN is one of five protocols used in the OBD-II vehicle diagnostics standard. The OBD
standard has been mandatory for all cars and light trucks sold in the United States since 1996,
and the EOBD standard, mandatory for all petrol vehicles sold in the European Union since 2001
and all diesel vehicles since 2004.[2]
Applications
Automotive
A modern automobile may have as many as 70 electronic control units (ECU) for various
subsystems.[3] Typically the biggest processor is the engine control unit (also engine control
module/ECM in automobiles); others are used for transmission, airbags, antilock braking, cruise
control, audio systems, windows, doors, mirror adjustment, etc. Some of these form independent
subsystems, but communications among others are essential. A subsystem may need to control
actuators or receive feedback from sensors. The CAN standard was devised to fill this need.
The CAN bus may be used in vehicles to connect engine control unit and transmission, or (on a
different bus) to connect the door locks, climate control, seat control, etc. Today the CAN bus is
also used as a fieldbus in general automation environments, primarily due to the low cost of
some CAN Controllers and processors.
Technology
CAN is a multi-master broadcast serial bus standard for connecting electronic control units
(ECUs).
Each node is able to send and receive messages, but not simultaneously. A message consists
primarily of an id, which represents the priority of the message, and up to eight data bytes. It is
transmitted serially onto the bus. This signal pattern is encoded in non-return-to-zero (NRZ) and
is sensed by all nodes.
The devices that are connected by a CAN network are typically sensors, actuators, and other
control devices. These devices are not connected directly to the bus, but through a host processor
and a CAN controller.
If the bus is free, any node may begin to transmit. If two or more nodes begin sending messages
at the same time, the message with the more dominant id (which has more dominant bits, i.e.,
zeroes) will overwrite other nodes' less dominant id's, so that eventually (after this arbitration on
the id.) only the dominant message remains and is received by all nodes. This mechanism is
referred to as priority based bus arbitration. Messages with numerically smaller values of id.
have higher priority and are transmitted first.
• Host processor
o The host processor decides what received messages mean and which messages it
wants to transmit itself.
o Sensors, actuators and control devices can be connected to the host processor.
• CAN controller (hardware with a synchronous clock).
o Receiving: the CAN controller stores received bits serially from the bus until an
entire message is available, which can then be fetched by the host processor
(usually after the CAN controller has triggered an interrupt).
o Sending: the host processor stores its transmit messages to a CAN controller,
which transmits the bits serially onto the bus.
• Transceiver (possibly integrated into the CAN controller)
o Receiving: it adapts signal levels from the bus to levels that the CAN controller
expects and has protective circuitry that protects the CAN controller.
o Sending: it converts the transmit-bit signal received from the CAN controller into
a signal that is sent onto the bus.
Bit rates up to 1 Mbit/s are possible at network lengths below 40 m. Decreasing the bit rate
allows longer network distances (e.g., 500 m at 125 kbit/s).
The CAN data link layer protocol is standardized in ISO 11898-1 (2003). This standard describes
mainly the data link layer (composed of the logical link control (LLC) sublayer and the media
access control (MAC) sublayer) and some aspects of the physical layer of the OSI reference
model. All the other protocol layers are the network designer's choice.
Data transmission
This is achieved by CAN transmitting data through a binary model of "dominant" bits and
"recessive" bits where dominant is a logical 0 and recessive is a logical 1. This means open
collector, or wired or physical implementation of the bus (but since dominant is 0 this is
sometimes referred to as wired and). If one node transmits a dominant bit and another node
transmits a recessive bit then the dominant bit "wins" (a logical AND between the two).
So, if you are transmitting a recessive bit, and someone sends a dominant bit, you see a dominant
bit, and you know there was a collision. (All other collisions are invisible.) A dominant bit is
asserted by creating a voltage across the wires while a recessive bit is simply not asserted on the
bus. If any node sets a voltage difference, all nodes will see it. Thus there is no delay to the
higher priority messages, and the node transmitting the lower priority message automatically
attempts to re-transmit 6 bit clocks after the end of the dominant message.
When used with a differential bus, a carrier sense multiple access/bitwise arbitration
(CSMA/BA) scheme is often implemented: if two or more devices start transmitting at the same
time, there is a priority based arbitration scheme to decide which one will be granted permission
to continue transmitting. The CAN solution to this is prioritized arbitration (and for the dominant
message delay free), making CAN very suitable for real time prioritised communications
systems.
During arbitration, each transmitting node monitors the bus state and compares the received bit
with the transmitted bit. If a dominant bit is received when a recessive bit is transmitted then the
node stops transmitting (i.e., it lost arbitration). Arbitration is performed during the transmission
of the identifier field. Each node starting to transmit at the same time sends an id. with dominant
as binary 0, starting from the high bit. As soon as their id. is a larger number (lower priority)
they'll be sending 1 (recessive) and see 0 (dominant), so they back off. At the end of id.
transmission, all nodes but one have backed off, and the highest priority message gets through
unimpeded.
For example, consider an 11-bit id. CAN network, with two nodes with id's of 15 (binary
representation, 00000001111) and 16 (binary representation, 00000010000). If these two nodes
transmit at the same time, each will transmit the first 6 zeros of their id. with no arbitration
decision being made. When the 7th bit is transmitted, the node with the id. of 16 transmit a 1
(recessive) for its id., and the node with the id. of 15 transmits a 0 (dominant) for its id.. When
this happens, the node with the id. of 16 will realize that it lost its arbitration, and allow the node
with id. of 15 to continue its transmission. This ensures that the node with the lower bit value
will always win the arbitration. The id. with the smaller number will win the right to use.
Id. allocation
Messages id's must be unique on a single CAN bus, otherwise two nodes would continue
transmission beyond the end of the arbitration field (id.) causing an error.
The choice of id's for messages is often done simply on the basis of identifying the type of data
and the sending node; however, as the id. is also used as the message priority, this can lead to
poor real-time performance. For example, if an urgent message with a short deadline has a
numerically high id. (low priority) then its transmission can be delayed by other messages with
lower numerical id's (higher priority), even though these messages may have much longer
deadlines.
In the early 1990s, CAN messages in automotive systems were typically given id's based only on
the type of data and sending node, and this led to the widely held but incorrect belief that a low
CAN bus utilization of circa 30% was required to ensure that all messages would meet their
deadlines. However, if id's are instead determined based on the deadline of the message, so the
shorter the deadline, the lower the numerical id. and hence the higher the message priority, then
bus utilizations of 70 to 80% can typically be achieved before any message deadlines are missed.
Bit timing
Each node in a CAN network has its own clock, and no clock is sent during data transmission.
Synchronization is done by dividing each bit of the frame into a number of segments:
Synchronization, Propagation, Phase 1 and Phase 2. The Length of each phase segment can be
adjusted based on network and node conditions. The sample point falls between Phase Buffer
Segment 1 and Phase Buffer Segment 2, which helps facilitate continuous synchronization.
Continuous synchronization in turn enables the receiver to be able to properly read the messages.
Layers
Based on levels of abstraction, the structure of the CAN protocol can be described in terms of the
following layers:
• Application Layer
• Object Layer
o Message Filtering
o Message and Status Handling
Transfer Layer
The Transfer Layer represents the kernel of the CAN protocol. It presents messages
received to the object layer and accepts messages to be transmitted from the object layer.
The transfer layer is responsible for bit timing and synchronization, message framing,
arbitration, acknowledgement, error detection and signalling, and fault confinement. It
performs:
• Fault Confinement
• Error Detection
• Message Validation
• Acknowledgement
• Arbitration
• Message Framing
• Transfer Rate and Timing
• Information Routing
Physical Layer
CAN bus in its original form was a link layer protocol specification that made reference to the
physical layer only in abstract terms. (IE as a medium that supported multiple access at the
individual bit level by providing dominant and recessive states). In recent times the ISO11898-2
standard went some distance towards providing a candidate concrete class definition for the
electrical part of the physical layer and is now widely adopted as a standard solution. The
mechanical aspects of the physical layer however (connector type, pin-outs etc.) continue to lack
formal treatment and it is from this background that we see the emergence of several de-facto
standards for mechanical implementation with the 9 Way ‘D’ type CAN-(2), CAN+(7), OV (3),
Supply(9) configuration as one of the most common.
[Tip for node designers here wishing to standardise on the de-facto mechanical interface:- Make
sure each node is provided with 1 male and 1 female 9 Way D connector electrically wired in
parallel. – Assume power is fed to the male and drawn from the female – Adoption of this
strategy allows buses to be constructed using standard cable sets and avoids the use of the
dreaded ‘ hand built 2 cables into 1 D type’ scenario which over the years has made a significant
contribution to bus unreliability, cable incompatibility and per network cost.]
The absence of a formal definition for the physical layer had the original advantage of freeing the
scope of CAN bus from the constraints of any one particular physical implementation however
its legacy has been to leave CAN bus implementations open to inter-operability issues in the
physical domain.
The very high noise immunity on ISO11898-2 is achieved by ensuring that the differential
impedance of the bus is maintained at a very low level using low value resistors (120 ohms)
mounted at each end of the bus. The low impedance draws more current (and power) than other
voltage based signalling specifications during the dominant state. On CAN bus systems,
balanced line operation, where current in one signal line is exactly balanced by current in the
opposite direction in the other signal leg becomes an essential facility to provide an independant
stable 0 V reference for the receivers. Best practice determines that CAN bus balanced pair
signals be carried in twisted pair form within a shielded cable and it is this precaution that helps
to keep RF emissions to a minimum.
Whilst ISO11898-2 provides a small degree of immunity to common mode voltage between
transmitter and receiver it is usual to implement networks with a high degree of voltage
association between the transceivers of different nodes by having a 0 V rail running along the
bus. Also, in the de-facto configuration, a supply rail is also included to distribute power to each
of the participating CAN bus transceiver nodes. The design intention here is to provide a
common supply for all the transceivers rather than as a convenient method of powering all the
nodes. It should be noted however, that the actual Voltage to be applied, which nodes apply it (if
any) are application specific and not formally specified. Common ‘good practice’ node design
might provide each node with transceivers which are optically isolated from their node host and
derive a 5 V linearly regulated supply voltage for the transceivers from the universal supply rail
provided by the bus. This configuration generally allows a sufficiently wide operating margin on
the supply rail to provide interoperability across a broad spectrum of different node types.
Typical values of supply voltage on such networks range between 7 and 30 Volts however lack
of standardisation means that ultimately it is up to the individual system designer to check out all
aspects of supply rail compatibility.
The standard (ISO11898-2) describes the electrical implementation formed from a multi-dropped
single-ended balanced line configuration with resistor termination at each end of the bus. In this
configuration a dominant state is asserted by 1 or more transmitters switching the CAN- to
supply 0 V and (simultaneously) switching CAN+ to the +5 V bus voltage thereby forming a
current path through the resistors that terminate the bus. As such the terminating resistors form
an essential component of the signalling system and are included not just to limit wave reflection
at high frequency. During a recessive state the signal lines and resistor(s) remain in a high
impedances state with respect to both rails. Voltages on both CAN+ and CAN- tend (weakly)
towards ½ rail voltage. During a dominant state the signal lines and resistor(s) move to a low
impedance state with respect to the rails so that current flows through the resistor. CAN+ voltage
tends to +5 V and CAN- tends to 0 V. A recessive state is only present on the bus when none of
the transmitters on the bus is asserting a dominant state. Irrespective of signal state the signals
lines are always in low impedance state with respect to one another by virtue of the terminating
resistors at the end of the bus.
It should be noted that this signalling strategy differs significantly from other balanced line
transmission technologies such as RS-422/3, RS-485, etc. which employ differential line drivers/
receivers and use a signalling system based on the differential mode voltage of the balanced line
crossing a notional 0 V. Multiple access on such systems normally relies on the media supporting
3 states (active high, active low and inactive tri-state)and is dealt with in the time domain.
Multiple access on CAN bus is achieved by the electrical logic of the system supporting just 2
states that are conceptually analagous to a ‘wired OR’ network.
Frames
A CAN network can be configured to work with two different message (or "frame") formats: the
standard or base frame format (or CAN 2.0 A), and the extended frame format (or CAN 2.0 B).
The only difference between the two formats is that the "CAN base frame" supports a length of
11 bits for the identifier, and the "CAN extended frame" supports a length of 29 bits for the
identifier, made up of the 11-bit identifier ("base identifier") and an 18-bit extension ("identifier
extension"). The distinction between CAN base frame format and CAN extended frame format is
made by using the IDE bit, which is transmitted as dominant in case of an 11-bit frame, and
transmitted as recessive in case of a 29-bit frame. CAN controllers that support extended frame
format messages are also able to send and receive messages in CAN base frame format. All
frames begin with a start-of-frame (SOF) bit that denotes the start of the frame transmission.
Data frame
The data frame is the only frame for actual data transmission. There are two message formats:
The CAN standard requires the implementation must accept the base frame format and may
accept the extended frame format, but must tolerate the extended frame format.
ZigBee
ZigBee module. The €1 coin, shown for size reference, is about 23 mm (0.9 inch) in diameter.
ZigBee is a specification for a suite of high level communication protocols using small, low-
power digital radios based on the IEEE 802.15.4-2003 standard for Low-Rate Wireless Personal
Area Networks (LR-WPANs), such as wireless light switches with lamps, electrical meters with
in-home-displays, consumer electronics equipment via short-range radio needing low rates of
data transfer. The technology defined by the ZigBee specification is intended to be simpler and
less expensive than other WPANs, such as Bluetooth. ZigBee is targeted at radio-frequency (RF)
applications that require a low data rate, long battery life, and secure networking.
Technical overview
ZigBee is a low-cost, low-power, wireless mesh networking standard. First, the low cost allows
the technology to be widely deployed in wireless control and monitoring applications. Second,
the low power-usage allows longer life with smaller batteries. Third, the mesh networking
provides high reliability and more extensive range.
It is not capable of powerline networking though other elements of the OpenHAN standards suite
promoted by openAMI [1] and UtilityAMI [2] deal with communications co-extant with AC
power outlets. In other words, ZigBee is intended not to support powerline networking but to
interface with it at least for smart metering and smart appliance purposes. Utilities, e.g. Penn
Energy, have declared the intent to require them to interoperate [3] again via the openHAN
standards.
The ZigBee Alliance is a group of companies that maintain and publish the ZigBee standard. The
term ZigBee is a registered trademark of this group, not a single technical standard.
As per its main role, it standardizes the body that defines ZigBee, and also publishes application
profiles that allow multiple OEM vendors to create interoperable products. The current list of
application profiles either published, or in the works are:
Released specifications
The relationship between IEEE 802.15.4 and ZigBee[2] is similar to that between IEEE 802.11
and the Wi-Fi Alliance. The ZigBee 1.0 specification was ratified on 14 December 2004 and is
available to members of the ZigBee Alliance. Most recently, the ZigBee 2007 specification was
posted on 30 October 2007. The first ZigBee Application Profile, Home Automation, was
announced 2 November 2007. As amended by NIST, the Smart Energy Profile 2.0 specification
will remove the dependency on IEEE 802.15.4. Device manufacturers will be able to implement
any MAC/PHY, such as IEEE 802.15.4(x) and IEEE P1901, under an IP layer based on
6LoWPAN.
ZigBee operates in the industrial, scientific and medical (ISM) radio bands; 868 MHz in Europe,
915 MHz in the USA and Australia, and 2.4 GHz in most jurisdictions worldwide. The
technology is intended to be simpler and less expensive than other WPANs such as Bluetooth.
ZigBee chip vendors typically sell integrated radios and microcontrollers with between 60 KB
and 256 KB flash memory.
• Atmel ATmega128RFA1
• Digi International XBee XB24CZ7PIS-004
• Freescale MC13213
• Ember EM250
• Jennic JN5148
• Renesas uPD78F8056/57/58, M16C/6B3 and R8C/3MQ
• STMicroelectronics STM32W
• Samsung Electro-Mechanics ZBS240
• Texas Instruments CC2530 and CC2520
Radios are also available as stand-alone components to be used with any processor or
microcontroller. Generally, the chip vendors also offer the ZigBee software stack, although
independent ones are also available.
Because ZigBee can activate (go from sleep to active mode) in 30 msec or less, the latency can
be very low and devices can be very responsive — particularly compared to Bluetooth wake-up
delays, which are typically around three seconds. [3] Because ZigBees can sleep most of the time,
average power consumption can be very low, resulting in long battery life.
The first stack release is now called ZigBee 2004. The second stack release is called ZigBee
2006, and mainly replaces the MSG/KVP structure used in 2004 with a "cluster library". The
2004 stack is now more or less obsolete.[citation needed]
ZigBee 2007, now the current stack release, contains two stack profiles, stack profile 1 (simply
called ZigBee), for home and light commercial use, and stack profile 2 (called ZigBee Pro).
ZigBee Pro offers more features, such as multi-casting, many-to-one routing and high security
with Symmetric-Key Key Exchange (SKKE), while ZigBee (stack profile 1) offers a smaller
footprint in RAM and flash. Both offer full mesh networking and work with all ZigBee
application profiles.[citation needed]
ZigBee 2007 is fully backward compatible with ZigBee 2006 devices: A ZigBee 2007 device
may join and operate on a ZigBee 2006 network and vice versa. Due to differences in routing
options, ZigBee Pro devices must become non-routing ZigBee End-Devices (ZEDs) on a ZigBee
2006 network, the same as for ZigBee 2006 devices on a ZigBee 2007 network must become
ZEDs on a ZigBee Pro network. The applications running on those devices work the same,
regardless of the stack profile beneath them.
Licensing
For non-commercial purposes, the ZigBee specification is available free to the general public. [4]
An entry level membership in the ZigBee Alliance, called Adopter, provides access to the as-yet
unpublished specifications and permission to create products for market using the specifications.
The click through license on the ZigBee specification requires a commercial developer to join
the ZigBee Alliance. "No part of this specification may be used in development of a product for
sale without becoming a member of ZigBee Alliance." This causes problems for open-source
developers because the annual fee conflicts with the GNU General Public License. From the
GPL v2, "b) You must cause any work that you distribute or publish, that in whole or in part
contains or is derived from the Program or any part thereof, to be licensed as a whole at no
charge to all third parties under the terms of this License." Since the GPL makes no distinction
between commercial and non-commercial use it is impossible to implement a GPL licensed
ZigBee stack or combine a ZigBee implementation with GPL licensed code. The requirement for
the developer to join the ZigBee Alliance similarly conflicts with most other Free software
licenses.[5]
Uses
ZigBee protocols are intended for use in embedded applications requiring low data rates and low
power consumption. ZigBee's current focus is to define a general-purpose, inexpensive, self-
organizing mesh network that can be used for industrial control, embedded sensing, medical data
collection, smoke and intruder warning, building automation, home automation, etc. The
resulting network will use very small amounts of power — individual devices must have a
battery life of at least two years to pass ZigBee certification.[6]
• Wireless Sensor Networks' — Starting with individual sensors like Telosb/Tmote and
Iris from Memsic.
Device types
• ZigBee coordinator (ZC): The most capable device, the coordinator forms the root of the
network tree and might bridge to other networks. There is exactly one ZigBee coordinator
in each network since it is the device that started the network originally. It is able to store
information about the network, including acting as the Trust Center & repository for
security keys[8][9].
• ZigBee Router (ZR): As well as running an application function, a router can act as an
intermediate router, passing on data from other devices.
• ZigBee End Device (ZED): Contains just enough functionality to talk to the parent node
(either the coordinator or a router); it cannot relay data from other devices. This
relationship allows the node to be asleep a significant amount of the time thereby giving
long battery life. A ZED requires the least amount of memory, and therefore can be less
expensive to manufacture than a ZR or ZC.
Protocols
The protocols build on recent algorithmic research (Ad-hoc On-demand Distance Vector,
neuRFon) to automatically construct a low-speed ad-hoc network of nodes. In most large
network instances, the network will be a cluster of clusters. It can also form a mesh or a single
cluster. The current profiles derived from the ZigBee protocols support beacon and non-beacon
enabled networks.
In beacon-enabled networks, the special network nodes called ZigBee Routers transmit periodic
beacons to confirm their presence to other network nodes. Nodes may sleep between beacons,
thus lowering their duty cycle and extending their battery life. Beacon intervals may range from
15.36 milliseconds to 15.36 ms * 214 = 251.65824 seconds at 250 kbit/s, from 24 milliseconds to
24 ms * 214 = 393.216 seconds at 40 kbit/s and from 48 milliseconds to 48 ms * 2 14 = 786.432
seconds at 20 kbit/s. However, low duty cycle operation with long beacon intervals requires
precise timing, which can conflict with the need for low product cost.
In general, the ZigBee protocols minimize the time the radio is on so as to reduce power use. In
beaconing networks, nodes only need to be active while a beacon is being transmitted. In non-
beacon-enabled networks, power consumption is decidedly asymmetrical: some devices are
always active, while others spend most of their time sleeping.
Except for the Smart Energy Profile 2.0, which will be MAC/PHY agnostic, ZigBee devices are
required to conform to the IEEE 802.15.4-2003 Low-Rate Wireless Personal Area Network
(WPAN) standard. The standard specifies the lower protocol layers—the physical layer (PHY),
and the media access control (MAC) portion of the data link layer (DLL). This standard specifies
operation in the unlicensed 2.4 GHz (worldwide), 915 MHz (Americas) and 868 MHz (Europe)
ISM bands. In the 2.4 GHz band there are 16 ZigBee channels, with each channel requiring
5 MHz of bandwidth. The center frequency for each channel can be calculated as, FC = (2405 + 5
* (ch - 11)) MHz, where ch = 11, 12, ..., 26.
The radios use direct-sequence spread spectrum coding, which is managed by the digital stream
into the modulator. BPSK is used in the 868 and 915 MHz bands, and OQPSK that transmits
four bits per symbol is used in the 2.4 GHz band. The raw, over-the-air data rate is 250 kbit/s per
channel in the 2.4 GHz band, 40 kbit/s per channel in the 915 MHz band, and 20 kbit/s in the
868 MHz band. Transmission range is between 10 and 75 meters (33 and 246 feet) and up to
1500 meters for zigbee pro, although it is heavily dependent on the particular environment. The
output power of the radios is generally 0 dBm (1 mW).
The basic channel access mode is "carrier sense, multiple access/collision avoidance"
(CSMA/CA). That is, the nodes talk in the same way that people converse; they briefly check to
see that no one is talking before they start. There are three notable exceptions to the use of
CSMA. Beacons are sent on a fixed timing schedule, and do not use CSMA. Message
acknowledgments also do not use CSMA. Finally, devices in Beacon Oriented networks that
have low latency real-time requirements may also use Guaranteed Time Slots (GTS), which by
definition do not use CSMA.
ZigBee RF4CE
On March 3, 2009 the RF4CE (Radio Frequency for Consumer Electronics) Consortium agreed
to work with the ZigBee Alliance to jointly deliver a standardized specification for radio
frequency-based remote controls. ZigBee RF4CE is designed to be deployed in a wide range of
remotely-controlled audio/visual consumer electronics products, such as TVs and set-top boxes.
It promises many advantages over existing remote control solutions, including richer
communication and increased reliability, enhanced features and flexibility, interoperability, and
no line-of-sight barrier.[10]
The software is designed to be easy to develop on small, inexpensive microprocessors. The radio
design used by ZigBee has been carefully optimized for low cost in large scale production. It has
few analog stages and uses digital circuits wherever possible.
Even though the radios themselves are inexpensive, the ZigBee Qualification Process involves a
full validation of the requirements of the physical layer. This amount of concern about the
Physical Layer has multiple benefits, since all radios derived from that semiconductor mask set
would enjoy the same RF characteristics. On the other hand, an uncertified physical layer that
malfunctions could cripple the battery lifespan of other devices on a ZigBee network. Where
other protocols can mask poor sensitivity or other esoteric problems in a fade compensation
response, ZigBee radios have very tight engineering constraints: they are both power and
bandwidth constrained. Thus, radios are tested to the ISO 17025 standard with guidance given by
Clause 6 of the 802.15.4-2006 Standard. Most vendors plan to integrate the radio and
microcontroller onto a single chip [4] getting smaller devices [5].
History
• ZigBee-style networks began to be conceived around 1998, when many installers realized
that both Wi-Fi and Bluetooth were going to be unsuitable for many applications. In
particular, many engineers[by whom?]
saw a need for self-organizing ad-hoc digital radio
networks.[citation needed]
• The IEEE 802.15.4-2003 standard was completed in May 2003 and has been superseded
by the publication of IEEE 802.15.4-2006. [6]
• In the summer of 2003, Philips Semiconductors, a major mesh network supporter, ceased
the investment. Philips Lighting has, however, continued Philips' participation, and
Philips remains a promoter member on the ZigBee Alliance Board of Directors.[citation needed]
• The ZigBee Alliance announced in October 2004 that the membership had more than
doubled in the preceding year and had grown to more than 100 member companies, in 22
countries. By April 2005 membership had grown to more than 150 companies, and by
December 2005 membership had passed 200 companies.[citation needed]
• The ZigBee specifications were ratified on 14 December 2004.[citation needed]
• The ZigBee Alliance announces public availability of Specification 1.0 on 13 June 2005,
known as ZigBee 2004 Specification.
• The ZigBee Alliance announces the completion and immediate member availability of
the enhanced version of the ZigBee Standard in September 2006, known as ZigBee 2006
Specification.
• During the last quarter of 2007, ZigBee PRO, the enhanced ZigBee specification was
finalized.[citation needed]
The name of the brand is originated with reference to the behaviour of honey bees after their
return to the beehive
Buzzer
Mechanical
Electromechanical
Early devices were based on an electromechanical system identical to an electric bell without the
metal gong. Similarly, a relay may be connected to interrupt its own actuating current, causing
the contacts to buzz. Often these units were anchored to a wall or ceiling to use it as a sounding
board. The word "buzzer" comes from the rasping noise that electromechanical buzzers made.
Piezoelectric
Piezoelectric disk beeper
A piezoelectric element may be driven by an oscillating electronic circuit or other audio signal
source, driven with a piezoelectric audio amplifier. Sounds commonly used to indicate that a
button has been pressed are a click, a ring or a beep.
Uses
• Annunciator panels
• Electronic metronomes
• Game shows
• Microwave ovens and other household appliances
• Sporting events such as basketball games
Alarms include:
• burglar alarms, designed to warn of burglaries; this is often a silent alarm: the police or
guards are warned without indication to the burglar, which increases the chances of
catching him or her.
• alarm clocks can produce an alarm at a given time
• distributed control manufacturing systems or DCSs, found in nuclear power plants,
refineries and chemical facilities also generate alarms to direct the operator's attention to
an important event that he or she needs to address.
• alarms in an operation and maintenance (O&M) monitoring system, which informs the
bad working state of (a particular part of) the system under monitoring.
o first-out alarm
• safety alarms, which go off if a dangerous condition occurs. Common public safety
alarms include:
o tornado sirens
o fire alarms
"Multiple-alarm fire", a locally-specific measure of the severity of a fire
and the fire-department reaction required.
o car alarms
o community Alarm or autodialer alarm (medical alarms)
o air raid sirens
o personal alarm
o tocsins — a historical method of raising an alarm
Alarms have the capability of causing a fight-or-flight response in humans; a person under this
mindset will panic and either flee the perceived danger or attempt to eliminate it, often ignoring
rational thought in either case. We can characterise a person in such a state as "alarmed".
With any kind of alarm, the need exists to balance between on the one hand the danger of false
alarms (called "false positives") — the signal going off in the absence of a problem — and on the
other hand failing to signal an actual problem (called a "false negative"). False alarms can waste
resources expensively and can even be dangerous. For example, false alarms of a fire can waste
firefighter manpower, making them unavailable for a real fire, and risk injury to firefighters and
others as the fire engines race to the alleged fire's location. In addition, false alarms may
acclimatise people to ignore alarm signals, and thus possibly to ignore an actual emergency:
Aesop's fable of The Boy Who Cried Wolf exemplifies this problem.
Etymology
The word comes from the Old French À l'arme meaning "To the arms", "To the weapons",
telling armed men to pick up their weapons and get ready for action, because an enemy may have
suddenly appeared.
Software components
Go to Project – Open Project and browse for Hello in Ch03_00 in Pont and open it.
Go to Project – Select Device for Target ‘Target1’
The flashing LED we will view will be connected to Port 1. We therefore want to
observe the activity on this port
To ensure that the port activity is visible, we need to start the ‘periodic window
update’ flag
Go to Debug - Go
While the simulation is running, view the performance analyzer to check the delay
durations.
Go to
Debug – Performance Analyzer and click on it
Keil is a cross compiler. So first we have to understand the concept of compilers and
cross compilers. After then we shall learn how to work with keil.
Concept of compiler: -
Compilers are programs used to convert a High Level Language to object code.
Desktop compilers produce an output object code for the underlying
microprocessor, but not for other microprocessors. I.E the programs written in one
of the HLL like ‘C’ will compile the code to run on the system for a particular
processor like x86 (underlying microprocessor in the computer). For example
compilers for Dos platform is different from the Compilers for Unix platform
A cross compiler is similar to the compilers but we write a program for the target
processor (like 8051 and its derivatives) on the host processors (like computer of
x86)
It means being in one environment you are writing a code for another
environment is called cross development. And the compiler used for cross
development is called cross compiler
So the definition of cross compiler is a compiler that runs on one computer but
produces object code for a different type of computer. Cross compilers are used
to generate software that can run on computers with a new architecture or on
special-purpose devices that cannot host their own compilers. Cross compilers
are very popular for embedded development, where the target probably couldn't
run a compiler. Typically an embedded platform has restricted RAM, no hard
disk, and limited I/O capability. Code can be edited and compiled on a fast host
machine (such as a PC or Unix workstation) and the resulting executable code
can then be downloaded to the target to be tested. Cross compilers are
beneficial whenever the host machine has more resources (memory, disk, I/O
etc) than the target. Keil C Compiler is one such compiler that supports a huge
number of host and target combinations. It supports as a target to 8 bit
microcontrollers like Atmel and Motorola etc.
There are several advantages of using cross compiler. Some of them are
described as follows
Now after going through the concept of compiler and cross compilers lets we start
with Keil C cross compiler.
• Project Manager
• Simulator
• Debugger
Keil Software provides you with software development tools for the ARM
microcontrollers. With these tools, you can generate embedded applications for the
multitude of ARM derivatives. Keil provides following tools for ARM development
2. Macro Assembler,
3. ARM Utilities (linker, object file converter, library manager),
4. Source-Level Debugger/Simulator,
The keil ARM tool kit includes three main tools, assembler, compiler and linker.
A linker is used to create an absolute object module suitable for your in-circuit
emulator.
Embedded C:
Data Types:
U people have already come across the word “Data types” in C- Language. Here also the
functionality and the meaning of the word is same except a small change in the prefix of their
labels. Now we will discuss some of the widely used data types for embedded C- programming.
The sbit data type is widely used and designed specifically to access single bit
addressable registers. It allows access to the single bits of the SFR registers.
Source code:
#include<reg52.h>
#include<intrins.h>
#include "lcd.h"
void _nop_(void);
sbit sck=P3^4;
sbit dout=P3^5;
sbit din=P3^6;
sbit cs=P3^7;
void integer_lcd(int);
void timer(unsigned int);
void init_lcd(void);
void cmd_lcd(unsigned char);
void write_lcd(unsigned char);
void delay_ms(unsigned int);
bit flag=0;
void transmit(unsigned char *);
void integer_lcd1(int);
void main(void)
{
unsigned int p=0,t=0;
TMOD=0x20;
SCON=0x50;
TH1=0XFD;
TR1=1;
IE=0x90;
init_lcd();
display_lcd("real time patient");
cmd_lcd(0xc0);
display_lcd("USING CAN BUS");
delay_ms(1000);
while(1)
{
cs=0;
byte1=txrxbyte(0x06);
byte2=txrxbyte(0x00);
byte3=txrxbyte(0x00);
i=(byte2&0x0f);
i=(i<<8|byte3);
dcode1=(((4.096*i)/4096));
//output1=dcode1;
dcode1=dcode1/0.035;
cs=1;
delay_ms(10);
cs=0;
byte1=txrxbyte(0x06);
byte2=txrxbyte(0x40);
byte3=txrxbyte(0x00);
i=(byte2&0x0f);
i=(i<<8|byte3);
dcode2=(((4.096*i)/4096));
//output1=dcode1;
dcode2=dcode2*100;
cs=1;
delay_ms(10);
if(dcode2>45)
{
SBUF='T';
while(!TI);
TI=0;
}
else
{
SBUF='t';
while(!TI);
TI=0;
}
if(dcode1>70)
{
SBUF='H';
while(!TI);
TI=0;
}
else
{
SBUF='h';
while(!TI);
TI=0;
}
cmd_lcd(0x01);
display_lcd("TEMPARATURE: *C");
cmd_lcd(0xc0);
integer_lcd(dcode2);
delay_ms(1000);
cmd_lcd(0x01);
display_lcd("Humidity: %RH");
cmd_lcd(0xc0);
integer_lcd(dcode1);
delay_ms(1000);
}
}
while(*t_data!='\0')
{
SBUF = *t_data;
while(!TI);
TI=0;
t_data++;
}
for(i=0;i<8;i++)
{
sck=1;
if(d&mask)
{din=1;}
else
{din=0;}
sck=0;
if(dout==1)
{c=c|mask;}
mask=mask>>1;
return c;
}
Receiver section:
//program to implement rs232 serial communication using loop back test
#include<reg51.h>
#define LCD P2
sbit AB =P1^0;
void init_lcd(void);
void cmd_lcd(unsigned char);
void write_lcd(unsigned char);
void display_lcd(unsigned char *);
void delay_ms(unsigned int);
while(1);
{
cmd_lcd(0xc0);
while(*c)
{
SBUF=*c++; //transmit byte
delay_ms(100);
}
delay_ms(1000);
c=s;
}
}
void init_lcd(void)
{
delay_ms(10);
cmd_lcd(0x28);
cmd_lcd(0x0e);
cmd_lcd(0x06);
cmd_lcd(0x01);
}
Electronic Components
-D.V.Prasad
Wireless Communications
- Theodore S. Rappaport
www.national.com
www.nxp.com
www.8052.com
www.microsoftsearch.com
www.geocities.com