CONTACT-LESS TACHOMETER
INTRODUCTION
1 A tachometer is an instrument designed to measure the speed of an object or
substance. The word is formed from Greek roots tachos, meaning speed, and
metron, meaning measure. The traditional tachometer is laid out as a dial, with a
needle indicating the current reading and marking safe and dangerous levels.
Recently, digital tachometers giving a direct numeric output have become more
common. In its most familiar form, a tachometer measures the speed at which a
mechanical device is rotating. A common example is the tachometer found on
automobile dashboards. In this application, the tachometer measures the
revolutions per minute (RPMs) of the engine drive shaft. It is important to
monitor engine RPMs, as running the engine at excessively high rates can
drastically shorten engine life. A tachometer used in this application can be built
in multiple ways. It may be a small generator attached to the engine drive shaft,
where the RPM measurement is scaled to the electric current generated by the
device. Alternately, it may simply measure the rate at which the ignition system
sends sparks to the engine. The traditional tachometer requires physical contact
between the instrument and the device being measured. In applications where
this is not feasible for technical or safety reasons, it may be possible to use a
Contact less tachometer to take measurements from a distance. A Contact less
tachometer works by pulsing an Infrared radiation against the rotating element.
The rotating element will have a reflective spot, and the tachometer measures the
rate at which the infrared radiation is reflected back. A Contact less tachometer
can be a permanent part of the system, or it can be handheld for occasional spot
measurements.
2 So I have made this possible which overcome the disadvantages of the
traditional tachometer. I have used new technologies like the liquid crystal
display, the 8051 microcontroller, the infrared sensor and the generator. It has
many advantages over the traditional tachometer. Although, laser can be used
instead of the infrared transmitter and the receiver. There was a practical problem
using the laser. The laser uses more power consumption. By using the infrared
radiation I have omitted those practical problems. We can name it as a pick up or
transducer because it converts the frequency of the shaft into the pulses using the
infrared transmitter and the receiver. These pulses are counted by the
microcontroller. These pulses are the short duration pulses of the order of few
milliseconds. So the microcontroller sense these pulses counted these pulses and
convert it into revolutions per minute. These revolutions per minute is then
converted in the voltage and then sent it to the liquid crystal display. The liquid
crystal display can be replaced by the seven segment display but I have used the
liquid crystal display because I have display the four digit number which uses
four seven segment. I have to display the maximum and the average speed of the
rotating part. It may leads to increased number of interconnection and the circuit
complexity will be increased. To minimize the circuit I have used the liquid
1
2
crystal display. It has less number of interconnection and requires less power. It
occupies less area than the seven segment display. I will explain each and every
point in the detail that is the principle, the algorithm used, the program that I
have created. The microcontroller working and operation.
PRINCIPLE OF OPERATION
3 The idea behind most digital counting device, frequency meters and
tachometers, is a micro-controller, used to count the pulses coming from a sensor
or any other electronic device. In the case of this tachometer, the counted pluses
will come from proximity sensor, which will detect any reflective element
passing in front of it, and thus, will give an output pulse for each and every
rotation of the shaft, as show in the picture. Those pulses will be fed to the
microcontroller and counted. to understand the microcontroller counts pulses,
and deduce the frequency of those pulse, please refer to this tutorial about
building a frequency meter that elaborates the process of frequency counting.
The main difference between this tutorial about tachometer and frequency
meters, is that we need the reading in pulses per minutes (to count revolutions
per minutes), but in the same time, we don't want to wait a whole minute before
getting a correct reading. Thus we need some additional processing to predict the
number of revolutions per minute in less than a second that I will explain in the
algorithm.
INSTANTANEOUS MEASUREMENT ALGORITHM
4 To be able to deduce an RPM reading in less than second, while constantly
refining the reading's accuracy, a simple algorithm have been developed, where a
counter and a timer are used. Counter and timers are part of the internal features
of a micro-controller and they can be easily configured through programming.
The timer and the counter are used for this task; The counter is connected I such
a way to count pulses coming from the proximity sensor, while the timer is used
to precisely feed the counted value to the microcontroller every filth of a second,
and stable reading and prevent display flickering.
2
3
3
4
4
5
provides a very simple battery monitor, with a green and a red LED, showing
whether the battery needs to be recharged or not. The switch SW1 is used to
enable/disable the measurement or the counting process. When the switch is
pressed, the device measures the RPM of the shaft under test, and constantly
updates the reading on the LCD, when the switch is released, the last reading is
held unchanged on the display, as long as the device stays on. When the switch is
pressed again the old reading is replaced by the new one. The wire connection
P1, which is connected to the output of the sensor, is connected to the pin 3.4 of
the microcontroller, this pin has a dual function which is to count incoming
pulses and increment a 8, 13, or 16 bit register according to the configuration of
the timer T0.
OPERATION OF MICROCONTROLLER
9 Even though there are a large number of different types of microcontrollers
and even more programs created for their use only, all of them have many things
in common. A typical scenario on the basis of which it all functions is as follows
(a) Power supply is turned off and everything is still the program is
loaded into the microcontroller
(b) Power supply is turned on and everything starts to happen at high
speed! The control logic unit keeps everything under control. It
disables all other circuits except quartz crystal to operate. While the
preparations are in progress, the first milliseconds go by.
(c) Power supply voltage reaches its maximum and oscillator
frequency becomes stable. SFRs are being filled with bits reflecting
the state of all circuits within the microcontroller. All pins are
configured as inputs. The overall electronic starts operation in
rhythm with pulse sequence. From now on the time is measured in
micro and nanoseconds.
(d) Program Counter is set to zero. Instruction from that address is
sent to instruction decoder which recognizes it, after which it is
executed with immediate effect.
(e) The value of the Program Counter is incremented by 1 and the
whole process is repeated several million times per second.
6
7
7
8
PROGRAM COUNTER
8
9
15 This is a unit which monitors and controls all processes within the
microcontroller and the user cannot affect its work. It consists of several smaller
subunits, of which the most important are
(a) Instruction decoder is a part of the electronics which recognizes
program instructions and runs other circuits on the basis of that. The
abilities of this circuit are expressed in the "instruction set" which is
different for each microcontroller family.
(b) Arithmetical Logical Unit (ALU) performs all mathematical and
logical operations upon data.
(c) Accumulator is an SFR closely related to the operation of ALU.
It is a kind of working desk used for storing all data upon which
some operations should be executed (addition, shift etc.). It also
stores the results ready for use in further processing. One of the
SFRs, called the Status Register, is closely related to the
accumulator, showing at any given time the "status" of a number
stored in the accumulator.
16 A bit is just a word invented to confuse novices at electronics. Joking
aside, this word in practice indicates whether the voltage is present on a
conductor or not. If it is present, the appropriate pin is set to logic one (1), i.e. the
bit’s value is 1. Otherwise, if the voltage is 0 V, the appropriate pin is cleared (0),
i.e. the bit’s value is 0. It is more complicated in theory where a bit is referred to
as a binary digit, but even in this case, its value can be either 0 or 1.
OSCILLATOR
9
10
TIMERS/COUNTERS
SERIAL COMMUNICATION
PROGRAM
simple writing instructions in the order in which they should be executed. There
are also many programs running in Windows environment used to facilitate the
work providing additional visual tools.
24 Interrupt electronics is usually faster than physical processes it
should keep under control. This is why the microcontroller spends most of its
time waiting for something to happen or execute. In other words, when some
event takes place, the microcontroller does something. In order to prevent the
microcontroller from spending most of its time endlessly checking for logic state
on input pins and registers, an interrupt is generated. It is the signal which
informs the central processor that something attention worthy has happened. As
its name suggests, it interrupts regular program execution. It can be generated by
different sources so when it occurs, the microcontroller immediately stops
operation and checks for the cause. If it is needed to perform some operations, a
current state of the program counter is pushed onto the Stack and the appropriate
program is executed. It's the so called interrupt routine.
25 Stack is a part of RAM used for storing the current state of the
program counter (address) when an interrupt occurs. In this way, after a
subroutine or an interrupt execution, the microcontroller knows from where to
continue regular program execution. This address is cleared after returning to the
program because there is no need to save it any longer, and one location of the
stack is automatically available for further use. In addition, the stack can consist
of several levels. This enables subroutines’ nesting, i.e. calling one subroutine
from another.
8051 STANDARD
26 I am describing the 8051 standards. Microcontroller manufacturers
have been competing for a long time for attracting choosy customers and every
couple of days a new chip with a higher operating frequency, more memory and
upgraded A/D converters appeared on the market. However, most of them had
the same or at least very similar architecture known in the world of
microcontrollers as “8051 compatible”. What is all this about. The whole story
has its beginnings in the far 80s when Intel launched the first series of
microcontrollers called the MCS 051. Even though these microcontrollers had
quite modest features in comparison to the new ones, they conquered the world
very soon and became a standard for what nowadays is called the
microcontroller.
27 The main reason for their great success and popularity is a skillfully
chosen configuration which satisfies different needs of a large number of users
allowing at the same time constant expansions. Besides, the software has been
developed in great extend in the meantime, and it simply was not profitable to
change anything in the microcontroller’s basic core. This is the reason for having
a great number of various microcontrollers which basically are solely upgraded
versions of the 8051 family.
(a) 4 Kb of ROM is not much at all.
(b) 128b of RAM (including SFRs) satisfies the user's basic needs.
12
13
PINOUT DESCRIPTION
(a) Pins 1-8 port 1 each of these pins can be configured as an input or an
output.
(b) Pin 9 (Rs)A logic one on this pin disables the microcontroller and
clears the contents of most registers. In other words, the positive
voltage on this pin resets the microcontroller. By applying logic zero
to this pin, the program starts execution from the beginning.
(c) Pin 10-17:port 3:Similar to port 1, each of these pins can serve as
general input or output. Besides, all of them have alternative
functions:
(d) Pin 10 Rxd Serial asynchronous communication input or Serial
synchronous communication output.
(e) Pin 11 Txd Serial asynchronous communication output or Serial
synchronous communication clock output.
(f) Pin 12 Int 0 Interrupt 0 input.
(g) Pin 13 Int 1 Interrupt 1 input.
(h) Pin 14 Counter 0 clock input.
13
14
as an input (1) or an output (0), depends on its logic state. In order to configure a
microcontroller pin as an input, it is necessary to apply logic zero (0) to
appropriate I/O port bit. In this case, voltage level on appropriate pin will be 0.
Similarly, in order to configure a microcontroller pin as an input, it is necessary
to apply a logic one (1) to appropriate port. In this case, voltage level on
appropriate pin will be 5V (as is the case with any TTL input). This may seem
confusing but don't loose your patience. It all becomes clear after studying
simple electronic circuits connected to an I/O pin.
30 INPUT/OUTPUT (I/O) PIN
It refers to all the pins except those of the P0 port which do not have pull-up
resistors built-in.
PORT 0
PORT 1
PORT 2
15
16
PORT 3
34 All port pins can be used as general I/O, but they also have an
alternative function. In order to use these alternative functions, a logic one (1)
must be applied to appropriate bit of the P3 register. In terms of hardware, this
port is similar to P0, with the difference that its pins have a pull-up resistor built-
in.
35 When configured as outputs (logic zero (0)), single port pins can
receive a current of 10mA. If all 8 bits of a port are active, a total current must be
limited to 15mA (port P0: 26mA). If all ports (32 bits) are active, total maximum
current must be limited to 71mA. When these pins are configured as inputs (logic
1), built-in pull-up resistors provide very weak current.
MEMORY ORGANIZATION
36 The 8051 has two types of memory and these are Program Memory
and Data Memory. Program Memory (ROM) is used to permanently save the
program being executed, while Data Memory (RAM) is used for temporarily
storing data and intermediate results created and used during the operation of the
microcontroller. Depending on the model in use (we are still talking about the
8051 microcontroller family in general) at most a few Kb of ROM and 128 or
256 bytes of RAM is used. All 8051 microcontrollers have a 16-bit addressing
bus and are capable of addressing 64 kb memory. It is neither a mistake nor a big
ambition of engineers who were working on basic core development.
PROGRAM MEMORY
37 The first models of the 8051 microcontroller family did not have
internal program memory. It was added as an external separate chip. These
models are recognizable by their label beginning with 803 (for example 8031 or
8032). All later models have a few Kbyte ROM embedded. Even though such an
amount of memory is sufficient for writing most of the programs, there are
situations when it is necessary to use additional memory as well.
In both cases, P0 and P2 are not available for use since being used for data and
address transmission. Besides, the ALE and PSEN pins are also used.
DATA MEMORY
16
17
ADDITIONAL RAM
41 From the user’s point of view, everything works quite simply when
properly connected because most operations are performed by the
microcontroller itself. The 8051 microcontroller has two pins for data read
RD#(P3.7) and PSEN#. The first one is used for reading data from external data
memory (RAM), while the other is used for reading data from external program
memory (ROM). Both pins are active low. A typical example of memory
expansion by adding RAM and ROM chips (Hardware architecture). Even
though additional memory is rarely used with the latest versions of the
microcontrollers, we will describe in short what happens when memory chips are
connected according to the previous schematic. The whole process described
below is performed automatically.
(a) When the program during execution encounters an instruction
which resides in external memory (ROM), the microcontroller will
activate its control output ALE and set the first 8 bits of address (A0-
A7) on P0. IC circuit 74HCT573 passes the first 8 bits to memory
address pins.
(b) A signal on the ALE pin latches the IC circuit 74HCT573 and
immediately afterwards 8 higher bits of address (A8-A15) appear on
18
19
DIRECT ADDRESSING
INDIRECT ADDRESSING
46 Special Function Registers (SFRs) are a sort of control table used for
running and monitoring the operation of the microcontroller. Each of these
registers as well as each bit they include, has its name, address in the scope of
RAM and precisely defined purpose such as timer control, interrupt control,
serial communication control etc. Even though there are 128 memory locations
intended to be occupied by them, the basic core, shared by all types of 8051
microcontrollers, has only 21 such registers. Rest of locations are intentionally
left unoccupied in order to enable the manufacturers to further develop
microcontrollers keeping them compatible with the previous versions. It also
enables programs written a long time ago for microcontrollers which are out of
production now to be
A REGISTER (ACCUMULATOR)
B REGISTER
R REGISTERS (R0-R7)
20
21
52 A value stored in the Stack Pointer points to the first free stack address
and permits stack availability. Stack pushes increment the value in the Stack
Pointer by 1. Likewise, stack pops decrement its value by 1. Upon any reset and
power-on, the value 7 is stored in the Stack Pointer, which means that the space
of RAM reserved for the stack starts at this location. If another value is written to
this register, the entire Stack is moved to the new memory location.
21
22
Timer T0
Since the timer T0 is virtually 16-bit register, the largest value it can store is 65
535. In case of exceeding this value, the timer will be automatically cleared and
counting starts from 0. This condition is called an overflow. Two registers
TMOD and TCON are closely connected to this timer and control its operation.
22
23
57 This is one of the rarities being kept only for the purpose of
compatibility with the previous versions of microcontrollers. This mode
configures timer 0 as a 13-bit timer which consists of all 8 bits of TH0 and the
lower 5 bits of TL0. As a result, the Timer 0 uses only 13 of 16 bits. How does it
operate? Each coming pulse causes the lower register bits to change their states.
After receiving 32 pulses, this register is loaded and automatically cleared, while
the higher byte (TH0) is incremented by 1. This process is repeated until registers
count up 8192 pulses. After that, both registers are cleared and counting starts
from 0.
23
24
the timer starts operation. If the quartz crystal with frequency of 12MHz is
embedded then its contents will be incremented every microsecond. After 65.536
microseconds, the both registers the timer consists of will be loaded. The
microcontroller automatically clears them and the timer keeps on repeating
procedure from the beginning until the TR0 bit value is logic zero (0).
'READ' A TIMER
device is being turned on, the timer will measure duration of its operation, which
actually was the objective.
COUNTING UP PULSES
66 This time it's about the C/T0 bit. If the bit is cleared the timer counts
pulses generated by the internal oscillator, i.e. measures the time passed. If the
bit is set, the timer input is provided with pulses from the P3.4 pin (T0). Since
these pulses are not always of the same width, the timer cannot be used for time
measurement and is turned into a counter, therefore. The highest frequency that
could be measured by such a counter is 1/24 frequency of used quartz-crystal.
TIMER 1
26
27
(e) TB8 - Transmitter bit 8. Since all registers are 8-bit wide, this bit
solves the problem of transmitting the 9th bit in modes 2 and 3. It is
set to transmit logic 1 in the 9th bit.
(f) RB8 - Receiver bit 8 or the 9th bit received in modes 2 and 3.
Cleared by hardware if 9th bit received is a logic 0. Set by hardware
if 9th bit received is logic 1.
(g) TI - Transmit Interrupt flag is automatically set at the moment the
last bit of one byte is sent. It's a signal to the processor that the line is
available for a new byte transmits. It must be cleared from within the
software.
(h) RI - Receive Interrupt flag is automatically set upon one byte
receive. It signals that byte is received and should be read quickly
prior to being replaced by a new data. This bit is also cleared from
within the software.
69 Serial port mode is selected by combining the SM0 and SM2 bits. In
mode 0, serial data are transmitted and received through the RXD pin, while the
TXD pin output clocks. The bout rate is fixed at 1/12 the oscillator frequency. On
transmit, the least significant bit (LSB bit) is sent/received first.
TRANSMIT
RECEIVE
(b) Data receive through the RXD pin starts upon the two following
conditions are met: bit REN=1 and RI=0 (both of them are stored in
the SCON register). When all 8 bits have been received, the RI bit of
the SCON register is automatically set indicating that one byte
receive is complete. Since there are no START and STOP bits or any
other bit except data sent from the SBUF register in the pulse
sequence, this mode is mainly used when the distance between
devices is short, noise is minimized and operating speed is of
importance. A typical example is I/O port expansion by adding a
cheap IC
MODE 1
27
28
(a) TRANSMIT
(b)RECEIVE
The START bit (logic zero (0)) on the RXD pin initiates data
receive. The following two conditions must be met: bit REN=1 and
bit RI=0. Both of them are stored in the SCON register. The RI bit is
automatically set upon data reception is complete. The Baud rate in
this mode is determined by the timer 1 overflow.
MODE 2
MODE 3
72 Mode 3 is the same as Mode 2 in all respects except the baud rate. The
baud rate in Mode 3 is variable.
BAUD RATE
73 Baud Rate is a number of sent/received bits per second. In case the
UART is used, baud rate depends on: selected mode, oscillator frequency and in
some cases on the state of the SMOD bit of the SCON register. Timer 1 is
usually used as a clock generator as it enables various baud rates to be easily set.
(a) First, enable Timer 1 overflow interrupt.
(b) Configure Timer T1 to operate in auto-reload mode.
(c) Depending on needs, select one of the standard values from the
table and write it to the TH1 register. That's all.
MULTIPROCESSOR COMMUNICATION
28
29
75 There are five interrupt sources for the 8051, which means that they
can recognize 5 different events that can interrupt regular program execution.
Each interrupt can be enabled or disabled by setting bits of the IE register.
Likewise, the whole interrupt system can be disabled by clearing the EA bit of
the same register. Now, it is necessary to explain a few details referring to
external interrupts- INT0 and INT1. If the IT0 and IT1 bits of the TCON register
are set, an interrupt will be generated on high to low transition, i.e. on the falling
pulse edge (only in that moment). If these bits are cleared, an interrupt will be
continuously executed as far as the pins are held low.
30
31
(ii) Priority 1
(e) PX0 - External Interrupt INT0 Priority
(i) Priority 0
(ii) Priority 1
HANDLING INTERRUPT
79 When an interrupt request arrives the following occurs
(a) Instruction in progress is ended.
(b) The address of the next instruction to execute is pushed on the
stack.
(c) Depending on which interrupt is requested, one of 5 vectors
(addresses) is written to the program counter in accordance to the
table below
(d) These addresses store appropriate subroutines processing
interrupts. Instead of them, there are usually jump instructions
specifying locations on which these subroutines reside.
(e) When an interrupt routine is executed, the address of the next
instruction to execute is poped from the stack to the program counter
and interrupted program resumes operation from where it left off.
RESET
80 Reset occurs when the RS pin is supplied with a positive pulse in
duration of at least 2 machine cycles (24 clock cycles of crystal oscillator). After
that, the microcontroller generates an internal reset signal which clears all SFRs,
except SBUF registers, Stack Pointer and ports (the state of the first two ports is
not defined, while FF value is written to the ports configuring all their pins as
inputs). Depending on surrounding and purpose of device, the RS pin is usually
connected to a power-on reset push button or circuit or to both of them. Figure
below illustrates one of the simplest circuits providing safe power-on reset.
Basically, everything is very simple: after turning the power on, electrical
capacitor is being charged for several milliseconds through a resistor connected
to the ground. The pin is driven high during this process. When the capacitor is
charged, power supply voltage is already stable and the pin remains connected to
the ground, thus providing normal operation of the microcontroller. Pressing the
reset button causes the capacitor to be temporarily discharged and the
microcontroller is reset. Microcontrollers normally operate at very high speed.
The use of 12 Mhz quartz crystal enables 1.000.000 instructions to be executed
per second. Basically, there is no need for higher operating rate. In case it is
needed, it is easy to build in a crystal for high frequency. The problem arises
when it is necessary to slow down the operation of the microcontroller. For
example during testing in real environment when it is necessary to execute
several instructions step by step in order to check I/O pins' logic state.Interrupt
system of the 8051 microcontroller practically stops operation of the
microcontroller and enables instructions to be executed one after another by
pressing the button. Two interrupt features enable that
(a) Interrupt request is ignored if an interrupt of the same priority
level is in progress.
31
32
83 The microcontroller is inactive for the most part and just waits for
some external signal in order to takes its role in a show. This can cause some
problems in case batteries are used for power supply. In extreme cases, the only
solution is to set the whole electronics in sleep mode in order to minimize
consumption. A typical example is a TV remote controller: it can be out of use
for months but when used again it takes less than a second to send a command to
TV receiver. The AT89S53 uses approximately 25mA for regular operation,
which doesn't make it a power-saving microcontroller. Anyway, it doesn’t have
to be always like that, it can easily switch the operating mode in order to reduce
its total consumption to approximately 40uA. Actually, there are two power-
saving modes of operation: Idle and Power Down.
IDLE MODE
84 Upon the IDL bit of the PCON register is set, the microcontroller turns
off the greatest power consumer- CPU unit while peripheral units such as serial
port, timers and interrupt system continue operating normally consuming 6.5mA.
In Idle mode, the state of all registers and I/O ports remains unchanged. In order
to exit the Idle mode and make the microcontroller operate normally, it is
necessary to enable and execute any interrupt or reset. It will cause the IDL bit to
be automatically cleared and the program resumes operation from instruction
having set the IDL bit. It is recommended that first three instructions to execute
now are NOP instructions. They don't perform any operation but provide some
time for the microcontroller to stabilize and prevents undesired changes on the
I/O ports.
32
33
85 By setting the PD bit of the PCON register from within the program,
the microcontroller is set to Power down mode, thus turning off its internal
oscillator and reduces power consumption enormously. The microcontroller can
operate using only 2V power supply in power- down mode, while a total power
consumption is less than 40uA. The only way to get the microcontroller back to
normal mode is by reset. While the microcontroller is in Power Down mode, the
state of all SFR registers and I/O ports remains unchanged. By setting it back
into the normal mode, the contents of the SFR register is lost, but the content of
internal RAM is saved. Reset signal must be long enough, approximately 10mS,
to enable stable operation of the quartz oscillator.
PCON REGISTER
86 The purpose of the Register PCON bits is
(a) SMOD Baud rate is twice as much higher by setting this bit.
(b) GF1 General-purpose bit.
(c) GF1 General-purpose bit.
(d) GF0 General-purpose bit.
(e) PD By setting this bit the microcontroller enters the Power Down
mode.
(f) IDL By setting this bit the microcontroller enters the Idle mode.
THE 8051 INSTRUCTION SET
87 The process of writing program for the microcontroller mainly
consists of giving instructions (commands) in the specific order in which they
should be executed in order to carry out a specific task. As electronics cannot
“understand” what for example an instruction “if the push button is pressed- turn
the light on” means, then a certain number of simpler and precisely defined
orders that decoder can recognize must be used. All commands are known as
instruction set. All microcontrollers compatible with the 8051 have in total of
255 instructions, i.e. 255 different words available for program writing. At first
sight, it is imposing number of odd signs that must be known by heart. However,
It is not so complicated as it looks like. Many instructions are considered to be
“different”, even though they perform the same operation, so there are only 111
truly different commands. For example: ADD A, R0, ADD A, R1, ADD A, R7
are instructions that perform the same operation (addition of the accumulator and
register). Since there are 8 such registers, each instruction is counted separately.
Taking into account that all instructions perform only 53 operations (addition,
subtraction, copy etc.) and most of them are rarely used in practice, there are
actually 20-30 abbreviations to be learned, which is acceptable.
TYPES OF INSTRUCTIONS
LOGIC INSTRUCTIONS
BIT-ORIENTED INSTRUCTIONS
34
35
A - Accumulator;
Rn - is one of working registers (R0-R7) in the currently active RAM memory
bank;
Direct - is any 8-bit address register of RAM. It can be any general-purpose
register or a SFR (I/O port, control register etc.);
@Ri - is indirect internal or external RAM location addressed by register R0 or
R1;
#data - is an 8-bit constant included in instruction (0-255);
#data16 - is a 16-bit constant included as bytes 2 and 3 in instruction (0-65535);
addr16 - is a 16-bit address. May be anywhere within 64KB of program
memory;
addr11 - is an 11-bit address. May be within the same 2KB page of program
memory as the first byte of the following instruction;
rel - is the address of a close memory location (from -128 to +127 relative to the
first byte of the following instruction). On the basis of it, assembler computes the
value to add or subtract from the number currently stored in the program counter;
bit - is any bit-addressable I/O pin, control or status bit; and
C - is carry flag of the status register (register PSW).
A: accumulator
R:register(R0-R7)
Instruction adds the register Rn (R0-R7) to the accumulator. After addition, the
result is stored in the accumulator.
35
36
A: accumulator
R:register(R0-R1)
Instruction adds the indirect RAM to the accumulator. Address of indirect RAM
is stored in the Ri register (R0 or R1). After addition, the result is stored in the
accumulator.
A: accumulator
Instruction adds the direct byte to the accumulator. As it is direct addressing, the
direct can be any SFR or general-purpose register with address 0-7 Fh. The result
is stored in the accumulator.
ADDC A,Rn - Adds the register to the accumulator with a carry flag
A: accumulator
Rn:register(R0-R7)
Instruction adds the accumulator with a carry flag and Rn register (R0-R7). After
addition, the result is stored in the accumulator.
A: accumulator
Instruction adds data (0-255) to the accumulator. After addition, the result is
stored in the accumulator.
ADDC A,direct - Adds the direct byte to the acumulator with a carry flag
A: accumulator
Instruction adds the direct byte to the accumulator with a carry flag. As it is
direct addressing, the register can be any SFRs or general purpose register with
address 0-7Fh (0-127dec.). The result is stored in the accumulator.
ADDC A,@Ri - Adds the indirect RAM to the accumulator with a carry flag
A: accumulator
R:register(R0-R1)
Instruction adds the indirect RAM to the accumulator with a carry flag. RAM
address is stored in the Ri register (R0 or R1). After addition, the result is stored
in the accumulator.
ADDC A,#data - Adds the immediate data to the accumulator with a carry flag
A: accumulator
Instruction adds data (0-255) to the accumulator with a carry flag. After addition,
the result is stored in the accumulator.
37
38
A: accumulator
R:register(R0-R7)
A: accumulator
R:register(R0-R7)
Instruction performs logic AND operation between the accumulator and drect
register. As it is direct addressing, the register can be any SFRs or general-
purpose register with address 0-7Fh (o-127 dec.). The result is stored in the
accumulator.
38
39
A: accumulator
R:register(R0-R1)
A: accumulator
Instruction performs logic AND operation between the accumulator and data.
The result is stored in the accumulator.
Instruction performs logic AND operation between direct byte and accumulator.
As it is direct addressing, the register can be any SFRs or general-purpose
register with address 0-7Fh (0-127 dec.). The result is stored in the direct byte.
39
40
Instruction performs logic AND operation between direct byte and data. As it is
direct addressing, the register can be any SFRs or general-purpose register with
address 0-7Fh (0-127 dec.). The result is stored in the direct byte.
C: carry flag
Instruction performs logic AND operation between the direct bit and the carry
flag. Syntax: ANL C, bit address;
Bytes: 2 (instruction code, bit address);
STATUS register flags: C;
C: carry flag
40
41
CJNE A,direct,rel - Compares direct byte to the accumulator and jumps if not
equal
Instruction first compares the number in the accumulator with the directly
addressed byte. If they are equal, the program proceeds with execution.
Otherwise, a jump to the specified address will be executed. This is a short jump
instruction, which means that the address of a new location must be relatively
near the current one (-128 to +127 locations relative to the first following
instruction).
41
42
Syntax: CLR A;
Byte: 1 (instruction code);
STATUS register flags: No flags are affected.
Syntax: CLR C;
Byte: 1 (instruction code);
STATUS register flags: C;
Syntax: CPL A;
Bytes: 1 (instruction code);
STATUS register flags: No flags are affected.
Syntax: CPL C;
Byte: 1 (instruction code);
STATUS register flags: C;
Syntax: DA A;
Byte: 1 (instruction code);
STATUS register flags: C;
Syntax: DEC A;
Byte: 1 (instruction code);
STATUS register flags: No flags are affected;
43
44
Instruction divides the value in the accumulator by the value in the B register.
After division the integer part of result is stored in the accumulator while the
register contains the remainder. In case of dividing by 1, the flag OV is set and
the result of division is unpredictable. The 8-bit quotient is stored in the
accumulator and the 8-bit remainder is stored in the B register.
This instruction decrements the value in the indirectly addressed register of RAM
by 1. The register address is stored in the Ri register (R0 or R1). If there is a 0 in
the register, the result will be FFh.
This instruction first decrements value in the register. If the result is 0, the
program proceeds with execution. Otherwise, a jump to the specified address in
the program will be executed. As it is direct addressing, the register must be
44
45
within the first 255 locations of RAM. This is a short jump instruction, which
means that the address of a new location must be relatively near the current one
(-128 to +127 locations relative to the first following instruction).
98 This instruction first decrements the value in the Rn register. If the result
is 0, the program proceeds with execution. Otherwise, a jump to the specified
address in the program will be executed. This is a short jump instruction, which
means that the address of a new location must be relatively near the current one
(- 128 to +127 locations relative to the first following instruction).
99 Syntax: DJNZ Rn, [jump address];
Bytes: 2 (instruction code, jump address);
STATUS register flags: No flags are affected;
Syntax: INC A;
Byte: 1 (instruction code);
STATUS register flags: No flags are affected;
45
46
This instruction increments the value in the directly addressed register of RAM
by 1. The register address is stored in the Ri Register (R0 or R1). If the register
includes the number 255, the result of the operation will be 0.
Instruction increments the direct byte by 1. If the register includes the number
255, the result of the operation will be 0. As it is direct addressing, the register
must be within the first 255 RAM locations.
If the bit is set, a jump to the specified address will be executed. Otherwise, if the
value of bit is 0, the program proceeds with the next instruction. This is a short
jump instruction, which means that the address of a new location must be
relatively near the current one (-128 to + 127 locations relative to the first
following instruction).
46
47
Instruction increments the value of the 16-bit data pointer by 1. This is the only
16-bit register upon which this operation can be performed.
Instruction first checks if the carry flag is set. If set, a jump to the specified
address is executed. Otherwise, the program proceeds with the next instruction.
This is a short jump instruction, which means that the address of a new location
must be relatively near the current one (-129 to + 127 locations relative to the
first following instruction).
This instruction first checks if the bit is set. If set, a jump to the specified address
is executed and the bit is cleared. Otherwise, the program proceeds with the first
following instruction. This is a short jump instruction, which means that the
address of a new location must be relatively near the current one (-129 to + 127
locations relative to the first following instruction).
If the bit is cleared, a jump to the specified address will be executed. Otherwise,
if the bit value is 1, the program proceeds with the first following instruction.
This is a short jump instruction, which means that the address of a new location
47
48
must be relatively near the current one (-129 to + 127 locations relative to the
first following instruction).
This instruction causes a jump to the address calculated by adding value stored in
the accumulator to the 16-bit number in the DPTR Register. It is used with
complex program branching where the accumulator affects jump address, for
example when reading a table. Neither accumulator nor DPTR register are
affected.
JNZ Jump if accumulator is not zero. This instruction checks if the value stored
in the accumulator is 0. If not, a jump to the specified address will be executed.
Otherwise, the program proceeds with the first following instruction. This is a
short jump instruction, which means that the address of a new location must be
relatively near the current one (-129 to + 127 locations relative to the first
following instruction).
48
49
This instruction first checks whether the carry flag is set. If not, a jump to the
specified address will be executed. Otherwise, the program proceeds with the
first following instruction. This is a short jump instruction, which means that the
address of a new location must be relatively near the current one (-129 to + 127
locations relative to the first following instruction).
The instruction checks whether the value stored in the accumulator is 0. If yes, a
jump to the specified address will be executed. Otherwise, the program proceeds
with the following instruction. This is a short jump instruction, which means that
the address of a new location must be relatively near the current one (-129 to +
127 locations relative to the first following instruction).
The instruction moves the Rn register to the accumulator. The Rn register is not
affected.
49
50
50
51
Instruction moves the direct byte to the Rn register. As it is direct addressing, the
register can be any SFRs or general-purpose register with address 0-7Fh. (0-127
dec.). After executing the instruction, the register is not affected.
Instruction moves the Rn register to the direct byte. As it is direct addressing, the
register can be any SFRs or general-purpose register with address 0-7Fh. (0-127
dec.). After executing the instruction, the register is not affected.
51
52
Instruction moves the indirectly adressed register of RAM to the direct byte. The
register is not affected.
Instruction moves the direct byte to another direct byte. As it is direct addressing,
both registers can be any SFRs or general-purpose registers with address 0-7Fh.
(0-127 dec.). The direct1 is not affected.
52
53
Instruction moves the immediate data to the idirectly addressed register of RAM.
The register address is stored in the Ri register (R0 or R1).
Instruction moves the direct byte to a register the address of which is stored in
the Ri register (R0 or R1). After executing the instruction, the direct byte is not
affected.
53
54
Instruction moves the carry flag to the direct bit. After executing the instruction,
the carry flag is not affected.
Instruction moves the direct bit to the carry flag. After executing the instruction,
the bit is not affected.
MOVC A,@A+DPTR - Moves the code byte relative to the DPTR to the
accumulator
Instruction first adds the 16-bit DPTR register to the accumulator. The result of
addition is then used as a memory address from which the 8-bit data is moved to
the accumulator.
Instruction stores a 16-bit constant to the DPTR register. The 8 high bits of the
constant are stored in the DPH register, while the 8 low bits are stored in the
DPL register.
54
55
MOVX A,@Ri - Moves the external RAM (8-bit address) to the accumulator
Instruction reads the content of a register in external RAM and moves it to the
accumulator. The register address is stored in the Ri register (R0 or R1).
MOVC A,@A+PC - Moves the code byte relative to the PC to the accumulator
Instruction first adds the 16-bit PC register to the accumulator (the current
program address is stored in the PC register). The result of addition is then used
as a memory address from which the 8-bit data is moved to the accumulator.
MOVX @Ri,A - Moves the accumulator to the external RAM (8-bit address)
55
56
Instruction multiplies the value in the accumulator with the value in the B
register. The low-order byte of the 16-bit result is stored in the accumulator,
while the high byte remains in the B register. If the result is larger than 255, the
overflow flag is set. The carry flag is not affected.
Instruction moves the accumulator to a register stored in external RAM. The 16-
bit address of the register is stored in the DPTR register (DPH and DPL).
56
57
NOP - No operation
103 Instruction doesn’t perform any operation and is used when additional
time delays are needed.
Syntax: NOP;
Byte: 1 (instruction code);
STATUS register flags: No flags affected;
57
58
Instruction performs logic OR operation between the direct bit and the carry flag.
The result is stored in the carry flag.
58
59
Instruction performs logic OR operation between the immediate data and the
direct byte. As it is direct addressing, the direct byte can be any SFRs or general-
purpose register with address 0-7Fh (0-127 dec.). The result is stored in the direct
byte.
105 Instruction first reads data from the location being pointed to by the
Stack. The data is then copied to the direct byte and the value of the Stack
Pointer is decremented by 1. As it is direct addressing, the direct byte can be any
SFRs or general-purpose register with address 0-7Fh. (0-127 dec.).
59
60
RET - Return from subroutine. This instruction ends every subroutine. After
execution, the program proceeds with the instruction following an ACALL or
LCALL.
Syntax: RET;
Byte: 1 (instruction code);
STATUS register flags: No flags affected;
Eight bits in the accumulator are rotated one bit left, so that the bit 7 is rotated
into the bit 0 position.
Syntax: RL A;
Byte: 1 (instruction code);
STATUS register flags: No flags affected;
This instruction ends every interrupt routine and informs processor about it. After
executing the instruction, the program proceeds from where it left off. The PSW
is not automatically returned its pre-interrupt status.
60
61
Syntax: RETI;
Byte: 1 (instruction code);
STATUS register flags: No flags affected;
108 All eight bits in the accumulator are rotated one bit right so that the bit 0
is rotated into the bit 7 position.
Syntax: RR A;
Byte: 1 (instruction code);
STATUS register flags: No flags affected;
RLC A - Rotates the accumulator one bit left through the carry flag
109 All eight bits in the accumulator and carry flag are rotated one bit left.
After this operation, the bit 7 is rotated into the carry flag position and the carry
flag is rotated into the bit 0 position.
Syntax: RLC A;
Byte: 1 (instruction code);
STATUS register flags: C;
Syntax: SETB C;
Byte: 1 (instruction code);
STATUS register flags: C;
RRC A - Rotates the accumulator one bit right through the carry flag
All eight bits in the accumulator and carry flag are rotated one bit right. After this
operation, the carry flag is rotated into the bit 7 position and the bit 0 is rotated
into the carry flag position.
61
62
Syntax: RRC A;
Byte: 1 (instruction code);
STATUS register flags: C;
Instruction enables jump to the new address which should be in the range of -128
to +127 locations relative to the first following instruction.
Instruction sets the specified bit. The register containing that bit must belong to
the group of the so called bit addressable registers.
SUBB A,direct - Subtracts the direct byte from the accumulator with a borrow
Instruction subtracts the direct byte from the accumulator with a borrow. If the
higher bit is subtracted from the lower bit then the carry flag is set. As it is direct
addressing, the direct byte can be any SFRs or general-purpose register with
address 0-7Fh. (0-127 dec.). The result is stored in the accumulator.
SUBB A,Rn - Subtracts the Rn register from the accumulator with a borrow
Instruction subtracts the Rn register from the accumulator with a borrow. If the
higher bit is subtracted from the lower bit then the carry flag is set. The result is
stored in the accumulator.
SUBB A,#data - Subtracts the immediate data from the accumulator with a
borrow
Instruction subtracts the immediate data from the accumulator with a borrow. If
the higher bit is subtracted from the lower bit then the carry flag is set. The result
is stored in the accumulator.
SUBB A,@Ri - Subtracts the indirect RAM from the accumulator with a borrow
Instruction causes the accumulator and Rn register to exchange data. The content
of the accumulator is moved to the Rn register and vice versa.
63
64
A nibble refers to a group of 4 bits within one register (bit0-bit3 and bit4-
bit7).This instruction interchanges high and low nibbles of the accumulator.
Syntax: SWAP A;
Byte: 1 (instruction code);
STATUS register flags: No flags are affected;
Instruction moves the contents of the accumulator into the direct byte and vice
versa. As it is direct addressing, the direct byte can be any SFRs or general-
purpose register with address 0-7Fh (0-127 dec.).
64
65
XCHD A,@Ri - Exchanges the low-order nibble indirect RAM with the
accumulator
This instruction interchanges the low-order nibbles (bits 0-3) of the accumulator
with the low-order nibbles of the indirectly addressed register of RAM. High-
order nibbles of the accumulator and register are not affected. This instruction is
mainly used when operating with BCD values. As it is indirect addressing, the
register address is stored in the register Ri (R0 or R1).
65
66
purpose register with address 0-7Fh (0-127 dec.). The result is stored in the
accumulator.
Instruction performs exclusive OR operation between the direct byte and the
accumulator. As it is direct addressing, the register can be any SFRs or general-
purpose register with address 0-7Fh (0-127 dec.). The result is stored in the
register.
Instruction performs exclusive OR operation between the immediate data and the
direct byte. As it is direct addressing, the register can be any SFRs or general-
purpose register with address 0-7Fh (0-127 dec.). The result is stored in the
register.
No flags affected;
P89V51RD2BN MICROCONTROLLER
111 The 8051 microcontroller is being manufactured across the globe by
many manufacturers and under different names. Of course, the latest versions are
by far more advanced than the original one. Many of them has the label “8051
compatible”, “8051 compliant”or “8051 family” in order to emphasize their
“noble heritage”. These tags imply that microcontrollers have similar architecture
and are programmed in a similar way using the same instruction set. Practically,
if you know how to handle one microcontroller belonging to this family, you will
be able to handle any of them. In other words, several hundreds of different
models are at your disposal. Because it is widely used, cheap and uses Flash
memory for storing programs. The last feature mentioned makes it ideal for
experimentation due to the fact that program can be loaded and erased from it for
many times. Besides, thanks to the built-in SPI System, the program can be
loaded to the microcontroller even after embedding the chip in the target device.
67
68
68
69
PINOUT DESCRIPTION
(a) PORT 0
(b)PORT 1
(c) PORT 2
69
70
(A8-A15) comes out on the Port 2 which is thus used for addressing
it.
(d) Port 3 Similar to P1, Port 3 pins can be used as general inputs or
outputs.
(e) RST
(f) ALE
(g) PSEN
(h)EA/VPP
(i) XTAL 1
(j) XTAL 2
70
71
115 EEPROM is a special type of memory having features of both RAM and
ROM. The contents of the EEPROM may be changed during operation, but
remains permanently saved even after the loss of power. The P89V51RD2BN
microcontroller has in total of 2K of EEPROM that is 2048 locations.
MEMORY EXPANSION
116 All mentioned above about ROM and RAM memory expansion remains
in force when it comes to the P89V51RD2BN microcontroller as it is based on
the 8051 core. In other words, both memories can be added as external chips with
the capacity of up to 64Kb. The process of addressing is also the same as in the
8051 standard.
TYPES OF ADDRESSING
117 Similar to all microcontrollers compatible with the 8051, there are two
ways of addressing
(a) Direct addressing (for example: MOV A,30h)
(b) Indirect addressing (for example: MOV A,@R0).
SPECIAL FUNCTION REGISTERS (SFRS)
71
72
mostly in control of one specific circuit within the microcontroller such as timers
or SPI.
ACCUMULATOR (ACC)
B REGISTER
120 The B register also belongs to the core registers of the 8051
microcontroller. Bits of this register are not modified. It is used during multiply
and divide operations (MUL and DIV instructions) to store the operands upon
which these operations are performed.
121 The PSW register belongs to the core registers of the 8051
microcontroller. Bits of this register are not modified.
123 Each bit of these registers corresponds to one of the port pins having the
same name. These registers are therefore used for communication with peripheral
environment which is carried out by sending data from registers to the
corresponding pins and vice versa. They belong to the core registers of the 8051
microcontroller and their bits are not modified.
124 They belong to the core registers of the 8051 microcontroller. Their bits
are not modified.
DISALE
(a) 0 ALE is activated at a constant rate of 1/6 the oscillator
frequency.
(b)1 ALE is active only during execution of MOVX or MOVC
instructions.
INTEL_PWD_EXIT
72
73
126 Data Pointers are not true registers as they don’t physically exist. They
consist of two separate registers: DPH (Data Pointer High) and DPL (Data
Pointer Low). All 16 bits are used for addressing external and internal EEPROM
memory. The DPS bit of the EECON register determines the registers to be used
as data pointers.
(a) DPS=0 -> Data pointer consists of DP0L and DP0H registers and
is marked as DPTR0.
(b) DPS=1 -> Data pointer consists of DP1L and DP1H registers and
is marked as DPTR1.
EECON REGISTER
73
74
WRTINH
129 The WRTINH bit is read-only. When the power supply voltage is too
low for programming EEPROM, hardware automatically clears this bit, which
means that write to EEPROM cannot be completed or is aborted if in progress.
RDY/BSY
130 The RDY/BSY bit is read-only.
(a) 0 - Write in progress (takes approximately 4mS).
(b) 1 - Write complete (data is written to EEPROM).
131 DPS
(a) 0 - Address for EEPROM write/read is stored in the DP0H and
DP0L registers.
(b) 1 - Address for EEPROM write/read is stored in the DP1H and
DP1L registers.
132 EEMEN
(a) 0 - Instruction MOVX is used for accessing external memory
chip.
(b) 1 - Instruction MOVX is used for accessing internal EEPROM
memory. If the register address is larger than 2K, the microcontroller
will access external memory chip.
EEMWE
133 When set, the EEMWE bit enables write to EEPROM using the MOVX
instruction. After completing EEPROM write, the bit must be cleared from
within the program.
EELD
135 The watchdog timer uses pulses generated by the quartz oscillator for its
operation. It is disabled after reset and during Power Down Mode, thus having no
effect on the program execution. If enabled, every time it counts up to the
program end, the microcontroller reset occurs and program execution starts from
the first instruction. Reset condition indicates that the program doesn’t work
properly for some reason. The point is to prevent this from happening by setting
instruction to reset the watchdog timer at the appropriate program location.
74
75
Practically, the whole this process is in control of several bits of the WDTCON
register. Three bits (PS2, PS1 and PS0), which are in control of the prescaler,
determine the most important feature of the watchdog timer- nominal time, i.e.
time required to count up a full cycle.
136 These three bits are in control of the prescaler and determine the
nominal time of the watchdog timer. If the program doesn’t clear the WSWRST
bit during that time, the watchdog timer will reset the microcontroller. When all
three bits are cleared to 0, the watchdog timer has a nominal period of 16K
machine cycles. When all three bits are set to 1, the nominal period is 2048K
machine cycles.
WDIDLE
137 The WDIDLE bit enables/disables the watchdog timer in Idle mode:
(a) 0 - Watchdog timer is enabled in Idle mode (low-consumption
mode).
(b) 1 - Watchdog timer is disabled in Idle mode.
DISRTO
138 The DISRTO bit enables/disables reset of peripheral circuits connected
to the RST pin
(a) 0 - Watchdog controls the state of the input reset pin. At the
moment of reset, this pin acts for a moment as an output and
generates a logic one (1). It causes the microcontroller and all other
circuits connected to the RST pin to be reset.
(b) 1 - Reset triggered by the watchdog timer doesn’t affect the state
of the reset pin. At the moment the watchdog timer resets the
microcontroller, the reset pin remains configured as an input.
HWDT
139 The HWDT bit selects hardware or software mode for the watchdog
timer:
(a) 0 - Watchdog is in software mode and can be enabled or disabled
by the WDTEN bit.
(b) 1 - Watchdog is in hardware mode. To enable it, the sequence
1E/E1(hex) should be written to the WDTRST register. Only reset
condition can disable the watchdog timer. In order to prevent the
WCDT from resetting the microcontroller when the nominal time
expires, the same sequence 1E/E1hex must be constantly repeated.
WSWRST
140 When set, this bit resets the watchdog timer in software mode (bit
HWDT=0). In order to enable the microcontroller to operate without being
interrupted, this bit must regularly be cleared from within the program. After
being set, the watchdog timer is cleared by hardware, counting starts from zero
and the bit is automatically cleared. If the watchdog timer is in hardware mode,
setting this bit has no effect on the watchdog timer operation.
75
76
WDTEN
141 The WDTEN bit enables/disables the watchdog timer in software mode
(HWDT=0)
(a) 0 - Watchdog disabled.
(b) 1 - Watchdog enabled.
142 When the watchdog timer is in hardware mode (HWDT=1), this bit is
read-only and reflects the status of the watchdog timer (whether it is enabled or
disabled).
INTERRUPTS
143 The P89V51RD2BN has in total of six interrupt sources, which means
that it can recognize up to 6 different events that can interrupt regular program
execution. Each of these interrupts can be individually enabled or disabled by
setting bits of the IE register, whereas the whole interrupt system can be disabled
by clearing the EA bit of the same register. Since this microcontroller has
embedded Timer T2 and SPI (they don't fall under the “8051 Standard”) which
can generate an interrupt, it was necessary to make some changes in registers
controlling interrupt system. Besides, there is a new interrupt vector i.e. program
memory address from which the program proceeds with execution when the
Timer T2 generates an interrupt. All these changes are made on the previously
unused bits. This enables all programs written for the previous versions of the
microcontrollers to be used in this one too without being modified. This is why
the 8051-based microcontrollers are so popular.
76
77
(g) EX0 bit enables or disables external interrupt through the INT1
pin:
(i) 0 - Interrupt on the INT1 pin disabled.
(ii) 1 - Interrupt on the INT1 pin enabled.
INTERRUPT PRIORITIES
144 When several interrupts are enabled, it may happen that while one of
them is in progress, another one is requested. In such situations, the
microcontroller needs to know whether to proceed with the execution of current
interrupt routine or to meet a new interrupt request. For this reason, there is a
priority list on the basis of which the microcontroller knows what to do. The
previous versions of the microcontrollers differentiate between two priority
levels defined in the IP register. As for the P89V51RD2BN microcontroller,
there is an additional SFR register IPH which enables all the interrupts to be
assigned 1 out of 4 priorities (excluding reset). Here is a list of priorities
(a) Reset. If a reset request arrives, all processes are stopped and the
microcontroller restarts.
(b) The high priority interrupt (3) can be disabled by reset only.
(c) The low priority interrupt (2, 1 or 0) can be disabled by any high
priority interrupt and reset.
145 It is usually defined at the beginning of the program which one of the
existing interrupt sources have high and which one has low priority level.
According to this, the following occurs.If two interrupt requests, at different
priority levels, arrive at the same time then the higher priority interrupt is always
serviced first. If the both interrupt requests, at the same priority level, occur one
after another, the one which came later has to wait until routine being in progress
ends. If two interrupt requests of equal priority arrive at the same time then the
interrupt to be serviced is selected according to the following priority list
(a) External interrupt INT0
(b) Timer T0 interrupt
(c) External interrupt INT1
(d) Timer T1 interrupt
(e) Serial communication interrupt
(f) Timer T2 Interrupt
IP REGISTER (INTERRUPT PRIORITY REGISTER)
(ii) 1 - Priority 1
(e) PT0 Timer T0 interrupt priority:
(i) 0 - Priority 0
(ii) 1 - Priority 1
(f) PX0 External interrupt INT0 priority:
(i) 0 - Priority 0
(ii) 1 - Priority 1
147 IPH Register (Interrupt Priority High)
(a) PT2H Timer T2 interrupt priority
(b) PSH Serial port interrupt priority
(c) PT1H Timer T1interrupt priority
(d) PX1H External interrupt INT1 priority
(e) PT0H Timer T0 interrupt priority
(f) PX0H External interrupt INT0 Priority
Bits of this register can be combined with appropriate bits of the IP register.
This is how a new priority list with 4 interrupt priority levels is obtained.
PROCESSING INTERRUPT
TIMERS T0 AND T1
TIMER T2
78
79
connected and operate as capture registers. They are used to temporarily store the
contents of the counter register. The main advantage of this timer compared to
timers 0 and 1 is that all read and swap operations are easily performed using one
instruction. Similar to T0 and T1, it has four different modes of operation.
79
80
153 If the CP/RL2 bit of the T2CON register is set, timer 2 operates. This is
so called Capture mode in which the value of the counter register can be
“captured” and copied to the capture register, thus not affecting the counting
process.
154 First, it is necessary to write a number from which the counting starts to
a 16-bit register (TH2+TL2). Timer 2 is enabled by setting the TR2 bit of the
TCON register. Each coming pulse increments the number stored in the 16-bit
register by 1. When both registers are loaded (decimal number 65536), the first
next pulse causes an overflow, reset occurs and counting starts from zero.
80
81
DCEN - When set, it enables counting in either direction- "up" and "down".
All previously mentioned about timer 2 is in force only if the T2MOD register
hasn't been changed, i.e. if DCEN = 0. Otherwise, timer/counter is enabled to
count in either direction, which depends on the T2EX pin
156 On counting up, the whole procedure is similar to the previous mode
with one exception referring to the function of the EXF2 bit. On counting down,
an overflow occurs when values stored in the counter and capture registers
match. It causes the TF2 bit as well as all bits of registers T2H and T2L to be set
while the counter keeps on counting down: 65535, 65534 and 65533. In either
case, the EXF2 bit is assigned a new function. When an overflow occurs, this bit
inverts the signal and cannot be used for generating an interrupt anymore.
Instead, it serves as supplementary bit (the 17th bit) of the counter register,
making this counters virtually a 17-bit register.
157 The Timer T2 can be used as a baud rate generator and a clock generator
simultaneously. If the RCLK or TCLK bit of the register TCON is set, timer T2
turns into a clock generator, so called Baud Rate generator). This mode is very
similar to auto-reload mode. The baud rate is computed using the following
formula
81
82
MULTIPROCESSOR COMMUNICATION
have to check each address received via the serial port. Let's make it clear. Two
special function registers, SADDR and SADEN, enable multiprocessor
communication. Each device has an individual address that is specified in the
SADDR register, while the so called mask address is written to the SADEN
register. The mask address contains don't care bits which provide the flexibility
to address one or more slaves at a time. In other words, it defines which bits of
the SADDR register are to be used and which are to be ignored. When the master
wants to transmit data to one of several slaves, it first sends out an address byte
which identifies the target device. An address byte differs from a data byte in that
the 9th bit is 1 in an address byte and 0 in a data byte. After receiving the address
byte, all slaves check whether it matches their address. The adressed slave clears
its SM2 bit and prepares to receive the data bytes to come. The slaves that
weren't addressed leave their SM2 bits set and ignore the coming data bytes.
(a) If transmit address is 1100 0010, the data will be sent to slave device B.
(b) If transmit address is 1100 0001 the data will be sent to slave device C.
(c) If transmit address is 1100 0000 the data will be sent to both slave devices.
83
84
164 Data written to the SPI data register SPDR is automatically transferred
to an 8- bit shift register. SPI clock generator is enabled and serial data appears
on the MOSI pin. An initial delay may occur for the sake of synchronization with
the main oscillator. After sending one byte, the SPI clock generator stops, the
SPIF bit (flag) is set, the received byte is transferred to the SPDR register and, if
enabled, an interrupt is generated. Any attempt to write another byte to the SPDR
register while byte transmits is in progress will cause the WCOL bit to be set. It
indicates that an error has occurred. However, the byte will be successfully
transmitted, while the new byte will be ignored, i.e. it will not be transmitted.
165 Enhanced mode is similar to normal except that this time data goes
through one more register while being transmitted. It makes no sense at first
sight, but communication is really faster. Data written to the SPI data register
SPDR is automatically transferred to the capture register (buffer), which causes
the WCOL bit to be set. It means that the buffer is full and any further write will
cause an overflow. Control electronics (hardware) cleares this bit after
transmitting data from buffer to the shift register and after commencing serial
data transmit. If the byte sent is the first, the data is immediately transmitted to
the shift register (still empty), thus clearing the WCOL bit. While one byte
transmit is in progress, the next byte to transmit may be written to the SPDR
register. It will be immediately moved to buffer. In order to check whether data
transmit is in progress, it is sufficient to check the logic state of the LDEN bit of
the SPSR register. If this bit is set and the WCOL bit is cleared, data transmit is
in progress and buffer is empty so the next byte can be written to the SPDR
register. If individual bytes are sent occasionally then there is no need to
complicate- the best solution is the normal mode. If it is necessary to send a great
amount of data, it is better to use enhanced mode in which the clock oscillator is
enabled as far as buffer is regularly loaded and the WCOL bit is set. In addition,
no time is needed for synchronization and data is easily and efficiently
transferred. The SPI system is under control of 3 special function registers. These
are SPDR, SPSR and SPCR.
The SPDR register is used for storing data to be transferred via SPI (in serial
format). It is also used for storing received data.
(a) SPIF Interrupt flag. Upon data transfer, this bit is automatically
set and an interrupt is generated if SPIE=1 and ES=1. The SPIF bit is
cleared by reading SPSR followed by reading/writing SPDR register.
84
85
(b) WCOL This bit is set in normal mode (ENH=0) if the SPDR
register is written during data transfer is in progress. The write is
premature and has no effect. It is called Write Collision. This bit is
cleared in the same manner as the SPIF bit.The bit is set in enhanced
mode (ENH=1) when buffer is full. It is indication that a new data is
ready to be transmitted to the shift register.
166 In enhanced mode, a new data can be written to buffer when the WCOL
bit is set. In addition, the WCOL bit must be cleared.
(a) DISSO When set, this bit causes the MISO pin to float,
thus enabling several slave microcontrollers to share the same
interface. Normally, the first byte, called address byte, is received
by all of them, but only one should clear its DISSO bit.
(b) ENH
0 SPI system operates in normal mode (without buffer).
1 SPI system operates in enhanced mode.
85
86
167 Like all models belonging to the 8051 series, this microcontroller can
operate in 1 out of 3 modes: normal (consumption ca. 25 mA), Idle
(consumption ca. 6.5 mA) and Power Down (consumption ca. 40 uA). The mode
of operation is selected by bits of the PCON register (Power Control Register).
Three bits are changed compared to the basic model:
PCON REGISTER
this purpose as well since the timer T1 is mostly used for bound rate generation.
When some of the interrupts is enabled, you should be careful because there is a
risk that program starts to perform unexpectedly. When an interrupt request
arrives, the microcontroller will execute instruction in progress, push the address
of the first following location onto the stack (in order to know from where to
continue) and jump to the specified interrupt routine address. When the routine
has been executed, the microcontroller will pop the address from the stack and
continue from where it left off. The microcontroller saves only the address to
continue from after routine execution. What is usually neglected is the fact that
the contents of many registers can be changed during routine execution. The
program normally procedees with execution considering the changed registers
correct if their original vaules haven't been saved, thus causing a total chaos. The
worst thing is that this problem can be manifested anytime: at the moment or
several days later (depending on the moment an interrupt occurs). Obviously, the
only solution is to save the state of all important registers at the beginning of
interrupt routine and to update these values before returning to the program. We
are actually talking about the following registers
(a) PSW
(b) DPTR (DPH, DPL)
(c) ACC
(d) B
(e) Registers R0 - R7
170 When some of the instructions for indirect addressing is used, you
should be careful not to use them for accessing SFRs as the microcontroller
ignores their addresses and accesses free RAM locations having the same
addresses as SFRs. When UART system for serial communication is used,
setting bits RI and TI of the SCON register generated the same interrupt. If such
an interrupt is generated, it is first necessary to detect interrupt source (byte is
sent, received or both). It is important to remember that the microcontroller only
sets these bits so that they must be cleared from within the program. Otherwise,
the program gets stuck and executes the same interrupt routine over and over
again.
ASSEMBLY LANGUAGE
171 It was time that hardware-oriented to the core made compromise if they
wanted to stay “in the game”. Namely, unlike other circuits which only need to
be connected to other components and powered in order to be of any use,
microcontrollers require to be programmed as well. Fortunately, they still didn't
progress so far in their evolution, so that all microcontroller families
“understand” only one language - machine language. That's a good thing. The
bad one is that, even primitive, this language of zeros and ones can only be
understood by microcontrollers and some of the experts working on its
development. In order to bridge this gap between machine and humans, the first
high-level programming language called Assembly language was created. The
main problem of remembering codes recognized as instructions by electronics
was solved therefore, but another one, equally complicated to both us and
87
88
172 Assembly language is basically like any other language, which means
that it has its words, rules and syntax. The basic elements of assembly language
are
(a) Labels;
(b) Orders;
(c) Directives; and
(d) Comments.
SYNTAX OF ASSEMBLY LANGUAGE
173 When writing a program in assembly language it is necessary to observe
specific rules in order to enable the process of compiling into executable “HEX-
code” to run without errors. These compulsory rules are called syntax and there
are only several of them
(a) Every program line may consist of a maximum of 255
characters;
(b) Every program line to be compiled, must start with a
symbol, label, mnemonics or directive;
(c) Text following the mark “;” in a program line represents a
comment ignored (not compiled) by the assembler; and
(d) All the elements of one program line (labels, instructions
etc.) must be separated by at least one space character. For the
sake of better clearness, a push button TAB on a keyboard is
commonly used instead of it, so that it is easy to delimit columns
with labels, directives etc. in a program.
NUMBERS
174 If octal number system, otherwise considered as obsolete, is
disregarded, assembly language allows numbers to be used in one out of three
number systems
DECIMAL NUMBERS
88
89
175 If not stated otherwise, the assembly language considers all the numbers
as decimal. All ten digits are used (0,1,2,3,4,5,6,7,8,9). Since at most 2 bytes are
used for saving them in the microcontroller, the largest decimal number that can
be written in assembly language is 65535. If it is necessary to specify that some
of the numbers is in decimal format, then it has to be followed by the letter “D”.
HEXADECIMAL NUMBERS
BINARY NUMBERS
177 Binary numbers are often used when the value of each individual bit of
some of the registers is important, since each binary digit represents one bit.
There are only two digits in use (0 and 1). The largest binary number written in
assembly language is 1111111111111111. In order to distinguish binary numbers
from other numbers, they are followed by the letter “b” (either in upper- or
lowercase).
OPERATORS
SYMBOLS
89
90
LABELS
DIRECTIVES
EQU DIRECTIVE
183 The EQU directive is used to replace a number by a symbol. After using
this directive, every appearance of the label “MAXIMUM” in the program will
be interpreted by the assembler as the number 99 (MAXIMUM = 99). Symbols
may be defined this way only once in the program. The EQU directive is mostly
used at the beginning of the program therefore.
SET DIRECTIVE
184 The SET directive is also used to replace a number by a symbol. The
significant difference compared to the EQU directive is that the SET directive
can be used an unlimited number of times.
90
91
BIT DIRECTIVE
185 The BIT directive is used to replace a bit address by a symbol. The bit
address must be in the range of 0 to 255.
(a) TRANSMIT BIT PSW.7 ;Transmit bit (the seventh bit in
PSW register) is assigned the name "TRANSMIT"
(b) OUTPUT BIT 6 ;Bit at address 06 is assigned the name
"OUTPUT"
(c) RELAY BIT 81 ;Bit at address 81 (Port 0)is assigned the
name "RELAY"
CODE DIRECTIVE
188 The IDATA directive is used to change or assign a new name to an indirectly
addressed register.
(a) TEMP22 IDATA 32 ;Register whose address is in register
;at address 32 is named as "TEMP22"
(b) TEMP33 IDATA T_ADR ;Register whose address is in
;register T_ADR is named as "TEMP33"
XDATA DIRECTIVE
ORG DIRECTIVE
91
92
USING DIRECTIVE
191 The USING directive is used to define which register bank (registers
R0-R7) is to be used in the program.
(a) USING 0 ;Bank 0 is used (registers R0-R7 at RAM-
addresses 0-7)
(b) USING 1 ;Bank 1 is used (registers R0-R7 at RAM-
addresses 8-15)
(c) USING 2 ,Bank 2 is used (registers R0-R7 at RAM-
addresses 16-23)
(d) USING 3 ;Bank 3 is used (registers R0-R7 at RAM-
addresses 24-31)
END DIRECTIVE
192 The END directive is used at the end of every program. The assembler
will stop compiling once the program encounters this directive.
193 There are 5 directives used for selecting one out of five memory
segments in the microcontroller
(a) CSEG ;Indicates that the next segment refers to program
memory;
(b) BSEG ;Selects bit-addressable part of RAM;
(c) DSEG ;Indicates that the next segment refers to the part of
internal RAM accessed by direct addressing
(d) ISEG ;Indicates that the next segment refers to the part of
internal RAM accessed by indirect addressing using registers R0
and R1);
(e) XSEG ;Selects external RAM memory.
194 The CSEG segment is activated by default after enabling the assembler
and remains active until a new directive is specified. Each of these memory
segments has its internal address counter which is cleared every time the
assembler is activated. Its value can be changed by specifying value after the
mark AT. It can be a number, an arithmetical operation or a symbol.
DS directive
DBIT DIRECTIVE
196 The DBIT directive is used to reserve space within bit-addressable part
of RAM. The memory size is expressed in bits. It can be used only if the BSEG
segment is active.
92
93
DB DIRECTIVE
197 The DB directive is used for writing specified value into program
memory. If several values are specified, then they are separated by a comma. If
ASCII array is specified, it should be enclosed within single quotation marks.
This directive can be used only if the CSEG segment is active.
DW DIRECTIVE
200 Control directives start with a dollar symbol $. They are used to
determine which files are to be used by the assembler during compilation, where
the executable file is to be stored as well as the final layout of the compiled
program called Listing. There are many control directives, but only few of them
is of importance.
INCLUDE DIRECTIVE
201 This directive enables the assembler to use data stored in other files
during compilation. $INCLUDE(TABLE.ASM)
$MOD8253 DIRECTIVE
202 This directive is a file containing names and addresses of all SFRs of
8253 microcontrollers. By means of this file and directive having the same name,
the assembler can compile the program on the basis of register names. If they are
not used, it is necessary to specify name and address of every SFRs to be used at
the beginning of the program.
BASIC CONNECTING
93
94
POWER SUPPLY
205 Even though this microcontroller can operate at different power supply
voltages, why to test “Murphy’s low”?! A 5V DC is most commonly used. The
circuit, shown in the figure, uses a cheap integrated three-terminal positive
regulator LM7805, and provides high-quality voltage stability and quite enough
current to enable the microcontroller and peripheral electronics to operate.
RESET SIGNAL
206 In order that the microcontroller can operate properly, a logic 0 (0V)
must be applied to the reset pin RS. The push button connecting the reset pin RS
to power supply VCC is not necessary. However, it is almost always provided
because it enables the microcontroller safe return to normal operating conditions
if something goes wrong. 5V is brought to this pin, the microcontroller is reset
and program starts execution from the beginning.
CLOCK SIGNAL
94
95
LCD PINS
209 There are pins along one side of a small printed board. These are used
for connecting to the microcontroller. There are in total of 14 pins marked with
numbers (16 if it has backlight). Their function is described in the table bellow
LCD SCREEN
LCD MEMORY
CGROM Memory
95
96
213 CGROM memory contains the default character map with all characters
that can be displayed on the screen. Each character is assigned to one memory
location. The addresses of CGROM memory locations match the characters of
ASCII. If the program being currently executed encounters a command “send
character P to port”, then the binary value 0101 0000 appears on the port. This
value is the ASCII equivalent to the character P. It is then written to LCD, which
results in displaying the symbol from 0101 0000 location of CGROM. In other
words, the character “P” is displayed. This applies to all letters of alphabet
(capitals and small), but not to numbers. “Map”, addresses of all digits are
pushed forward by 48 relative to their values (digit 0 address is 48, digit 1
address is 49, digit 2 address is 50 etc.). Accordingly, in order to display digits
correctly, each of them needs to be added a decimal number 48 prior to be sent to
LCD.
CGRAM MEMORY
214 Apart from standard characters, the LCD display can also display
symbols defined by the user itself. It can be any symbol in the size of 5x8 pixels.
RAM memory called CGRAM in the size of 64 bytes enables it. Symbols are
usually defined at the beginning of the program by simply writing zeros and ones
to registers of CGRAM memory so that they form desired shapes. In order to
display them it is sufficient to specify their address. Pay attention to the first
coloumn in the CGROM map of characters. It doesn't contain RAM memory
addresses, but symbols being discussed here. In this example, “display 0” means
- display “č”, “display 1” means - display “ž” etc.
215 All data transferred to LCD through the outputs D0-D7 will be
interpreted as a command or a data, which depends on the pin RS logic state:
BUSY FLAG
96
97
LCD CONNECTION
217 Depending on how many lines are used for connecting the LCD to the
microcontroller, there are 8-bit and 4-bit LCD modes. The appropriate mode is
selected at the beginning of the operation. This process is called “initialization”.
8-bit LCD mode uses outputs D0-D7 to transfer data in the way explained on the
previous page. The main purpose of 4-bit LED mode is to save valuable I/O pins
of the microcontroller. Only 4 higher bits (D4-D7) are used for communication,
while other may be left unconnected. Each data is sent to the LCD in two steps:
four higher bits are sent first (normally through the lines D4-D7), then four lower
bits. Initialization enables the LCD to link and interpret received bits correctly.
Data is rarely read from the LCD (it is mainly transferred from the
microcontroller to LCD) so that it is often possible to save an extra I/O pin by
simple connecting R/W pin to ground. Such saving has its price. Messages will
be normally displayed, but it will not be possible to read the busy flag since it is
not possible to read the display either. Fortunately, there is a simple solution.
After sending a character or a command it is important to give the LCD enough
time to do its job. Owing to the fact that execution of the slowest command lasts
for approximately 1.64mS, it will be sufficient to wait approximately 2mS for
LCD.
LCD INITIALIZATION
218 The LCD is automatically cleared when powered up. It lasts for
approximately 15mS. After that, the display is ready for operation. The mode of
operation is set by default. It means that:
97
98
unpredictably. If the voltage supply unit is not able to meet this condition or if it
is needed to provide completely safe operation, the process of initialization is
applied. Initialization, among other things, causes a new reset enabling display to
operate normally. Apart from components necessary for the operation of the
microcontroller such as oscillator with capacitors and the simplest reset circuit,
there are also several LEDs and one push button. These are used to indicate the
operation of the program. All LEDs are polarized in such a way that they are
activated by driving a microcontroller pin low. A microcontroller is a good-
natured “genie in the bottle” and no extra knowledge is required to use it. In
order to create a device controlled by the microcontroller, it is necessary to
provide the simplest PC, program for compiling and simple device to transfer the
code from PC to the chip itself. Even though the whole process is quite logical,
there are often some queries, not because it is complicated, but for numerous
variations.
PROGRAM IN ASSEMBLY LANGUAGE
#include <REGX51.h>
#include <math.h>
unsigned int
clk_tmp,clk_tmp2,clk_sec,clk_sec2,ex_pulses,rps,rps_tmp,temp,rps_avg,rps_max;
unsigned int rps_his[5];
char a,b,c,d,e,ani;
unsigned char count1,count2,scale;
unsigned char scale = 4;
unsigned char bcd[10];
delay(y){
unsigned int i;
for(i=0;i<y;i++){;}
}
ena(){
P2_7 = 1;
delay (5);
P2_7 = 0;
}
ini_lcd(){
98
99
P1_1 = 0;
P2_7 = 0; //transfering instructions
P2_6 = 0;
P0 = 56; //function set
ena();
P0 = 56; //function set
ena();
P0 = 12; // display on, cursor on, blink on
ena();
P0 = 1; //clr display
ena();
P0 = 6; //entry mode set
ena();
//enable on 2_6
//RS on 2_7
P2_6 = 1; // ready to transfere diplay data
}
locate(pos){
P2_6 = 0; //transfering instructions
P0 = pos; // change DDRAM adress
ena();
P2_6 = 1; // ready to transfere diplay data
}
line_2(){//go to botom line
locate(192);
}
line_1(){//go to botom line
locate(128);
}
lcd_send(chr){
P0 = chr;
ena();
}
lcd_send_slow(chr){
delay(1500);
P0 = chr;
ena();
}
lcd_send_num(num){
if (num == 0){
lcd_send (48);
}else if(num == 1){
lcd_send (49);
}else if(num == 2){
lcd_send (50);
}else if(num == 3){
99
100
lcd_send (51);
}else if(num == 4){
lcd_send (52);
}else if(num == 5){
lcd_send (53);
}else if(num == 6){
lcd_send (54);
}else if(num == 7){
lcd_send (55);
}else if(num == 8){
lcd_send (56);
}else if(num == 9){
lcd_send (57);
}
}
setup_interrupts(){
EA = 1;
EX0 = 0;
EX1 = 0;
ET0 = 1; //set the Timer/counter 0
TR0 = 1; //Enable Timer/counter 0 to count
TMOD = 0X25; //counter 0 in mode 1 (16 bit counter) , timer 1 in mode 2 (auto
reload from TH1
TL0 = 0; //empty the counting registers
TH0 = 0; //empty the counting registers
TH1 = 0; //start counter from 0
ET1 = 1; //enable timer 1
TR1 = 1; //Enable Timer/counter 1 to count
PT0 = 1;
PT1 = 0;
}
void int_to_digits(unsigned int number){ //store the 5 digits of an integer number in
the variable a,b,c,d,e
float itd_a,itd_b;
itd_a = number / 10.0;
e = floor((modf(itd_a,&itd_b)* 10)+0.5);
itd_a = itd_b / 10.0;
d = floor((modf(itd_a,&itd_b)* 10)+0.5);
itd_a = itd_b / 10.0;
c = floor((modf(itd_a,&itd_b)* 10)+0.5);
itd_a = itd_b / 10.0;
b = floor((modf(itd_a,&itd_b)* 10)+0.5);
itd_a = itd_b / 10.0;
a = floor((modf(itd_a,&itd_b)* 10)+0.5);
}
clk() interrupt 3 //timer 1 interrupt
100
101
{
clk_tmp++;
clk_tmp2++;
if (clk_tmp2 > (1236)){ // update display
clk_tmp2 = 0;
rps_avg = floor(((rps_his[0] + rps_his[1] + rps_his[2] + rps_his[3] +
rps_his[4])/5)*60);
line_1();
int_to_digits(rps_avg);
// to lcd: AVG:
lcd_send (65);
lcd_send (86);
lcd_send (71);
lcd_send (58);
lcd_send_num(a);
lcd_send_num(b);
lcd_send_num(c);
lcd_send_num(d);
lcd_send_num(e);
// to lcd: rpm
lcd_send (32);
lcd_send (114);
lcd_send (112);
lcd_send (109);
if (P2_0 == 0){
if (ani == 0){
ani = 1;
lcd_send (32);
lcd_send (32);
lcd_send (32);
}else if(ani == 1){
ani = 2;
lcd_send (46);
lcd_send (32);
lcd_send (32);
}else if(ani == 2){
ani = 3;
lcd_send (46);
lcd_send (111);
lcd_send (32);
}else if(ani == 3){
ani = 0;
lcd_send (46);
lcd_send (111);
lcd_send (79);;
}
101
102
}else{
lcd_send (32);
lcd_send (32);
lcd_send (88);
}
rps_max = rps_his[0];
if (rps_his[1] > rps_max){
rps_max = rps_his[1];
}
if(rps_his[2] > rps_max){
rps_max = rps_his[2];
}
if(rps_his[4] > rps_max){
rps_max = rps_his[3];
}
if(rps_his[4] > rps_max){
rps_max = rps_his[4];
}
int_to_digits(rps_max*60);
line_2();
// to lcd: MAX:
lcd_send (77);
lcd_send (65);
lcd_send (88);
lcd_send (58);
lcd_send_num(a);
lcd_send_num(b);
lcd_send_num(c);
lcd_send_num(d);
lcd_send_num(e);
// to lcd: rpm
lcd_send (32);
lcd_send (114);
lcd_send (112);
lcd_send (109);
lcd_send (32);
lcd_send (32);
lcd_send (32);
}
if (clk_tmp > (6584/scale)){ // update data
clk_tmp = 0;
if (P2_0 == 0){
rps = TL0;
temp = TH0;
temp = temp * 256;
rps = (rps + temp)* scale;
102
103
rps_his[4] = rps_his[3];
rps_his[3] = rps_his[2];
rps_his[2] = rps_his[1];
rps_his[1] = rps_his[0];
rps_his[0] = rps;
}
TL0 = 0;
TH0 = 0;
}
}
count_pulses() interrupt 1 //counter 0 interrupt
{
if (scale < 10)
scale++;
//ex_pulses++;
}
void main(){
scale = 10 ;
P3_3 = 0; // ini proximity sensor, OFF
P3_4 = 1; // ini sensor input
P1_1 = 0; //turn LCD backlight ON
P2_0 = 1; //ini count/hold button
ini_lcd(); // ini the LCD
lcd_send_slow (32);
lcd_send_slow (32);
lcd_send_slow (32);
lcd_send_slow (32);
lcd_send_slow (32);
lcd_send_slow (68);
lcd_send_slow (45);
lcd_send_slow (84);
lcd_send_slow (65);
lcd_send_slow (67);
lcd_send_slow (72);
lcd_send_slow (32);
lcd_send_slow (32);
lcd_send_slow (32);
lcd_send_slow (32);
lcd_send_slow (32);
delay(30000);
delay(30000);
delay(30000);
delay(30000);
line_2();
lcd_send_slow (105);
lcd_send_slow (107);
103
104
lcd_send_slow (97);
lcd_send_slow (64);
lcd_send_slow (105);
lcd_send_slow (107);
lcd_send_slow (97);
lcd_send_slow (108);
lcd_send_slow (111);
lcd_send_slow (103);
lcd_send_slow (105);
lcd_send_slow (99);
lcd_send_slow (46);
lcd_send_slow (99);
lcd_send_slow (111);
lcd_send_slow (109);
delay(30000);
delay(30000);
delay(30000);
delay(30000);
delay(30000);
delay(30000);
delay(30000);
delay(30000);
delay(30000);
setup_interrupts();
while(1){
P3_3 = ~P2_0;
if (P2_0 == 1){
scale= 4;
}
//e = fmod(5,10);
}
}
221 Then this code is converted into the hexadecimal code by the K.E.I.L.
software and fed to the 8051 microcontroller by mounting it on the burner. To
enable the compiler to operate successfully, it is necessary that a document
containing this program has the extension, .asm in its name, for example:
Program asm. When a specialized program (K.E.I.L.)) is used, this extension will
be automatically added. If any other program for text processing (Notepad) is
used then the document should be saved and renamed.
COMPILING A PROGRAM
:030BF600010C04EB
:0D0B87007F307E75120B94120B94120B94AC
:100B9400E4FDFCC3ED9FEC9E50070DBD00010C80ED
:010BA400F25E
:010BA500222D
:0C000E00D2A77F057E00120B94C2A7222F
:100B6000C291C2A7C2A675803812000E75803812D5
:100B7000000E75800C12000E75800112000E75803B
:070B80000612000ED2A622AE
:0A0BE500C2A68F8012000ED2A622D5
:070003007FC07E00020BE547
:070BEF007F807E00020BE590
:0B0BD5007F207E00120BE07F207E00DE
:050BE0008F8002000EF1
:100B30007F207E00120B507F207E00120B507F2002
:100B40007E00120B507F207E00120B507F207E0013
:100B5000AB07AA067FDC7E05120B948B8002000E89
:100A04007E00120BE07F3A7E00120BE0AF26EF333C
:100A140095E0FE120A3FAF27EF3395E0FE120A3F3E
:100A2400AF28EF3395E0FE120A3FAF29EF3395E08C
:0B0A3400FE120A3FAF2AEF3395E0FEF0
:100A3F00EF4E70047F308058EF64014E70047F31A9
:100A4F00804EEF64024E70047F328044EF64034E99
:100A5F0070047F33803AEF64044E70047F3480302B
:100A6F00EF64054E70047F358026EF64064E7004E8
:100A7F007F36801CEF64074E70047F378012EF645F
:100A8F00084E70047F388008EF64094E70067F3976
:050A9F00FE120BE02235
:100BA600D2AFC2A8C2AAD2A9D28C758925E4F58A89
:0D0BB600F58CF58DD2ABD28ED2B9C2BB2228
:1006CF00AD07AC06E41202C1E4FBFA7920784112BF
:1006DF00021F7B007A00793912095BE4FBFA79205B
:1006EF007841120116E4FBFAF9783F12002512083F
:1006FF00AB1202FA8F2AE4FBFA79207841AF3CAEB5
:10070F003BAD3AAC3912021F7B007A0079391209DE
:10071F005BE4FBFA79207841120116E4FBFAF978D1
:10072F003F1200251208AB1202FA8F29E4FBFA7967
:10073F00207841AF3CAE3BAD3AAC3912021F7B0083
:10074F007A00793912095BE4FBFA792078411201BA
:10075F0016E4FBFAF9783F1200251208AB1202FAE1
:10076F008F28E4FBFA79207841AF3CAE3BAD3AAC31
:10077F003912021F7B007A00793912095BE4FBFA08
:10078F0079207841120116E4FBFAF9783F1200251F
105
106
:10079F001208AB1202FA8F27E4FBFA79207841AFE7
:1007AF003CAE3BAD3AAC3912021F7B007A0079396F
:1007BF0012095BE4FBFA79207841120116E4FBFA87
:0E07CF00F9783F1200251208AB1202FA8F26AD
:0107DD0022F9
:03001B000204AC30
:1004AC00C0E0C0F0C083C082C0D075D000C000C016
:1004BC0001C002C003C004C005C006C007052CE57E
:1004CC002C7002052B0510E5107002050FD394D487
:1004DC00E50F94045003020647750F00751000E5F4
:1004EC00302532CFE52F3531CF2534CF3533CF25DD
:1004FC0036CF3535CF2538CF3537FE7C007D05120C
:10050C0003FA7C007D3C1203E8AC06AD07E4120252
:10051C00C11208AB1202FA8E2D8F2E120BEFAF2EDA
:10052C00AE2D1206CF7F417E00120BE07F567E006F
:10053C00120BE07F47120A04120BDC7F727E001252
:10054C000BE07F707E00120BE07F6D7E00120BE0E3
:10055C0020A052E51D7008751D017F20FE800CE562
:10056C001DB4010E751D027F2E7E00120BE07F2044
:10057C008011E51DB40215751D037F2E7E00120B34
:10058C00E07F6F7E00120BE07F20801EE51D640370
:10059C00701DF51D7F2EFE120BE07F6F7E00120B7F
:1005AC00E07F4F8005120BD57F587E00120BE08543
:1005BC002F08853009D3E5329509E53195084006B9
:1005CC00853108853209D3E5349509E53395084022
:1005DC0006853308853409D3E5389509E537950840
:1005EC004006853508853609D3E5389509E53795F4
:1005FC00084006853708853809AE08AF097C007DB0
:10060C003C1203E81206CF1200037F4D7E00120B42
:10061C00E07F417E00120BE07F58120A04120BDCC3
:10062C007F727E00120BE07F707E00120BE07F6DFC
:10063C007E00120BE0120BD5120BDCE50CFB7E19C5
:10064C007FB8FD7C001203FAD3E52C9FE52B9E406E
:10065C0057752B00752C0020A048AF8A751E008F93
:10066C001FAF8C751B008F1CE51C751C00F51BE562
:10067C001F251CFFE51E351BFEAD037C001203E895
:10068C008E1E8F1F85353785363885333585343644
:10069C00853133853234852F31853032851E2F8557
:1006AC001F30758A00758C00D007D006D005D00499
:1006BC00D003D002D001D000D0D0D082D083D0F0E3
:0306CC00D0E03249
:03000B00020BC322
:100BC300C0E0C0D0E50CC3940A5002050CD0D0D0CD
:020BD300E0320E
:1007DE00750C0AC2B3D2B4C291D2A0120B60120B26
:1007EE00307F447E00120B507F2D7E00120B507F07
106
107
:1007FE00547E00120B507F417E00120B507F437EC1
:10080E0000120B507F487E00120B50120B30120B51
:10081E00871200037F697E00120B507F6B7E0012E1
:10082E000B507F617E00120B507F407E00120B50EA
:10083E007F697E00120B507F6B7E00120B507F6122
:10084E007E00120B507F6C7E00120B507F6F7E006D
:10085E00120B507F677E00120B507F697E00120BC9
:10086E00507F637E00120B507F2E7E00120B507F46
:10087E00637E00120B507F6F7E00120B507F6D7ED9
:10088E0000120B50120B87120B8B120B94120BA62D
:0D089E00A2A0B392B330A0F8750C0480F353
:10001E00020366E86480F8E933E83360110460F0A7
:10002E00ED33EC337009E8FCE9FDEAFEEBFF220448
:10003E0060DED3EB9FEA9EE99DE8C2E78CF0C2F743
:10004E0095F0400CE8CCF8E9CDF9EACEFAEBCFFB0F
:10005E0012033185D0F05804700320D5B3E8047034
:10006E00075002B2D502037092D5EC0460F7E4CCCF
:10007E00C0E0C398F8603B94186008400DD0E0FBD8
:10008E00020348E4FBFAC9FC8028E830E406E4C920
:10009E00FBE4CAFCE830E305E4C9CACBFCE854072C
:1000AE006010F8C3E913F9EA13FAEB13FBEC13FC37
:1000BE00D8F130F52FC3E49CFCEF9BFFEE9AFEEDDA
:1000CE0099FDD0E0FBEF4E4D4C701222DB03020384
:1000DE006DEC2CFCEF33FFEE33FEED33FDED30E730
:1000EE00EB020348EF2BFFEE3AFEED39FDD0E0FBBD
:1000FE0050130BBB0003020370ED13FDEE13FEEF66
:08010E0013FFEC13FC0203488F
:10011600EC4D6011E8497017ED33EC3304600DE4E3
:10012600FCFFFEFD22E933E8330470F80203661291
:10013600033158046009E4CC248150062850090292
:10014600037028400302036DC0E0EB4A7044B98097
:1001560006D0E0FB02035CEF4E701CBD8008EBFF8F
:10016600EAFEE9FD80EBE98DF0A4FEE5F00201FF71
:10017600E9CDF9EAFEEBFFEF89F0A4FCE5F0CE89C4
:10018600F0A42EFFE435F0CD89F0A42DFEE435F081
:100196008067EF4E7005BD80D780C3EF8BF0A4ACAF
:1001A600F0EE8BF0A42CFCE435F0F8EF8AF0A42CEA
:1001B600E5F038FCE433CB8DF0A42CFCE5F03BF8FD
:1001C600EE8AF0A42CFCE5F038F8E433CF89F0A4ED
:1001D6002CFCE5F038CF3400CE89F0A42FFFE5F0F3
:1001E6003EFEE433C98DF0A42EFEE5F039CD8AF04B
:1001F600A42FFFE5F03EFEE43DFD33D0E0FB5007C3
:100206000BBB000F020370EC2CFCEF33FFEE33FE4A
:06021600ED33FD02034878
:10021C00020370EC5D046005E85904700302036688
:10022C00120331580460F6EC4860F2EC7004FDFEE9
107
108
:10023C00FF22C860DB2481C85009C39860025006B5
:10024C0002036D9850CAF582E9294B4A7005AB82BE
:10025C0002035C75F0007C1A7880C3EF9BEE9AED7C
:10026C0099400DC3EF9BFFEE9AFEED99FDE842F02D
:10027C00DC23ACF0D0E0FFD0E0FED0E0FDAB822080
:10028C00E7101BEB60BAEC2CFCEF33FFEE33FEED0A
:10029C0033FD020348E803F830E705C0F075F000C1
:1002AC00EF2FFFEE33FEED33FD40B830E7C280AAEE
:1002BC0075F020800E75F010800575F0087D007EBD
:1002CC00007F003392D530D50312044FEC3340102D
:1002DC00EF33FFEE33FEED33FDEC33FCD5F0ED22C6
:0E02EC00E5F0247EA2D513CC92E7CDCEFF2202
:1002FA00EDD2E7CD33EC3392D524814006E4FFFEFC
:10030A00FDFC22FCE4CFCECDCC24E0501174FF805A
:10031A00EDC3CC13CCCD13CDCE13CECF13CF0470F7
:07032A00F030D5DE02044FA4
:1008AB008F408E3F8D3E8C3D74FFFFFEFDFCAB40B9
:1008BB00AA3FA93EA83DC312045D602C7F807E96A3
:1008CB007D187C4BAB40AA3FA93EA83D12037B6031
:1008DB000250157F807E967D187CCBAB40AA3FA93A
:1008EB003EA83D12037B5009AF40AE3FAD3EAC3D41
:1008FB0022AF40AE3FAD3EAC3D1202FA8F448E4369
:10090B008D428C41EC1202BCC8ECC8C9EDC9CAEED1
:10091B00CACBEFCBAF40AE3FAD3EAC3D120021E4B6
:10092B00FBFAF9F812037B601A401874FF2544F5A3
:10093B0044E54334FFF543E54234FFF542E54134EA
:10094B00FFF541AF44AE43AD42AC41EC1202BC22C9
:10095B008F408E3F8D3E8C3D8B418A42894374FF85
:10096B00FFFEFDFCAB40AA3FA93EA83DC312045DB0
:10097B00602C7F807E967D187C4BAB40AA3FA93EB6
:10098B00A83D12037B600250157F807E967D187CFC
:10099B00CBAB40AA3FA93EA83D12037B5017AF40FB
:1009AB00AE3FAD3EAC3DAB41AA42A94312046EE44F
:1009BB00FFFEFDFC22AF40AE3FAD3EAC3D1202FA56
:1009CB008F478E468D458C44EC1202BCAB41AA423C
:1009DB00A94312046EAF47AE46AD45AC44EC1202D0
:1009EB00BCC8ECC8C9EDC9CAEECACBEFCBAF40AEA1
:0909FB003FAD3EAC3D120021228B
:10033100E9D2E7C933E833F892D5EDD2E7CD33EC12
:0703410033FC5002B2D5228B
:10034800EC30E7100FBF000C0EBE00080DBD000416
:100358000BEB6014A2D5EB13FCED92E7FD2274FFC2
:10036800FCFDFEFF22E480F8A2D574FF13FC7D801B
:03037800E480EF2F
:10037B0074F8CC6480CCC86480C8F582046043C335
:10038B00EB9FF5F0EA9E42F0E99D42F0E89C45F0C8
108
109
:10039B0060305018E5825FFFE582F42B5582FB50ED
:1003AB00210ABA001D09B90019088016E5825BFB0A
:1003BB00E582F42F5582FF50090EBE00050DBD00DE
:1003CB00010CC3EB9FF5F0EA9E42F0E99D42F0E889
:0D03DB009C45F06007CC4820E701B3EC2200
:03000000020AA44D
:0C0AA400787FE4F6D8FD758147020AEB6C
:1003E800EF8DF0A4A8F0CF8CF0A428CE8DF0A42E29
:0203F800FE22E3
:1003FA00BC000BBE0029EF8DF084FFADF022E4CCE7
:10040A00F875F008EF2FFFEE33FEEC33FCEE9DECAF
:10041A00984005FCEE9DFE0FD5F0E9E4CEFD22EDF5
:10042A00F8F5F0EE8420D21CFEADF075F008EF2F3F
:10043A00FFED33FD4007985006D5F0F222C398FD30
:05044A000FD5F0EA22CD
:0E044F00C3E49FFFE49EFEE49DFDE49CFC22BE
:10045D00EB9FF5F0EA9E42F0E99D42F0E89C45F0F5
:01046D00226C
:10046E00BB010789828A830204945005E9F80204CD
:0A047E0088BBFE05E9F80204A02285
:100AB0000207DEE493A3F8E493A34003F68001F277
:100AC00008DFF48029E493A3F85407240CC8C33347
:100AD000C4540F4420C8834004F456800146F6DF16
:100AE000E4800B0102040810204080900BF6E47EA5
:100AF000019360BCA3FF543F30E509541FFEE4930B
:100B0000A360010ECF54C025E060A840B8E493A3D1
:100B1000FAE493A3F8E493A3C8C582C8CAC583CAFC
:100B2000F0A3C8C582C8CAC583CADFE9DEE780BEB4
:010BF90000FB
:0C048800ECF608EDF608EEF608EFF622A0
:0C049400ECF0A3EDF0A3EEF0A3EFF022DB
:0C04A000ECF208EDF208EEF208EFF22298
:00000001FF
223 In the event that other software for program writing in assembly
language is used, a special software for compiling the program must be installed
and used as follows - set up the compiler, open the document with .asm extension
and compile. The result is the same- a new document with extension .hex. The
only problem now is that it is stored in your PC.
PROGRAMMING A MICROCONTROLLER
224 In order to transfer a “hex code” to the microcontroller, it is necessary to
provide a cable for serial communication and a special device, called
programmer, with software. There are several ways to do it. A large number of
programs and electronic circuits having this purpose can be found on the
Internet. Open hex code document, set a few parameters and click the icon for
compiling. After a while, a sequence of zeros and ones will be programmed into
109
110
DEVELOPMENT SYSTEMS
225 A device which in the testing program phase can simulate any
environment is called a development system. Apart from the programmer, the
power supply unit and the microcontroller’s socket, the development system
contains elements for input pin activation and output pin monitoring. The
simplest version has every pin connected to one push button and one LED as
well. A high quality version has LED displays, LCD displays, temperature
sensors and all other elements which can be supplied with the target device.
These peripherals can be connected to the MCU via miniature jumpers. In this
way, the whole program may be tested in practice during its development stage,
because the microcontroller doesn't know or care whether its input is activated by
a push button or a sensor built in a real device.
8MHZ OSCILLATOR
229 Each I/O port pin is connected to one LED which enables visual
indication of its logic state. In the event that the presence of directly polarized
LEDs and serial resistors is not acceptable in some applications, DIP switch SW2
enables them to be disconnected from the port.
230 Similar to LEDs, each I/O port pin is connected to one push button on
the development board. It enables simple activation of input pins. Jumper J6 is
used for selecting voltage polarity (+ or -) brought to pins by pressing
appropriate push button.
segments are connected to the port P0 via resistors. Transistor drivers used for
activating individual digits are connected to the first four port P1 pins. It enables
programs using 7-segment displays to be tested with minimum use of I/O ports.
Similar to LEDs, DIP switch SW2 enables transistor drivers to be disconnected
from microcontroller pins.
LCD DISPLAYS
FEATURES
112
113
113
114
APPLICATIONS
240 The tachometer measures how fast the engine is turning in RPM -
Revolutions per Minute.
(a) This tachometer information is useful if your car has a
standard shift transmission and you want to shift at the optimum
tachometer RPM for best fuel economy or best acceleration. One
of the least used gauges on a car with an automatic transmission.
You should never race your engine so fast that the tachometer
moves into the red zone as this can cause engine damage. Some
engines are protected by the engine computer from going into the
red zone. Usually, the tachometer shows single digit markings
like 1, 2, 3 etc. Somewhere, you will also see an indicator that
says RPM x 1000. This means that you multiply the reading by
1000 to get the actual RPM, so if the needle is pointing to 2, the
engine is running at 2000 RPM.
114
115
(b) This can be used by the companies that prepare the fan. It
can be used to check the performance of the fan.
(c) This can be used by the companies that manufacture motor
that has the r.p.m. less than 9900 can use this device it shows the
maximum and the average speed of the motor or rotating part.
(d) It can be used as optical counter just the thing is that the
material to be counted should reflect the infrared radiation.
(e) It can be used to check the r.p.m for the hard disk drives,
floppy disk drives in the field of electronics.
(f) When choosing a motorcycle tachometer there is a decent
selection of manufacturers to choose from. Autometer
tachometers are a brand that are well known. Each of these
companies make a quality Tach for bikes. Autometer makes
Tach's for cars and has expanded to making them for motor cycles
as well. This line is called Pro-Cycle. When it comes to choosing
the right Tach it is important to keep in mind the application that
you are going to use it for. They are fairly easy to install and have
a range of up too 9,000 RPM. Since most bikes have high revving
engines it is important to find one that suits your application.
Autometer Tachometers are mostly electronic and come in a
variety of sizes and variations. Their is bound to be one that suits
your application. Autometer also makes tachometers that have
integrated shift lights or you can buy the shift light kit by itself. In
order to use a shift light you will also need a RPM activated
module and a RPM Pill module kit. You can also choose from a
black or white face as well as the diameter of the gauge.
Lightning Performance makes a pretty cool looking electronic
tachometer. I am currently of currently aware of 3 different
Lightning Performance tach's. They are all micro gauges and are
easily mounted on to a handlebar. They integrate very well in to
most motor cycle’s lines. Lightning Performance Electronic
tachometers are CNC machined from a 5 lb brick of billet
aluminum which is then chrome plated for a show quality finish.
BENEFITS
241 The following are the benefits of the contact less tachometer
(a) It takes less than a minute to read out r.p.m.
(b) It reads the r.p.m. with the maximum speed and the average
speed.
(c) It gives better performance and reliability.
(d) It saves the energy consumed by the conventional tachometer.
(e) Since it is working with the nine volt battery so it can be used
even if the electricity is not there.
(f) It is portable so we can carry it to large rotating machine to note
the r.p.m.
115
116
(g) It does not slow the speed of the main motor as it was in the
conventional contact tachometer.
(h) It does not interfere with the motor on test because we are not
touching any component.
(i) It refreshes the L.C.D. after the reset key is pressed.
(j) It can hold the reading if hold key is pressed.
(k) It can measure accurately in the range of 10cm.
(l) It has a flexible I.R.proximity sensor which can be turned round
according to the requirement.
(m) It does not cause the friction and the wear and tear of the
components as in the conventional tachometer.
(n) Light in weight as compared to the conventional tachometer.
(o) Compact in size.
(p) Simple circuitry and easy to understand.
(q) Mass production may reduce the cost of Contact less tachometer.
(r) Calibrations points are given to change the capacitance.
(s) It can measure maximum r.p.m. of 9900 which was less in the
conventional tachometer.
(t) Easy to repair and can be extended to the wireless tachometer.
(u) Unique method of setting the conversion factor.
SAFETY
242 The following are the safety measure use to kept in mind while making
this project and using it.
(a) Do not touch the sensor this may lead to wrong reading.
(b) Keep the sensor away from the rotating part because
mishandling may lead to damage of the sensor.
(c) The sensor should be kept at the safe place.
(d) The microcontroller should be mounted properly. If it is not
mounted properly then the pins get bent and break this make the
microcontroller useless.
CONCLUSION
243 It gives me immense pleasure that I have completed my project
successfully. This project helps me to enhance my skill. By selecting this project
I have understood the applications of the microcontroller. I understood how the
microcontroller reduces the circuit and performs the function accurately. It was
my great opportunity to work on this project “Contact-Less Tachometer”. By this
project I have learnt the P.C.B. designing, layout preparation, burning of the
microcontroller, tinning. It gives me immense pleasure that I have learnt
something new from the project which helps me in my technical life. This project
helps the mechanical students to know the r.p.m. of any motor, fan, engine shaft
which can helps him to decide the engine performance. The electrical students
are also benefited by this project that they do not have to wait for minutes to
know the r.p.m. of the fan. The application of this project are very much
interesting because now a days this technology is being used in the car and the
116
117
bikes, which replaces the analog speedometer by digital contact less tachometer
which first find out the r.p.m. then calculates the speed in Km/Hr.
244 The mounting of the component is very interesting because with
precautions the components are damaged. I have done the component mounting
carefully. I like the drilling of the P.C.B. because it requires concentration and
attention on the target point. The etching of the P.C.B. is a very interesting
because the fine tracks are formed by this process. I think my efforts may leads
to new innovation in extending this project into the wireless Tachometer. I am
glad that I have created something new. I have prepared this report that one can
easily understand and if anyone wants to extend it can easily find each and every
information. In this report I have explained the project step by step so one follow
those steps and can make this project and can extend according to the
requirement. This report look like a simple project but it is mine of knowledge
about the new electronics components. By this project I have understood the
power of microcontroller.
245 I conclude with these words that whatever I have understood in this
project I have given it as a record for future reference which can help my junior
to know about the new innovation of hardware interfacing. This project will help
me to gain knowledge. I understood what is the difference between the
theoretical knowledge and the practical knowledge. How the theoretical
knowledge can be used to make new project and utilize our potential in new
innovation. In making this project I have found many problems relating to the
component availability. I have found the substitute to every component which
has the same operation and working. This helps me to know different types of
components. I have learnt how components are classified according to the
performance, company. I have learnt the specifications of the components.
Different companies manufacture the same components with different name and
the serial number. Finally, I would like to say that my concept can be utilized in
the manufacturing of the Contact less tachometer.
117