Batch 1
Batch 1
Batch 1
Embedded systems are electronic devices that incorporate microprocessors with in Their
implementations. The main purposes of the microprocessors are to simplify the system design
and provide flexibility. Having a microprocessor in the device means that removing the bugs,
making modifications, or adding new features are only matters of rewriting the software that
controls the device. Or in other words embedded computer systems are electronic systems that
include a microcomputer to perform a specific dedicated application. The computer is hidden
inside these products. Embedded systems are ubiquitous. Every week millions of tiny computer
chips come pouring out of factories finding their way into our everyday products.
Embedded systems are self-contained programs that are embedded within a piece of
hardware. Whereas a regular computer has many different applications and software that can be
applied to various tasks, embedded systems are usually set to a specific task that cannot be
altered without physically manipulating the circuitry. Another way to think of an embedded
system is as a computer system that is created with optimal efficiency, thereby allowing it to
complete specific functions as quickly as possible.
Embedded systems technologies are usually fairly expensive due to the necessary
development time and built in efficiencies, but they are also highly valued in specific industries.
Smaller businesses may wish to hire a consultant to determine what sort of embedded systems
will add value to your organization.
Embedded
System
Software Hardware
ALP Processor
C Peripherals
VB memory
Etc.,
Software deals with the languages like ALP, C, and VB etc., and Hardware deals with Processors,
Peripherals, and Memory.
Transport
Domestic service
Communications
Office systems and mobile equipment
Banking, finance and commercial
Medical diagnostics, monitoring and life support
Testing, monitoring and diagnostic systems
ALU
CU
Memory
Etc.,
Digital Signal Processors (DSPs):
Digital Signal Processors is one which performs scientific and mathematical operation. Digital Signal
Processor chips - specialized microprocessors with architectures designed specifically for the types of
operations required in digital signal processing. Like a general-purpose microprocessor, a DSP is a
programmable device, with its own native instruction code. DSP chips are capable of carrying out
millions of floating point operations per second, and like their better-known general-purpose cousins,
faster and more powerful versions are continually being introduced. DSPs can also be embedded within
complex "system-on-chip" devices, often containing both analog and digital circuitry.
Application Specific Integrated Circuit (ASIC)
ASIC is a combination of digital and analog circuits packed into an IC to achieve the desired
control/computation function
There are two different types of computer instruction set there are:
A RISC (reduced instruction set computer) is a microprocessor that is designed to perform a smaller
number of types of computer instruction so that it can operate at a higher speed (perform more million
instructions per second, or millions of instructions per second). Since each instruction type that a
computer must perform requires additional transistors and circuitry, a larger list or set of computer
instructions tends to make the microprocessor more complicated and slower in operation.
Besides performance improvement, some advantages of RISC and related design improvements are:
A new microprocessor can be developed and tested more quickly if one of its aims is to be less
complicated.
Operating system and application programmers who use the microprocessor's instructions will
find it easier to develop code with a smaller instruction set.
The simplicity of RISC allows more freedom to choose how to use the space on a
microprocessor.
Higher-level language compilers produce more efficient code than formerly because they have always
tended to use the smaller set of instructions to be found in a RISC computer.
RISC characteristics
Simpleinstructionset:
In a RISC machine, the instruction set contains simple, basic instructions, from which more complex
instructions can be composed.
Samelengthinstructions.
Each instruction is the same length, so that it may be fetched in a single operation.
1machine-cycleinstructions.
Most instructions complete in one machine cycle, which allows the processor to handle several
instructions at the same time. This pipelining is a key technique used to speed up RISC machines.
Complex Instruction Set Computer (CISC)
CISC, which stands for Complex Instruction Set Computer, is a philosophy for designing chips that
are easy to program and which make efficient use of memory. Each instruction in a CISC instruction set
might perform a series of operations inside the processor. This reduces the number of instructions
required to implement a given program, and allows the programmer to learn a small but flexible set of
instructions.
At the time of their initial development, CISC machines used available technologies to optimize
computer performance.
Microprogramming is as easy as assembly language to implement, and much less expensive than
hardwiring a control unit.
The ease of micro-coding new instructions allowed designers to make CISC machines upwardly
compatible: a new computer could run the same programs as earlier computers because the new
computer would contain a superset of the instructions of the earlier computers.
As each instruction became more capable, fewer instructions could be used to implement a given
task. This made more efficient use of the relatively slow main memory.
Because micro program instruction sets can be written to match the constructs of high-level
languages, the compiler does not have to be as complicated.
Disadvantages of CISC
Still, designers soon realized that the CISC philosophy had its own problems, including:
Earlier generations of a processor family generally were contained as a subset in every new
version --- so instruction set & chip hardware become more complex with each generation of computers.
So that as many instructions as possible could be stored in memory with the least possible wasted
space, individual instructions could be of almost any length---this means that different instructions will
take different amounts of clock time to execute, slowing down the overall performance of the machine.
Many specialized instructions aren't used frequently enough to justify their existence ---
approximately 20% of the available instructions are used in a typical program.
CISC instructions typically set the condition codes as a side effect of the instruction. Not only
does setting the condition codes take time, but programmers have to remember to examine the condition
code bits before a subsequent instruction changes them.
Memory Architecture
Harvard Architecture
Von-Neumann Architecture
Harvard Architecture
Computers have separate memory areas for program instructions and data. There are two or more
internal data buses, which allow simultaneous access to both instructions and data. The CPU fetches
program instructions on the program memory bus.
The Harvard architecture is a computer architecture with physically separate storage and signal
pathways for instructions and data. The term originated from the Harvard Mark I relay-based computer,
which stored instructions on punched tape (24 bits wide) and data in electro-mechanical counters. These
early machines had limited data storage, entirely contained within the central processing unit, and
provided no access to the instruction storage as data. Programs needed to be loaded by an operator, the
processor could not boot itself.
A computer has a single, common memory space in which both program instructions and data are stored.
There is a single internal data bus that fetches both instructions and data. They cannot be performed at
the same time
The von Neumann architecture is a design model for a stored-program digital computer that uses a
central processing unit (CPU) and a single separate storage structure ("memory") to hold both
instructions and data. It is named after the mathematician and early computer scientist John von
Neumann. Such computers implement a universal Turing machine and have a sequential architecture.
A stored-program digital computer is one that keeps its programmed instructions, as well as its data, in
read-write, random-access memory (RAM). Stored-program computers were advancement over the
program-controlled computers of the 1940s, such as the Colossus and the ENIAC, which were
programmed by setting switches and inserting patch leads to route data and to control signals between
various functional units. In the vast majority of modern computers, the same memory is used for both
data and program instructions. The mechanisms for transferring the data and instructions between the
CPU and memory are, however, considerably more complex than the original von Neumann
architecture.
The terms "von Neumann architecture" and "stored-program computer" are generally used
interchangeably, and that usage is followed in this article.
The primary difference between Harvard architecture and the Von Neumann architecture is in the
Von Neumann architecture data and programs are stored in the same memory and managed by the same
information handling system.
Whereas the Harvard architecture stores data and programs in separate memory devices and they
are handled by different subsystems.
In a computer using the Von-Neumann architecture without cache; the central processing unit
(CPU) can either be reading and instruction or writing/reading data to/from the memory. Both of these
operations cannot occur simultaneously as the data and instructions use the same system bus.
In a computer using the Harvard architecture the CPU can both read an instruction and access
data memory at the same time without cache. This means that a computer with Harvard architecture can
potentially be faster for a given circuit complexity because data access and instruction fetches do not
contend for use of a single memory pathway.
Today, the vast majority of computers are designed and built using the Von Neumann architecture
template primarily because of the dynamic capabilities and efficiencies gained in designing,
implementing, operating one memory system as opposed to two. Von Neumann architecture may be
somewhat slower than the contrasting Harvard Architecture for certain specific tasks, but it is much
more flexible and allows for many concepts unavailable to Harvard architecture such as self
programming, word processing and so on.
Harvard architectures are typically only used in either specialized systems or for very specific
uses. It is used in specialized digital signal processing (DSP), typically for video and audio processing
products. It is also used in many small microcontrollers used in electronics applications such as
Advanced RISK Machine (ARM) based products for many vendors.
Characteristics
Two major areas of differences are cost and power consumption. Since many embedded systems
are produced in the tens of thousands to millions of units range, reducing cost is a major concern.
Embedded systems often use a (relatively) slow processor and small memory size to minimize costs.The
slowness is not just clock speed. The whole architecture of the computer is often intentionally simplified
to lower costs. For example, embedded systems often use peripherals controlled by synchronous serial
interfaces, which are ten to hundreds of times slower than comparable peripherals used in PCs.Programs
on an embedded system often must run with real-time constraints with limited hardware resources: often
there is no disk drive, operating system, keyboard or screen. A flash drive may replace rotating media,
and a small keypad and LCD screen may be used instead of a PC's keyboard and screen.Firmware is the
name for software that is embedded in hardware devices, e.g. in one or more ROM/Flash memory IC
chips.
Embedded systems are routinely expected to maintain 100% reliability while running
continuously for long periods, sometimes measured in years. Firmware is usually developed and tested
too much stricter requirements than is general-purpose software, which can usually be easily restarted if
a problem occurs.
Platform
There are many different CPU architectures used in embedded designs. 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.One common configuration for 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.
Tools
Like a typical computer programmer, embedded system designers use compilers,
assemblers and debuggers to develop an embedded system.
Software companies that specialize in the embedded market Ported from the GNU software
development tools. Sometimes, development tools for a personal computer can be used if the
embedded processor is a close relative to a common PC processor. Embedded system designers
also use a few software tools rarely used by typical computer programmers.Some designers keep
a utility program to turn data files into code, so that they can include any kind of data in a
program. Most designers also have utility programs to add a checksum or CRC to a program, so
it can check its program data before executing it.
Operating system
They often have no operating system, or a specialized embedded operating system (often
a real-time operating system), or the programmer is assigned to port one of these to the new
system.
Debugging
Debugging is usually performed with an in-circuit emulator, or some type of debugger
that can interrupt the micro controller’s internal microcode.
The microcode interrupt lets the debugger operate in hardware in which only the CPU works. The
CPU-based debugger can be used to test and debug the electronics of the computer from the viewpoint
of the CPU. This feature was pioneered on the PDP-11.
Developers should insist on debugging which shows the high-level language, with breakpoints and
single stepping, because these features are widely available. Also, developers should write and use
simple logging facilities to debug sequences of real-time events.PC or mainframe programmers first
encountering this sort of programming often become confused about design priorities and acceptable
methods. Mentoring, code-reviews and ego less programming are recommended.
Start-up
All embedded systems have start-up code. Usually it disables interrupts, sets up the
electronics, tests the computer (RAM, CPU and software), and then starts the application code.
Many embedded systems recover from short-term power failures by restarting (without recent
self-tests). Restart times under a tenth of a second are common.
Many designers have found one of more hardware plus software-controlled LEDs useful to
indicate errors during development (and in some instances, after product release, to produce
troubleshooting diagnostics). A common scheme is to have the electronics turn off the LED(s) at
reset, whereupon the software turns it on at the first opportunity, to prove that the hardware and
start-up software have performed their job so far. After that, the software blinks the LED(s) or
sets up light patterns during normal operation, to indicate program execution progress and/or
errors. This serves to reassure most technicians/engineers and some users.
Many designers prefer to design their state machines to check only one or two things per
state. Usually this is a hardware event, and a software timer.
Designers recommend that hierarchical state machines should run the lower-level state
machines before the higher, so the higher run with accurate information. Complex functions like
internal combustion controls are often handled with multi-dimensional tables. Instead of complex
calculations, the code looks up the values. The software can interpolate between entries, to keep
the tables small and cheap One major weakness of this system is that it does not guarantee a time
to respond to any particular hardware event. Careful coding can easily assure that nothing
disables interrupts for long. Thus interrupt code can run at very precise timings. Another major
weakness of this system is that it can become complex to add new features. Algorithms that take
a long time to run must be carefully broken down so only a little piece gets done each time
through the main loop.This system's strength is its simplicity, and on small pieces of software the
loop is usually so fast that nobody cares that it is not predictable. Another advantage is that this
system guarantees that the software will run. There is no mysterious operating system to blame
for bad behavior.
User interfaces
User interfaces for embedded systems vary wildly, and thus deserve some special
comment. Designers recommend testing the user interface for usability at the earliest possible
instant. A quick, dirty test is to ask an executive secretary to use cardboard models drawn with
magic markers, and manipulated by an engineer. The videotaped result is likely to be both
humorous and very educational. In the tapes, every time the engineer talk, the interface has
failed: It would cause a service call.
Exactly one person should approve the user interface. Ideally, this should be a customer, the
major distributor or someone directly responsible for selling the system. The decision maker should be
able to decide. The problem is that a committee will never make up its mind, and neither will some
people. Not doing this causes avoidable, expensive delays. A usability test is more important than any
number of opinions. Interface designers at PARC, Apple Computer, Boeing and HP minimize the
number of types of user actions. For example, use 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"). A touch-screen or screen-edge buttons also minimize the types of user actions.
Another basic trick is to minimize and simplify the type of output. Designs should
consider using 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 she speaks. For example, Boeing's standard test
interface is a button and some lights. When you press the button, all the lights turn on. When you
release the button, the lights with failures stay on. The labels are in Basic English. For another
example, look at a small computer printer. You might have one next to your computer. Notice
that the lights are labeled with stick-on labels that can be printed in any language. Really look at
it.
Designers use colors. Red means the users can get hurt- think of blood. Yellow means
something might be wrong. Green means everything's OK. Another essential trick is to make any
modes absolutely clear on the user's display.
Most designers prefer the display to respond to the user. The display should change
immediately after a user action. If the machine is going to do anything, it should start within 7
seconds, or give progress reports. If a design needs a screen, many designers use plain text. It can
be sold as a temporary expedient. Why is it better than pictures? Users have been reading signs
for years. A GUI is pretty and can do anything, but typically adds a year from artist, approval and
translator delays and one or two programmers to a project's cost, without adding any value.
Often, a clever GUI actually confuses users. If a design needs to point to parts of the machine (as
in copiers), these are labeled with numbers on the actual machine, that are visible with the doors
closed. A network interface is just a remote screen. It needs the same caution as any other user
interface. One of the most successful general-purpose screen-based interfaces is the two menu
buttons and a line of text in the user's native language. It's used in pagers, medium-priced
printers, network switches, and other medium-priced situations that require complex behavior
from users When there's text, there are languages. The default language should be the one most
widely understood. Right now this is English. French and Spanish follow.
Most designers recommend that one use the native character sets, no matter how painful.
People with peculiar character sets feel coddled and loved when their language shows up on
machinery they use. Text should be translated by professional translators, even if native speakers
are on staff. Marketing staff have to be able to tell foreign distributors that the translations are
professional.
A foreign organization should give the highest-volume distributor the duty to review and
correct any translations in his native language. This stops critiques by other native speakers, who
tend to believe that no foreign organization will ever know their language as well as they.
AT89C51 MICROCONTROLLER
FEATURES
80C51 based architecture
4-Kbytes of on-chip Reprogrammable Flash Memory
128 x 8 RAM
Two 16-bit Timer/Counters
Full duplex serial channel
Boolean processor
Four 8-bit I/O ports, 32 I/O lines
Memory addressing capability
– 64K ROM and 64K RAM
Power save modes:
– Idle and power-down
Six interrupt sources
Most instructions execute in 0.3 us
CMOS and TTL compatible
Maximum speed: 40 MHz @ Vcc = 5V
Industrial temperature available
Packages available:
– 40-pin DIP
– 44-pin PLCC
– 44-pin PQFP
GENERAL DESCRIPTION:
THE MICROCONTROLLER:
A microcontroller is a general purpose device, but that is meant to read data, perform limited
calculations on that data and control its environment based on those calculations. The prime use of a
microcontroller is to control the operation of a machine using a fixed program that is stored in ROM and
that does not change over the lifetime of the system. The microcontroller design uses a much more
limited set of single and double byte instructions that are used to move data and code from internal
memory to the ALU. The microcontroller is concerned with getting data from and to its own pins; the
architecture and instruction set are optimized to handle data in bit and byte size.
Supply voltage
GND
Ground
Port 0
Port 0 is an 8-bit open drain bi-directional I/O port. As an output port, each pin can sink eight TTL
inputs. When 1s are written to port 0 pins, the pins can be used as high impedance inputs.
Port 0 can also be configured to be the multiplexed low order address/data bus during access to
external program and data memory. In this mode, P 0 has internal pull-ups. Port 0 also receives the code
bytes during Flash programming and outputs the code bytes during program verification. External pull-
ups are required during program verification.
Port 1
Port 1 is an 8-bit bi-directional I/O port with internal pull-ups. The port 1output buffers can
sink/source four TTL inputs. When 1s are written to port 1 pins, they are pulled high by the internal pull-
ups can be used as inputs. As inputs, Port 1 pins that are externally being pulled low will source current
(1) because of the internal pull-ups.
Port 2
Port 2 is an 8-bit bi-directional I/O port with internal pull-ups. The port 2 output buffers can
sink/source four TTL inputs. When 1s are written to port 2 pins, they are pulled high by the internal
pull-ups can be used as inputs. As inputs, Port 2 pins that are externally being pulled low will source
current because of the internal pull-ups.
Port 2 emits the high-order address byte during fetches from external program memory and
during access to DPTR. In this application Port 2 uses strong internal pull-ups when emitting 1s. During
accesses to external data memory that use 8-bit data address (MOVX@R1), Port 2 emits the contents of
the P2 Special Function Register. Port 2 also receives the high-order address bits and some control
signals during Flash programming and verification.
Port 3
Port 3 is an 8-bit bi-directional I/O port with internal pull-ups. The port 3 output buffers can
sink/source four TTL inputs. When 1s are written to port 3 pins, they are pulled high by the internal pull-
ups can be used as inputs. As inputs, Port 3 pins that are externally being pulled low will source current
because of the internal pull-ups.
Port 3 also receives some control signals for Flash Programming and verification
RST
Rest input A on this pin for two machine cycles while the oscillator is running resets the device.
ALE/PROG:
Address Latch Enable is an output pulse for latching the low byte of the address during access to
external memory. This pin is also the program pulse input (PROG) during Flash programming.
In normal operation ALE is emitted at a constant rate of 1/16 the oscillator frequency and may be
used for external timing or clocking purpose. Note, however, that one ALE pulse is skipped during each
access to external Data memory.
_____
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
External Access Enable (EA) must be strapped to GND in order to enable the device to fetch
code from external program memory locations starting at 0000h up to FFFFH. Note, however, that if
lock bit 1 is programmed EA will be internally latched on reset. EA should be strapped to Vcc for
internal program executions. This pin also receives the 12-volt programming enable voltage (Vpp)
during Flash programming when 12-volt programming is selected.
XTAL1
Input to the inverting oscillator amplifier and input to the internal clock operating circuit.
XTAL 2
OPERATING DESCRIPTION
The detail description of the AT89C51 included in this description is:
• Timer/Counters
• Interrupt System
MEMORY MAP AND REGISTERS
Memory
The AT89C51 has separate address spaces for program and data memory. The program and data
memory can be up to 64K bytes long. The lower 4K program memory can reside on-chip. The AT89C51
has 128 bytes of on-chip RAM. The lower 128 bytes can be accessed either by direct addressing or by
indirect addressing. The lower 128 bytes of RAM can be divided into 3 segments as listed below
1. Register Banks 0-3: locations 00H through 1FH (32 bytes). The device after reset defaults to register
bank 0. To use the other register banks, the user must select them in software. Each register bank
contains eight 1-byte registers R0-R7. Reset initializes the stack point to location 07H, and is
incremented once to start from 08H, which is the first register of the second register bank.
2. Bit Addressable Area: 16 bytes have been assigned for this segment 20H-2FH. Each one of the 128
bits of this segment can be directly addressed (0-7FH). Each of the 16 bytes in this segment can also be
addressed as a byte.
3. Scratch Pad Area: 30H-7FH are available to the user as data RAM. However, if the data pointer has
been initialized to this area, enough bytes should be left aside to prevent SP data destruction.
SPECIAL FUNCTION REGISTERS
The Special Function Registers (SFR's) are located in upper 128 Bytes direct addressing area.
The SFR Memory Map in shows that. Not all of the addresses are occupied. Unoccupied addresses are
not implemented on the chip. Read accesses to these addresses in general return random data, and write
accesses have no effect. User software should not write 1s to these unimplemented locations, since they
may be used in future microcontrollers to invoke new features. In that case, the reset or inactive values
of the new bits will always be 0, and their active values will be 1.
Accumulator (ACC)
ACC is the Accumulator register. The mnemonics for Accumulator-specific instructions, however, refer
to the Accumulator simply as A.
B Register (B)
The B register is used during multiply and divide operations. For other instructions it can be treated as
another scratch pad register.
The Stack Pointer Register is eight bits wide. It is incremented before data is stored during PUSH and
CALL executions. While the stack may reside anywhere in on chip RAM, the Stack Pointer is initialized
to 07H after a reset. This causes the stack to begin at location 08H.
The Data Pointer consists of a high byte (DPH) and a low byte (DPL). Its function is to hold a 16-bit
address. It may be manipulated as a 16-bit register or as two independent 8-bit registers.
The Serial Data Buffer is actually two separate registers, a transmit buffer and a receive buffer register.
When data is moved to SBUF, it goes to the transmit buffer, where it is held for serial transmission.
(Moving a byte to SBUF initiates the transmission.) When data is moved from SBUF, it comes from the
receive buffer.
Timer Registers
Register pairs (TH0, TL0) and (TH1, TL1) are the 16-bit Counter registers for Timer/Counters 0 and 1,
respectively.
Control Registers
Special Function Registers IP, IE, TMOD, TCON, SCON, and PCON contain control and status bits for
the interrupt system, the Timer/Counters, and the serial port.
TIMER/COUNTERS
The IS89C51 has two 16-bit Timer/Counter registers: Timer 0 and Timer 1. All two can be
configured to operate either as Timers or event counters. As a Timer, the register is incremented every
machine cycle. Thus, the register counts machine cycles. Since a machine cycle consists of 12 oscillator
periods, the count rate is 1/12 of the oscillator frequency.
cycle, the count is incremented. The new count value appears in the register during S3P1 of the cycle
following the one in which the transition was detected. Since two machine cycles (24 oscillator periods)
are required to recognize a 1-to-0 transition, the maximum count rate is 1/24 of the oscillator frequency.
There are no restrictions on the duty cycle of the external input signal, but it should be held for at least
one full machine cycle to ensure that a given level is sampled at least once before it changes.In addition
to the Timer or Counter functions, Timer 0 and Timer 1 have four operating modes: 13-bit timer, 16-bit
timer, 8-bit auto-reload, split timer.
TIMERS:
OSCILLATOR
FREQUENCY 12D
TMOD Register
TCON Register
Timer(T0) & timer(T1) Registers
The timer mode SFR is used to configure the mode of operation of each of the two timers. Using
this SFR your program may configure each timer to be a 16-bit timer, or 13 bit timer, 8-bit auto
reload timer, or two separate timers. Additionally you may configure the timers to only count
when an external pin is activated or to count “events” that are indicated on an external pin.
It can consider as two duplicate 4-bit registers, each of which controls the action of one of the
timers.
(ii) TCON Register
The timer control SFR is used to configure and modify the way in which the 8051’s two timers
operate. This SFR controls whether each of the two timers is running or stopped and contains a
flag to indicate that each timer has overflowed. Additionally, some non-timer related bits are
located in TCON SFR.
These bits are used to configure the way in which the external interrupt flags are activated,
which are set when an external interrupt occurs.
T H0 T L0
The Timer or Counter function is selected by control bits C/T in the Special Function Register TMOD.
These two Timer/Counters have four operating modes, which are selected by bit pairs (M1, M0) in
TMOD. Modes 0, 1, and 2 are the same for both Timer/Counters, but Mode 3 is different.
Mode 0:
Both Timers in Mode 0 are 8-bit Counters with a divide-by-32 pre scalar. Figure 8 shows the
Mode 0 operation as it applies to Timer 1. In this mode, the Timer register is configured as a 13-bit
register. As the count rolls over from all 1s to all 0s, it sets the Timer interrupt flag TF1. The counted
input is enabled to the Timer when TR1 = 1 and either GATE = 0 or INT1 = 1. Setting GATE = 1 allows
the Timer to be controlled by external input INT1, to facilitate pulse width measurements. TR1 is a
control bit in the Special Function Register TCON. Gate is in TMOD.
The 13-bit register consists of all eight bits of TH1 and the lower five bits of TL1. The upper
three bits of TL1 are indeterminate and should be ignored. Setting the run flag (TR1) does not clear the
registers.
Mode 0 operation is the same for Timer 0 as for Timer 1, except that TR0, TF0 and INT0 replace
the corresponding Timer 1 signals. There are two different GATE bits, one for Timer 1 (TMOD.7) and
one for Timer 0 (TMOD.3).
Mode 1
Mode 1 is the same as Mode 0, except that the Timer register is run with all 16 bits. The clock is
applied to the combined high and low timer registers (TL1/TH1). As clock pulses are received, the timer
counts up: 0000H, 0001H, 0002H, etc. An overflow occurs on the FFFFH-to-0000H overflow flag. The
timer continues to count. The overflow flag is the TF1 bit in TCON that is read or written by software
Mode 2
Mode 2 configures the Timer register as an 8-bit Counter (TL1) with automatic reload, as shown in
Figure 10. Overflow from TL1 not only sets TF1, but also reloads TL1 with the contents of TH1, which
is preset by software. The reload leaves the TH1 unchanged. Mode 2 operation is the same for
Timer/Counter 0.
Mode 3
Timer 1 in Mode 3 simply holds its count. The effect is the same as setting TR1 = 0. Timer 0 in
Mode 3 establishes TL0and TH0 as two separate counters. The logic for Mode 3 on Timer 0 is shown in
Figure 11. TL0 uses the Timer 0 control bits: C/T, GATE, TR0, INT0, and TF0. TH0 is locked into a
timer function (counting machine cycles) and over the use of TR1 and TF1 from Timer 1. Thus, TH0
now controls the Timer 1 interrupt.
Mode 3 is for applications requiring an extra 8-bit timer or counter. With Timer 0 in Mode 3, the
AT89C51 can appear to have three Timer/Counters. When Timer 0 is in Mode 3, Timer 1 can be turned
on and off by switching it out of and into its own Mode 3. In this case, Timer 1 can still be used by the
serial port as a baud rate generator or in any application not requiring an interrupt.
INTERRUPT SYSTEM
An interrupt is an external or internal event that suspends the operation of micro controller to
inform it that a device needs its service. In interrupt method, whenever any device needs its service, the
device notifies the micro controller by sending it an interrupt signal. Upon receiving an interrupt signal,
the micro controller interrupts whatever it is doing and serves the device. The program associated with
interrupt is called as interrupt service subroutine (ISR).Main advantage with interrupts is that the micro
controller can serve many devices.
Baud Rate
The baud rate in Mode 0 is fixed as shown in the following equation. Mode 0 Baud Rate =
Oscillator Frequency /12 the baud rate in Mode 2 depends on the value of the SMOD bit in Special
Function Register PCON. If SMOD = 0 the baud rate is 1/64 of the oscillator frequency. If SMOD = 1,
the baud rate is 1/32 of the oscillator frequency.
In the IS89C51, the Timer 1 overflow rate determines the baud rates in Modes 1 and 3.
0000H Reset
Lower the vector, higher the priority. The External Interrupts INT0 and INT1 can each be either
level-activated or transition-activated, depending on bits IT0 and IT1 in Register TCON. The flags that
actually generate these interrupts are the IE0 and IE1 bits in TCON. When the service routine is
vectored, hardware clears the flag that generated an external interrupt only if the interrupt was transition-
activated. If the interrupt was level-activated, then the external requesting source (rather than the on-chip
hardware) controls the request flag.
The Timer 0 and Timer 1 Interrupts are generated by TF0and TF1, which are set by a rollover in
their respective Timer/Counter registers (except for Timer 0 in Mode 3).When a timer interrupt is
generated, the on-chip hardware clears the flag that is generated.
The Serial Port Interrupt is generated by the logical OR of RI and TI. The service routine
normally must determine whether RI or TI generated the interrupt, and the bit must be cleared in
software. All of the bits that generate interrupts can be set or cleared by software, with the same result as
though they had been set or cleared by hardware. That is, interrupts can be generated and pending
interrupts can be canceled in software.
Each of these interrupt sources can be individually enabled or disabled by setting or clearing a bit
in Special Function Register IE (interrupt enable) at address 0A8H. There is a global enable/disable bit
that is cleared to disable all interrupts or to set the interrupts.
Bit D7 of the IE register must be set to high to allow the rest of register to take effect. If EA=1,
interrupts are enabled and will be responded to if their corresponding bits in IE are high. If EA=0, no
interrupt will be responded to even if the associated bit in the IE register is high.
D7 bit: Disables all interrupts. If EA =0, no interrupt is acknowledged, if EA=1 each interrupt
source is individually enabled or disabled by setting or clearing its enable bit.
D6 bit: Reserved.
There is one more SRF to assign priority to the interrupts which is named as interrupt priority
(IP). User has given the provision to assign priority to one interrupt. Writing one to that particular bit in
the IP register fulfils the task of assigning the priority.
D7 bit: Reserved.
D6 bit: Reserved.
POWER SUPPLY
In this project we have power supplies with +5V & -5V option normally +5V is enough for total
circuit. Another (-5V) supply is used in case of OP amp circuit .Transformer primary side has 230/50HZ
AC voltage whereas at the secondary winding the voltage is step downed to 12/50hz and this voltage is
rectified using two full wave rectifiers .the rectified output is given to a filter circuit to fiter the
unwanted ac in the signal After that the output is again applied to a regulator LM7805(to provide +5v)
regulator. Whereas LM7905 is for providing –5V regulation.
(+12V circuit is used for stepper motors, Fan and Relay by using LM7812 regulator same process like
above supplies.)
Transformer is a device that converts the one form energy to another form of energy like
a transducer.
Figure: Transformer
A transformer consists of two coils (often called 'windings') linked by an iron core,
as shown in figure below. There is no electrical connection between the coils, instead they
are linked by a magnetic field created in the core.
Figure: Basic Transformer
Transformers are used to convert electricity from one voltage to another with
minimal loss of power. They only work with AC (alternating current) because they
require a changing magnetic field to be created in their core. Transformers can increase
voltage (step-up) as well as reduce voltage (step-down).
The iron core is laminated to prevent 'eddy currents' flowing in the core. These are
currents produced by the alternating magnetic field inducing a small voltage in the core,
just like that induced in the secondary coil. Eddy currents waste power by needlessly
heating up the core but they are reduced to a negligible amount by laminating the iron
because this increases the electrical resistance of the core without affecting its magnetic
properties.
Transformers have two great advantages over other methods of changing voltage:
1. They provide total electrical isolation between the input and output, so they can be
safely used to reduce the high voltage of the mains supply.
2. Almost no power is wasted in a transformer. They have a high efficiency (power
out / power in) of 95% or more.
Step-Up Transformer
Step-Down Transformer
Step-Down Transformer:
Step down transformers are designed to reduce electrical voltage. Their primary
voltage is greater than their secondary voltage. This kind of transformer "steps down" the
voltage applied to it. For instance, a step down transformer is needed to use a 110v
product in a country with a 220v supply.
Step down transformers convert electrical voltage from one level or phase configuration
usually down to a lower level. They can include features for electrical isolation, power
distribution, and control and instrumentation applications. Step down transformers
typically rely on the principle of magnetic induction between coils to convert voltage
and/or current levels.
Step down transformers are made from two or more coils of insulated wire wound around
a core made of iron. When voltage is applied to one coil (frequently called the primary or
input) it magnetizes the iron core, which induces a voltage in the other coil, (frequently
called the secondary or output). The turn’s ratio of the two sets of windings determines
the amount of voltage transformation.
Figure: Step-Down Transformer
An example of this would be: 100 turns on the primary and 50 turns on the secondary, a
ratio of 2 to 1.
Step down transformers can be considered nothing more than a voltage ratio device:
With step down transformers the voltage ratio between primary and secondary will
mirror the "turn’s ratio" (except for single phase smaller than 1 kva which have
compensated secondary). A practical application of this 2 to 1 turn’s ratio would be a 480
to 240 voltage step down. Note that if the input were 440 volts then the output would be
220 volts. The ratio between input and output voltage will stay constant. Transformers
should not be operated at voltages higher than the nameplate rating, but may be operated
at lower voltages than rated. Because of this it is possible to do some non-standard
applications using standard transformers.
Single phase step down transformers 1 kva and larger may also be reverse
connected to step-down or step-up voltages. (Note: single phase step up or step down
transformers sized less than 1 KVA should not be reverse connected because the
secondary windings have additional turns to overcome a voltage drop when the load is
applied. If reverse connected, the output voltage will be less than desired.)
Step-Up Transformer:
A step up transformer has more turns of wire on the secondary coil, which makes a
larger induced voltage in the secondary coil. It is called a step up transformer because the
voltage output is larger than the voltage input.
Step-up transformer 110v 220v design is one whose secondary voltage is greater
than its primary voltage. This kind of transformer "steps up" the voltage applied to it. For
instance, a step up transformer is needed to use a 220v product in a country with a 110v
supply.
A step up transformer 110v 220v converts alternating current (AC) from one
voltage to another voltage. It has no moving parts and works on a magnetic induction
principle; it can be designed to "step-up" or "step-down" voltage. So a step up
transformer increases the voltage and a step down transformer decreases the voltage.
The primary components for voltage transformation are the step up transformer
core and coil. The insulation is placed between the turns of wire to prevent shorting to
one another or to ground. This is typically comprised of Mylar, nomex, Kraft paper,
varnish, or other materials. As a transformer has no moving parts, it will typically have a
life expectancy between 20 and 25 years.
Applications
The ratio of the number of turns on the primary and secondary coils determines the
ratio of the voltages...
...where Vp is the primary (input) voltage, Vs is the secondary (output) voltage, Np is the
number of turns on the primary coil, and Ns is the number of turns on the secondary coil.
Diodes:
Diodes allow electricity to flow in only one direction. The arrow of the circuit
symbol shows the direction in which the current can flow. Diodes are the electrical
version of a valve and early diodes were actually called valves.
A diode is a device which only allows current to flow through it in one direction.
In this direction, the diode is said to be 'forward-biased' and the only effect on the signal
is that there will be a voltage loss of around 0.7V. In the opposite direction, the diode is
said to be 'reverse-biased' and no current will flow through it.
Rectifier
The half-wave rectifier is the simplest type of rectifier since it only uses one diode,
as shown in figure .
Figure 2 shows the AC input waveform to this circuit and the resulting output. As
you can see, when the AC input is positive, the diode is forward-biased and lets the
current through. When the AC input is negative, the diode is reverse-biased and the diode
does not let any current through, meaning the output is 0V. Because there is a 0.7V
voltage loss across the diode, the peak output voltage will be 0.7V less than Vs.
HEAT SINK:
More often transistors gets heated when the circuit is ON for long time. In order to avoid
heating up of transistors we use heat sinks.
D1
1 5
RL
AC Supply 6
4 8
D2
OPERATION
During the positive half cycle of secondary voltage, the end A of the secondary winding
becomes positive and end B negative. This makes the diode D1 forward biased and D2 reverse biased.
Therefore D1 conducts while D2 does not. The conventional current flow is through diode D1, load
resistor RL and upper half of secondary winding as shown by the dotted arrows. During the negative half
cycle, end A of the secondary winding becomes negative and end B positive. Therefore D2 conducts
while D1 does not. The conventional current flow is through D2, load RL and lower half winding as
shown by solid arrows in the figure above .It is seen that current in the load RL is in the same direction
for both half cycles of input ac voltage. Therefore dc is obtained across the load RL. Also the polarities
of the output across the load should be noted
Suppose Vm is the maximum voltage across the half secondary winding at the instant
secondary voltage reaches its maximum value in the positive direction. At this instant D1 is conducting
while D2 is not conducting. Therefore whole of the secondary voltage appears across the non-
conducting diode. Consequently the peak inverse voltage is twice the maximum voltage across the half
secondary winding.
FILTER CIRCUIT
A filter circuit is a device which removes the ac component of rectifier output but allows
the dc component to the load. The most commonly used filter circuits are capacitor filter, choke input
filter and capacitor input filter or pi-filter. We used capacitor filter here.
CAPACITOR FILTER
This consists of a capacitor C placed across the rectifier output in parallel with the load
RL. The pulsating direct voltage of the rectifier is applied across the capacitor. As the rectifier voltage
increases, it charges the capacitor and also supplies current to the load. At the end of quarter cycle the
capacitor is charged to the peak value Vm of the rectifier voltage. Now the rectifier voltage starts to
decrease. As this occurs the capacitor discharges through the load and the voltage across it decrease. The
voltage across load will decrease only slightly because immediately the next voltage peak comes and
recharges the capacitor. This process is repeated again and again. At the output very little ripple is left.
moreover output voltage is higher as it remains substantially near the peak value of rectifier output
voltage.
The capacitor filter circuit is extremely popular because of its low cost, small size,little weight and
good characteristics. For small load currents this type of filter is preferred. it is commonly used in
transistor radio battery eliminators.
Rectifier O/P C RL
Capacitor Filter
POWER SUPPLY
Description
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 To make a 5 volt power supply, we use a LM7805 voltage regulator IC (Integrated Circuit).
The IC is shown below.
Fig: 5.2.1
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.
Block Diagram:
Circuit Features:
Brief description of operation: Gives out well regulated +5V output, output current capability of
100 mA .Circuit protection: Built-in overheating protection shuts down output when regulator IC gets
too hot Circuit complexity: Very simple and easy to build Circuit performance: Very stable +5V output
voltage, reliable operation Availability of components: Easy to get, uses only very common basic
components Design testing: Based on datasheet example circuit, I have used this circuit successfully as
part of many electronics projects
Component costs: Few dollars for the electronics components + the input transformer cost.
Description:
The LM35 series are precision integrated-circuit temperature sensors, whose output voltage is linearly
proportional to the Celsius (Centigrade) temperature. The LM35 thus has an advantage over linear
temperature sensors calibrated in ° Kelvin, as the user is not required to subtract a large constant voltage
from its output to obtain convenient Centigrade scaling. The LM35 does not require any external
calibration or trimming to provide typical accuracies of ±¼°C at room temperature and ±¾°C over a full
-55 to +150°C temperature range. Low cost is assured by trimming and calibration at the wafer level.
The LM35's low output impedance, linear output, and precise inherent calibration make interfacing to
readout or control circuitry especially easy. It can be used with single power supplies, or with plus and
minus supplies. As it draws only 60 µA from its supply, it has very low self-heating, less than 0.1°C in
still air. The LM35 is rated to operate over a -55° to +150°C temperature range, while the LM35C is
rated for a -40° to +110°C range (-10° with improved accuracy). The LM35 series is available packaged
in hermetic TO-46 transistor packages, while the LM35C, LM35CA, and LM35D are also available in
the plastic TO-92 transistor package. The LM35D is also available in an 8-lead surface mount small
outline package and a plastic TO-220 package
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.
FIG: LM35
The LM35 series are precision integrated-circuit temperature sensors, whose output voltage is linearly
proportional to the Celsius (Centigrade) temperature.
The LM35 thus has an advantage over linear temperature sensors calibrated in
° Kelvin, as the user is not required to subtract a large constant voltage from its output to obtain
convenient Centigrade scaling.
The LM35 does not require any external calibration or trimming to provide typical accuracies of
±1⁄4°Cat room temperature and ±3⁄4°C over a full −55 to +150°Ctemperature range.
Low cost is assured by trimming and calibration at the wafer level. The LM35’s low output
impedance, linear output, and precise inherent calibration make interfacing to readout or control
circuitry especially easy.
It can be used with single power supplies, or with plus and minus supplies. As it draws only 60μA
from its supply, it has very low self-heating, less than 0.1°C in still air. The LM35 is rated to operate
over a −55° to +150°C temperature range, while the LM35C is rated for a −40° to +110°C range
(−10°with improved accuracy).
The LM35 series is available packaged in hermetic TO-46 transistor packages, while theLM35C,
LM35CA, and LM35D are also available in the plastic TO-92 transistor package. The LM35D is also
available in an 8-lead surface mount small outline package and a plastic TO-220
package.M35 temperature sensor is used to co
Although the voltage sensor can reach 30 volts but given to sensor is at 5 volts, so it can be
used with single power supply with the provision that the LM35 only require a current
of 60 μA this means that LM35 has the ability to produce heat (self-heating) of the
sensor which can cause a low reading error is less than 0.5 º C at a temperature of25 º C.
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 micro sensors using MEMS technology. In most cases, a micro sensor
reaches a significantly higher speed and sensitivity compared with macroscopic approaches.
Thermistors are the most common temperature sensors you'll run across they're just temperature-sensitive
resistors (resistance goes down as temperature goes up). The internal chemistry of thermistors is quite tailor
able -- this allows manufacturers to make thermistors with a wide selection of temperature sensing ranges.
Note that thermistors tend to exhibit a fair amount of variability from unit to unit. So if you're using a pair of
thermistors to give your 'bot the ability to find warm or cool areas, you'll want to incorporate a potentiometer to
allow you to "tune" their response a bit (or else, buy a number of thermistors and attempt to find a "matching"
pair).
AD-590s are temperature sensing integrated circuits which output a current proportional to temperature.
While more expensive than thermistors (about $5 US each, vs. a few cents for a thermistor), they are also much
more accurate. This allows you to dispense with matching and tuning should you be using temperature sensors
as a "homing" device.
Thermocouples
Thermocouples are a physically simple sensor, though how they function is more complex. Figure 1
shows the basic wiring of a thermocouple. A thermocouple is comprised of two dissimilar alloys (wires
A and B) joined at one end, called the “hot junction” (T1). The other leads are connected to a voltmeter
or other input device that measures the voltage (V1) across the '“cold junction” (T2).
The hot junction is the sensing element, and the cold junction is kept at a constant reference
temperature. A voltage is produced as the hot junction is heated, which is proportional to the
temperature difference between the two junctions. This principle, called the thermocouple effect was
discovered by Thomas See beck in 1821 (Awtrey, 2001). And so, the electromotive force (EMF)
produced when the junctions of dissimilar alloys are maintained at different temperatures is known as
the See beck EMF. The theory behind the thermocouple and thermoelectric effect is based upon the
atomic structure of the alloys and is beyond the scope of this report. The voltage is also dependent
upon the type of conductors used. Different alloys produce distinct voltages; therefore standards have
been established to facilitate reliability and repeatability. There exist eight standardized alloy
combinations, each referenced by a letter: B, E, J, K, R, S, T, and N.
The See beck EMF produced by a thermocouple is of such small scale that the voltage must be
amplified and processed by a specialized thermocouple input module.
Thermocouples are calibrated with a cold junction temperature of 0°C. However, two problems arise
when connecting thermocouples to their input device: firstly, the input terminals, which are
constructed with a different type of metal, create their own See beck voltage which alters the actual
thermocouple voltage; and second, the device has to be recalibrated for an operational cold
junction temperature. With the advancements in technology over the past few decades, these input
modules have been designed to be self-calibrating and self-compensating and are able to be configured
for a variety of thermocouple types.
Resistance temperature detectors (RTDs)
Resistance temperature devices, known as RTDs, are constructed by winding a fine metal wire around
a glass or ceramic cylinder, then a coating of glass or ceramic is applied to insulate the coil. RTDs
function on the principle that as the sensing element is heated, the resistance of the metal wire
increases proportionally. RTDs are commonly made with copper, nickel, or nickel-iron, but platinum
RTDs are the most linear, repeatable, and stable. The resistance is almost a linear function
of temperature for very pure platinum, which is the primary reason for this metal’s pervasiveness in
RTDs.
RTDs are calibrated to exhibit a resistance of 100 Ω at 0°C. Their resistance at other temperatures
depends on the value of the mean slope of the metal’s resistance-temperature plot, known as
the constant alpha. Alpha is dependent upon the platinum’s purity. Although RTDs are fairly linear,
advanced RTD input devices use software with curve fitting and software processing to increase
their accuracy at higher temperatures.
Thermistors:
Thermistors, like RTDs, vary their resistance as the ambient temperature is changed. Unlike RTDs,
which use pure metals, the material used in a thermistor is generally a ceramic or polymer.
Positive temperature coefficient (PTC) thermistors will show an increase of resistance with
increasing temperature, while negative temperature coefficient (NTC) thermistors will show a decrease
of resistance with increasing of temperature. Comprised of a metal oxide ceramic semiconductor
sensing element, thermistors are notorious for their non-linearity, which engineers often dampen by
implementing pairs of offsetting thermistors, providing a more linear output.
These temperature dependent resistors are highly sensitive to temperature change. Thermistors vary
their resistance about -4.4% at 25°C when heated by one degree Celsius (Ogden, 2000). Since
thermistors are resistive devices, in operation an electrical current is passed through the sensor. Some
of this electricity is converted into heat, which may cause slightly higher than ambient
temperature readings. Thermistors can operate without significant error with long lead wires, because
of their high base resistance. Thus they can be installed at long distances, upwards of one hundred
metres, from the input module. Thermistor resistances are non-standardized and vary from 100 to
1,000,000 Ω at 25°C (Ogden, 2000).
Temperature-transducer ICs:
Semiconductor temperature sensors are produced in the form of ICs. Their design results from the
fact that semiconductor diodes have temperature-sensitive voltage vs. current characteristics. When
two identical transistors are operated at a constant ratio of collector current densities, the difference in
base-emitter voltages is directly proportional to the absolute temperature.
The use of IC temperature sensors is limited to applications where the temperature is within a –55° to
150°C range. The measurement range of IC temperature sensors may be small compared to that of
thermocouples and RTDs, but they have several advantages: they are small, accurate, and inexpensive.
Temperature sensing ICs are available either in analog form, which output a voltage or current which
is proportional to the temperature, or digital, which communicate temperature over a digital
communication line, such as one-wire PWM, two-wire I2C, or a multiple wire SPI connection.
The Sonic City project developed a wearable system that creates music based on data from sensors
measuring bodily and environmental factors. This includes environmental temperature measurements.
A video summarizing the project is linked to in the media section below, and Viktoria site for the
project has a more detailed description.
Sound Kitchen includes temperature sensors and uses voltage changes in liquids to create music. The
liquids include wine, soda and other items you might find in a kitchen, and the over all aesthetic
connects strongly with cooking.
Comparison of temperature sensor types
The following table offers a comparison of the different characteristics of the various
temperature sensor types.
Temperature
Characteristic Platinum RTD Thermistor Thermocouple
IC
Changing Voltage or
Resistance Resistance Voltage
Parameter Current
Temperature
-200°C to 500°C -40°C to 260°C -270°C to 1750°C -55°C to 150°C
Range
~1 mv/°C or ~1
Sensitivity 2 mv/°C 40 mV/°C 0.05 mV/°C
uA/°C
Noise
Low Low High High
Susceptibility
Relative
Moderate Low to Moderate Moderate Low
System Cost
Features
Calibrated directly in ° Celsius (Centigrade)
Linear + 10.0 mV/°C scale factor
0.5°C accuracy guarantee able (at +25°C)
Rated for full -55° to +150°C range
Suitable for remote applications
Low cost due to wafer-level trimming
Operates from 4 to 30 volts
Less than 60 µA current drain
Low self-heating, 0.08°C in still air
Nonlinearity only ±¼°C typical
Low impedance output, 0.1 Ohm for 1 mA load
1 Introduction
HC serial Bluetooth products consist of Bluetooth serial interface module and Bluetooth adapter, such
as:
(1) Bluetooth serial interface module:
Industrial level: HC-03, HC-04(HC-04-M, HC-04-S)
Civil level: HC-05, HC-06(HC-06-M, HC-06-S)
device while the other one connects to slave device. Their connection can be built once the pair is made.
This Bluetooth connection is equivalently liked to a serial port line connection including RXD, TXD
signals. And they can use the Bluetooth serial module to communicate with each other.
2. When MCU has Bluetooth salve module, it can communicate with Bluetooth adapter of
computers and smart phones. Then there is a virtual communicable serial port line between MCU and
computer or smart phone.
3. The Bluetooth devices in the market mostly are salve devices, such as Bluetooth printer,
Bluetooth GPS. So, we can use master module to make pair and communicate with them.
Bluetooth Serial module’s operation doesn’t need drive, and can communicate with the other
Bluetooth device who has the serial. But communication between two Bluetooth modules requires at
least two conditions:
(1) The communication must be between master and slave.
(2) The password must be correct.
However, the two conditions are not sufficient conditions. There are also some other conditions
basing on different device model. Detailed information is provided in the following chapters.
In the following chapters, we will repeatedly refer to Linvor’s (Formerly known as Guangzhou HC
HC-05 HC-06
Master and slave mode can be switched Master and slave mode can’t be switched
Bluetooth name: HC-05 Bluetooth name: linvor
Password:1234 Password:1234
Master role: have no function to remember the last
paired salve device. It can be made paired to any
slave device. In other words, just set Master role: have paired memory to remember
AT+CMODE=1 when out of factory. If you want last slave device and only make pair with that
HC-05 to remember the last paired slave device device unless KEY (PIN26) is triggered by high
address like HC-06, you can set AT+CMODE=0 level. The default connected PIN26 is low level.
after paired with the other device. Please refer the
command set of HC-05 for the details.
Pairing: The master device can not only make pair
with the specified Bluetooth address, like
cell-phone, computer adapter, slave device, but Pairing: Master device search and make pair with
also can search and make pair with the slave the slave device automatically.
device automatically. Typical method: On some specific conditions,
Typical method: On some specific conditions, master and slave device can make pair with each
master device and slave device can make pair with other automatically.
each other automatically. (This is the default
method.)
Multi-device communication: There is only point Multi-device communication: There is only point
to point communication for modules, but the to point communication for modules, but the
adapter can communicate with multi-modules. adapter can communicate with multi-modules.
AT Mode 1: After power on, it can enter the AT
mode by triggering PIN34 with high level. Then
the baud rate for setting AT command is equal to
the baud rate in communication, for example: AT Mode: Before paired, it is at the AT mode.
9600.
AT mode 2: First set the PIN34 as high level, or After paired it’s at transparent communication.
while on powering the module set the PIN34 to be
high level, the Baud rate used here is 38400 bps.
Notice: All AT commands can be operated only
when the PIN34 is at high level. Only part of the
AT commands can be used if PIN34 doesn’t keep
the high level after entering to the AT mode.
Through this kind of designing, set permissions for
the module is left to the user’s external control
circuit, that makes the application of HC-05 is very
flexible.
3. Information of Package
The PIN definitions of HC-03, HC-04, HC-05 and HC-06 are kind of different, but the package size
is the same: 28mm * 15mm * 2.35mm.
The following figure 1 is a picture of HC-06 and its main PINs. Figure 2 is a picture of HC-05 and
its main PINs. Figure 3 is a comparative picture with one coin. Figure 4 is their package size information.
When user designs the circuit, you can visit the website of Guangzhou HC Information Technology Co.,
Ltd. (www.wavesen.com) to download the package library of protle version.
Figure 1 HC-06 Figure 2 HC-05
Figure 3 Comparative picture with one coin
Figure 4 Package size information
4. The Using and Testing Method of HC-06 for the First Time
This chapter will introduce the using method of HC-06 in detail. User can test the module
according to this chapter when he or she uses the module at the first time.
PINs description:
In principle, HC-06 can work when UART_TXD, UART_RXD, VCC and GND are connected.
However, for better testing results, connecting LED and KEY are recommended (when testing the
master).
Where, the 3.3V TXD of MCU connects to HC-06’s UART_RXD, the 3.3V RXD of MCU connects
to HC-06’s UART_TXD, and 3.3V power and GND should be connected. Then the minimum system is
finished.
Note that, the PIN2:UART_RXD of Bluetooth module has no pull-up resistor. If the MCU TXD
doesn’t have pull-up function, then user should add a pull-up resistor to the UART_RXD. It may be easy
to be ignored.
If there are two MCU which connect to master and slave device respectively, then before
paired(LED will flicker) user can send AT commands by serial port when the system is power on. Please
refer to HC-04 and HC-06’s data sheet for detailed commands. In the last chapter, the command set will
be introduced. Please pay attention to that the command of HC-04/HC-06 doesn’t have terminator. For
example, consider the call command, sending out AT is already enough, need not add the CRLF
(carriage return line feed).
If the LED is constant lighting, it indicates the pairing is finished. The two MCUs can communicate
with each other by serial port. User can think there is a serial port line between two MCUs.
(2) The circuit 2 (connect the module to 5V serial port of MCU) is showed by figure 6.
Figure 6 is the block diagram of Bluetooth baseboard. This kind of circuit can amplify Bluetooth
module’s operating voltage to 3.1-6.5V. In this diagram, the J1 port can not only be connected with
MCU system of 3.3V and 5V, but also can be connected with computer serial port.
Do not let the sending frequency of AT command of HC-06 exceed 1Hz, because the command of
become active after discharged all the energy of the module. If the module still has any energy, the old one is
still active. In the test, for discharging all the system energy and activating the new password, we can connect
the power supply PIN with GND about 20 seconds after the power is cut off. Generally, shutting down the
device for 30 minutes also can discharge the energy, if there is no peripheral circuit helps discharge energy.
User should make the proper way according to the specific situation.
(7) Name introduction
If the device has no name, it’s better that user doesn’t try to change the master device name. The
name should be limited in 20 characters.
Summary: The character of HC-06: 1 not many command 2 easy for application 3 low price. It’s
good for some specific application. HC-04 is very similar with HC-06. Their only one difference is HC-
04 is for industry, HC-06 is for civil. Except this, they don’t have difference.
The following reference about HC-04 and HC-06 can be downloaded from company website
www.wavesen.com:
HC-06 datasheet .pdf (the command set introduction is included)
HC-04 datasheet .pdf (the command set introduction is included)
IVT BlueSoleil-2.6 (IVT Bluetooth drive test version)
Bluetooth FAQ.pdf
HC-04-D(HD-06-D)datasheet(English).pdf
HC-06-AT command software (test version) (some commands in V1.5 is not supported by V1.4)
PIN1 UART_TXD, Bluetooth serial signal sending PIN, can connect with MCU’s RXD PIN
UART_RXD, Bluetooth serial signal receiving PIN, can connect with the MCU’s TXD PIN,
PIN2
there is no pull-up resistor in this PIN. But It needs to be added an eternal pull-up resistor.
RESET, the reset PIN of module, inputting low level can reset the module, when the module
PIN11
is in using, this PIN can connect to air.
PIN12 VCC, voltage supply for logic, the standard voltage is 3.3V, and can work at 3.0-4.2V
PIN13 GND
LED1, indicator of work mode. Has 3 modes:
When the module is supplied power and PIN34 is input high level, PIN31 output 1Hz square
wave to make the LED flicker slowly. It indicates that the module is at the AT mode, and the
baud rate is 38400;
When the module is supplied power and PIN34 is input low level, PIN31 output 2Hz square
wave to make the LED flicker quickly. It indicates the module is at the pairable mode. If
PIN31
PIN34 is input high level, then the module will enter to AT mode, but the output of PIN31 is
still 2Hz square wave.
After the pairing, PIN31 output 2Hz square ware.
Note: if PIN34 keep high level, all the commands in the AT command set can be in
application. Otherwise, if just excite PIN34 with high level but not keep, only some command
can be used. More information has provided at chapter 2.
Output terminal. Before paired, it output low level. Once the pair is finished, it output high
PIN32
level.
Mode switch input. If it is input low level, the module is at paired or communication mode. If
it’s input high level, the module will enter to AT mode. Even though the module is at
PIN34
communication, the module can enter to the AT mode if PIN34 is input high level. Then it will
go back to the communication mode if PIN34 is input low level again.
(2) Application circuit 1 (connect to the 3.3V system)
Figure 7 Application 1
(3) Application circuit 2 (connect to 5V serial system or PC serial)
to make pair with random one first, then set the module to make pair with the Bluetooth module has
specified address. Then the module will search the last paired module until the module is found.
Summary:
HC-05 has many functions and covers all functions of HC-06. The above commands are the most
common ones. Besides this, HC-05 leaves lots of space for user. So HC-05 is better than HC-06 and
(the command set introduction is included)
(the command set introduction is included)
(IVT Bluetooth drive test version)
recommended. HC-03 is similar with HC-05. The above introduction also suits HC-03
The following reference about HC-03 and HC-05 can be downloaded from company website
www.wavesen.com:
IVT BlueSoleil-2.6
Bluetooth FAQ.pdf
6. Ordering information
The website of Guangzhou HC Information Technology Co., Ltd is www.wavesen.com The contact
information is provided at the company website.
Order Way: If you want our product, you can give order to the production center of our company
directly or order it in Taobao. There is a link to Taobao in our company website.
Package: 50 pieces chips in an anti-static blister package. The weight of a module is about 0.9g.
Here is a simple project to control your Robot/Robo Car using Bluetooth Module HC-05 &
89c2051 Microcontroller with your Android Smartphone device.
Circuit diagram of Wireless Android Based Remote Control to control Robot / Robo Car
using 89C2051 and HC-05 Bluetooth Module
These components are “specialized” for being used with the microcontrollers,
which means that they cannot be activated by standard IC circuits. They are used
for writing different messages on a miniature LCD.
A model described here is for its low price and great possibilities most frequently
used in practice. It is based on the HD44780 microcontroller (Hitachi) and can
display messages in two lines with 16 characters each. It displays all the alphabets,
Greek letters, punctuation marks, mathematical symbols etc. In addition, it is
possible to display symbols that user makes up on its own. Automatic shifting
message on display (shift left and right), appearance of the pointer, backlight etc.
are considered as useful characteristics.
Pins Functions
There are pins along one side of the small printed board used for connection to the
microcontroller. There are total of 14 pins marked with numbers (16 in case the background light
is built in). Their function is described in the table below:
Pin Logic
Function Name Description
Number State
Ground 1 Vss - 0V
8 D1 0/1 Bit 1
9 D2 0/1 Bit 2
12 D5 0/1 Bit 5
13 D6 0/1 Bit 6
LCD screen consists of two lines with 16 characters each. Each character consists
of 5x7 dot matrix. Contrast on display depends on the power supply voltage and
whether messages are displayed in one or two lines. For that reason, variable
voltage 0-Vdd is applied on pin marked as Vee. Trimmer potentiometer is usually
used for that purpose. Some versions of displays have built in backlight (blue or
green diodes). When used during operating, a resistor for current limitation should
be used (like with any LE diode).
LCD Basic Commands
All data transferred to LCD through outputs D0-D7 will be interpreted as
commands or as data, which depends on logic state on pin RS:
Execution
Command RS RW D7 D6 D5 D4 D3 D2 D1 D0
Time
Write to CGRAM or
1 0 D7 D6 D5 D4 D3 D2 D1 D0 40uS
DDRAM
Depending on how many lines are used for connection to the microcontroller, there
are 8-bit and 4-bit LCD modes. The appropriate mode is determined at the
beginning of the process in a phase called “initialization”. In the first case, the data
are transferred through outputs D0-D7 as it has been already explained. In case of
4-bit mode, for the sake of saving valuable I/O pins of the microcontroller, there
are only 4 higher bits (D4-D7) used for communication, while other may be left
unconnected.
Consequently, each data is sent to LCD in two steps: four higher bits are sent first
(that normally would be sent through lines D4-D7), four lower bits are sent
afterwards. With the help of initialization, LCD will correctly connect and interpret
each data received. Besides, with regards to the fact that data are rarely read from
LCD (data mainly are transferred from microcontroller to LCD) one more I/O pin
may be saved by simple connecting R/W pin to the Ground. Such saving has its
price.
LCD Initialization
Once the power supply is turned on, LCD is automatically cleared. This process
lasts for approximately 15mS. After that, display is ready to operate. The mode of
operating is set by default. This means that:
1. Display is cleared
2. Mode
D = 0 Display off
U = 0 Cursor off
4. Character entry
Automatic reset is mainly performed without any problems. If for any reason
power supply voltage does not reach full value in the course of 10mS, display will
start to perform completely unpredictably.
Variable resistors used as potentiometers have all three terminals connected. This
arrangement is normally used to vary voltage, for example to set the switching
point of a circuit with a sensor, or control the volume (loudness) in an amplifier
circuit. If the terminals at the ends of the track are connected across the power
supply, then the wiper terminal will provide a voltage which can be varied from
zero up to the maximum of the supply.
Presets
These are miniature versions of the standard variable resistor. They are designed to
be mounted directly onto the circuit board and adjusted only when the circuit is
built. For example, to set the frequency of an alarm tone or the sensitivity of a
light-sensitive circuit, a small screwdriver or similar tool is required to adjust
presets.
Presets are much cheaper than standard variable resistors so they are sometimes
used in projects where a standard variable resistor would normally be used.
Multiturn presets are used where very precise adjustments must be
made. The screw must be turned many times (10+) to move the slider from
one end of the track to the other, giving very fine control.
J10
C O N 16
VC C
lcd
12
13
14
15
1
2
3
4
5
6
11
16
10K .
VC C LPC2148
0 U 1
1 6 4
2 P 0 .2 1 /P W M 5 /A D 1 .6 /C A P 1 .3 P 1 .2 7 /T D 0 6 2
3 P 0 .2 2 /A D 1 .7 /C A P 0 .0 /M A T 0 .0 VR EF 6 2 Y 1
4 R TC X1 XTA L1 6 1
5 P 1 .1 9 /T R A C E P K T 3 XTA L2 6 0
6 R TC X2 P 1 .2 8 /T D 5 9
7 v ss VSSA 5 8
8 v dd P 0 .2 3 /V B U S 5 7
33 pF 12Mhz
VC C
9 P 1 .1 8 /T R A C E P K T 2 R ESET 5 6
1 0 P 0 .2 5 /A D 0 .4 /A O U T P 1 .2 9 /T C K 5 5 33 pF
1 1 D + P 0 .2 0 /M A T1 .3 /S S E L 1 /E IN T 3 5 4
1 2 D - P 0 .1 9 /M A T 1 .2 /M O S I1 /C A P 1 .2 5 3 SW 2
1 3 P 1 .1 7 /T R A C E P K T 1 P 0 .1 8 /C A P 1 .3 /M IS O 1 /M A T 1 .3 5 2 1 0 u F /1 6 V
1 4 P 0 .2 8 /A D 0 .1 /C A P 0 .2 /M A T 0 .2 P 1 .3 0 /T M S 5 1
1 5 P 0 .2 9 /A D 0 .2 /C A P 0 .3 /M A T 0 .3 VD D 5 0
1 6 P 0 .3 0 /A D 0 .3 /E IN T 3 /C A P 0 .0 VSS 4 9
1 7 P 1 .1 6 /T R A C E P K T 0 VBAT 4 8
1 8 P 0 .3 1 /U P _ L E D /C O N N E C T P 1 .2 0 /T R A C E S Y N C 4 7
1 9 V SS P 0 .1 7 /C A P 1 .2 /S C K 1 /M A T1 .2 4 6
8.2k
2 0 P 0 .0 /T X D 0 /P W M 1 P 0 .1 6 /E IN T 0 /M A T 0 .2 /C A P 0 .2 4 5
2 1 P 1 .3 1 /T R S T P 0 .1 5 /R I1 /E IN T 2 /A D 1 .5 4 4
2 2 P 0 .1 /R XD 0 /P W M 3 /E IN T 0 P 1 .2 1 /P IP E S T A T 0 4 3
2 3 P 0 .2 /S C L 0 /C A P 0 .0 VD D 4 2
2 4 V D D VSS 4 1
2 5 P 1 .2 6 /R T C K P 0 .1 4 /D C D 1 /E IN T 1 /S D A 1 4 0
2 6 V SS P 1 .2 2 /P IP E S T A T 1 3 9
2 7 P 0 .3 /S D A 0 /M A T 0 .0 /E IN T 1 P 0 .1 3 /D T R 1 /M A T 1 .1 /A D 1 .4 3 8
2 8 P 0 .4 /S C K 0 /C A P 0 .1 /A D 0 .6 P 0 .1 2 /D S R 1 /M A T 1 .0 /A D 1 .3 3 7
2 9 P 1 .2 5 /E X T IN 0 P 0 .1 1 /C T S 1 /C A P 1 .1 /S C L 1 3 6
3 0 P 0 .5 /M IS O 0 /M A T 0 .1 /A D 0 .7 P 1 .2 3 /P IP E S T A T 2 3 5
3 1 P 0 .6 /M O S I0 /C A P 0 .2 /A D 1 .0 P 0 .1 0 /R T S 1 /C A P 1 .0 /A D 1 .2 3 4
3 2 P 0 .7 /S S E L 0 /P W M 2 /E IN T 2 P 0 .9 /R XD 1 /P W M 6 /E IN T 3 3 3
P 1 .2 4 /T R A C E C L K P 0 .8 /T X D 1 /P W M 4 /A D 1 .1
SOFTWAR EXPLANATION
6.1 ABOUT KEIL SOFTWARE
Software’s used are:
*Keil software for c programming
µVision3 adds many new features to the Editor like Text Templates, Quick
Function Navigation, and Syntax Coloring with brace high lighting Configuration
Wizard for dialog based startup and debugger setup. µVision3 is fully compatible
to µVision4 and can be used in parallel with µVision4.
What is µVision4?
A project manager.
A make facility.
Tool configuration.
Editor.
A powerful debugger.
To help you get started, several example programs (located in the
\C51\Examples, \C251\Examples, \C166\Examples, and \ARM\...\Examples) are
provided.
HELLO is a simple program that prints the string "Hello World" using the
Serial Interface.
MEASURE is a data acquisition system for analog and digital systems.
TRAFFIC is a traffic light controller with the RTX Tiny operating system.
SIEVE is the SIEVE Benchmark.
DHRY is the Dhrystone Benchmark.
WHETS is the Single-Precision Whetstone Benchmark.
Additional example programs not listed here are provided for each device
architecture.
4. Save the Project by typing suitable project name with no extension in u r own folder
sited in either C:\ or D:\
5. Then Click on Save button above.
14. Click on the file option from menu bar and select “new”
15. The next screen will be as shown in next page, and just maximize it by double
clicking on its blue boarder.
16. Now start writing program in either in “C” or “ASM”
17. For a program written in Assembly, then save it with extension “. asm” and for “C”
based program save it with extension “ .C”
18. Now right click on Source group 1 and click on “Add files to Group Source”
19. Now you will get another window, on which by default “C” files will appear.
20. Now select as per your file extension given while saving the file
22. Now Press function key F7 to compile. Any error will appear if so happen.
23. If the file contains no error, then press Control+F5 simultaneously.
26. Now Click on the Peripherals from menu bar, and check your required port as shown
in fig below
27. Drag the port a side and click in the program file.
28. Now keep Pressing function key “F11” slowly and observe.
29. You are running your program successfully