SlideShare ist ein Scribd-Unternehmen logo
1 von 100
Report
On
RFID READER BASED
Attendance System
Objective :-
• To interface 8051 with Serial
devivce
• To Study RFID Reader
FEATURES.
USING MICROCONTROLLER
89S51 ( 40 PIN) MICROCONTROLLER
LCD INTERFACE. 2 BY 16 LINE
4 VOTE CAST SWITCH.
4 INDIVIDUAL VOTE CHECKING MACHINE.
1 SWITCH FOR TOTAL VOTE
2 SWITCH FOR RESET THE WHOLE DATA.
1 SWITCH FOR ELECTION CONTROL.
1 ALARNM POINT FOR VAOTE CASTING INDICATION.
24C02 FLASH MEMORY
Detail methodology
Methodology of this project Serial Communication Between Reader and
Microcntroller. Tag will give 32 character to reader. Reader will give data to
89s52. We will work on serial communication and RFID technology.
In this project we will use UID. UID is unique Identification using RFID
reader machine Reader. We will use 125KHz frequency RFID for Reading
purpose. Tag will be provided to each for identification. Person will have to
show tag. Reader will tag and machine will give serial output. Max232 will
be used for communication between RFID machine reader and
Microcontroller 89s52. LCD will show each tag Number on LCD.
In this voting machine we use ic 89s52 as a main microcontroller. Lcd
available is 2 by 16 line. Eerom is 24c02 .
Pin no 40 is connected to the positive supply. Pin no 20 is connected to the
negative supply.
Pin 1 to 4 of IC2 is connected with IC1 ‘s port 0. Thsese pins are to mark
attendance. Pin 5 to 8 is to check the attendance of Individual candidate.
Crystal is connected to the pin no 18 and pin no 19
Pin no 21 is the output pin and buzzer is connected to the pin no 21
Pin no 9 is connected to the reset button to reset the microcontroller
automatically when we switch on the power. Power on reset
Eerom of this circuit is 24c02
Pin no 8 is connected to the positive supply. Pin no 1,2,3,4 is connected to
the ground pin. Pin no 6,7,8 is the data read and write pins and these pins
are connected to the
Pin no 22,23,24
In this project firstly we use one step down transformer. Step down
transformer step down the voltage from 220 volt Ac to 12 volt Ac. This Ac
voltage is further converted into DC with the help of rectifier circuit. In
rectifier circuit we use four diode. All the diodes are arranges as a bridge
rectifier circuit. Output of this rectifier is pulsating Dc. To convert this
pulsating DC into smooth dc we use one capacitor as a filter components.
Capacitor converts the pulsating Dc into smooth DC with the help of its
charging and discharging effect.
Output of the rectifier is now regulated with the help of IC regulator circuit.
In this project we use positive voltage regulator circuit. Here we use three
pin regulator. Output of this regulator is regulated voltage. If we use 7805
regulator then its means its is 5 volt regulator and if we use 7808 regulator
then its means that it is 8 volt regulator circuit. In this project we use 5 volt
dc regulated power supply for the complete circuit. Separate 9 volt dc power
supply is used for the relay coil
89s52 microcontroller is a main ic of this project. To drive the lcd,
to check the balance amount and balance comparison all this
activity is done in the this ic. Here we use microcontroller for this
purpose. We wrote a program for this ic. Program is to be written
in the ASM codes and then this code is converted into hex code
with the help of the assembler. In this project we use 8051 ide
software to assemble the asm codes into hex code. Once the code
is converted into hex code then we transfer this code in the blank
ic with the help of program kit connected with the computer. After
transfer the hex code in the blank ic our ic is ready for the
project .
LCD INTERFACE.
In this project we use lcd for output device. Here in this project we use 2 by
16 lcd for the output device. LCD drive by the microcontroller directly
with the port p0. In this project we use 8 data line for the data transfer from
the microcontroller to lcd. Our processor inside the controller is 8 bit
processor, so we use parallel line transfer from microcontroller to lcd. Three
control line R/S, R/W, AND ENABLE is also provided by the
microcontroller itself.
Lcd display welcome message. In the starting, then after show the recharge
value of the money Then display the balance in first line and in the second
line show the unit consumption and pulse counter logic.
COMPONENTS USED IN THE PROJECT VOTING MACHINE:
STEP DWON TRANSFORMER 9-0-9
DIODE IN 4007 (2)
CAPACITOR:
470 MFD, 1000MFD, 10 MFD, 27 PF(2)
IC 89s52 OR 89S51 ( 40 PIN MICROCONTROLLER)
LCD 2BY 16.
MEMORY IC 24C02
PUSH TO ON SWITCHES. 12 SWITCHES.
CRYSTAL 12 MHZ
PULL UP RESISTOR 10 K OHM ( CONNECTED TO PORT 0)
PC B DESIGN
BUZZER ALARM.
Complete PIN LAYOUT of the voting machine.
In this voting machine we use ic 89s52 as a main microcontroller. Lcd
available is 2 by 16 line. Eerom is 24c02 .
Pin no 40 is connected to the positive supply. Pin no 20 is connected to the
negative supply. All the input switches are connected to the pin no 1,2,3,
4,5 6,7,8 ,10,11,12, 13
Pin no 1,4,6,8, is connected to the four different candidate vote enter switch
Pin no 2,3,5,7 is connected to the check the vote of individual candidate
Pin no 10 is connected to the total vote
Pin no 12 is control the voting, After pressing this switch by both controller
we enter the vote on different candidate
Block Diagram:
Description of Project
In this project LCD is connected to Microcntroller port 0. RFID is
connected to MCU at port pins p3.0 and p3.1. when any data card come
contact with RFID reader then our reader give 32 character serial data to
mcu
Candidate
selection
switches
LCD display
Check switch
for each
candidate & reset
sw
Supply circuit
5v
buzzer
mcu. MCU pick last 8 bits and save in serial eeprom 24c02. Serial eeprom
is to save data permanently. When switch off power even then eeprom save
RFID tags. Our controller 1 give output at port 0. P0.0 connected to mcu2
port p1.0 respectively. Similarly p0.1 connected to p1.1.
In this controller we will connect lcd at port 1 and switches to check vote at
port1.
Rs , rw , and en of LCD at port p2.5, pp2.4 and p2.3 respectively.
To check total votes at pin p3.0
We used 5v DC power supply for whole circuit.
We used 12v 1A adapter for RFID reader.
About controller used in Circuit.
Look around. Notice the smart “intelligent” systems? Be it the T.V, washing
machines, video games, telephones, automobiles, aero planes, power
systems, or any application having a LED or a LCD as a user interface, the
control is likely to be in the hands of a micro controller!
Measure and control, that’s where the micro controller is at its best.
Micro controllers are here to stay. Going by the current trend, it is obvious
that micro controllers will be playing bigger and bigger roles in the different
activities of our lives.
These embedded chips are very small, but are designed to replace
components much bigger and bulky In size. They process information very
intelligently and efficiently. They sense the environment around them. The
signals they gather are tuned into digital data that streams through tributaries
of circuit lines at the speed of light. Inside the microprocessor collates and
calculators. The software has middling intelligence. Then in a split second,
the processed streams are shoved out.
What is the primary difference between a microprocessor
and a micro controller?
Unlike the microprocessor, the micro controller can be considered to be a
true “Computer on a chip”.
In addition to the various features like the ALU, PC, SP and registers found
on a microprocessor, the micro controller also incorporates features like the
ROM, RAM, Ports, timers, clock circuits, counters, reset functions etc.
While the microprocessor is more a general-purpose device, used for read,
write and calculations on data, the micro controller, in addition to the above
functions also controls the environment.
8051 micro controller
The 8051
The 8051 developed and launched in the early 80`s, is one of the most
popular micro controller in use today. It has a reasonably large amount of
built in ROM and RAM. In addition it has the ability to access external
memory.
The generic term `8x51` is used to define the device. The value of x defining
the kind of ROM, i.e. x=0, indicates none, x=3, indicates mask ROM, x=7,
indicates EPROM and x=9 indicates EEPROM or Flash.
A note on ROM
The early 8051, namely the 8031 was designed without any ROM. This
device could run only with external memory connected to it. Subsequent
developments lead to the development of the PROM or the programmable
ROM. This type had the disadvantage of being highly unreliable.
The next in line, was the EPROM or Erasable Programmable ROM. These
devices used ultraviolet light erasable memory cells. Thus a program could
be loaded, tested and erased using ultra violet rays. A new program could
then be loaded again.
An improved EPROM was the EEPROM or the electrically erasable PROM.
This does not require ultra violet rays, and memory can be cleared using
circuits within the chip itself.
Finally there is the FLASH, which is an improvement over the EEPROM.
While the terms EEPROM and flash are sometimes used interchangeably,
the difference lies in the fact that flash erases the complete memory at one
stroke, and not act on the individual cells. This results in reducing the time
for erasure.
Different microcontrollers in market.
• PIC One of the famous microcontrollers used in the industries. It is
based on RISC Architecture which makes the microcontroller process faster than
other microcontroller.
• INTEL These are the first to manufacture microcontrollers. These are not
as sophisticated other microcontrollers but still the easiest one to learn.
• ATMEL Atmel’s AVR microcontrollers are one of the most
powerful in the embedded industry. This is the only microcontroller having 1kb of
ram even the entry stage. But it is unfortunate that in India we are unable to find
this kind of microcontroller.
Intel 8051
Intel 8051 is CISC architecture which is easy to program in assembly language and also
has a good support for High level languages.
The memory of the microcontroller can be extended up to 64k.
This microcontroller is one of the easiest microcontrollers to learn.
The 8051 microcontroller is in the field for more than 20 years. There are lots of books
and study materials are readily available for 8051.
Derivatives
The best thing done by Intel is to give the designs of the 8051 microcontroller to
everyone. So it is not the fact that Intel is the only manufacture for the 8051 there more
than 20 manufactures, with each of minimum 20 models. Literally there are hundreds of
models of 8051 microcontroller available in market to choose. Some of the major
manufactures of 8051 are
 Atmel
 Philips
Philips
The Philips‘s 8051 derivatives has more number of features than in any
microcontroller. The costs of the Philips microcontrollers are higher than the Atmel’s
which makes us to choose Atmel more often than Philips
Dallas
Dallas has made many revolutions in the semiconductor market. Dallas’s 8051
derivative is the fastest one in the market. It works 3 times as fast as a 8051 can process.
But we are unable to get more in India.
Atmel
These people were the one to master the flash devices. They are the cheapest
microcontroller available in the market. Atmel’s even introduced a 20pin variant of 8051
named 2051. The Atmel’s 8051 derivatives can be got in India less than 70 rupees. There
are lots of cheap programmers available in India for Atmel. So it is always good for
students to stick with 8051 when you learn a new microcontroller.
]
Architecture
Architecture is must to learn because before learning new machine it is necessary to learn
the capabilities of the machine. This is some thing like before learning about the car you
cannot become a good driver. The architecture of the 8051 is given below.
The 8051 doesn’t have any special feature than other microcontroller. The only feature is
that it is easy to learn. Architecture makes us to know about the hardware features of the
microcontroller. The features of the 8051 are
 4K Bytes of Flash Memory
 128 x 8-Bit Internal RAM
 Fully Static Operation: 1 MHz to 24 MHz
 32 Programmable I/O Lines
 Two 16-Bit Timer/Counters
 Six Interrupt Sources (5 Vectored)
 Programmable Serial Channel
 Low Power Idle and Power Down Modes
The 8051 has a 8-Bit CPU that means it is able to process 8 bit of data at a time. 8051 has
235 instructions. Some of the important registers and their functions are
Let’s now move on to a practical example. We shall work on a simple
practical application and using the example as a base, shall explore the
various features of the 8051 microcontroller.
Consider an electric circuit as follows,
The positive side (+ve) of the battery is connected to one side of a switch.
The other side of the switch is connected to a bulb or LED (Light Emitting
Diode). The bulb is then connected to a resistor, and the other end of the
resistor is connected to the negative (-ve) side of the battery.
When the switch is closed or ‘switched on’ the bulb glows. When the switch
is open or ‘switched off’ the bulb goes off
If you are instructed to put the switch on and off every 30 seconds, how
would you do it? Obviously you would keep looking at your watch and
every time the second hand crosses 30 seconds you would keep turning the
switch on and off.
Imagine if you had to do this action consistently for a full day. Do you think
you would be able to do it? Now if you had to do this for a month, a year??
No way, you would say!
The next step would be, then to make it automatic. This is where we use the
Microcontroller.
But if the action has to take place every 30 seconds, how will the
microcontroller keep track of time?
Execution time
Look at the following instruction,
clr p1.0
This is an assembly language instruction. It means we are instructing the
microcontroller to put a value of ‘zero’ in bit zero of port one. This
instruction is equivalent to telling the microcontroller to switch on the bulb.
The instruction then to instruct the microcontroller to switch off the bulb is,
Set p1.0
This instructs the microcontroller to put a value of ‘one’ in bit zero of port
one.
Don’t worry about what bit zero and port one means. We shall learn it in
more detail as we proceed.
There are a set of well defined instructions, which are used while
communicating with the microcontroller. Each of these instructions requires
a standard number of cycles to execute. The cycle could be one or more in
number.
How is this time then calculated?
The speed with which a microcontroller executes instructions is determined
by what is known as the crystal speed. A crystal is a component connected
externally to the microcontroller. The crystal has different values, and some
of the used values are 6MHZ, 10MHZ, and 11.059 MHz etc.
Thus a 10MHZ crystal would pulse at the rate of 10,000,000 times per
second.
The time is calculated using the formula
No of cycles per second = Crystal frequency in HZ / 12.
For a 10MHZ crystal the number of cycles would be,
10,000,000/12=833333.33333 cycles.
This means that in one second, the microcontroller would execute
833333.33333 cycles.
Therefore for one cycle, what would be the time? Try it out.
The instruction clr p1.0 would use one cycle to execute. Similarly, the
instruction setb p1.0 also uses one cycle.
So go ahead and calculate what would be the number of cycles required to
be executed to get a time of 30 seconds!
Getting back to our bulb example, all we would need to do is to instruct the
microcontroller to carry out some instructions equivalent to a period of 30
seconds, like counting from zero upwards, then switch on the bulb, carry out
instructions equivalent to 30 seconds and switch off the bulb.
Just put the whole thing in a loop, and you have a never ending on-off
sequence.
Let us now have a look at the features of the 8051 core, keeping the above
example as a reference,
1. 8-bit CPU.( Consisting of the ‘A’ and ‘B’ registers)
Most of the transactions within the microcontroller are carried out through
the ‘A’ register, also known as the Accumulator. In addition all arithmetic
functions are carried out generally in the ‘A’ register. There is another
register known as the ‘B’ register, which is used exclusively for
multiplication and division.
Thus an 8-bit notation would indicate that the maximum value that can be
input into these registers is ‘11111111’. Puzzled?
The value is not decimal 111, 11,111! It represents a binary number, having
an equivalent value of ‘FF’ in Hexadecimal and a value of 255 in decimal.
We shall read in more detail on the different numbering systems namely the
Binary and Hexadecimal system in our next module.
2. 4K on-chip ROM
Once you have written out the instructions for the microcontroller, where do
you put these instructions?
Obviously you would like these instructions to be safe, and not get deleted
or changed during execution. Hence you would load it into the ‘ROM’
The size of the program you write is bound to vary depending on the
application, and the number of lines. The 8051 microcontroller gives you
space to load up to 4K of program size into the internal ROM.
4K, that’s all? Well just wait. You would be surprised at the amount of stuff
you can load in this 4K of space.
Of course you could always extend the space by connecting to 64K of
external ROM if required.
3. 128 bytes on-chip RAM
This is the space provided for executing the program in terms of moving
data, storing data etc.
4. 32 I/O lines. (Four- 8 bit ports, labeled P0, P1, P2, P3)
In our bulb example, we used the notation p1.0. This means bit zero of port
one. One bit controls one bulb.
Thus port one would have 8 bits. There are a total of four ports named p0,
p1, p2, p3, giving a total of 32 lines. These lines can be used both as input or
output.
5. Two 16 bit timers / counters.
A microcontroller normally executes one instruction at a time. However
certain applications would require that some event has to be tracked
independent of the main program.
The manufacturers have provided a solution, by providing two timers. These
timers execute in the background independent of the main program. Once
the required time has been reached, (remember the time calculations
described above?), they can trigger a branch in the main program.
These timers can also be used as counters, so that they can count the number
of events, and on reaching the required count, can cause a branch in the main
program.
6. Full Duplex serial data receiver / transmitter.
The 8051 microcontroller is capable of communicating with external devices
like the PC etc. Here data is sent in the form of bytes, at predefined speeds,
also known as baud rates.
The transmission is serial, in the sense, one bit at a time
7. 5- interrupt sources with two priority levels (Two external and three
internal)
During the discussion on the timers, we had indicated that the timers can
trigger a branch in the main program. However, what would we do in case
we would like the microcontroller to take the branch, and then return back to
the main program, without having to constantly check whether the required
time / count has been reached?
This is where the interrupts come into play. These can be set to either the
timers, or to some external events. Whenever the background program has
reached the required criteria in terms of time or count or an external event,
the branch is taken, and on completion of the branch, the control returns to
the main program.
Priority levels indicate which interrupt is more important, and needs to be
executed first in case two interrupts occur at the same time.
8. On-chip clock oscillator.
This represents the oscillator circuits within the microcontroller. Thus the
hardware is reduced to just simply connecting an external crystal, to achieve
the required pulsing rate.
PIN FUNCTION OF IC 89C51.
1 Supply pin of this ic is pin no 40. Normally we apply a 5 volt regulated dc
power supply to this pin. For this purpose either we use step down
transformer power supply or we use 9 volt battery with 7805 regulator.
2 Ground pin of this ic is pin no 20. Pin no 20 is normally connected to the
ground pin ( normally negative point of the power supply.
3 XTAL is connected to the pin no 18 and pin no 19 of this ic. The quartz
crystal oscillator connected to XTAL1 and XTAL2 PIN. These pins also needs
two capacitors of 30 pf value. One side of each capacitor is connected to
crystal and other pis is connected to the ground point. Normally we connect
a 12 MHz or 11.0592 MHz crystal with this ic.. But we use crystal upto 20
MHz to this pins
4 RESET PIN.. Pin no 9 is the reset pin of this ic.. It is an active high pin.
On applying a high pulse to this pin, the micro controller will reset and
terminate all activities. This is often referred to as a power on reset. The high
pulse must
be high for a minimum of 2 machine cycles before it is allowed to go low.
5. PORT0 Port 0 occupies a total of 8 pins. Pin no 32 to pin no 39. It can be
used for input or output. We connect all the pins of the port 0 with the pullup
resistor (10 k ohm) externally. This is due to fact that port 0 is an open drain
mode. It is just like a open collector transistor.
6. PORT1. ALL the ports in micrcontroller is 8 bit wide pin no 1 to pin no 8
because it is a 8 bit controller. All the main register and sfr all is mainly 8 bit
wide. Port 1 is also occupies a 8 pins. But there is no need of pull up resistor
in this port. Upon reset port 1 act as a input port. Upon reset all the ports act
as a input port
7. PORT2. port 2 also have a 8 pins. It can be used as a input or output.
There is no need of any pull up resistor to this pin.
PORT 3. Port3 occupies a totoal 8 pins from pin no 10 to pin no 17. It can
be used as input or output. Port 3 does not require any pull up resistor. The
same as port 1 and port2. Port 3 is configured as an output port on reset. Port
3 has the additional function of providing some important signals such as
interrupts. Port 3 also use for serial communication.
ALE ALE is an output pin and is active high. When connecting an 8031 to external
memory, port 0 provides both address and data. In other words, the 8031 multiplexes
address and data through port 0 to save pins. The ALE pin is used for demultiplexing the
address and data by connecting to the ic 74ls373 chip.
PSEN. PSEN stands for program store eneable. In an 8031 based system in which an
external rom holds the program code, this pin is connected to the OE pin of the rom.
EA. EA. In 89c51 8751 or any other family member of the ateml 89c51 series all come
with on-chip rom to store programs, in such cases the EA pin is connected to the Vcc.
For family member 8031 and 8032 is which there is no on chip rom, code is stored in
external memory and this is fetched by 8031. In that case EA pin must be connected to
GND pin to indicate that the code is stored externally.
SPECIAL FUNCTION REGISTER ( SFR) ADDRESSES.
ACC ACCUMULATOR 0E0H
B B REGISTER 0F0H
PSW PROGRAM STATUS WORD 0D0H
SP STACK POINTER 81H
DPTR DATA POINTER 2 BYTES
DPL LOW BYTE OF DPTR 82H
DPH HIGH BYTE OF DPTR 83H
P0 PORT0 80H
P1 PORT1 90H
P2 PORT2 0A0H
P3 PORT3 0B0H
TMOD TIMER/COUNTER MODE CONTROL 89H
TCON TIMER COUNTER CONTROL 88H
TH0 TIMER 0 HIGH BYTE 8CH
TLO TIMER 0 LOW BYTE 8AH
TH1 TIMER 1 HIGH BYTE 8DH
TL1 TIMER 1 LOW BYTE 8BH
SCON SERIAL CONTROL 98H
SBUF SERIAL DATA BUFFER 99H
PCON POWER CONTROL 87H
INSTRUCTIONS
SINGLE BIT INSTRUCTIONS.
SETB BIT SET THE BIT =1
CLR BIT CLEAR THE BIT =0
CPL BIT COMPLIMENT THE BIT 0 =1, 1=0
JB BIT,TARGET JUMP TO TARGET IF BIT =1
JNB BIT, TARGET JUMP TO TARGET IF BIT =0
JBC BIT,TARGET JUMP TO TARGET IF BIT =1 &THEN CLEAR THE BIT
MOV INSTRUCTIONS
MOV instruction simply copy the data from one location to another location
MOV D,S
Copy the data from(S) source to D(destination)
MOV R0,A ; Copy contents of A into Register R0
MOV R1,A ; Copy contents of A into register R1
MOV A,R3 ; copy contents of Register R3 into Accnmulator.
DIRECT LOADING THROUGH MOV
MOV A,#23H ; Direct load the value of 23h in A
MOV R0,#12h ; direct load the value of 12h in R0
MOV R5,#0F9H ; Load the F9 value in the Register R5
ADD INSTRUCTIONS.
ADD instructions adds the source byte to the accumulator ( A) and place the result in the
Accumulator.
MOV A, #25H
ADD A,#42H ; BY this instructions we add the value 42h in Accumulator
( 42H+ 25H)
ADDA,R3 ;By this instructions we move the data from register r3 to
accumulator and then add the contents of the register into
accumulator .
SUBROUTINE CALL FUNCTION.
ACALL,TARGET ADDRESS
By this instructions we call subroutines with a target address within 2k bytes from the
current program counter.
LCALL, TARGET ADDRESS.
ACALL is a limit for the 2 k byte program counter, but for upto 64k byte we use
LCALL instructions.. Note that LCALL is a 3 byte instructions.
ACALL is a two byte instructions.
AJMP TARGET ADDRESS.
This is for absolute jump
AJMP stand for absolute jump. It transfers program execution to the target address
unconditionally. The target address for this instruction must be
withib 2 k byte of program memory.
LJMP is also for absoltute jump. It tranfer program execution to the target addres
unconditionally. This is a 3 byte instructions LJMP jump to any
address within 64 k byte location.
INSTRUCTIONS RELATED TO THE CARRY
JC TARGET
JUMP TO THE TARGET IF CY FLAG =1
JNC TARGET
JUMP TO THE TARGET ADDRESS IF CY FLAG IS = 0
INSTRUCTIONS RELASTED TO JUMP
WITH ACCUMULATOR
JZ TARGET
JUMP TO TARGET IF A = 0
JNZ TARGET
JUMP IF ACCUMULATOR IS NOT ZERO
This instructions jumps if registe A has a value other than zero
INSTRUCTIONS RELATED TO THE ROTATE
RL A
ROTATE LEFT THE ACCUMULATOR
BY this instructions we rotate the bits of A left. The bits rotated out of A are
rotated back into A at the opposite end
RR A
By this instruction we rotate the contents of the accumulator from right to
left from LSB to MSB
RRC A
This is same as RR A but difference is that the bit rotated out of register first
enter in to carry and then enter into MSB
RLC A
ROTATE A LEFT THROUGH CARRY
Same as above but but shift the data from MSB to carry and carry to LSB
RET
This is return from subroutine. This instructions is used to return from a
subroutine previously entered by instructions LCALL and ACALL.
RET1
THIS is used at the end of an interrupt service routine. We use this
instructions after intruupt routine,
PUSH.
This copies the indicated byte onto the stack and increments SP by . This
instructions supports only direct addressing mode.
POP.
POP FROM STACK.
This copies the byte pointed to be SP to the location whose direct address is
indicated, and decrements SP by 1. Notice that this instructions supports
only direct addressing mode.
DPTR INSTRUCTIONS.
MOV DPTR,#16 BIT VALUE
LOAD DATA POINTER
This instructions load the 16 bit dptr register with a 16 bit immediate value
MOV C A,@A+DPTR
This instructions moves a byte of data located in program ROM into register
A. This allows us to put strings of data, such as look up table elements.
MOVC A,@A+PC
This instructions moves a byte of data located in the program area to A. the
address of the desired byte of data is formed by adding the program counter
( PC) register to the original value of the accumulator.
INC BYTE
This instructions add 1 to the register or memory location specified by the
operand.
INC A
INC Rn
INC DIRECT
DEC BYTE
This instructions subtracts 1 from the byte operand. Note that CY is
unchanged
DEC A
DEC Rn
DEC DIRECT
ARITHMATIC INSTRUCTIONS.
ANL dest-byte, source-byte
This perform a logical AND operation
This performs a logical AND on the operands, bit by bit, storing the result in
the destination. Notice that both the source and destination values are byte –
size only
`
DIV AB
This instructions divides a byte accumulator by the byte in register B. It is
assumed that both register A and B contain an unsigned byte. After the
division the quotient will be in register A and the remainder in register B.
TMOD ( TIMER MODE ) REGISTER
Both timer is the 89c51 share the one register TMOD. 4 LSB bit for the timer 0 and 4
MSB for the timer 1.
In each case lower 2 bits set the mode of the timer
Upper two bits set the operations.
GATE: Gating control when set. Timer/counter is enabled only while the INTX
pin is high and the TRx control pin is set. When cleared, the timer is enabled whenever
the TRx control bit is set
C/T : Timer or counter selected cleared for timer operation ( input from internal
system clock)
M1 Mode bit 1
M0 Mode bit 0
M1 M0 MODE OPERATING MODE
0 0 0 13 BIT TIMER/MODE
0 1 1 16 BIT TIMER MODE
1 0 2 8 BIT AUTO RELOAD
1 1 3 SPLIT TIMER MODE
PSW ( PROGRAM STATUS WORD)
CY PSW.7 CARRY FLAG
AC PSW.6 AUXILIARY CARRY
F0 PSW.5 AVAILABLE FOR THE USER FRO GENERAL PURPOSE
RS1 PSW.4 REGISTER BANK SELECTOR BIT 1
RS0 PSW.3 REGISTER BANK SELECTOR BIT 0
0V PSW.2 OVERFLOW FLAG
-- PSW.1 USER DEFINABLE BIT
P PSW.0 PARITY FLAG SET/CLEARED BY HARDWARE
PCON REGISATER ( NON BIT ADDRESSABLE)
If the SMOD = 0 ( DEFAULT ON RESET)
TH1 = CRYSTAL FREQUENCY
256---- ____________________
384 X BAUD RATE
If the SMOD IS = 1
CRYSTAL FREQUENCY
TH1 = 256--------------------------------------
192 X BAUD RATE
There are two ways to increase the baud rate of data transfer in the 8051
1. To use a higher frequency crystal
2. To change a bit in the PCON register
PCON register is an 8 bit register . Of the 8 bits, some are unused, and some are used for
the power control capability of the 8051. the bit which is used for the serial
communication is D7, the SMOD bit. When the 8051 is powered up, D7 ( SMOD BIT)
OF PCON register is zero. We can set it to high by software and thereby double the
baud rate
BAUD RATE COMPARISION FOR SMOD = 0 AND SMOD =1
TH1 ( DECIMAL) HEX SMOD =0 SMOD =1
-3 FD 9600 19200
-6 FA 4800 9600
-12 F4 2400 4800
-24 E8 1200 2400
XTAL = 11.0592 MHZ
IE ( INTERRUPT ENABLE REGISTOR)
EA IE.7 Disable all interrupts if EA = 0, no interrupts is acknowledged
If EA is 1, each interrupt source is individually enabled or disbaled
By sending or clearing its enable bit.
IE.6 NOT implemented
ET2 IE.5 enables or disables timer 2 overflag in 89c52 only
ES IE.4 Enables or disables all serial interrupt
ET1 IE.3 Enables or Disables timer 1 overflow interrupt
EX1 IE.2 Enables or disables external interrupt
ET0 IE.1 Enables or Disbales timer 0 interrupt.
EX0 IE.0 Enables or Disables external interrupt 0
INTERRUPT PRIORITY REGISTER
If the bit is 0, the corresponding interrupt has a lower priority and if the bit is 1 the
corresponding interrupt has a higher priority
IP.7 NOT IMPLEMENTED, RESERVED FOR FUTURE USE.
IP.6 NOT IMPLEMENTED, RESERVED FOR FUTURE USE
PT2 IP.5 DEFINE THE TIMER 2 INTERRUPT PRIORITY LELVEL
PS IP.4 DEFINES THE SERIAL PORT INTERRUPT PRIORITY LEVEL
PT1 IP.3 DEFINES THE TIMER 1 INTERRUPT PRIORITY LEVEL
PX1 IP.2 DEFINES EXTERNAL INTERRUPT 1 PRIORITY LEVEL
PT0 IP.1 DEFINES THE TIMER 0 INTERRUPT PRIORITY LEVEL
PX0 IP.0 DEFINES THE EXTERNAL INTERRUPT 0 PRIORITY LEVEL
SCON: SERIAL PORT CONTROL REGISTER , BIT ADDRESSABLE
SCON
SM0 : SCON.7 Serial Port mode specifier
SM1 : SCON.6 Serial Port mode specifier
SM2 : SCON.5
REN : SCON.4 Set/cleared by the software to Enable/disable reception
TB8 : SCON.3 The 9th
bit that will be transmitted in modes 2 and 3, Set/cleared
By software
RB8 : SCON.2 In modes 2 &3, is the 9th
data bit that was received. In mode 1,
If SM2 = 0, RB8 is the stop bit that was received. In mode 0
RB8 is not used
T1 : SCON.1 Transmit interrupt flag. Set by hardware at the end of the 8th
bit
Time in mode 0, or at the beginning of the stop bit in the other
Modes. Must be cleared by software
R1 SCON.0 Receive interrupt flag. Set by hardware at the end of the 8th
bit
Time in mode 0, or halfway through the stop bit time in the other
Modes. Must be cleared by the software.
TCON TIMER COUNTER CONTROL REGISTER
This is a bit addressable
TF1 TCON.7 Timer 1 overflow flag. Set by hardware when the Timer/Counter 1
Overflows. Cleared by hardware as processor
TR1 TCON.6 Timer 1 run control bit. Set/cleared by software to turn Timer
Counter 1 On/off
TF0 TCON.5 Timer 0 overflow flag. Set by hardware when the timer/counter 0
Overflows. Cleared by hardware as processor
TR0 TCON.4 Timer 0 run control bit. Set/cleared by software to turn timer
Counter 0 on/off.
IE1 TCON.3 External interrupt 1 edge flag
ITI TCON.2 Interrupt 1 type control bit
IE0 TCON.1 External interrupt 0 edge
IT0 TCON.0 Interrupt 0 type control bit.
- 8051 Instruction Set
Arithmetic Operations
Mnemonic Description Size Cycles
ADD A,Rn Add register to Accumulator (ACC). 1 1
ADD A,direct Add direct byte to ACC. 2 1
ADD A,@Ri Add indirect RAM to ACC . 1 1
ADD A,#data Add immediate data to ACC . 2 1
ADDC A,Rn Add register to ACC with carry . 1 1
ADDC A,direct Add direct byte to ACC with carry. 2 1
ADDC A,@Ri Add indirect RAM to ACC with carry. 1 1
ADDC A,#data Add immediate data to ACC with carry. 2 1
SUBB A,Rn Subtract register from ACC with borrow. 1 1
SUBB A,direct Subtract direct byte from ACC with borrow 2 1
SUBB A,@Ri Subtract indirect RAM from ACC with borrow. 1 1
SUBB A,#data Subtract immediate data from ACC with borrow. 2 1
INC A Increment ACC. 1 1
INC Rn Increment register. 1 1
INC direct Increment direct byte. 2 1
INC @Ri Increment indirect RAM. 1 1
DEC A Decrement ACC. 1 1
DEC Rn Decrement register. 1 1
DEC direct Decrement direct byte. 2 1
DEC @Ri Decrement indirect RAM. 1 1
INC DPTR Increment data pointer. 1 2
MUL AB Multiply A and B Result: A <- low byte, B <- high byte. 1 4
DIV AB Divide A by B Result: A <- whole part, B <- remainder. 1 4
DA A Decimal adjust ACC. 1 1
Logical Operations
Mnemonic Description Size Cycles
ANL A,Rn AND Register to ACC. 1 1
ANL A,direct AND direct byte to ACC. 2 1
ANL A,@Ri AND indirect RAM to ACC. 1 1
ANL A,#data AND immediate data to ACC. 2 1
ANL direct,A AND ACC to direct byte. 2 1
ANL direct,#data AND immediate data to direct byte. 3 2
ORL A,Rn OR Register to ACC. 1 1
ORL A,direct OR direct byte to ACC. 2 1
ORL A,@Ri OR indirect RAM to ACC. 1 1
ORL A,#data OR immediate data to ACC. 2 1
ORL direct,A OR ACC to direct byte. 2 1
ORL direct,#data OR immediate data to direct byte. 3
2
XRL A,Rn Exclusive OR Register to ACC. 1 1
XRL A,direct Exclusive OR direct byte to ACC. 2 1
XRL A,@Ri Exclusive OR indirect RAM to ACC. 1 1
XRL A,#data Exclusive OR immediate data to ACC. 2 1
XRL direct,A Exclusive OR ACC to direct byte. 2 1
XRL direct,#data XOR immediate data to direct byte. 3 2
CLR A Clear ACC (set all bits to zero). 1 1
CPL A Compliment ACC. 1 1
RL A Rotate ACC left. 1 1
RLC A Rotate ACC left through carry. 1 1
RR A Rotate ACC right. 1 1
RRC A Rotate ACC right through carry. 1 1
SWAP A Swap nibbles within ACC. 1 1
Data Transfer
Mnemonic Description Size Cycles
MOV A,Rn Move register to ACC. 1 1
MOV A,direct Move direct byte to ACC.
2 1
MOV A,@Ri Move indirect RAM to ACC. 1 1
MOV A,#data Move immediate data to ACC. 2 1
MOV Rn,A Move ACC to register. 1 1
MOV Rn,direct Move direct byte to register. 2 2
MOV Rn,#data Move immediate data to register. 2 1
MOV direct,A Move ACC to direct byte. 2 1
MOV direct,Rn Move register to direct byte. 2 2
MOV direct,direct Move direct byte to direct byte. 3 2
MOV direct,@Ri Move indirect RAM to direct byte. 2 2
MOV direct,#data Move immediate data to direct byte. 3 2
MOV @Ri,A Move ACC to indirect RAM. 1 1
MOV @Ri,direct Move direct byte to indirect RAM. 2 2
MOV @Ri,#data Move immediate data to indirect RAM. 2 1
MOV DPTR,#data16 Move immediate 16 bit data to data pointer register. 3 2
MOVC A,@A+DPTR Move code byte relative to DPTR to ACC (16 bit address).
1 2
MOVC A,@A+PC Move code byte relative to PC to ACC (16 bit address).1 2
MOVX A,@Ri Move external RAM to ACC (8 bit address).1 2
MOVX A,@DPTR Move external RAM to ACC (16 bit address). 1 2
MOVX @Ri,A Move ACC to external RAM (8 bit address).1 2
MOVX @DPTR,A Move ACC to external RAM (16 bit address). 1 2
PUSH direct Push direct byte onto stack. 2 2
POP direct Pop direct byte from stack. 2 2
XCH A,Rn Exchange register with ACC. 1 1
XCH A,direct Exchange direct byte with ACC. 2 1
XCH A,@Ri Exchange indirect RAM with ACC. 1 1
XCHD A,@Ri Exchange low order nibble of indirect
RAM with low order nibble of ACC 1 1
Boolean Variable Manipulation
Mnemonic Description Size Cycles
CLR C Clear carry flag. 1 1
CLR bit Clear direct bit. 2 1
SETB C Set carry flag. 1 1
SETB bitSet direct bit 2 1
CPL C Compliment carry flag. 1 1
CPL bit Compliment direct bit. 2 1
ANL C,bit AND direct bit to carry flag. 2 2
ANL C,/bit AND compliment of direct bit to carry. 2 2
ORL C,bit OR direct bit to carry flag. 2 2
ORL C,/bit OR compliment of direct bit to carry. 2 2
MOV C,bit Move direct bit to carry flag. 2 1
MOV bit,C Move carry to direct bit. 2 2
JC rel Jump if carry is set. 2 2
JNC rel Jump if carry is not set. 2 2
JB bit,rel Jump if direct bit is set. 3 2
JNB bit,rel Jump if direct bit is not set. 3 2
JBC bit,rel Jump if direct bit is set & clear bit. 3 2
Program Branching
Mnemonic Description Size Cycles
ACALL addr11 Absolute subroutine call. 2 2
LCALL addr16 Long subroutine call. 3 2
RET Return from subroutine. 1 2
RETI Return from interrupt. 1 2
AJMP addr11 Absolute jump. 2 2
LJMP addr16 Long jump. 3 2
SJMP rel Short jump (relative address). 2 2
JMP @A+DPTR Jump indirect relative to the DPTR. 1 2
JZ rel Jump relative if ACC is zero. 2 2
JNZ rel Jump relative if ACC is not zero. 2 2
CJNE A,direct,rel Compare direct byte to ACC and jump if not equal. 3 2
CJNE A,#data,rel Compare immediate byte to ACC and jump if not equal.3 2
CJNE Rn,#data,rel Compare immediate byte to register and jump if not equal.32
CJNE @Ri,#data,rel Compare immediate byte to indirect and jump if not equal.32
DJNZ Rn,rel Decrement register and jump if not zero. 2 2
DJNZ direct,rel Decrement direct byte and jump if not zero. 3 2
Other Instructions
Mnemonic Description Size Cycles
NOP No operation. 1 1
component qty rate
IC89C051, 1 60
ULN2003, 1 30
Diodes in4001, 4 1
IC 7805 1 15
Optocoupler PC817 4 12
Tr548 4 3
Tr 558 4 3
Motors 12v 2 250
IC base 20 pin 1 10
Crystal 12 Mhz 1 25
Resiatncec 10k 4 .25
4k 4 .25
Cap 10µf 1 5
Connecting wires 1 20
Ir sensors 3 120
• Software:-
Keil compiler or UMPS for programming
Window xp
Bibliography:
http://www.sciencejoywagon.com/physicszone/lesson/otherpub/wfendt/electricmotor.
htm
exists which allows us to communicate with the vast 3 control lines as well as either 4 or
8 I/O lines for the data bus. The user may select whether the LCD is to operate with a 4-
bit data bus or an 8-bit data bus. If a 4-bit data bus is used, the LCD The 44780 standard
requires 3 control lines as well as either 4 or 8 I/O lines for the data bus. The user may
select whether the LCD is to operate with a 4-bit data bus or an 8-bit data bus. If a 4-bit
data bus is used, the LCD will require a total of 7 data lines (3 control lines plus the 4
lines for the data bus). If an 8-bit data bus is used, the LCD will require a total of 11 data
lines (3 control lines plus the 8 lines for the data bus).
The three control lines are referred to as EN, RS, and RW.
will require a total of 7 data lines (3 control lines plus the 4 lines for the data bus). If an
8-bit data bus is used, the LCD will require a total of 11 data lines (3 control lines plus
the 8 lines for the data bus).
The three control lines are referred to as EN, RS, and RW.
The EN line is called "Enable." This control line is used to tell the LCD that you are
sending it data. To send data to the LCD, your program should first set this line high (1)
and then set the other two control lines and/or put data on the data bus. When the other
lines are completely ready, bring EN low (0) again. The 1-0 transition tells the 44780 to
take the data currently found on the other control lines and on the data bus and to treat it
as a command.
The RS line is the "Register Select" line. When RS is low (0), the data is to be treated as
a command or special instruction (such as clear screen, position cursor, etc.). When RS is
high (1), the data being sent is text data which should be displayed on the screen. For
example, to display the letter "T" on the screen you would set RS high.
The RW line is the "Read/Write" control line. When RW is low (0), the information on
the data bus is being written to the LCD. When RW is high (1), the program is effectively
querying (or reading) the LCD. Only one instruction ("Get LCD status") is a read
command. All others are write commands--so RW will almost always be low.
Finally, the data bus consists of 4 or 8 lines (depending on the mode of operation selected
by the user). In the case of an 8-bit data bus, the lines are referred to as DB0, DB1, DB2,
DB3, DB4, DB5, DB6, and DB7.
Fortunately, a very popular standard exists which allows us to communicate with the vast
majority of data from an external source (in this case, the 8051) and communicates
directly with the LCD.
I
atic Showing Column of Laser Light Leaving Optical Oscillator
COMPONENT DESCRIPTION
TRANSFORMER
Transformer works on the principle of mutual inductance. We know that if two coils or
windings are placed on the core of iron, and if we pass alternating current in one winding,
back emf or induced voltage is produced in the second winding. We know that alternating
current always changes with the time. So if we apply AC voltage across one winding, a
voltage will be induced in the other winding. Transformer works on this same principle.
It is made of two windings wound around the same core of iron. The winding to which
AC voltage is applied is called primary winding. The other winding is called as
secondary winding.
Voltage and current relationship:
Let V1 volts be input alternating voltage applied to primary winding. I1 Amp is input
alternating current through primary winding. V2 volt is output alternating voltage
produced in the secondary. I2 amp be the current flowing through the secondary.
Then relationship between input and output voltages is given by
V1/V2 = N1/N2
Relationship between input and output currents is
I1/I2 = N2/N1
(Where N1 is no. of turns of coil in primary and N2 is number of turns in secondary )
We know that Power = Current X Voltage. It is to be noted that input power is
equal to output power. Power is not changed. If V2 is greater than V1, then I2 will
be less than I1. This type of transformer is called as step up transformer. If V1 is
greater than V2, then I1 will be less than I2. This type of transformer is called as
step down transformer.
For step up transformer, N2>N1, i.e., number of turns of secondary winding is
more than those in primary.
For step down transformer, N1>N2, i.e., numbers of turns of primary winding is
more than those in secondary.
RESISTORS
The flow of charge (or current) through any material, encounters an
opposing force similar in many respect to mechanical friction. This opposing
force is called resistance of the material. It is measured in ohms. In some
electric circuits resistance is deliberately introduced in the form of the
resistor.
Resistors are of following types:
1. Wire wound resistors.
2. Carbon resistors.
3. Metal film resistors.
Wire Wound Resistors:
Wire wound resistors are made from a long (usually Ni-Chromium) wound
on a ceramic core. Longer the length of the wire, higher is the resistance. So
depending on the value of resistor required in a circuit, the wire is cut and
wound on a ceramic core. This entire assembly is coated with a ceramic
metal. Such resistors are generally available in power of 2 watts to several
hundred watts and resistance values from 1ohm to 100k ohms. Thus wire
wound resistors are used for high currents.
Carbon Resistors:
Carbon resistors are divided into three types:
a. Carbon composition resistors are made by mixing carbon grains with
binding material (glue) and moduled in the form of rods. Wire leads
are inserted at the two ends. After this an insulating material seals the
resistor. Resistors are available in power ratings of 1/10, 1/8, 1/4 ,
1/2 , 1.2 watts and values from 1 ohm to 20 ohms.
b. Carbon film resistors are made by deposition carbon film on a ceramic
rod. They are cheaper than carbon composition resistors.
c. Cement film resistors are made of thin carbon coating fired onto a
solid ceramic substrate. The main purpose is to have more precise
resistance values and greater stability with heat. They are made in a
small square with leads.
Metal Film Resistors:
They are also called thin film resistors. They are made of a thin metal
coating deposited on a cylindrical insulating support. The high resistance
values are not precise in value; however, such resistors are free of
inductance effect that is common in wire wound resistors at high frequency.
Variable Resistors:
Potentiometer is a resistor where values can be set depending on the
requirement. Potentiometer is widely used in electronics systems. Examples
are volume control, tons control, brightness and contrast control of radio or
T.V. sets.
Fusible Resistors:
These resistors are wire wound type and are used in T.V. circuits for
protection. They have resistance of less than 15 ohms. Their function is
similar to a fuse made to blow off whenever current in the circuit exceeds
the limit.
Resistance of a wire is directly proportional to its length and inversely
proportional to its thickness.
R L
R 1/A
RESISTOR COLOR CODE
Example: 1k or 1000 ohms
1st
2nd
3rd
4th
Band1
Band 2
Band 3
Band 4
COLOUR CODES
COLOUR NUMBE
R
MULTIPLI
ER
COLOUR TOLERANC
E
Black
Brown
Red
Orange
Yellow
Green
Blue
Violet
Grey
White
Gold
Silver
0
1
2
3
4
5
6
7
8
9
100
101
102
103
104
105
106
107
108
109
10-1
10-2
Gold
Silver
No colour
5%
10%
20%
CAPACITORS
A capacitor can store charge, and its capacity to store charge is called
capacitance. Capacitors consist of two conducting plates, separated by an
insulating material (known as dielectric). The two plates are joined with two
leads. The dielectric could be air, mica, paper, ceramic, polyester,
polystyrene, etc. This dielectric gives name to the capacitor. Like paper
capacitor, mica capacitor etc.
Types of capacitors:
Capacitors can be broadly classified in two categories, i.e., Electrolytic
capacitors and Non-Electrolytic capacitors as shown if the figure above.
Electrolytic Capacitor:
Electrolytic capacitors have an electrolyte as a dielectric. When such an
electrolyte is charged, chemical changes takes place in the electrolyte. If its
one plate is charged positively, same plate must be charged positively in
future. We call such capacitors as polarized. Normally we see electrolytic
capacitor as polarized capacitors and the leads are marked with positive or
negative on the can. Non-electrolyte capacitors have dielectric
Capacitor
Fixed capacitor Variable capacitor
Electrolytic Non-Electrolytic
Pape
material such as paper, mica or ceramic. Therefore, depending
upon the dielectric, these capacitors are classified.
Mica Capacitor:
It is sandwich of several thin metal plates separated by thin sheets
of mica. Alternate plates are connected together and leads attached
for outside connections. The total assembly is encased in a plastic
capsule or Bakelite case. Such capacitors have small capacitance
value (50 to 500pf) and high working voltage (500V and above).
The mica capacitors have excellent characteristics under stress of
temperature variation and high voltage application. These
capacitors are now replaced by ceramic capacitors.
Ceramic Capacitor:
Such capacitors have disc or hollow tabular shaped dielectric made
of ceramic material such as titanium dioxide and barium titanate.
Thin coating of silver compounds is deposited on both sides of
dielectric disc, which acts as capacitor plates. Leads are attached to
each sides of the dielectric disc and whole unit is encapsulated in a
moisture proof coating. Disc type capacitors have very high value
up to 0.001uf. Their working voltages range from 3V to 60000V.
These capacitors have very low leakage current. Breakdown
voltage is very high.
Paper Capacitor:
It consists of thin foils, which are separated by thin paper or waxed
paper. The sandwich of foil and paper is then rolled into a
cylindrical shape and enclosed in a paper tube or encased in a
plastic capsules. The lead at each end of the capacitor is internally
attached to the metal foil. Paper capacitors have capacitance
ranging from 0.0001uf to 2.0uf and working voltage rating as high
as 2000V.
THE DIODE
Diodes are polarized, which means that they must be inserted into
the PCB the correct way round. This is because an electric current
will only flow through them in one direction (like air will only
flow one way trough a tyre valve). Diodes have two connections,
an anode and a cathode. The cathode is always identified by a dot,
ring or some other mark.
The PCB is often marked with a +sign for the cathode end. Diodes
come in all shapes and sizes. They are often marked with a type
number. Detailed characteristics of a diode can be found by
looking up the type number in a data book. If you know how to
measure resistance with a meter then test some diodes. A good one
has low resistance in one direction and high in other. They are
specialized types of diode available such as the zener and light
emitting diode (LED).
SYMBOLS OF DIFFERENT DIODES
anode cathode
simple diode zener diode
+
IC
IC (Integrated Circuit) means that all the components of the circuit are fabricated
on same chip. Digital ICs are a collection of resistors, diodes, and transistors
fabricated on a single piece of semiconductor, usually silicon called a substrate,
which is commonly referred to as ‘wafer’. The chip is enclosed in a protective
plastic or ceramic package from which pins extend out connecting the IC to other
device. Suffix N or P stands for dual-in-line (plastic package (DIP)) while suffix J
or I stands for dual-in-lime ceramic package. Also the suffix for W stands for flat
ceramic package.
The pins are numbered counter clockwise when viewed from the top of the
package with respect to an identity notch or dot at one end of the chip.The
manufacturer’s name can usually be guessed from its logo that is printed on the
IC. The IC type number also indicates the manufacturer’s code. For e.g. DM 408
N SN 7404 indicates National Semiconductor and Texas Instruments.
Other examples are:
Fair Child : UA, UAF
National Semiconductor : DM, LM, LH, LF, and TA.
Motorola : MC, MFC.
Sprague : UKN, ULS, ULX.
Signetic : N/s, NE/SE, and SU.
Burr-Brown : BB.
Texas Instruments : SN.
The middle portion i.e. the IC type number tells about the IC function and also the
family, which the particular IC belongs to.IC’s that belongs to standard TTL series
have an identification number that starts with 74; for e.g. 7402, 74LS04, 74S04
etc. IC’s that belongs to standard CMOS family their number starts with 4, like
4000, 451B, 4724B, 1400. The 74C, 74HC, 74AC & 74ACT series are newer
CMOS series.
Various series with TTL logic family are:-
Standard TTL 74.
Schottky TTL 74s.
Low power Schottky 74LS.
Advance Schottky 74AS.
Advanced Low Power Schottky 74ALs.
Also there are various series with CMOS logic family as metal state CMOS 40 or
140.
Power Supply
For TTL circuits, the power supply pin is labeled Vcc and its nominal value.
For CMOS ICs, the power supply pin is labeled as VDD & its nominal value range
from T3 to 18V.
Unconnected Inputs
An unconnected input is called “floating input”. The floating TTL input acts as
logic 1. High level is applied to it. This characteristic is often used when
testing a TTL circuit. A floating TTL input will measure a DC level between 1.4V
to 1.8V when checked with VOM as oscilloscope. If a CMOS input is left floating,
it may have disastrous results. The IC may become overheated and eventually
destroy itself. For this reason, all inputs to CMOS circuit must be connected to a
LOW or HIGH level or to the output of another IC.
RELAYS
STRIP
OUT N/C
OUT N/O
SPRING
MAGNET
230V P
Error: Reference source not found
A relay is an electrically operated switch. The relay contacts can be made to
operate in the pre-arranged fashion. For instance, normally open contacts close
and normally closed contacts open. In electromagnetic relays, the contacts
however complex they might be, they have only two position i.e. OPEN and
CLOSED, whereas in case of electromagnetic switches, the contacts can have
multiple positions.
NEED FOR THE USE OF RELAY
The reason behind using relay for switching loads is to provide complete electrical
isolation. The means that there is no electrical connection between the driving
circuits and the driven circuits. The driving circuit may be low voltage operated
low power circuits that control several kilowatts of power. In our circuit where a
high fan could be switched on or off depending upon the output from the
telephone.
Since the relay circuit operated on a low voltage, the controlling circuit is quite
safe. In an electromagnetic relay the armature is pulled by a magnetic force only.
There is no electrical connection between the coil of a relay and the switching
contacts of the relay. If there are more than one contact they all are electrically
isolated from each other by mounting them on insulating plates and washers.
Hence they can be wired to control different circuits independently.
Some of the popular contacts forms are described below:
1. Electromagnetic relay
2. Power Relay.
3. Time Delay Relay.
4. Latching Relay.
5. Crystal Can Relay.
6. Co-axial Relay.
1. Electromagnetic relay:
An electromagnetic relay in its simplest form consists of a coil, a DC current
passing through which produces a magnetic field. This magnetic field attracts an
armature, which in turn operates the contacts. Normally open contacts close and
normally closed contacts open. Electromagnetic relays are made in a large variety
of contacts forms.
2. Power relays:
Power relays are multi-pole heavy duty lapper type relays that are capable of
switching resistive loads of upto 25amp.. These relays are widely used for a
variety of industrial application like control of fractional horse power motors,
solenoids, heating elements and so on. These relays usually have button like silver
alloy contacts and the contact welding due to heavy in rush current is avoided by
wiping action of the contacts to quench the arc during high voltage DC switching
thus avoiding the contact welding.
3. Time Delay Relay:
A time delay relay is the one in which there is a desired amount of time delay
between the application of the actuating signal and operation of the load switching
devices.
4. Latching Relay:
In a Latching Relay, the relay contacts remain in the last energized position even
after removal of signal in the relay control circuit. The contacts are held in the last
relay-energized position after removal of energisation either electrically or
magnetically. The contacts can be released to the normal position electrically or
mechanically.
5. Crystal Can Relay:
They are so called, as they resemble quartz crystal in external shapes. These are
high performance hermetically sealed miniature or sub-miniature relay widely
used in aerospace and military application. These relays usually have gold plated
contacts and thus have extremely low contact resistance. Due to low moment of
inertia of the armature and also due to statically and dynamically balanced nature
of armature, these relays switch quite reliably even under extreme condition of
shock and vibration.
6. Co-axial Relay:
A Co-axial Relay has two basic parts, an actuator which is nothing but some kind
of a coil and a cavity, housing the relay contacts. The co-axial relay are
extensively used for radio frequency switching operations of equipment
THE JUNCTION TRANSISTOR
Collector Collector
Base Base
Emitter Emitter
C
C
B
B
E
E
NPN PNP
_ _ _ _ _
_ _ _ _ _
+ + + + +
_ _ _ _ _
_ _ _ _ _
_ _ _ _ _
_ _ _
+ + + + +
+ + + + +
+ + +
+ + + + +
+ + + + +
+ + + + + -- -- -- --
Junction transistors consists of two junctions made from N-type and P-Junction transistors consists of two junctions made from N-type and P-
type semiconductor materials and are called bipolar transistors (twotype semiconductor materials and are called bipolar transistors (two
polarities). They have three connections emitter, base, and collector.polarities). They have three connections emitter, base, and collector.
TRANSISTOR CURRENTSTRANSISTOR CURRENTS
CollectorCollector
CurrentCurrent IIcc
IIbb
Base currentBase current
EmitterEmitter IIee
currentcurrent
IIee == IIbb++IIcc
The forward biased base/emitter junction causes electrons to beThe forward biased base/emitter junction causes electrons to be
attracted from the emitter area towards the base. Arriving in the baseattracted from the emitter area towards the base. Arriving in the base
area, most of the negative electrons come under the influence of thearea, most of the negative electrons come under the influence of the
more positive collector and are attracted by it. This is shown in the leftmore positive collector and are attracted by it. This is shown in the left
hand drawing, where the base current plus collector current equals thehand drawing, where the base current plus collector current equals the
emitter current. Alpha gain is collector current divided by emitteremitter current. Alpha gain is collector current divided by emitter
current, and is always less than 1. Beta gain is collector current dividedcurrent, and is always less than 1. Beta gain is collector current divided
by base current and can be fairly high number. Therefore, causing aby base current and can be fairly high number. Therefore, causing a
small base current to flow makes a much larger collector current tosmall base current to flow makes a much larger collector current to
flow. A small base current controls a large collector current. There isflow. A small base current controls a large collector current. There is
0.6 volts across the baseemitter junction, where it is forward biased0.6 volts across the baseemitter junction, where it is forward biased
(0.3 volts for germanium).(0.3 volts for germanium).
How to control sensors
What is a voltage divider?
You are going to find out but don't be in too much of a hurry. Work through the Chapter
and allow the explanation to develop.
The diagram below shows a light dependent resistor, or LDR, together with its circuit
symbol:
The light-sensitive part of the LDR is a wavy track of cadmium sulphide. Light energy
triggers the release of extra charge carriers in this material, so that its resistance falls as
the level of illumination increases.
A light sensor uses an LDR as part of a voltage divider.
The essential circuit of a voltage divider, also called a potential divider, is:
What happens if one of the resistors in the voltage divider is replaced by an LDR? In the
circuit below, Rtop is a 10 resistor, and an LDR is used as Rbottom :
Suppose the LDR has a resistance of 500 , 0.5 , in bright light, and 200 in the
shade (these values are reasonable).
When the LDR is in the light, Vout will be:
In the shade, Vout will be:
In other words, this circuit gives a LOW voltage when the LDR is in the light, and a
HIGH voltage when the LDR is in the shade. The voltage divider circuit gives an output
voltage which changes with illumination.
A sensor subsystem which functions like this could be thought of as a 'dark sensor' and
could be used to control lighting circuits which are switched on automatically in the
evening.
Perhaps this does not seem terribly exciting, but almost every sensor circuit you can think
of uses a voltage divider. There's just no other way to make sensor subsystems work.
Here is the voltage divider built with the LDR in place of Rtop :
Temperature sensors
A temperature-sensitive resistor is called a thermistor. There are several different types:
The resistance of most common types of thermistor decreases as the temperature rises.
They are called negative temperature coefficient, or ntc, thermistors. Note the -t° next
to the circuit symbol. A typical ntc thermistor is made using semiconductor metal oxide
materials. (Semiconductors have resistance properties midway between those of
conductors and insulators.) As the temperature rises, more charge carriers become
available and the resistance falls.
Although less often used, it is possible to manufacture positive temperature coefficient,
or ptc, thermistors. These are made of different materials and show an increase in
resistance with temperature.
How could you make a sensor circuit for use in a fire alarm? You want a circuit which
will deliver a HIGH voltage when hot conditions are detected. You need a voltage divider
with the ntc thermistor in the Rtop position:
How could you make a sensor circuit to detect temperatures less than 4°C to warn
motorists that there may be ice on the road? You want a circuit which will give a HIGH
voltage in cold conditions. You need a voltage divider with the thermistor in place of
Rbottom :
This last application raises an important question: How do you know what value of Vout
you are going to get at 4°C?
Key point: The biggest change in Vout from a voltage divider is obtained when Rtop and
Rbottom are equal in value
Sound sensors
Another name for a sound sensor is a microphone. The diagram shows a cermet
microphone:
Cermet' stands for 'ceramic' and 'metal'. A mixture of these materials is used in making
the sound-sensitive part of the microphone. To make them work properly, cermet
microphones need a voltage, usually around 1.5 V across them. A suitable circuit for use
with a 9 V supply is:
The 4.7 and the 1 resistors make a voltage divider which provides 1.6 V across
the microphone. Sound waves generate small changes in voltage, usually in the range 10-
20 mV. To isolate these small signals from the steady 1.6 V, a capacitor is used.
Signals from switches
When a switch is used to provide an input to a circuit, pressing the switch usually
generates a voltage signal. It is the voltage signal which triggers the circuit into action.
What do you need to get the switch to generate a voltage signal? . . . You need a voltage
divider. The circuit can be built in either of two ways:
The pull down resistor in the first circuit forces Vout to become LOW except when the
push button switch is operated. This circuit delivers a HIGH voltage when the switch is
pressed. A resistor value of 10 is often used.
In the second circuit, the pull up resistor forces Vout to become HIGH except when the
switch is operated. Pressing the switch connects Vout directly to 0 V. In other words, this
circuit delivers a LOW voltage when the switch is pressed.
In circuits which process logic signals, a LOW voltage is called 'logic 0' or just '0', while
a HIGH voltage is called 'logic1' or '1'. These voltage divider circuits are perfect for
providing input signals for logic systems.
What kinds of switches could you use. One variety of push button switch is called a
miniature tactile switch. These are small switches which work well with prototype
board:
As you can see, the switch has four pins which are linked in pairs by internal metal strips.
Pressing the button bridges the contacts and closes the switch. The extra pins are useful in
designing printed circuit boards for keyboard input and also stop the switch from being
moved about or bent once soldered into position.
There are lots of other switches which you might want to use in a voltage divider
configuration. These include magnetically-operated reed switches, tilt switches and
pressure pads, all with burglar alarm applications.
Transistor Circuits
This page explains the operation of transistors in circuits. Practical matters such as
testing, precautions when soldering and identifying leads are covered by the Transistors
page.
General: Types | Currents | Functional model | Darlington pair
Switching: Introduction | Use relay? | IC output | for NPN | and PNP | Sensors | Inverter
Next Page: Analogue and Digital Systems
Also See: Transistors (soldering, lead identification)
Types of transistor
There are two types of standard transistors, NPN and PNP, with different circuit
symbols. The letters refer to the layers of semiconductor material used to make the
transistor. Most transistors used today are NPN because this is the easiest type to make
from silicon. This page is mostly about NPN transistors and if you are new to electronics
it is best to start by learning how to use these first.
The leads are labelled base (B), collector (C) and emitter (E).
These terms refer to the internal operation of a transistor but they are not much help in understanding how a
transistor is used, so just treat them as labels!
A Darlington pair is two transistors connected together to give a very high current gain.
In addition to standard (bipolar junction) transistors, there are field-effect transistors
which are usually referred to as FETs. They have different circuit symbols and properties
and they are not (yet) covered by this page.
Transistor currents
The diagram shows the two current paths through a transistor. You can build this circuit
with two standard 5mm red LEDs and any general purpose low power NPN transistor
(BC108, BC182 or BC548 for example).
Transistor circuit symbols
The small base current controls the larger collector current.
When the switch is closed a small current flows into the base (B) of the
transistor. It is just enough to make LED B glow dimly. The transistor
amplifies this small current to allow a larger current to flow through from
its collector (C) to its emitter (E). This collector current is large enough to
make LED C light brightly.
When the switch is open no base current flows, so the transistor switches
off the collector current. Both LEDs are off.
A transistor amplifies current and can be used as a switch.
This arrangement where the emitter (E) is in the controlling circuit (base current) and in
the controlled circuit (collector current) is called common emitter mode. It is the most
widely used arrangement for transistors so it is the one to learn first.
Functional model of an NPN transistor
The operation of a transistor is difficult to explain and understand in terms of its internal
structure. It is more helpful to use this functional model:
• The base-emitter junction behaves like a diode.
• A base current IB flows only when the voltage VBE across the base-emitter
junction is 0.7V or more.
• The small base current IB controls the large collector current Ic.
• Ic = hFE × IB (unless the transistor is full on and saturated)
hFE is the current gain (strictly the DC current gain), a typical value for hFE is 100
(it has no units because it is a ratio)
• The collector-emitter resistance RCE is controlled by the base current IB:
o IB = 0 RCE = infinity transistor off
o IB small RCE reduced transistor partly on
o IB increased RCE = 0 transistor full on ('saturated')
Additional notes:
• A resistor is often needed in series with the base connection to limit the base
current IB and prevent the transistor being damaged.
• Transistors have a maximum collector current Ic rating.
• The current gain hFE can vary widely, even for transistors of the same type!
• A transistor that is full on (with RCE = 0) is said to be 'saturated'.
• When a transistor is saturated the collector-emitter voltage VCE is reduced to
almost 0V.
• When a transistor is saturated the collector current Ic is determined by the supply
voltage and the external resistance in the collector circuit, not by the transistor's
current gain. As a result the ratio Ic/IB for a saturated transistor is less than the
current gain hFE.
• The emitter current IE = Ic + IB, but Ic is much larger than IB, so roughly IE = Ic.
There is a table showing technical data for some popular transistors on the transistors
page.
Darlington pair
This is two transistors connected together so that the current amplified by the first is
amplified further by the second transistor. The overall current gain is equal to the two
individual gains multiplied together:
Darlington pair current gain, hFE = hFE1 × hFE2
(hFE1 and hFE2 are the gains of the individual transistors)
This gives the Darlington pair a very high current gain, such as 10000, so that only a tiny
base current is required to make the pair switch on.
A Darlington pair behaves like a single transistor with a very high current gain. It
has three leads (B, C and E) which are equivalent to the leads of a standard individual
transistor. To turn on there must be 0.7V across both the base-emitter junctions which are
connected in series inside the Darlington pair, therefore it requires 1.4V to turn on.
Darlington pairs are available as complete packages but you can make up your own from
two transistors; TR1 can be a low power type, but normally TR2 will need to be high
Touch switch circuit
power. The maximum collector current Ic(max) for the pair is
the same as Ic(max) for TR2.
A Darlington pair is sufficiently sensitive to respond to the
small current passed by your skin and it can be used to make a
touch-switch as shown in the diagram. For this circuit which
just lights an LED the two transistors can be any general
purpose low power transistors. The 100k resistor protects the
transistors if the contacts are linked with a piece of wire.
Using a transistor as a switch
When a transistor is used as a switch it must be either OFF or fully ON. In the fully ON
state the voltage VCE across the transistor is almost zero and the transistor is said to be
saturated because it cannot pass any more collector current Ic. The output device
switched by the transistor is usually called the 'load'.
The power developed in a switching transistor is very small:
• In the OFF state: power = Ic × VCE, but Ic = 0, so the power is zero.
• In the full ON state: power = Ic × VCE, but VCE = 0 (almost), so the power is very
small.
This means that the transistor should not become hot in use and you do not need to
consider its maximum power rating. The important ratings in switching circuits are the
maximum collector current Ic(max) and the minimum current gain hFE(min). The
transistor's voltage ratings may be ignored unless you are using a supply voltage of more
than about 15V. There is a table showing technical data for some popular transistors on
the transistors page.
For information about the operation of a transistor please see the functional model above.
Protection diode
If the load is a motor, relay or solenoid (or any other device with a coil) a diode must be
connected across the load to protect the transistor from the brief high voltage produced
when the load is switched off. The diagram shows how a protection diode is connected
'backwards' across the load, in this case a relay coil.
Current flowing through a coil creates a magnetic field which collapses suddenly when the current is
switched off. The sudden collapse of the magnetic field induces a brief high voltage across the coil which is
very likely to damage transistors and ICs. The protection diode allows the induced voltage to drive a brief
current through the coil (and diode) so the magnetic field dies away quickly rather than instantly. This
prevents the induced voltage becoming high enough to cause damage to transistors and ICs.
When to use a relay
Transistors cannot switch AC or high voltages (such as mains electricity) and they are not
usually a good choice for switching large currents (> 5A). In these cases a relay will be
needed, but note that a low power transistor may still be needed to switch the current for
the relay's coil!
Advantages of relays:
• Relays can switch AC and DC, transistors can only switch DC.
• Relays can switch high voltages, transistors cannot.
• Relays are a better choice for switching large currents (> 5A).
• Relays can switch many contacts at once.
Disadvantages of relays:
• Relays are bulkier than transistors for switching small currents.
• Relays cannot switch rapidly, transistors can switch many times per second.
• Relays use more power due to the current flowing through their coil.
• Relays require more current than many ICs can provide, so a low power transistor may be
needed to switch the current for the relay's coil.
Connecting a transistor to the output from an IC
Relays
Photographs © Rapid Electronics
Most ICs cannot supply large output currents so it may be necessary to use a transistor to
switch the larger current required for output devices such as lamps, motors and relays.
The 555 timer IC is unusual because it can supply a relatively large current of up to
200mA which is sufficient for some output devices such as low current lamps, buzzers
and many relay coils without needing to use a transistor.
A transistor can also be used to enable an IC connected to a low voltage supply (such as
5V) to switch the current for an output device with a separate higher voltage supply (such
as 12V). The two power supplies must be linked, normally this is done by linking their
0V connections. In this case you should use an NPN transistor.
A resistor RB is required to limit the current flowing into the base of the transistor and
prevent it being damaged. However, RB must be sufficiently low to ensure that the
transistor is thoroughly saturated to prevent it overheating, this is particularly important if
the transistor is switching a large current (> 100mA). A safe rule is to make the base
current IB about five times larger than the value which should just saturate the transistor.
Choosing a suitable NPN transistor
The circuit diagram shows how to connect an NPN transistor, this will switch on the
load when the IC output is high. If you need the opposite action, with the load switched
on when the IC output is low (0V) please see the circuit for a PNP transistor below.
The procedure below explains how to choose a suitable switching transistor.
1. The transistor's maximum collector current Ic(max) must be greater than the load
current Ic.
load current Ic =
supply voltage Vs
load resistance RL
NPN transistor switch
(load is on when IC output is high)
Using units in calculations
Remember to use V, A and or
V, mA and k . For more details
please see the Ohm's Law page.
2. The transistor's minimum current gain hFE(min) must be at least five times the
load current Ic divided by the maximum output current from the IC.
hFE(min) > 5 ×
load current Ic
max. IC current
3. Choose a transistor which meets these requirements and make a note of its
properties: Ic(max) and hFE(min).
There is a table showing technical data for some popular transistors on the transistors page.
4. Calculate an approximate value for the base resistor:
RB =
Vc × hFE where Vc = IC supply voltage
(in a simple circuit with one supply this is Vs)5 × Ic
5. For a simple circuit where the IC and the load share the same power supply (Vc = Vs) you may
prefer to use: RB = 0.2 × RL × hFE
6. Then choose the nearest standard value for the base resistor.
7. Finally, remember that if the load is a motor or relay coil a protection diode is
required.
Example
The output from a 4000 series CMOS IC is required to operate a relay with a 100 coil.
The supply voltage is 6V for both the IC and load. The IC can supply a maximum current of 5mA.
1. Load current = Vs/RL = 6/100 = 0.06A = 60mA, so transistor must have Ic(max) > 60mA.
2. The maximum current from the IC is 5mA, so transistor must have hFE(min) > 60
(5 × 60mA/5mA).
3. Choose general purpose low power transistor BC182 with Ic(max) = 100mA and hFE(min) = 100.
4. RB = 0.2 × RL × hFE = 0.2 × 100 × 100 = 2000 . so choose RB = 1k8 or 2k2.
5. The relay coil requires a protection diode.
Choosing a suitable PNP transistor
The circuit diagram shows how to connect a PNP transistor, this will switch on the load
when the IC output is low (0V). If you need the opposite action, with the load switched
on when the IC output is high please see the circuit for an NPN transistor above.
PNP transistor switch
(load is on when IC output is low)
The procedure for choosing a suitable PNP transistor is exactly the same as that for an
NPN transistor described above.
Using a transistor switch with sensors
The top circuit diagram shows an LDR (light sensor) connected so that the LED lights
when the LDR is in darkness. The variable resistor adjusts the brightness at which the
transistor switches on and off. Any general purpose low power transistor can be used in
this circuit.
The 10k fixed resistor protects the transistor from excessive base current (which will
destroy it) when the variable resistor is reduced to zero. To make this circuit switch at a
suitable brightness you may need to experiment with different values for the fixed
resistor, but it must not be less than 1k .
If the transistor is switching a load with a coil, such as a motor or relay, remember to add
a protection diode across the load.
The switching action can be inverted, so the LED lights when the LDR is brightly lit,
by swapping the LDR and variable resistor. In this case the fixed resistor can be omitted
because the LDR resistance cannot be reduced to zero.
LED lights when the LDR is dark
LED lights when the LDR is bright
Note that the switching action of this circuit is not particularly good because there will be
an intermediate brightness when the transistor will be partly on (not saturated). In this
state the transistor is in danger of overheating unless it is switching a small current. There
is no problem with the small LED current, but the larger current for a lamp, motor or
relay is likely to cause overheating.
Other sensors, such as a thermistor, can be used with this circuit, but they may require a
different variable resistor. You can calculate an approximate value for the variable
resistor (Rv) by using a multimeter to find the minimum and maximum values of the
sensor's resistance (Rmin and Rmax):
Variable resistor, Rv = square root of (Rmin × Rmax)
For example an LDR: Rmin = 100 , Rmax = 1M , so Rv = square root of (100 × 1M) = 10k .
You can make a much better switching circuit with sensors connected to a suitable IC
(chip). The switching action will be much sharper with no partly on state.
A transistor inverter (NOT gate)
Inverters (NOT gates) are available on logic ICs but if you only require one inverter it is
usually better to use this circuit. The output signal (voltage) is the inverse of the input
signal:
• When the input is high (+Vs) the output is low (0V).
• When the input is low (0V) the output is high (+Vs).
Any general purpose low power NPN transistor can be used. For general use RB = 10k
and RC = 1k , then the inverter output can be connected to a device with an input
impedance (resistance) of at least 10k such as a logic IC or a 555 timer (trigger and
reset inputs).
If you are connecting the inverter to a CMOS logic IC input (very high impedance) you
can increase RB to 100k and RC to 10k , this will reduce the current used by the
inverter.
List of activities to be carried Out to complete the Project-
0
0.2
0.4
0.6
0.8
1
1.2
1.4
1.6
1.8
2
Study PCB design Troubleshooting
Weeks
In First weeks I will collect study material and circuit diagram.
I will finalized circuit and detail.
In next week I will test circuit on simulation softare proteus or
bread board. Proteus is simulation software.
In Next we will make PCB on copper clad Board.
After it we will do programming and soldering.
After soldering we will Test circuit.
If there will be any problem then we will do repair of it.
After completion of project we will make report.
Applications:
1. Attendance System
2.electronics voting machine for polls
3.for commercial voting machine
4. for quiz purposes.
5. Access control System
Advantages:
low cost
flexible
portable
easy to make
component easily available
Conclusion:
Finally project is working . it was tough to program controller . it was tough
to interface to mcu with RFID reader.
Program 1.
#include<reg51.h>
sbit RS=P3^7;
sbit EN=P3^6;
sbit R=P3^2;
sbit bz=P1^7;
void Rxmsg(void);
void lcdinit(void);
void lcdData(unsigned char l);
void lcdcmd(unsigned char k);
void DelayMs(unsigned int count);
void sucessRx(void);
void unknown(void);
void display(unsigned char s, t);
void welcome(void);
void main()
{
unsigned char i=0;
unsigned int j=0;
unsigned char c[15];
TMOD=0x20; //
Configure the serial port to 9600 baud rate
TH1=0xFD;
SCON=0X50;
TR1=1;
R=0;
lcdinit();
welcome();
bz=1;
while(1)
{
back:
for(i=0;i<15;i++)
//command to recv data
{
c[i]=0xFF;
}
while(RI==0);
for(i=0;i<15;i++)
//command to recv data
{
j=0;
while(RI==0)
{
if(j>=1000)
goto timeout;
j++;
}
c[i]=SBUF;
RI=0;
}
timeout:
for(i=0;i<15;i++)
{
if(c[i]=='1' && c[i+1]=='E' && c[i+2]=='0' && c[i+3]=='0' && c[i+4]=='7'
&& c[i+5]=='C' && c[i+6]=='A' && c[i+7]=='0' && c[i+8]=='3' &&
c[i+9]=='C')
{
sucessRx();
DelayMs(1000);
R=1;
bz=0;
DelayMs(1000);
R=0;
bz=1;
DelayMs(1000);
lcdinit();
DelayMs(100);
welcome();
goto back;
}
}
unknown();
DelayMs(2000);
bz=0;
DelayMs(2000);
bz=1;
DelayMs(1000);
lcdinit();
DelayMs(100);
welcome();
}
}
void sucessRx()
{
unsigned int i=0;
unsigned char c[]="ACCESS GRANTED ";
lcdcmd(0x01);
DelayMs(10);
lcdcmd(0x80);
DelayMs(10);
while(c[i]!='0')
{
lcdData(c[i]);
i++;
}
}
void unknown(void)
{
unsigned int i=0;
unsigned char c[]="ACCESS DENIED";
lcdcmd(0x01);
DelayMs(10);
lcdcmd(0x80);
DelayMs(10);
while(c[i]!='0')
{
lcdData(c[i]);
i++;
}
}
//---------------------------------------
// Lcd initialization subroutine
//---------------------------------------
void lcdinit(void)
{
lcdcmd(0x38);
DelayMs(250);
lcdcmd(0x0E);
DelayMs(250);
lcdcmd(0x01);
DelayMs(250);
lcdcmd(0x06);
DelayMs(250);
lcdcmd(0x80);
DelayMs(250);
}
//---------------------------------------
// Lcd data display
//---------------------------------------
void lcdData(unsigned char l)
{
P2=l;
RS=1;
EN=1;
DelayMs(1);
EN=0;
return;
}
//---------------------------------------
// Lcd command
//---------------------------------------
void lcdcmd(unsigned char k)
{
P2=k;
RS=0;
EN=1;
DelayMs(1);
EN=0;
return;
}
//---------------------------------------
// Delay mS function
//---------------------------------------
void DelayMs(unsigned int count)
{ // mSec Delay 11.0592 Mhz
unsigned int i; //
Keil v7.5a
while(count) {
i = 115;
// 115
exact
value
while(i>0)
i--;
count--;
}
}
void welcome(void)
{
unsigned int i=0;
unsigned char c[]="RFID READER";
unsigned char d[]="SYSTEM";
lcdcmd(0x01);
DelayMs(10);
lcdcmd(0x80);
DelayMs(10);
while(c[i]!='0')
{
lcdData(c[i]);
i++;
}
lcdcmd(0xc0);
i=0;
while(d[i]!='0')
{
lcdData(d[i]);
i++;
}
}
;
*************************************************************
*****
RS BIT P2.5
RW BIT P2.4
E BIT P2.3
FL BIT P0.7
buzz BIT P3.7
LCD EQU P0
C1 EQU 31H
C2 EQU 32H
C3 EQU 33H
ORG 00H
AJMP START
ORG 30H
START:
MOV LCD,#00H
MOV C1,#0
MOV C2,#0
MOV C3,#0
MOV A,#38H ;2*16 MATRIX
ACALL COMMAND
MOV A,#38H ;2*16 MATRIX
ACALL COMMAND
MOV A,#02 ;RETURN HOME
ACALL COMMAND
MOV A,#01 ;CLEAR DISPLAY SCREEN
ACALL COMMAND
MOV A,#0CH ;DISPLAY ON CURSOR OFF
ACALL COMMAND
MOV A,#80H ;MOVE CURSOR TO FIRST LINE SECOND
COLOUMN
ACALL COMMAND
MOV DPTR,#TABLE1 ;DISPLAY ERP
ACALL DISPLAY
ACALL DELAY1
MOV R1,#00
MOV R0,#00
MOV R2,#00
MOV R3,#00
MOV R4,#00
MOV R5,#00
MOV A,#80H ;MOVE CURSOR TO FIRST LINE SECOND
COLOUMN
ACALL COMMAND
MOV DPTR,#TABLE1 ;DISPLAY ERP
ACALL DISPLAY
MOV A,#0C0H ;MOVE CURSOR TO FIRST LINE SECOND
COLOUMN
ACALL COMMAND
MOV DPTR,#TABLE7 ;DISPLAY ERP
ACALL DISPLAY
MAIN:
jnb p1.0,act1
jnb p1.1,act2
jnb p1.2,act3
jnb p1.3,act4
jnb p1.4,act5 ; CHECK ATTENDENCE
jnb p1.5,act6
jnb p1.6,act7
jnb p1.7,act8
JNB P3.0,START
JB P3.1,MAIN
acall READING41
SJMP MAIN
act1:
INC R0
INC R4
cpl p2.0
ACALL BUZZE
ACALL READING5
SJMP MAIN
act2:
INC R1
INC R4
ACALL BUZZE
cpl p2.1
ACALL READING5
SJMP MAIN
act3:
INC R2
INC R4
ACALL BUZZE
cpl p2.2
ACALL READING5
SJMP MAIN
act4:
INC R3
INC R4
ACALL BUZZE
cpl p2.6
ACALL READING5
SJMP MAIN
act5:
ACALL READING1
SJMP MAIN
act6:
ACALL READING2
SJMP MAIN
act7:
ACALL READING3
SJMP MAIN
act8:
ACALL READING4
SJMP MAIN
READING5:
ACALL LCDCLR
MOV A,#0C0H ;MOVE CURSOR TO FIRST LINE SECOND
COLOUMN
ACALL COMMAND
MOV DPTR,#TABLE6 ;DISPLAY ERP
ACALL DISPLAY
SJMP MAIN
READING1:
ACALL LCDCLR
MOV A,#0C0H
ACALL COMMAND
MOV DPTR,#TABLE2
ACALL DISPLAY
MOV A,#0CAH
ACALL COMMAND
MOV A,R0
ACALL HTD
ACALL OUT1
AJMP MAIN
READING2:
ACALL LCDCLR
MOV A,#0C0H
ACALL COMMAND
MOV DPTR,#TABLE3
ACALL DISPLAY
MOV A,#0CAH
ACALL COMMAND
MOV A,R1
ACALL HTD
ACALL OUT1
AJMP MAIN
READING3:
ACALL LCDCLR
MOV A,#0C0H
ACALL COMMAND
MOV DPTR,#TABLE4
ACALL DISPLAY
MOV A,#0CAH
ACALL COMMAND
MOV A,R2
ACALL HTD
ACALL OUT1
AJMP MAIN
READING4:
ACALL LCDCLR
MOV A,#0C0H
ACALL COMMAND
MOV DPTR,#TABLE5
ACALL DISPLAY
MOV A,#0CAH
ACALL COMMAND
MOV A,R3
ACALL HTD
ACALL OUT1
AJMP MAIN
READING41:
ACALL LCDCLR
MOV A,#0C0H
ACALL COMMAND
MOV DPTR,#TABLE8
ACALL DISPLAY
MOV A,#0CAH
ACALL COMMAND
MOV A,R4
ACALL HTD
ACALL OUT1
AJMP MAIN
BUZZE:
clr buzz
acall delay1
ACALL delay1
ACALL delay1
ACALL delay1
SETB BUZZ
RET
HTD:
;CONVERT HEX(BINARY) TO ASCII
MOV B,#10
DIV AB
MOV C1,B
MOV B,#10
DIV AB
MOV C2,B
MOV C3,A
RET
OUT1:
MOV A,C3
ORL A,#30H
ACALL WRITE
MOV A,C2
ORL A,#30H
ACALL WRITE
MOV A,C1
ORL A,#30H
ACALL WRITE
RET
LCDCLR:
MOV A,#01H ;CLEAR DISPLAY SCREEN
ACALL COMMAND
RET ; DISPLAY DATA ON LCD
DISPLAY:
CLR A
MOVC A,@A+DPTR
JZ NEXT
ACALL WRITE
INC DPTR
JMP DISPLAY
NEXT:
RET
WRITE:
ACALL CHKBUSY
MOV LCD,A
SETB RS
CLR RW
SETB E
acall delay1
CLR E
RET
COMMAND:
ACALL CHKBUSY
MOV LCD,A
CLR RS
CLR RW
SETB E
acall delay1
CLR E
RET
delay1:
MOV R6,#255
AGAIN1: MOV R7,#255
BACK1: DJNZ R7,BACK1
DJNZ R6,AGAIN1
RET
TABLE1: DB 'ATTENDANCE SYSTEM',0
TABLE7: DB 'MARK THE ATTENDANCE ',0
TABLE2: DB 'CAND NO.1',0
TABLE3: DB 'CAND NO.2',0
TABLE4: DB 'CAND NO.3',0
TABLE5: DB 'CAND NO.4',0
TABLE6: DB 'ATTENDANCE MARKED',0
TABLE8: DB 'TOTAL ATTENDANCE',0
Statement of problem:
1. EEprom not working- when I was testing project
voter rfid did not saved in eeprom. . I tested no. of
time my program.
Reason- problem in eeprom connection with
Microcontroller.
2. RFid controller not giving output port0 and input
to attendance ic at port1
Reason- Port 0 is open collector port. So it need
pull up resistor. So I used 10k+5% -1/4 watt
resistor.
Structure-
First of all bring RFid
tag close to RFid
reader
RFID reader will display
on LCD. When card in
contact it will show card no
and will show valid/invalid
Mcu will give low
pulse at pin p0.0 when
card 1 detected
P0.0 is connected to
p1.0 of mcu2. It will
show attendance
marked
Every time system
will ask for rfid tag to
mark attendance
Final Result:
Finally project is working. We marked the attendance with different card to
different candidates. Hardware is working properly.
Scope of Future Study-
Benefit of this project is that a electronics RFID +GSM Attendance system
could be provided to each candidate. It can be used for the safety & security
purpose.
Problems
RFID reader rarely available in the market.
BIBILIOGRAPHY
1. HAND BOOK OF ELECTRONICS A.K. MAINI.
2.HAND BOOK OF ELECTRONICS GUPTA & KUMAR.
3.LET US C YASHWANT KANITKAR.
4.SHYAM SERIES TATA MC GRILL.
5.DIGITAL SYSTEMS PRINCIPLES AND APPLICATION RONALD LTOCCI.
(Sixth addition)
6.ELECTRONICS FOR YOU (MARCH 1998).
7.DIGITAL DESIGN MORIS MANO.
(Second addition)
8.RELAYS AND ITS APPLICATION SHARMA, MC.
(Bpb-publishers)
9.MODERN ALL ABOUT MOTHERBOARD LOTHIA, M.
(Bpb-publishers)
10.POWER SUPPLY FOR ALL OCCASION SHARMA, MC.
(Bpb-publishers)
11.CMOS DATA BOOK (74SERIES) ECA.
(Bpb-publishers)
12.PRACTICAL VALUE AND TRANSISTOR DATA POPE.
(Bpb-publishers)
13.PRACTICAL TRANSFORMER DESIGN HAND BOOK LABON. E.
(Bpb-publishers)
14 MODERN IC MANAHAR LOTIA.
(DATA AND SUBSTITUTIONAL MANUAL)

Weitere ähnliche Inhalte

Was ist angesagt?

Electronic voting machine
Electronic voting machineElectronic voting machine
Electronic voting machineShusomm
 
P 4812--cell phone based voting machine
P 4812--cell phone based voting machineP 4812--cell phone based voting machine
P 4812--cell phone based voting machinechrahulr27
 
project report on embedded system
project report on embedded systemproject report on embedded system
project report on embedded systemram avtar
 
LCD based voting machine using 8051 microcontroller (
LCD based voting machine using 8051 microcontroller (LCD based voting machine using 8051 microcontroller (
LCD based voting machine using 8051 microcontroller (Sohel Siddique
 
Embedded Systems & Robotics
Embedded Systems  & RoboticsEmbedded Systems  & Robotics
Embedded Systems & Roboticsspoorani
 
Fingerprint EVM
Fingerprint EVMFingerprint EVM
Fingerprint EVMPranay Raj
 
Arduino bluetooth controlled robot
Arduino bluetooth controlled robotArduino bluetooth controlled robot
Arduino bluetooth controlled robotUVSofts Technologies
 
Robotics and Embedded System.
Robotics and Embedded System.Robotics and Embedded System.
Robotics and Embedded System.Puneet Parihar
 
Application of dual tone multi frequency technology
Application of dual tone multi frequency technologyApplication of dual tone multi frequency technology
Application of dual tone multi frequency technologyeSAT Publishing House
 
Sms based patient report from remote place1
Sms based patient report from remote place1Sms based patient report from remote place1
Sms based patient report from remote place1Atul Uttam
 
IRJET- Centralised Status alert system for industrial machines
IRJET-  	  Centralised Status alert system for industrial machinesIRJET-  	  Centralised Status alert system for industrial machines
IRJET- Centralised Status alert system for industrial machinesIRJET Journal
 
Microprocessor-Based Automatic Door Opener
Microprocessor-Based Automatic Door OpenerMicroprocessor-Based Automatic Door Opener
Microprocessor-Based Automatic Door OpenerJitendra Choudhary
 
Tracking police man using rf proximity card
Tracking police man using rf proximity cardTracking police man using rf proximity card
Tracking police man using rf proximity cardAlbert Jose
 

Was ist angesagt? (18)

Electronic voting machine
Electronic voting machineElectronic voting machine
Electronic voting machine
 
P 4812--cell phone based voting machine
P 4812--cell phone based voting machineP 4812--cell phone based voting machine
P 4812--cell phone based voting machine
 
Ppt
PptPpt
Ppt
 
project report on embedded system
project report on embedded systemproject report on embedded system
project report on embedded system
 
Evm electronic voting machine
Evm electronic voting machineEvm electronic voting machine
Evm electronic voting machine
 
LCD based voting machine using 8051 microcontroller (
LCD based voting machine using 8051 microcontroller (LCD based voting machine using 8051 microcontroller (
LCD based voting machine using 8051 microcontroller (
 
Embedded Systems & Robotics
Embedded Systems  & RoboticsEmbedded Systems  & Robotics
Embedded Systems & Robotics
 
Fingerprint EVM
Fingerprint EVMFingerprint EVM
Fingerprint EVM
 
Arduino bluetooth controlled robot
Arduino bluetooth controlled robotArduino bluetooth controlled robot
Arduino bluetooth controlled robot
 
Robotics and Embedded System.
Robotics and Embedded System.Robotics and Embedded System.
Robotics and Embedded System.
 
Application of dual tone multi frequency technology
Application of dual tone multi frequency technologyApplication of dual tone multi frequency technology
Application of dual tone multi frequency technology
 
Embedded system demo
Embedded system demoEmbedded system demo
Embedded system demo
 
Sms based patient report from remote place1
Sms based patient report from remote place1Sms based patient report from remote place1
Sms based patient report from remote place1
 
IRJET- Centralised Status alert system for industrial machines
IRJET-  	  Centralised Status alert system for industrial machinesIRJET-  	  Centralised Status alert system for industrial machines
IRJET- Centralised Status alert system for industrial machines
 
evm
evmevm
evm
 
Arduino dtmf controlled robot
Arduino dtmf controlled robotArduino dtmf controlled robot
Arduino dtmf controlled robot
 
Microprocessor-Based Automatic Door Opener
Microprocessor-Based Automatic Door OpenerMicroprocessor-Based Automatic Door Opener
Microprocessor-Based Automatic Door Opener
 
Tracking police man using rf proximity card
Tracking police man using rf proximity cardTracking police man using rf proximity card
Tracking police man using rf proximity card
 

Andere mochten auch

SMART CARD & GSM BASED VOTING MACHINE
SMART CARD & GSM BASED VOTING MACHINESMART CARD & GSM BASED VOTING MACHINE
SMART CARD & GSM BASED VOTING MACHINEsnehapanda22
 
05 enclosures
05 enclosures05 enclosures
05 enclosurespsize web
 
python chapter 1
python chapter 1python chapter 1
python chapter 1Raghu nath
 
What are bleached knots
What are bleached knotsWhat are bleached knots
What are bleached knotsMax Lee
 
Intro to developing for @twitterapi (updated)
Intro to developing for @twitterapi (updated)Intro to developing for @twitterapi (updated)
Intro to developing for @twitterapi (updated)Raffi Krikorian
 
المعارض والمؤتمرات شهر يونيو
المعارض والمؤتمرات شهر يونيوالمعارض والمؤتمرات شهر يونيو
المعارض والمؤتمرات شهر يونيوPalestinian Business Forum
 
2008111807581919
20081118075819192008111807581919
2008111807581919psy101618
 
Rian vebrianto brunai (PEMBANGUNAN MEDIA PENGAJARAN: MODUL DAN MULTIMEDIA DA...
Rian vebrianto  brunai (PEMBANGUNAN MEDIA PENGAJARAN: MODUL DAN MULTIMEDIA DA...Rian vebrianto  brunai (PEMBANGUNAN MEDIA PENGAJARAN: MODUL DAN MULTIMEDIA DA...
Rian vebrianto brunai (PEMBANGUNAN MEDIA PENGAJARAN: MODUL DAN MULTIMEDIA DA...Rian vebrianto
 
Certificate 4 (1)
Certificate 4 (1)Certificate 4 (1)
Certificate 4 (1)sabegu1
 
Plus Eight Star Web20 Orange Labs
Plus Eight Star Web20 Orange LabsPlus Eight Star Web20 Orange Labs
Plus Eight Star Web20 Orange LabsBenjamin Joffe
 
Browsers with Wings
Browsers with WingsBrowsers with Wings
Browsers with WingsRemy Sharp
 

Andere mochten auch (17)

SMART CARD & GSM BASED VOTING MACHINE
SMART CARD & GSM BASED VOTING MACHINESMART CARD & GSM BASED VOTING MACHINE
SMART CARD & GSM BASED VOTING MACHINE
 
05 enclosures
05 enclosures05 enclosures
05 enclosures
 
python chapter 1
python chapter 1python chapter 1
python chapter 1
 
What are bleached knots
What are bleached knotsWhat are bleached knots
What are bleached knots
 
Intro to developing for @twitterapi (updated)
Intro to developing for @twitterapi (updated)Intro to developing for @twitterapi (updated)
Intro to developing for @twitterapi (updated)
 
Bab 5 9d
Bab 5 9dBab 5 9d
Bab 5 9d
 
المعارض والمؤتمرات شهر يونيو
المعارض والمؤتمرات شهر يونيوالمعارض والمؤتمرات شهر يونيو
المعارض والمؤتمرات شهر يونيو
 
1886 6445-1-pb
1886 6445-1-pb1886 6445-1-pb
1886 6445-1-pb
 
2008111807581919
20081118075819192008111807581919
2008111807581919
 
Rian vebrianto brunai (PEMBANGUNAN MEDIA PENGAJARAN: MODUL DAN MULTIMEDIA DA...
Rian vebrianto  brunai (PEMBANGUNAN MEDIA PENGAJARAN: MODUL DAN MULTIMEDIA DA...Rian vebrianto  brunai (PEMBANGUNAN MEDIA PENGAJARAN: MODUL DAN MULTIMEDIA DA...
Rian vebrianto brunai (PEMBANGUNAN MEDIA PENGAJARAN: MODUL DAN MULTIMEDIA DA...
 
Leave a mark in history
Leave a mark in historyLeave a mark in history
Leave a mark in history
 
Bebepolis
BebepolisBebepolis
Bebepolis
 
rgl test
rgl testrgl test
rgl test
 
Certificate 4 (1)
Certificate 4 (1)Certificate 4 (1)
Certificate 4 (1)
 
Plus Eight Star Web20 Orange Labs
Plus Eight Star Web20 Orange LabsPlus Eight Star Web20 Orange Labs
Plus Eight Star Web20 Orange Labs
 
99 app
99 app99 app
99 app
 
Browsers with Wings
Browsers with WingsBrowsers with Wings
Browsers with Wings
 

Ähnlich wie electronic voting machine by rfid

Coin based mobile charger project report
Coin based mobile charger project reportCoin based mobile charger project report
Coin based mobile charger project reportkaushal chaubey
 
Overview of Microcontroller and ATMega32 microcontroller
Overview of Microcontroller and ATMega32 microcontrollerOverview of Microcontroller and ATMega32 microcontroller
Overview of Microcontroller and ATMega32 microcontrollerRup Chowdhury
 
Embedded system 8051 Microcontroller
Embedded system 8051 MicrocontrollerEmbedded system 8051 Microcontroller
Embedded system 8051 Microcontrollerankitsharmaj
 
Implementation of an Improved Microcontroller Based Moving Message Display Sy...
Implementation of an Improved Microcontroller Based Moving Message Display Sy...Implementation of an Improved Microcontroller Based Moving Message Display Sy...
Implementation of an Improved Microcontroller Based Moving Message Display Sy...IOSR Journals
 
Implementation of an Improved Microcontroller Based Moving Message Display Sy...
Implementation of an Improved Microcontroller Based Moving Message Display Sy...Implementation of an Improved Microcontroller Based Moving Message Display Sy...
Implementation of an Improved Microcontroller Based Moving Message Display Sy...IOSR Journals
 
Implementation of an Improved Microcontroller Based Moving Message Display Sy...
Implementation of an Improved Microcontroller Based Moving Message Display Sy...Implementation of an Improved Microcontroller Based Moving Message Display Sy...
Implementation of an Improved Microcontroller Based Moving Message Display Sy...IOSR Journals
 
Implementation of an Improved Microcontroller Based Moving Message Display Sy...
Implementation of an Improved Microcontroller Based Moving Message Display Sy...Implementation of an Improved Microcontroller Based Moving Message Display Sy...
Implementation of an Improved Microcontroller Based Moving Message Display Sy...IOSR Journals
 
INDUSTRIAL TRAINING REPORT EMBEDDED SYSTEM.pptx
INDUSTRIAL TRAINING REPORT EMBEDDED SYSTEM.pptxINDUSTRIAL TRAINING REPORT EMBEDDED SYSTEM.pptx
INDUSTRIAL TRAINING REPORT EMBEDDED SYSTEM.pptxMeghdeepSingh
 
AUTOMATIC WIRELESS POWER GRID CONTROL
AUTOMATIC WIRELESS POWER GRID CONTROLAUTOMATIC WIRELESS POWER GRID CONTROL
AUTOMATIC WIRELESS POWER GRID CONTROLshiv kapil
 
4 Way traffic controll new
4 Way traffic controll new4 Way traffic controll new
4 Way traffic controll newMainak Nandi
 
Visiter counter doc
Visiter counter docVisiter counter doc
Visiter counter docPrem Kumar
 
AVR Atmega16 based Projects List - ATMega32 AVR _ Atmega16 based Projects.pdf
AVR Atmega16 based Projects List - ATMega32 AVR _ Atmega16 based Projects.pdfAVR Atmega16 based Projects List - ATMega32 AVR _ Atmega16 based Projects.pdf
AVR Atmega16 based Projects List - ATMega32 AVR _ Atmega16 based Projects.pdfIsmailkhan77481
 
Industrial training report of embedded system and robotics
Industrial training report of embedded system and roboticsIndustrial training report of embedded system and robotics
Industrial training report of embedded system and roboticsPallavi Bharti
 
Embedded systems presentation
Embedded systems presentationEmbedded systems presentation
Embedded systems presentationSurender Singh
 
A Report on Bidirectional Visitor Counter using IR sensors and Arduino Uno R3
A Report on Bidirectional Visitor Counter using IR sensors and Arduino Uno R3A Report on Bidirectional Visitor Counter using IR sensors and Arduino Uno R3
A Report on Bidirectional Visitor Counter using IR sensors and Arduino Uno R3Abhishekvb
 
Synopsis for alcohol detection with vehicle controlling (1)
Synopsis for alcohol detection with vehicle controlling (1)Synopsis for alcohol detection with vehicle controlling (1)
Synopsis for alcohol detection with vehicle controlling (1)Pankaj Singh
 
microcontroller and embedded system
microcontroller and embedded systemmicrocontroller and embedded system
microcontroller and embedded systempradeep rana
 
Automatic room light controller using microcontroller and visitor counter
Automatic room light controller using microcontroller and visitor counterAutomatic room light controller using microcontroller and visitor counter
Automatic room light controller using microcontroller and visitor countereSAT Journals
 

Ähnlich wie electronic voting machine by rfid (20)

Coin based mobile charger project report
Coin based mobile charger project reportCoin based mobile charger project report
Coin based mobile charger project report
 
Overview of Microcontroller and ATMega32 microcontroller
Overview of Microcontroller and ATMega32 microcontrollerOverview of Microcontroller and ATMega32 microcontroller
Overview of Microcontroller and ATMega32 microcontroller
 
Embedded system 8051 Microcontroller
Embedded system 8051 MicrocontrollerEmbedded system 8051 Microcontroller
Embedded system 8051 Microcontroller
 
Implementation of an Improved Microcontroller Based Moving Message Display Sy...
Implementation of an Improved Microcontroller Based Moving Message Display Sy...Implementation of an Improved Microcontroller Based Moving Message Display Sy...
Implementation of an Improved Microcontroller Based Moving Message Display Sy...
 
Implementation of an Improved Microcontroller Based Moving Message Display Sy...
Implementation of an Improved Microcontroller Based Moving Message Display Sy...Implementation of an Improved Microcontroller Based Moving Message Display Sy...
Implementation of an Improved Microcontroller Based Moving Message Display Sy...
 
Implementation of an Improved Microcontroller Based Moving Message Display Sy...
Implementation of an Improved Microcontroller Based Moving Message Display Sy...Implementation of an Improved Microcontroller Based Moving Message Display Sy...
Implementation of an Improved Microcontroller Based Moving Message Display Sy...
 
E010132736
E010132736E010132736
E010132736
 
Implementation of an Improved Microcontroller Based Moving Message Display Sy...
Implementation of an Improved Microcontroller Based Moving Message Display Sy...Implementation of an Improved Microcontroller Based Moving Message Display Sy...
Implementation of an Improved Microcontroller Based Moving Message Display Sy...
 
INDUSTRIAL TRAINING REPORT EMBEDDED SYSTEM.pptx
INDUSTRIAL TRAINING REPORT EMBEDDED SYSTEM.pptxINDUSTRIAL TRAINING REPORT EMBEDDED SYSTEM.pptx
INDUSTRIAL TRAINING REPORT EMBEDDED SYSTEM.pptx
 
AUTOMATIC WIRELESS POWER GRID CONTROL
AUTOMATIC WIRELESS POWER GRID CONTROLAUTOMATIC WIRELESS POWER GRID CONTROL
AUTOMATIC WIRELESS POWER GRID CONTROL
 
4 Way traffic controll new
4 Way traffic controll new4 Way traffic controll new
4 Way traffic controll new
 
Visiter counter doc
Visiter counter docVisiter counter doc
Visiter counter doc
 
AVR Atmega16 based Projects List - ATMega32 AVR _ Atmega16 based Projects.pdf
AVR Atmega16 based Projects List - ATMega32 AVR _ Atmega16 based Projects.pdfAVR Atmega16 based Projects List - ATMega32 AVR _ Atmega16 based Projects.pdf
AVR Atmega16 based Projects List - ATMega32 AVR _ Atmega16 based Projects.pdf
 
Industrial training report of embedded system and robotics
Industrial training report of embedded system and roboticsIndustrial training report of embedded system and robotics
Industrial training report of embedded system and robotics
 
Embedded systems presentation
Embedded systems presentationEmbedded systems presentation
Embedded systems presentation
 
A Report on Bidirectional Visitor Counter using IR sensors and Arduino Uno R3
A Report on Bidirectional Visitor Counter using IR sensors and Arduino Uno R3A Report on Bidirectional Visitor Counter using IR sensors and Arduino Uno R3
A Report on Bidirectional Visitor Counter using IR sensors and Arduino Uno R3
 
Synopsis for alcohol detection with vehicle controlling (1)
Synopsis for alcohol detection with vehicle controlling (1)Synopsis for alcohol detection with vehicle controlling (1)
Synopsis for alcohol detection with vehicle controlling (1)
 
microcontroller and embedded system
microcontroller and embedded systemmicrocontroller and embedded system
microcontroller and embedded system
 
embedded system
embedded systemembedded system
embedded system
 
Automatic room light controller using microcontroller and visitor counter
Automatic room light controller using microcontroller and visitor counterAutomatic room light controller using microcontroller and visitor counter
Automatic room light controller using microcontroller and visitor counter
 

electronic voting machine by rfid

  • 2. Objective :- • To interface 8051 with Serial devivce • To Study RFID Reader FEATURES. USING MICROCONTROLLER 89S51 ( 40 PIN) MICROCONTROLLER LCD INTERFACE. 2 BY 16 LINE 4 VOTE CAST SWITCH. 4 INDIVIDUAL VOTE CHECKING MACHINE. 1 SWITCH FOR TOTAL VOTE 2 SWITCH FOR RESET THE WHOLE DATA. 1 SWITCH FOR ELECTION CONTROL. 1 ALARNM POINT FOR VAOTE CASTING INDICATION. 24C02 FLASH MEMORY
  • 3. Detail methodology Methodology of this project Serial Communication Between Reader and Microcntroller. Tag will give 32 character to reader. Reader will give data to 89s52. We will work on serial communication and RFID technology. In this project we will use UID. UID is unique Identification using RFID reader machine Reader. We will use 125KHz frequency RFID for Reading purpose. Tag will be provided to each for identification. Person will have to show tag. Reader will tag and machine will give serial output. Max232 will be used for communication between RFID machine reader and Microcontroller 89s52. LCD will show each tag Number on LCD. In this voting machine we use ic 89s52 as a main microcontroller. Lcd available is 2 by 16 line. Eerom is 24c02 . Pin no 40 is connected to the positive supply. Pin no 20 is connected to the negative supply.
  • 4. Pin 1 to 4 of IC2 is connected with IC1 ‘s port 0. Thsese pins are to mark attendance. Pin 5 to 8 is to check the attendance of Individual candidate. Crystal is connected to the pin no 18 and pin no 19 Pin no 21 is the output pin and buzzer is connected to the pin no 21 Pin no 9 is connected to the reset button to reset the microcontroller automatically when we switch on the power. Power on reset Eerom of this circuit is 24c02 Pin no 8 is connected to the positive supply. Pin no 1,2,3,4 is connected to the ground pin. Pin no 6,7,8 is the data read and write pins and these pins are connected to the Pin no 22,23,24
  • 5.
  • 6. In this project firstly we use one step down transformer. Step down transformer step down the voltage from 220 volt Ac to 12 volt Ac. This Ac voltage is further converted into DC with the help of rectifier circuit. In rectifier circuit we use four diode. All the diodes are arranges as a bridge rectifier circuit. Output of this rectifier is pulsating Dc. To convert this pulsating DC into smooth dc we use one capacitor as a filter components. Capacitor converts the pulsating Dc into smooth DC with the help of its charging and discharging effect. Output of the rectifier is now regulated with the help of IC regulator circuit. In this project we use positive voltage regulator circuit. Here we use three pin regulator. Output of this regulator is regulated voltage. If we use 7805 regulator then its means its is 5 volt regulator and if we use 7808 regulator then its means that it is 8 volt regulator circuit. In this project we use 5 volt dc regulated power supply for the complete circuit. Separate 9 volt dc power supply is used for the relay coil
  • 7.
  • 8. 89s52 microcontroller is a main ic of this project. To drive the lcd, to check the balance amount and balance comparison all this activity is done in the this ic. Here we use microcontroller for this purpose. We wrote a program for this ic. Program is to be written in the ASM codes and then this code is converted into hex code with the help of the assembler. In this project we use 8051 ide software to assemble the asm codes into hex code. Once the code is converted into hex code then we transfer this code in the blank ic with the help of program kit connected with the computer. After transfer the hex code in the blank ic our ic is ready for the project .
  • 9.
  • 10. LCD INTERFACE. In this project we use lcd for output device. Here in this project we use 2 by 16 lcd for the output device. LCD drive by the microcontroller directly with the port p0. In this project we use 8 data line for the data transfer from the microcontroller to lcd. Our processor inside the controller is 8 bit processor, so we use parallel line transfer from microcontroller to lcd. Three control line R/S, R/W, AND ENABLE is also provided by the microcontroller itself. Lcd display welcome message. In the starting, then after show the recharge value of the money Then display the balance in first line and in the second line show the unit consumption and pulse counter logic.
  • 11. COMPONENTS USED IN THE PROJECT VOTING MACHINE: STEP DWON TRANSFORMER 9-0-9 DIODE IN 4007 (2) CAPACITOR: 470 MFD, 1000MFD, 10 MFD, 27 PF(2) IC 89s52 OR 89S51 ( 40 PIN MICROCONTROLLER) LCD 2BY 16. MEMORY IC 24C02 PUSH TO ON SWITCHES. 12 SWITCHES. CRYSTAL 12 MHZ PULL UP RESISTOR 10 K OHM ( CONNECTED TO PORT 0) PC B DESIGN BUZZER ALARM.
  • 12. Complete PIN LAYOUT of the voting machine. In this voting machine we use ic 89s52 as a main microcontroller. Lcd available is 2 by 16 line. Eerom is 24c02 . Pin no 40 is connected to the positive supply. Pin no 20 is connected to the negative supply. All the input switches are connected to the pin no 1,2,3, 4,5 6,7,8 ,10,11,12, 13 Pin no 1,4,6,8, is connected to the four different candidate vote enter switch Pin no 2,3,5,7 is connected to the check the vote of individual candidate Pin no 10 is connected to the total vote Pin no 12 is control the voting, After pressing this switch by both controller we enter the vote on different candidate
  • 13. Block Diagram: Description of Project In this project LCD is connected to Microcntroller port 0. RFID is connected to MCU at port pins p3.0 and p3.1. when any data card come contact with RFID reader then our reader give 32 character serial data to mcu Candidate selection switches LCD display Check switch for each candidate & reset sw Supply circuit 5v buzzer
  • 14. mcu. MCU pick last 8 bits and save in serial eeprom 24c02. Serial eeprom is to save data permanently. When switch off power even then eeprom save RFID tags. Our controller 1 give output at port 0. P0.0 connected to mcu2 port p1.0 respectively. Similarly p0.1 connected to p1.1. In this controller we will connect lcd at port 1 and switches to check vote at port1. Rs , rw , and en of LCD at port p2.5, pp2.4 and p2.3 respectively. To check total votes at pin p3.0 We used 5v DC power supply for whole circuit. We used 12v 1A adapter for RFID reader. About controller used in Circuit. Look around. Notice the smart “intelligent” systems? Be it the T.V, washing machines, video games, telephones, automobiles, aero planes, power systems, or any application having a LED or a LCD as a user interface, the control is likely to be in the hands of a micro controller! Measure and control, that’s where the micro controller is at its best.
  • 15. Micro controllers are here to stay. Going by the current trend, it is obvious that micro controllers will be playing bigger and bigger roles in the different activities of our lives. These embedded chips are very small, but are designed to replace components much bigger and bulky In size. They process information very intelligently and efficiently. They sense the environment around them. The signals they gather are tuned into digital data that streams through tributaries of circuit lines at the speed of light. Inside the microprocessor collates and calculators. The software has middling intelligence. Then in a split second, the processed streams are shoved out. What is the primary difference between a microprocessor and a micro controller? Unlike the microprocessor, the micro controller can be considered to be a true “Computer on a chip”. In addition to the various features like the ALU, PC, SP and registers found on a microprocessor, the micro controller also incorporates features like the ROM, RAM, Ports, timers, clock circuits, counters, reset functions etc. While the microprocessor is more a general-purpose device, used for read, write and calculations on data, the micro controller, in addition to the above functions also controls the environment.
  • 16. 8051 micro controller The 8051 The 8051 developed and launched in the early 80`s, is one of the most popular micro controller in use today. It has a reasonably large amount of built in ROM and RAM. In addition it has the ability to access external memory. The generic term `8x51` is used to define the device. The value of x defining the kind of ROM, i.e. x=0, indicates none, x=3, indicates mask ROM, x=7, indicates EPROM and x=9 indicates EEPROM or Flash.
  • 17. A note on ROM The early 8051, namely the 8031 was designed without any ROM. This device could run only with external memory connected to it. Subsequent developments lead to the development of the PROM or the programmable ROM. This type had the disadvantage of being highly unreliable. The next in line, was the EPROM or Erasable Programmable ROM. These devices used ultraviolet light erasable memory cells. Thus a program could be loaded, tested and erased using ultra violet rays. A new program could then be loaded again. An improved EPROM was the EEPROM or the electrically erasable PROM. This does not require ultra violet rays, and memory can be cleared using circuits within the chip itself. Finally there is the FLASH, which is an improvement over the EEPROM. While the terms EEPROM and flash are sometimes used interchangeably, the difference lies in the fact that flash erases the complete memory at one stroke, and not act on the individual cells. This results in reducing the time for erasure. Different microcontrollers in market. • PIC One of the famous microcontrollers used in the industries. It is based on RISC Architecture which makes the microcontroller process faster than other microcontroller. • INTEL These are the first to manufacture microcontrollers. These are not as sophisticated other microcontrollers but still the easiest one to learn. • ATMEL Atmel’s AVR microcontrollers are one of the most powerful in the embedded industry. This is the only microcontroller having 1kb of ram even the entry stage. But it is unfortunate that in India we are unable to find this kind of microcontroller.
  • 18. Intel 8051 Intel 8051 is CISC architecture which is easy to program in assembly language and also has a good support for High level languages. The memory of the microcontroller can be extended up to 64k. This microcontroller is one of the easiest microcontrollers to learn. The 8051 microcontroller is in the field for more than 20 years. There are lots of books and study materials are readily available for 8051. Derivatives The best thing done by Intel is to give the designs of the 8051 microcontroller to everyone. So it is not the fact that Intel is the only manufacture for the 8051 there more than 20 manufactures, with each of minimum 20 models. Literally there are hundreds of models of 8051 microcontroller available in market to choose. Some of the major manufactures of 8051 are  Atmel  Philips Philips The Philips‘s 8051 derivatives has more number of features than in any microcontroller. The costs of the Philips microcontrollers are higher than the Atmel’s which makes us to choose Atmel more often than Philips Dallas
  • 19. Dallas has made many revolutions in the semiconductor market. Dallas’s 8051 derivative is the fastest one in the market. It works 3 times as fast as a 8051 can process. But we are unable to get more in India. Atmel These people were the one to master the flash devices. They are the cheapest microcontroller available in the market. Atmel’s even introduced a 20pin variant of 8051 named 2051. The Atmel’s 8051 derivatives can be got in India less than 70 rupees. There are lots of cheap programmers available in India for Atmel. So it is always good for students to stick with 8051 when you learn a new microcontroller. ] Architecture Architecture is must to learn because before learning new machine it is necessary to learn the capabilities of the machine. This is some thing like before learning about the car you cannot become a good driver. The architecture of the 8051 is given below.
  • 20. The 8051 doesn’t have any special feature than other microcontroller. The only feature is that it is easy to learn. Architecture makes us to know about the hardware features of the microcontroller. The features of the 8051 are  4K Bytes of Flash Memory  128 x 8-Bit Internal RAM  Fully Static Operation: 1 MHz to 24 MHz  32 Programmable I/O Lines  Two 16-Bit Timer/Counters  Six Interrupt Sources (5 Vectored)  Programmable Serial Channel  Low Power Idle and Power Down Modes The 8051 has a 8-Bit CPU that means it is able to process 8 bit of data at a time. 8051 has 235 instructions. Some of the important registers and their functions are Let’s now move on to a practical example. We shall work on a simple practical application and using the example as a base, shall explore the various features of the 8051 microcontroller. Consider an electric circuit as follows,
  • 21. The positive side (+ve) of the battery is connected to one side of a switch. The other side of the switch is connected to a bulb or LED (Light Emitting Diode). The bulb is then connected to a resistor, and the other end of the resistor is connected to the negative (-ve) side of the battery. When the switch is closed or ‘switched on’ the bulb glows. When the switch is open or ‘switched off’ the bulb goes off If you are instructed to put the switch on and off every 30 seconds, how would you do it? Obviously you would keep looking at your watch and every time the second hand crosses 30 seconds you would keep turning the switch on and off. Imagine if you had to do this action consistently for a full day. Do you think you would be able to do it? Now if you had to do this for a month, a year?? No way, you would say! The next step would be, then to make it automatic. This is where we use the Microcontroller. But if the action has to take place every 30 seconds, how will the microcontroller keep track of time? Execution time Look at the following instruction, clr p1.0 This is an assembly language instruction. It means we are instructing the microcontroller to put a value of ‘zero’ in bit zero of port one. This instruction is equivalent to telling the microcontroller to switch on the bulb.
  • 22. The instruction then to instruct the microcontroller to switch off the bulb is, Set p1.0 This instructs the microcontroller to put a value of ‘one’ in bit zero of port one. Don’t worry about what bit zero and port one means. We shall learn it in more detail as we proceed. There are a set of well defined instructions, which are used while communicating with the microcontroller. Each of these instructions requires a standard number of cycles to execute. The cycle could be one or more in number. How is this time then calculated? The speed with which a microcontroller executes instructions is determined by what is known as the crystal speed. A crystal is a component connected externally to the microcontroller. The crystal has different values, and some of the used values are 6MHZ, 10MHZ, and 11.059 MHz etc. Thus a 10MHZ crystal would pulse at the rate of 10,000,000 times per second. The time is calculated using the formula No of cycles per second = Crystal frequency in HZ / 12. For a 10MHZ crystal the number of cycles would be, 10,000,000/12=833333.33333 cycles. This means that in one second, the microcontroller would execute
  • 23. 833333.33333 cycles. Therefore for one cycle, what would be the time? Try it out. The instruction clr p1.0 would use one cycle to execute. Similarly, the instruction setb p1.0 also uses one cycle. So go ahead and calculate what would be the number of cycles required to be executed to get a time of 30 seconds! Getting back to our bulb example, all we would need to do is to instruct the microcontroller to carry out some instructions equivalent to a period of 30 seconds, like counting from zero upwards, then switch on the bulb, carry out instructions equivalent to 30 seconds and switch off the bulb. Just put the whole thing in a loop, and you have a never ending on-off sequence. Let us now have a look at the features of the 8051 core, keeping the above example as a reference, 1. 8-bit CPU.( Consisting of the ‘A’ and ‘B’ registers) Most of the transactions within the microcontroller are carried out through the ‘A’ register, also known as the Accumulator. In addition all arithmetic functions are carried out generally in the ‘A’ register. There is another register known as the ‘B’ register, which is used exclusively for multiplication and division. Thus an 8-bit notation would indicate that the maximum value that can be input into these registers is ‘11111111’. Puzzled? The value is not decimal 111, 11,111! It represents a binary number, having an equivalent value of ‘FF’ in Hexadecimal and a value of 255 in decimal. We shall read in more detail on the different numbering systems namely the Binary and Hexadecimal system in our next module. 2. 4K on-chip ROM
  • 24. Once you have written out the instructions for the microcontroller, where do you put these instructions? Obviously you would like these instructions to be safe, and not get deleted or changed during execution. Hence you would load it into the ‘ROM’ The size of the program you write is bound to vary depending on the application, and the number of lines. The 8051 microcontroller gives you space to load up to 4K of program size into the internal ROM. 4K, that’s all? Well just wait. You would be surprised at the amount of stuff you can load in this 4K of space. Of course you could always extend the space by connecting to 64K of external ROM if required. 3. 128 bytes on-chip RAM This is the space provided for executing the program in terms of moving data, storing data etc. 4. 32 I/O lines. (Four- 8 bit ports, labeled P0, P1, P2, P3) In our bulb example, we used the notation p1.0. This means bit zero of port one. One bit controls one bulb. Thus port one would have 8 bits. There are a total of four ports named p0, p1, p2, p3, giving a total of 32 lines. These lines can be used both as input or output. 5. Two 16 bit timers / counters. A microcontroller normally executes one instruction at a time. However certain applications would require that some event has to be tracked independent of the main program. The manufacturers have provided a solution, by providing two timers. These timers execute in the background independent of the main program. Once the required time has been reached, (remember the time calculations
  • 25. described above?), they can trigger a branch in the main program. These timers can also be used as counters, so that they can count the number of events, and on reaching the required count, can cause a branch in the main program. 6. Full Duplex serial data receiver / transmitter. The 8051 microcontroller is capable of communicating with external devices like the PC etc. Here data is sent in the form of bytes, at predefined speeds, also known as baud rates. The transmission is serial, in the sense, one bit at a time 7. 5- interrupt sources with two priority levels (Two external and three internal) During the discussion on the timers, we had indicated that the timers can trigger a branch in the main program. However, what would we do in case we would like the microcontroller to take the branch, and then return back to the main program, without having to constantly check whether the required time / count has been reached? This is where the interrupts come into play. These can be set to either the timers, or to some external events. Whenever the background program has reached the required criteria in terms of time or count or an external event, the branch is taken, and on completion of the branch, the control returns to the main program. Priority levels indicate which interrupt is more important, and needs to be executed first in case two interrupts occur at the same time. 8. On-chip clock oscillator. This represents the oscillator circuits within the microcontroller. Thus the hardware is reduced to just simply connecting an external crystal, to achieve the required pulsing rate.
  • 26. PIN FUNCTION OF IC 89C51. 1 Supply pin of this ic is pin no 40. Normally we apply a 5 volt regulated dc power supply to this pin. For this purpose either we use step down transformer power supply or we use 9 volt battery with 7805 regulator. 2 Ground pin of this ic is pin no 20. Pin no 20 is normally connected to the ground pin ( normally negative point of the power supply. 3 XTAL is connected to the pin no 18 and pin no 19 of this ic. The quartz crystal oscillator connected to XTAL1 and XTAL2 PIN. These pins also needs two capacitors of 30 pf value. One side of each capacitor is connected to crystal and other pis is connected to the ground point. Normally we connect a 12 MHz or 11.0592 MHz crystal with this ic.. But we use crystal upto 20 MHz to this pins 4 RESET PIN.. Pin no 9 is the reset pin of this ic.. It is an active high pin. On applying a high pulse to this pin, the micro controller will reset and terminate all activities. This is often referred to as a power on reset. The high pulse must be high for a minimum of 2 machine cycles before it is allowed to go low. 5. PORT0 Port 0 occupies a total of 8 pins. Pin no 32 to pin no 39. It can be used for input or output. We connect all the pins of the port 0 with the pullup resistor (10 k ohm) externally. This is due to fact that port 0 is an open drain mode. It is just like a open collector transistor. 6. PORT1. ALL the ports in micrcontroller is 8 bit wide pin no 1 to pin no 8 because it is a 8 bit controller. All the main register and sfr all is mainly 8 bit wide. Port 1 is also occupies a 8 pins. But there is no need of pull up resistor in this port. Upon reset port 1 act as a input port. Upon reset all the ports act as a input port 7. PORT2. port 2 also have a 8 pins. It can be used as a input or output. There is no need of any pull up resistor to this pin. PORT 3. Port3 occupies a totoal 8 pins from pin no 10 to pin no 17. It can be used as input or output. Port 3 does not require any pull up resistor. The same as port 1 and port2. Port 3 is configured as an output port on reset. Port 3 has the additional function of providing some important signals such as interrupts. Port 3 also use for serial communication.
  • 27. ALE ALE is an output pin and is active high. When connecting an 8031 to external memory, port 0 provides both address and data. In other words, the 8031 multiplexes address and data through port 0 to save pins. The ALE pin is used for demultiplexing the address and data by connecting to the ic 74ls373 chip. PSEN. PSEN stands for program store eneable. In an 8031 based system in which an external rom holds the program code, this pin is connected to the OE pin of the rom. EA. EA. In 89c51 8751 or any other family member of the ateml 89c51 series all come with on-chip rom to store programs, in such cases the EA pin is connected to the Vcc. For family member 8031 and 8032 is which there is no on chip rom, code is stored in external memory and this is fetched by 8031. In that case EA pin must be connected to GND pin to indicate that the code is stored externally. SPECIAL FUNCTION REGISTER ( SFR) ADDRESSES. ACC ACCUMULATOR 0E0H B B REGISTER 0F0H PSW PROGRAM STATUS WORD 0D0H SP STACK POINTER 81H DPTR DATA POINTER 2 BYTES DPL LOW BYTE OF DPTR 82H DPH HIGH BYTE OF DPTR 83H
  • 28. P0 PORT0 80H P1 PORT1 90H P2 PORT2 0A0H P3 PORT3 0B0H TMOD TIMER/COUNTER MODE CONTROL 89H TCON TIMER COUNTER CONTROL 88H TH0 TIMER 0 HIGH BYTE 8CH TLO TIMER 0 LOW BYTE 8AH TH1 TIMER 1 HIGH BYTE 8DH TL1 TIMER 1 LOW BYTE 8BH SCON SERIAL CONTROL 98H SBUF SERIAL DATA BUFFER 99H PCON POWER CONTROL 87H INSTRUCTIONS SINGLE BIT INSTRUCTIONS. SETB BIT SET THE BIT =1 CLR BIT CLEAR THE BIT =0 CPL BIT COMPLIMENT THE BIT 0 =1, 1=0 JB BIT,TARGET JUMP TO TARGET IF BIT =1 JNB BIT, TARGET JUMP TO TARGET IF BIT =0 JBC BIT,TARGET JUMP TO TARGET IF BIT =1 &THEN CLEAR THE BIT
  • 29. MOV INSTRUCTIONS MOV instruction simply copy the data from one location to another location MOV D,S Copy the data from(S) source to D(destination) MOV R0,A ; Copy contents of A into Register R0 MOV R1,A ; Copy contents of A into register R1 MOV A,R3 ; copy contents of Register R3 into Accnmulator. DIRECT LOADING THROUGH MOV MOV A,#23H ; Direct load the value of 23h in A MOV R0,#12h ; direct load the value of 12h in R0 MOV R5,#0F9H ; Load the F9 value in the Register R5 ADD INSTRUCTIONS. ADD instructions adds the source byte to the accumulator ( A) and place the result in the Accumulator. MOV A, #25H ADD A,#42H ; BY this instructions we add the value 42h in Accumulator ( 42H+ 25H) ADDA,R3 ;By this instructions we move the data from register r3 to accumulator and then add the contents of the register into accumulator . SUBROUTINE CALL FUNCTION.
  • 30. ACALL,TARGET ADDRESS By this instructions we call subroutines with a target address within 2k bytes from the current program counter. LCALL, TARGET ADDRESS. ACALL is a limit for the 2 k byte program counter, but for upto 64k byte we use LCALL instructions.. Note that LCALL is a 3 byte instructions. ACALL is a two byte instructions. AJMP TARGET ADDRESS. This is for absolute jump AJMP stand for absolute jump. It transfers program execution to the target address unconditionally. The target address for this instruction must be withib 2 k byte of program memory. LJMP is also for absoltute jump. It tranfer program execution to the target addres unconditionally. This is a 3 byte instructions LJMP jump to any address within 64 k byte location. INSTRUCTIONS RELATED TO THE CARRY JC TARGET JUMP TO THE TARGET IF CY FLAG =1 JNC TARGET JUMP TO THE TARGET ADDRESS IF CY FLAG IS = 0 INSTRUCTIONS RELASTED TO JUMP WITH ACCUMULATOR
  • 31. JZ TARGET JUMP TO TARGET IF A = 0 JNZ TARGET JUMP IF ACCUMULATOR IS NOT ZERO This instructions jumps if registe A has a value other than zero INSTRUCTIONS RELATED TO THE ROTATE RL A ROTATE LEFT THE ACCUMULATOR BY this instructions we rotate the bits of A left. The bits rotated out of A are rotated back into A at the opposite end RR A By this instruction we rotate the contents of the accumulator from right to left from LSB to MSB RRC A This is same as RR A but difference is that the bit rotated out of register first enter in to carry and then enter into MSB RLC A
  • 32. ROTATE A LEFT THROUGH CARRY Same as above but but shift the data from MSB to carry and carry to LSB RET This is return from subroutine. This instructions is used to return from a subroutine previously entered by instructions LCALL and ACALL. RET1 THIS is used at the end of an interrupt service routine. We use this instructions after intruupt routine, PUSH. This copies the indicated byte onto the stack and increments SP by . This instructions supports only direct addressing mode. POP. POP FROM STACK. This copies the byte pointed to be SP to the location whose direct address is indicated, and decrements SP by 1. Notice that this instructions supports only direct addressing mode. DPTR INSTRUCTIONS. MOV DPTR,#16 BIT VALUE
  • 33. LOAD DATA POINTER This instructions load the 16 bit dptr register with a 16 bit immediate value MOV C A,@A+DPTR This instructions moves a byte of data located in program ROM into register A. This allows us to put strings of data, such as look up table elements. MOVC A,@A+PC This instructions moves a byte of data located in the program area to A. the address of the desired byte of data is formed by adding the program counter ( PC) register to the original value of the accumulator. INC BYTE This instructions add 1 to the register or memory location specified by the operand. INC A INC Rn INC DIRECT DEC BYTE This instructions subtracts 1 from the byte operand. Note that CY is unchanged DEC A DEC Rn DEC DIRECT ARITHMATIC INSTRUCTIONS. ANL dest-byte, source-byte
  • 34. This perform a logical AND operation This performs a logical AND on the operands, bit by bit, storing the result in the destination. Notice that both the source and destination values are byte – size only ` DIV AB This instructions divides a byte accumulator by the byte in register B. It is assumed that both register A and B contain an unsigned byte. After the division the quotient will be in register A and the remainder in register B. TMOD ( TIMER MODE ) REGISTER Both timer is the 89c51 share the one register TMOD. 4 LSB bit for the timer 0 and 4 MSB for the timer 1. In each case lower 2 bits set the mode of the timer Upper two bits set the operations. GATE: Gating control when set. Timer/counter is enabled only while the INTX pin is high and the TRx control pin is set. When cleared, the timer is enabled whenever the TRx control bit is set C/T : Timer or counter selected cleared for timer operation ( input from internal system clock) M1 Mode bit 1 M0 Mode bit 0
  • 35. M1 M0 MODE OPERATING MODE 0 0 0 13 BIT TIMER/MODE 0 1 1 16 BIT TIMER MODE 1 0 2 8 BIT AUTO RELOAD 1 1 3 SPLIT TIMER MODE PSW ( PROGRAM STATUS WORD) CY PSW.7 CARRY FLAG AC PSW.6 AUXILIARY CARRY F0 PSW.5 AVAILABLE FOR THE USER FRO GENERAL PURPOSE RS1 PSW.4 REGISTER BANK SELECTOR BIT 1 RS0 PSW.3 REGISTER BANK SELECTOR BIT 0 0V PSW.2 OVERFLOW FLAG -- PSW.1 USER DEFINABLE BIT P PSW.0 PARITY FLAG SET/CLEARED BY HARDWARE PCON REGISATER ( NON BIT ADDRESSABLE)
  • 36. If the SMOD = 0 ( DEFAULT ON RESET) TH1 = CRYSTAL FREQUENCY 256---- ____________________ 384 X BAUD RATE If the SMOD IS = 1 CRYSTAL FREQUENCY TH1 = 256-------------------------------------- 192 X BAUD RATE There are two ways to increase the baud rate of data transfer in the 8051 1. To use a higher frequency crystal 2. To change a bit in the PCON register PCON register is an 8 bit register . Of the 8 bits, some are unused, and some are used for the power control capability of the 8051. the bit which is used for the serial communication is D7, the SMOD bit. When the 8051 is powered up, D7 ( SMOD BIT) OF PCON register is zero. We can set it to high by software and thereby double the baud rate BAUD RATE COMPARISION FOR SMOD = 0 AND SMOD =1 TH1 ( DECIMAL) HEX SMOD =0 SMOD =1 -3 FD 9600 19200 -6 FA 4800 9600 -12 F4 2400 4800 -24 E8 1200 2400 XTAL = 11.0592 MHZ
  • 37. IE ( INTERRUPT ENABLE REGISTOR) EA IE.7 Disable all interrupts if EA = 0, no interrupts is acknowledged If EA is 1, each interrupt source is individually enabled or disbaled By sending or clearing its enable bit. IE.6 NOT implemented ET2 IE.5 enables or disables timer 2 overflag in 89c52 only ES IE.4 Enables or disables all serial interrupt ET1 IE.3 Enables or Disables timer 1 overflow interrupt EX1 IE.2 Enables or disables external interrupt ET0 IE.1 Enables or Disbales timer 0 interrupt. EX0 IE.0 Enables or Disables external interrupt 0 INTERRUPT PRIORITY REGISTER If the bit is 0, the corresponding interrupt has a lower priority and if the bit is 1 the corresponding interrupt has a higher priority IP.7 NOT IMPLEMENTED, RESERVED FOR FUTURE USE.
  • 38. IP.6 NOT IMPLEMENTED, RESERVED FOR FUTURE USE PT2 IP.5 DEFINE THE TIMER 2 INTERRUPT PRIORITY LELVEL PS IP.4 DEFINES THE SERIAL PORT INTERRUPT PRIORITY LEVEL PT1 IP.3 DEFINES THE TIMER 1 INTERRUPT PRIORITY LEVEL PX1 IP.2 DEFINES EXTERNAL INTERRUPT 1 PRIORITY LEVEL PT0 IP.1 DEFINES THE TIMER 0 INTERRUPT PRIORITY LEVEL PX0 IP.0 DEFINES THE EXTERNAL INTERRUPT 0 PRIORITY LEVEL SCON: SERIAL PORT CONTROL REGISTER , BIT ADDRESSABLE SCON SM0 : SCON.7 Serial Port mode specifier SM1 : SCON.6 Serial Port mode specifier SM2 : SCON.5
  • 39. REN : SCON.4 Set/cleared by the software to Enable/disable reception TB8 : SCON.3 The 9th bit that will be transmitted in modes 2 and 3, Set/cleared By software RB8 : SCON.2 In modes 2 &3, is the 9th data bit that was received. In mode 1, If SM2 = 0, RB8 is the stop bit that was received. In mode 0 RB8 is not used T1 : SCON.1 Transmit interrupt flag. Set by hardware at the end of the 8th bit Time in mode 0, or at the beginning of the stop bit in the other Modes. Must be cleared by software R1 SCON.0 Receive interrupt flag. Set by hardware at the end of the 8th bit Time in mode 0, or halfway through the stop bit time in the other Modes. Must be cleared by the software. TCON TIMER COUNTER CONTROL REGISTER This is a bit addressable TF1 TCON.7 Timer 1 overflow flag. Set by hardware when the Timer/Counter 1 Overflows. Cleared by hardware as processor TR1 TCON.6 Timer 1 run control bit. Set/cleared by software to turn Timer Counter 1 On/off TF0 TCON.5 Timer 0 overflow flag. Set by hardware when the timer/counter 0 Overflows. Cleared by hardware as processor TR0 TCON.4 Timer 0 run control bit. Set/cleared by software to turn timer Counter 0 on/off.
  • 40. IE1 TCON.3 External interrupt 1 edge flag ITI TCON.2 Interrupt 1 type control bit IE0 TCON.1 External interrupt 0 edge IT0 TCON.0 Interrupt 0 type control bit. - 8051 Instruction Set Arithmetic Operations Mnemonic Description Size Cycles ADD A,Rn Add register to Accumulator (ACC). 1 1 ADD A,direct Add direct byte to ACC. 2 1 ADD A,@Ri Add indirect RAM to ACC . 1 1 ADD A,#data Add immediate data to ACC . 2 1 ADDC A,Rn Add register to ACC with carry . 1 1 ADDC A,direct Add direct byte to ACC with carry. 2 1 ADDC A,@Ri Add indirect RAM to ACC with carry. 1 1 ADDC A,#data Add immediate data to ACC with carry. 2 1 SUBB A,Rn Subtract register from ACC with borrow. 1 1 SUBB A,direct Subtract direct byte from ACC with borrow 2 1 SUBB A,@Ri Subtract indirect RAM from ACC with borrow. 1 1 SUBB A,#data Subtract immediate data from ACC with borrow. 2 1 INC A Increment ACC. 1 1 INC Rn Increment register. 1 1 INC direct Increment direct byte. 2 1 INC @Ri Increment indirect RAM. 1 1
  • 41. DEC A Decrement ACC. 1 1 DEC Rn Decrement register. 1 1 DEC direct Decrement direct byte. 2 1 DEC @Ri Decrement indirect RAM. 1 1 INC DPTR Increment data pointer. 1 2 MUL AB Multiply A and B Result: A <- low byte, B <- high byte. 1 4 DIV AB Divide A by B Result: A <- whole part, B <- remainder. 1 4 DA A Decimal adjust ACC. 1 1 Logical Operations Mnemonic Description Size Cycles ANL A,Rn AND Register to ACC. 1 1 ANL A,direct AND direct byte to ACC. 2 1 ANL A,@Ri AND indirect RAM to ACC. 1 1 ANL A,#data AND immediate data to ACC. 2 1 ANL direct,A AND ACC to direct byte. 2 1 ANL direct,#data AND immediate data to direct byte. 3 2 ORL A,Rn OR Register to ACC. 1 1 ORL A,direct OR direct byte to ACC. 2 1 ORL A,@Ri OR indirect RAM to ACC. 1 1 ORL A,#data OR immediate data to ACC. 2 1 ORL direct,A OR ACC to direct byte. 2 1
  • 42. ORL direct,#data OR immediate data to direct byte. 3 2 XRL A,Rn Exclusive OR Register to ACC. 1 1 XRL A,direct Exclusive OR direct byte to ACC. 2 1 XRL A,@Ri Exclusive OR indirect RAM to ACC. 1 1 XRL A,#data Exclusive OR immediate data to ACC. 2 1 XRL direct,A Exclusive OR ACC to direct byte. 2 1 XRL direct,#data XOR immediate data to direct byte. 3 2 CLR A Clear ACC (set all bits to zero). 1 1 CPL A Compliment ACC. 1 1 RL A Rotate ACC left. 1 1 RLC A Rotate ACC left through carry. 1 1 RR A Rotate ACC right. 1 1 RRC A Rotate ACC right through carry. 1 1 SWAP A Swap nibbles within ACC. 1 1 Data Transfer Mnemonic Description Size Cycles MOV A,Rn Move register to ACC. 1 1 MOV A,direct Move direct byte to ACC. 2 1 MOV A,@Ri Move indirect RAM to ACC. 1 1 MOV A,#data Move immediate data to ACC. 2 1 MOV Rn,A Move ACC to register. 1 1
  • 43. MOV Rn,direct Move direct byte to register. 2 2 MOV Rn,#data Move immediate data to register. 2 1 MOV direct,A Move ACC to direct byte. 2 1 MOV direct,Rn Move register to direct byte. 2 2 MOV direct,direct Move direct byte to direct byte. 3 2 MOV direct,@Ri Move indirect RAM to direct byte. 2 2 MOV direct,#data Move immediate data to direct byte. 3 2 MOV @Ri,A Move ACC to indirect RAM. 1 1 MOV @Ri,direct Move direct byte to indirect RAM. 2 2 MOV @Ri,#data Move immediate data to indirect RAM. 2 1 MOV DPTR,#data16 Move immediate 16 bit data to data pointer register. 3 2 MOVC A,@A+DPTR Move code byte relative to DPTR to ACC (16 bit address). 1 2 MOVC A,@A+PC Move code byte relative to PC to ACC (16 bit address).1 2 MOVX A,@Ri Move external RAM to ACC (8 bit address).1 2 MOVX A,@DPTR Move external RAM to ACC (16 bit address). 1 2 MOVX @Ri,A Move ACC to external RAM (8 bit address).1 2 MOVX @DPTR,A Move ACC to external RAM (16 bit address). 1 2 PUSH direct Push direct byte onto stack. 2 2 POP direct Pop direct byte from stack. 2 2 XCH A,Rn Exchange register with ACC. 1 1 XCH A,direct Exchange direct byte with ACC. 2 1 XCH A,@Ri Exchange indirect RAM with ACC. 1 1 XCHD A,@Ri Exchange low order nibble of indirect
  • 44. RAM with low order nibble of ACC 1 1 Boolean Variable Manipulation Mnemonic Description Size Cycles CLR C Clear carry flag. 1 1 CLR bit Clear direct bit. 2 1 SETB C Set carry flag. 1 1 SETB bitSet direct bit 2 1 CPL C Compliment carry flag. 1 1 CPL bit Compliment direct bit. 2 1 ANL C,bit AND direct bit to carry flag. 2 2 ANL C,/bit AND compliment of direct bit to carry. 2 2 ORL C,bit OR direct bit to carry flag. 2 2 ORL C,/bit OR compliment of direct bit to carry. 2 2 MOV C,bit Move direct bit to carry flag. 2 1 MOV bit,C Move carry to direct bit. 2 2 JC rel Jump if carry is set. 2 2 JNC rel Jump if carry is not set. 2 2 JB bit,rel Jump if direct bit is set. 3 2 JNB bit,rel Jump if direct bit is not set. 3 2 JBC bit,rel Jump if direct bit is set & clear bit. 3 2 Program Branching Mnemonic Description Size Cycles ACALL addr11 Absolute subroutine call. 2 2
  • 45. LCALL addr16 Long subroutine call. 3 2 RET Return from subroutine. 1 2 RETI Return from interrupt. 1 2 AJMP addr11 Absolute jump. 2 2 LJMP addr16 Long jump. 3 2 SJMP rel Short jump (relative address). 2 2 JMP @A+DPTR Jump indirect relative to the DPTR. 1 2 JZ rel Jump relative if ACC is zero. 2 2 JNZ rel Jump relative if ACC is not zero. 2 2 CJNE A,direct,rel Compare direct byte to ACC and jump if not equal. 3 2 CJNE A,#data,rel Compare immediate byte to ACC and jump if not equal.3 2 CJNE Rn,#data,rel Compare immediate byte to register and jump if not equal.32 CJNE @Ri,#data,rel Compare immediate byte to indirect and jump if not equal.32 DJNZ Rn,rel Decrement register and jump if not zero. 2 2 DJNZ direct,rel Decrement direct byte and jump if not zero. 3 2 Other Instructions Mnemonic Description Size Cycles NOP No operation. 1 1
  • 46. component qty rate IC89C051, 1 60 ULN2003, 1 30 Diodes in4001, 4 1 IC 7805 1 15 Optocoupler PC817 4 12 Tr548 4 3 Tr 558 4 3 Motors 12v 2 250 IC base 20 pin 1 10 Crystal 12 Mhz 1 25 Resiatncec 10k 4 .25 4k 4 .25 Cap 10µf 1 5 Connecting wires 1 20 Ir sensors 3 120 • Software:- Keil compiler or UMPS for programming Window xp
  • 47. Bibliography: http://www.sciencejoywagon.com/physicszone/lesson/otherpub/wfendt/electricmotor. htm exists which allows us to communicate with the vast 3 control lines as well as either 4 or 8 I/O lines for the data bus. The user may select whether the LCD is to operate with a 4- bit data bus or an 8-bit data bus. If a 4-bit data bus is used, the LCD The 44780 standard requires 3 control lines as well as either 4 or 8 I/O lines for the data bus. The user may select whether the LCD is to operate with a 4-bit data bus or an 8-bit data bus. If a 4-bit data bus is used, the LCD will require a total of 7 data lines (3 control lines plus the 4 lines for the data bus). If an 8-bit data bus is used, the LCD will require a total of 11 data lines (3 control lines plus the 8 lines for the data bus). The three control lines are referred to as EN, RS, and RW. will require a total of 7 data lines (3 control lines plus the 4 lines for the data bus). If an 8-bit data bus is used, the LCD will require a total of 11 data lines (3 control lines plus the 8 lines for the data bus). The three control lines are referred to as EN, RS, and RW. The EN line is called "Enable." This control line is used to tell the LCD that you are sending it data. To send data to the LCD, your program should first set this line high (1)
  • 48. and then set the other two control lines and/or put data on the data bus. When the other lines are completely ready, bring EN low (0) again. The 1-0 transition tells the 44780 to take the data currently found on the other control lines and on the data bus and to treat it as a command. The RS line is the "Register Select" line. When RS is low (0), the data is to be treated as a command or special instruction (such as clear screen, position cursor, etc.). When RS is high (1), the data being sent is text data which should be displayed on the screen. For example, to display the letter "T" on the screen you would set RS high. The RW line is the "Read/Write" control line. When RW is low (0), the information on the data bus is being written to the LCD. When RW is high (1), the program is effectively querying (or reading) the LCD. Only one instruction ("Get LCD status") is a read command. All others are write commands--so RW will almost always be low. Finally, the data bus consists of 4 or 8 lines (depending on the mode of operation selected by the user). In the case of an 8-bit data bus, the lines are referred to as DB0, DB1, DB2, DB3, DB4, DB5, DB6, and DB7. Fortunately, a very popular standard exists which allows us to communicate with the vast majority of data from an external source (in this case, the 8051) and communicates directly with the LCD. I
  • 49. atic Showing Column of Laser Light Leaving Optical Oscillator COMPONENT DESCRIPTION TRANSFORMER Transformer works on the principle of mutual inductance. We know that if two coils or windings are placed on the core of iron, and if we pass alternating current in one winding, back emf or induced voltage is produced in the second winding. We know that alternating current always changes with the time. So if we apply AC voltage across one winding, a voltage will be induced in the other winding. Transformer works on this same principle. It is made of two windings wound around the same core of iron. The winding to which AC voltage is applied is called primary winding. The other winding is called as secondary winding. Voltage and current relationship: Let V1 volts be input alternating voltage applied to primary winding. I1 Amp is input alternating current through primary winding. V2 volt is output alternating voltage produced in the secondary. I2 amp be the current flowing through the secondary. Then relationship between input and output voltages is given by V1/V2 = N1/N2 Relationship between input and output currents is I1/I2 = N2/N1 (Where N1 is no. of turns of coil in primary and N2 is number of turns in secondary )
  • 50. We know that Power = Current X Voltage. It is to be noted that input power is equal to output power. Power is not changed. If V2 is greater than V1, then I2 will be less than I1. This type of transformer is called as step up transformer. If V1 is greater than V2, then I1 will be less than I2. This type of transformer is called as step down transformer. For step up transformer, N2>N1, i.e., number of turns of secondary winding is more than those in primary. For step down transformer, N1>N2, i.e., numbers of turns of primary winding is more than those in secondary.
  • 51. RESISTORS The flow of charge (or current) through any material, encounters an opposing force similar in many respect to mechanical friction. This opposing force is called resistance of the material. It is measured in ohms. In some electric circuits resistance is deliberately introduced in the form of the resistor. Resistors are of following types: 1. Wire wound resistors. 2. Carbon resistors. 3. Metal film resistors. Wire Wound Resistors: Wire wound resistors are made from a long (usually Ni-Chromium) wound on a ceramic core. Longer the length of the wire, higher is the resistance. So depending on the value of resistor required in a circuit, the wire is cut and wound on a ceramic core. This entire assembly is coated with a ceramic metal. Such resistors are generally available in power of 2 watts to several hundred watts and resistance values from 1ohm to 100k ohms. Thus wire wound resistors are used for high currents. Carbon Resistors: Carbon resistors are divided into three types: a. Carbon composition resistors are made by mixing carbon grains with binding material (glue) and moduled in the form of rods. Wire leads are inserted at the two ends. After this an insulating material seals the resistor. Resistors are available in power ratings of 1/10, 1/8, 1/4 ,
  • 52. 1/2 , 1.2 watts and values from 1 ohm to 20 ohms. b. Carbon film resistors are made by deposition carbon film on a ceramic rod. They are cheaper than carbon composition resistors. c. Cement film resistors are made of thin carbon coating fired onto a solid ceramic substrate. The main purpose is to have more precise resistance values and greater stability with heat. They are made in a small square with leads. Metal Film Resistors: They are also called thin film resistors. They are made of a thin metal coating deposited on a cylindrical insulating support. The high resistance values are not precise in value; however, such resistors are free of inductance effect that is common in wire wound resistors at high frequency. Variable Resistors: Potentiometer is a resistor where values can be set depending on the requirement. Potentiometer is widely used in electronics systems. Examples are volume control, tons control, brightness and contrast control of radio or T.V. sets. Fusible Resistors: These resistors are wire wound type and are used in T.V. circuits for protection. They have resistance of less than 15 ohms. Their function is similar to a fuse made to blow off whenever current in the circuit exceeds the limit. Resistance of a wire is directly proportional to its length and inversely proportional to its thickness. R L R 1/A
  • 53. RESISTOR COLOR CODE Example: 1k or 1000 ohms 1st 2nd 3rd 4th
  • 54. Band1 Band 2 Band 3 Band 4 COLOUR CODES COLOUR NUMBE R MULTIPLI ER COLOUR TOLERANC E Black Brown Red Orange Yellow Green Blue Violet Grey White Gold Silver 0 1 2 3 4 5 6 7 8 9 100 101 102 103 104 105 106 107 108 109 10-1 10-2 Gold Silver No colour 5% 10% 20% CAPACITORS A capacitor can store charge, and its capacity to store charge is called capacitance. Capacitors consist of two conducting plates, separated by an insulating material (known as dielectric). The two plates are joined with two leads. The dielectric could be air, mica, paper, ceramic, polyester,
  • 55. polystyrene, etc. This dielectric gives name to the capacitor. Like paper capacitor, mica capacitor etc. Types of capacitors: Capacitors can be broadly classified in two categories, i.e., Electrolytic capacitors and Non-Electrolytic capacitors as shown if the figure above. Electrolytic Capacitor: Electrolytic capacitors have an electrolyte as a dielectric. When such an electrolyte is charged, chemical changes takes place in the electrolyte. If its one plate is charged positively, same plate must be charged positively in future. We call such capacitors as polarized. Normally we see electrolytic capacitor as polarized capacitors and the leads are marked with positive or negative on the can. Non-electrolyte capacitors have dielectric Capacitor Fixed capacitor Variable capacitor Electrolytic Non-Electrolytic Pape
  • 56. material such as paper, mica or ceramic. Therefore, depending upon the dielectric, these capacitors are classified. Mica Capacitor: It is sandwich of several thin metal plates separated by thin sheets of mica. Alternate plates are connected together and leads attached for outside connections. The total assembly is encased in a plastic capsule or Bakelite case. Such capacitors have small capacitance value (50 to 500pf) and high working voltage (500V and above). The mica capacitors have excellent characteristics under stress of temperature variation and high voltage application. These capacitors are now replaced by ceramic capacitors. Ceramic Capacitor: Such capacitors have disc or hollow tabular shaped dielectric made of ceramic material such as titanium dioxide and barium titanate. Thin coating of silver compounds is deposited on both sides of dielectric disc, which acts as capacitor plates. Leads are attached to each sides of the dielectric disc and whole unit is encapsulated in a moisture proof coating. Disc type capacitors have very high value up to 0.001uf. Their working voltages range from 3V to 60000V. These capacitors have very low leakage current. Breakdown voltage is very high. Paper Capacitor: It consists of thin foils, which are separated by thin paper or waxed paper. The sandwich of foil and paper is then rolled into a cylindrical shape and enclosed in a paper tube or encased in a plastic capsules. The lead at each end of the capacitor is internally attached to the metal foil. Paper capacitors have capacitance
  • 57. ranging from 0.0001uf to 2.0uf and working voltage rating as high as 2000V. THE DIODE Diodes are polarized, which means that they must be inserted into the PCB the correct way round. This is because an electric current will only flow through them in one direction (like air will only
  • 58. flow one way trough a tyre valve). Diodes have two connections, an anode and a cathode. The cathode is always identified by a dot, ring or some other mark. The PCB is often marked with a +sign for the cathode end. Diodes come in all shapes and sizes. They are often marked with a type number. Detailed characteristics of a diode can be found by looking up the type number in a data book. If you know how to measure resistance with a meter then test some diodes. A good one has low resistance in one direction and high in other. They are specialized types of diode available such as the zener and light emitting diode (LED). SYMBOLS OF DIFFERENT DIODES anode cathode simple diode zener diode +
  • 59. IC IC (Integrated Circuit) means that all the components of the circuit are fabricated on same chip. Digital ICs are a collection of resistors, diodes, and transistors fabricated on a single piece of semiconductor, usually silicon called a substrate, which is commonly referred to as ‘wafer’. The chip is enclosed in a protective plastic or ceramic package from which pins extend out connecting the IC to other device. Suffix N or P stands for dual-in-line (plastic package (DIP)) while suffix J or I stands for dual-in-lime ceramic package. Also the suffix for W stands for flat ceramic package. The pins are numbered counter clockwise when viewed from the top of the package with respect to an identity notch or dot at one end of the chip.The manufacturer’s name can usually be guessed from its logo that is printed on the IC. The IC type number also indicates the manufacturer’s code. For e.g. DM 408 N SN 7404 indicates National Semiconductor and Texas Instruments. Other examples are: Fair Child : UA, UAF National Semiconductor : DM, LM, LH, LF, and TA. Motorola : MC, MFC. Sprague : UKN, ULS, ULX.
  • 60. Signetic : N/s, NE/SE, and SU. Burr-Brown : BB. Texas Instruments : SN. The middle portion i.e. the IC type number tells about the IC function and also the family, which the particular IC belongs to.IC’s that belongs to standard TTL series have an identification number that starts with 74; for e.g. 7402, 74LS04, 74S04 etc. IC’s that belongs to standard CMOS family their number starts with 4, like 4000, 451B, 4724B, 1400. The 74C, 74HC, 74AC & 74ACT series are newer CMOS series. Various series with TTL logic family are:- Standard TTL 74. Schottky TTL 74s. Low power Schottky 74LS. Advance Schottky 74AS. Advanced Low Power Schottky 74ALs. Also there are various series with CMOS logic family as metal state CMOS 40 or 140. Power Supply For TTL circuits, the power supply pin is labeled Vcc and its nominal value. For CMOS ICs, the power supply pin is labeled as VDD & its nominal value range from T3 to 18V.
  • 61. Unconnected Inputs An unconnected input is called “floating input”. The floating TTL input acts as logic 1. High level is applied to it. This characteristic is often used when testing a TTL circuit. A floating TTL input will measure a DC level between 1.4V to 1.8V when checked with VOM as oscilloscope. If a CMOS input is left floating, it may have disastrous results. The IC may become overheated and eventually destroy itself. For this reason, all inputs to CMOS circuit must be connected to a LOW or HIGH level or to the output of another IC. RELAYS STRIP OUT N/C OUT N/O SPRING MAGNET 230V P
  • 62. Error: Reference source not found A relay is an electrically operated switch. The relay contacts can be made to operate in the pre-arranged fashion. For instance, normally open contacts close and normally closed contacts open. In electromagnetic relays, the contacts however complex they might be, they have only two position i.e. OPEN and CLOSED, whereas in case of electromagnetic switches, the contacts can have multiple positions. NEED FOR THE USE OF RELAY The reason behind using relay for switching loads is to provide complete electrical isolation. The means that there is no electrical connection between the driving circuits and the driven circuits. The driving circuit may be low voltage operated low power circuits that control several kilowatts of power. In our circuit where a high fan could be switched on or off depending upon the output from the telephone. Since the relay circuit operated on a low voltage, the controlling circuit is quite safe. In an electromagnetic relay the armature is pulled by a magnetic force only. There is no electrical connection between the coil of a relay and the switching contacts of the relay. If there are more than one contact they all are electrically isolated from each other by mounting them on insulating plates and washers. Hence they can be wired to control different circuits independently. Some of the popular contacts forms are described below: 1. Electromagnetic relay 2. Power Relay. 3. Time Delay Relay. 4. Latching Relay. 5. Crystal Can Relay. 6. Co-axial Relay.
  • 63. 1. Electromagnetic relay: An electromagnetic relay in its simplest form consists of a coil, a DC current passing through which produces a magnetic field. This magnetic field attracts an armature, which in turn operates the contacts. Normally open contacts close and normally closed contacts open. Electromagnetic relays are made in a large variety of contacts forms. 2. Power relays: Power relays are multi-pole heavy duty lapper type relays that are capable of switching resistive loads of upto 25amp.. These relays are widely used for a variety of industrial application like control of fractional horse power motors, solenoids, heating elements and so on. These relays usually have button like silver alloy contacts and the contact welding due to heavy in rush current is avoided by wiping action of the contacts to quench the arc during high voltage DC switching thus avoiding the contact welding. 3. Time Delay Relay: A time delay relay is the one in which there is a desired amount of time delay between the application of the actuating signal and operation of the load switching devices.
  • 64. 4. Latching Relay: In a Latching Relay, the relay contacts remain in the last energized position even after removal of signal in the relay control circuit. The contacts are held in the last relay-energized position after removal of energisation either electrically or magnetically. The contacts can be released to the normal position electrically or mechanically. 5. Crystal Can Relay: They are so called, as they resemble quartz crystal in external shapes. These are high performance hermetically sealed miniature or sub-miniature relay widely used in aerospace and military application. These relays usually have gold plated contacts and thus have extremely low contact resistance. Due to low moment of inertia of the armature and also due to statically and dynamically balanced nature of armature, these relays switch quite reliably even under extreme condition of shock and vibration. 6. Co-axial Relay: A Co-axial Relay has two basic parts, an actuator which is nothing but some kind of a coil and a cavity, housing the relay contacts. The co-axial relay are extensively used for radio frequency switching operations of equipment
  • 65. THE JUNCTION TRANSISTOR Collector Collector Base Base Emitter Emitter C C B B E E NPN PNP _ _ _ _ _ _ _ _ _ _ + + + + + _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ + + + + + + + + + + + + + + + + + + + + + + + + + + + + -- -- -- --
  • 66. Junction transistors consists of two junctions made from N-type and P-Junction transistors consists of two junctions made from N-type and P- type semiconductor materials and are called bipolar transistors (twotype semiconductor materials and are called bipolar transistors (two polarities). They have three connections emitter, base, and collector.polarities). They have three connections emitter, base, and collector. TRANSISTOR CURRENTSTRANSISTOR CURRENTS CollectorCollector CurrentCurrent IIcc IIbb Base currentBase current EmitterEmitter IIee currentcurrent IIee == IIbb++IIcc The forward biased base/emitter junction causes electrons to beThe forward biased base/emitter junction causes electrons to be attracted from the emitter area towards the base. Arriving in the baseattracted from the emitter area towards the base. Arriving in the base area, most of the negative electrons come under the influence of thearea, most of the negative electrons come under the influence of the more positive collector and are attracted by it. This is shown in the leftmore positive collector and are attracted by it. This is shown in the left
  • 67. hand drawing, where the base current plus collector current equals thehand drawing, where the base current plus collector current equals the emitter current. Alpha gain is collector current divided by emitteremitter current. Alpha gain is collector current divided by emitter current, and is always less than 1. Beta gain is collector current dividedcurrent, and is always less than 1. Beta gain is collector current divided by base current and can be fairly high number. Therefore, causing aby base current and can be fairly high number. Therefore, causing a small base current to flow makes a much larger collector current tosmall base current to flow makes a much larger collector current to flow. A small base current controls a large collector current. There isflow. A small base current controls a large collector current. There is 0.6 volts across the baseemitter junction, where it is forward biased0.6 volts across the baseemitter junction, where it is forward biased (0.3 volts for germanium).(0.3 volts for germanium). How to control sensors What is a voltage divider? You are going to find out but don't be in too much of a hurry. Work through the Chapter and allow the explanation to develop. The diagram below shows a light dependent resistor, or LDR, together with its circuit symbol: The light-sensitive part of the LDR is a wavy track of cadmium sulphide. Light energy triggers the release of extra charge carriers in this material, so that its resistance falls as the level of illumination increases.
  • 68. A light sensor uses an LDR as part of a voltage divider. The essential circuit of a voltage divider, also called a potential divider, is: What happens if one of the resistors in the voltage divider is replaced by an LDR? In the circuit below, Rtop is a 10 resistor, and an LDR is used as Rbottom : Suppose the LDR has a resistance of 500 , 0.5 , in bright light, and 200 in the shade (these values are reasonable). When the LDR is in the light, Vout will be:
  • 69. In the shade, Vout will be: In other words, this circuit gives a LOW voltage when the LDR is in the light, and a HIGH voltage when the LDR is in the shade. The voltage divider circuit gives an output voltage which changes with illumination. A sensor subsystem which functions like this could be thought of as a 'dark sensor' and could be used to control lighting circuits which are switched on automatically in the evening. Perhaps this does not seem terribly exciting, but almost every sensor circuit you can think of uses a voltage divider. There's just no other way to make sensor subsystems work. Here is the voltage divider built with the LDR in place of Rtop : Temperature sensors A temperature-sensitive resistor is called a thermistor. There are several different types:
  • 70. The resistance of most common types of thermistor decreases as the temperature rises. They are called negative temperature coefficient, or ntc, thermistors. Note the -t° next to the circuit symbol. A typical ntc thermistor is made using semiconductor metal oxide materials. (Semiconductors have resistance properties midway between those of conductors and insulators.) As the temperature rises, more charge carriers become available and the resistance falls. Although less often used, it is possible to manufacture positive temperature coefficient, or ptc, thermistors. These are made of different materials and show an increase in resistance with temperature. How could you make a sensor circuit for use in a fire alarm? You want a circuit which will deliver a HIGH voltage when hot conditions are detected. You need a voltage divider with the ntc thermistor in the Rtop position:
  • 71. How could you make a sensor circuit to detect temperatures less than 4°C to warn motorists that there may be ice on the road? You want a circuit which will give a HIGH voltage in cold conditions. You need a voltage divider with the thermistor in place of Rbottom : This last application raises an important question: How do you know what value of Vout you are going to get at 4°C? Key point: The biggest change in Vout from a voltage divider is obtained when Rtop and Rbottom are equal in value Sound sensors
  • 72. Another name for a sound sensor is a microphone. The diagram shows a cermet microphone: Cermet' stands for 'ceramic' and 'metal'. A mixture of these materials is used in making the sound-sensitive part of the microphone. To make them work properly, cermet microphones need a voltage, usually around 1.5 V across them. A suitable circuit for use with a 9 V supply is:
  • 73. The 4.7 and the 1 resistors make a voltage divider which provides 1.6 V across the microphone. Sound waves generate small changes in voltage, usually in the range 10- 20 mV. To isolate these small signals from the steady 1.6 V, a capacitor is used. Signals from switches When a switch is used to provide an input to a circuit, pressing the switch usually generates a voltage signal. It is the voltage signal which triggers the circuit into action. What do you need to get the switch to generate a voltage signal? . . . You need a voltage divider. The circuit can be built in either of two ways: The pull down resistor in the first circuit forces Vout to become LOW except when the push button switch is operated. This circuit delivers a HIGH voltage when the switch is pressed. A resistor value of 10 is often used.
  • 74. In the second circuit, the pull up resistor forces Vout to become HIGH except when the switch is operated. Pressing the switch connects Vout directly to 0 V. In other words, this circuit delivers a LOW voltage when the switch is pressed. In circuits which process logic signals, a LOW voltage is called 'logic 0' or just '0', while a HIGH voltage is called 'logic1' or '1'. These voltage divider circuits are perfect for providing input signals for logic systems. What kinds of switches could you use. One variety of push button switch is called a miniature tactile switch. These are small switches which work well with prototype board: As you can see, the switch has four pins which are linked in pairs by internal metal strips. Pressing the button bridges the contacts and closes the switch. The extra pins are useful in designing printed circuit boards for keyboard input and also stop the switch from being moved about or bent once soldered into position. There are lots of other switches which you might want to use in a voltage divider configuration. These include magnetically-operated reed switches, tilt switches and pressure pads, all with burglar alarm applications.
  • 75. Transistor Circuits This page explains the operation of transistors in circuits. Practical matters such as testing, precautions when soldering and identifying leads are covered by the Transistors page. General: Types | Currents | Functional model | Darlington pair Switching: Introduction | Use relay? | IC output | for NPN | and PNP | Sensors | Inverter Next Page: Analogue and Digital Systems Also See: Transistors (soldering, lead identification) Types of transistor There are two types of standard transistors, NPN and PNP, with different circuit symbols. The letters refer to the layers of semiconductor material used to make the transistor. Most transistors used today are NPN because this is the easiest type to make from silicon. This page is mostly about NPN transistors and if you are new to electronics it is best to start by learning how to use these first. The leads are labelled base (B), collector (C) and emitter (E). These terms refer to the internal operation of a transistor but they are not much help in understanding how a transistor is used, so just treat them as labels! A Darlington pair is two transistors connected together to give a very high current gain. In addition to standard (bipolar junction) transistors, there are field-effect transistors which are usually referred to as FETs. They have different circuit symbols and properties and they are not (yet) covered by this page. Transistor currents The diagram shows the two current paths through a transistor. You can build this circuit with two standard 5mm red LEDs and any general purpose low power NPN transistor (BC108, BC182 or BC548 for example). Transistor circuit symbols
  • 76. The small base current controls the larger collector current. When the switch is closed a small current flows into the base (B) of the transistor. It is just enough to make LED B glow dimly. The transistor amplifies this small current to allow a larger current to flow through from its collector (C) to its emitter (E). This collector current is large enough to make LED C light brightly. When the switch is open no base current flows, so the transistor switches off the collector current. Both LEDs are off. A transistor amplifies current and can be used as a switch. This arrangement where the emitter (E) is in the controlling circuit (base current) and in the controlled circuit (collector current) is called common emitter mode. It is the most widely used arrangement for transistors so it is the one to learn first. Functional model of an NPN transistor The operation of a transistor is difficult to explain and understand in terms of its internal structure. It is more helpful to use this functional model: • The base-emitter junction behaves like a diode. • A base current IB flows only when the voltage VBE across the base-emitter junction is 0.7V or more. • The small base current IB controls the large collector current Ic. • Ic = hFE × IB (unless the transistor is full on and saturated) hFE is the current gain (strictly the DC current gain), a typical value for hFE is 100 (it has no units because it is a ratio) • The collector-emitter resistance RCE is controlled by the base current IB: o IB = 0 RCE = infinity transistor off o IB small RCE reduced transistor partly on o IB increased RCE = 0 transistor full on ('saturated') Additional notes: • A resistor is often needed in series with the base connection to limit the base current IB and prevent the transistor being damaged. • Transistors have a maximum collector current Ic rating. • The current gain hFE can vary widely, even for transistors of the same type! • A transistor that is full on (with RCE = 0) is said to be 'saturated'. • When a transistor is saturated the collector-emitter voltage VCE is reduced to almost 0V. • When a transistor is saturated the collector current Ic is determined by the supply voltage and the external resistance in the collector circuit, not by the transistor's
  • 77. current gain. As a result the ratio Ic/IB for a saturated transistor is less than the current gain hFE. • The emitter current IE = Ic + IB, but Ic is much larger than IB, so roughly IE = Ic. There is a table showing technical data for some popular transistors on the transistors page. Darlington pair This is two transistors connected together so that the current amplified by the first is amplified further by the second transistor. The overall current gain is equal to the two individual gains multiplied together: Darlington pair current gain, hFE = hFE1 × hFE2 (hFE1 and hFE2 are the gains of the individual transistors) This gives the Darlington pair a very high current gain, such as 10000, so that only a tiny base current is required to make the pair switch on. A Darlington pair behaves like a single transistor with a very high current gain. It has three leads (B, C and E) which are equivalent to the leads of a standard individual transistor. To turn on there must be 0.7V across both the base-emitter junctions which are connected in series inside the Darlington pair, therefore it requires 1.4V to turn on. Darlington pairs are available as complete packages but you can make up your own from two transistors; TR1 can be a low power type, but normally TR2 will need to be high Touch switch circuit
  • 78. power. The maximum collector current Ic(max) for the pair is the same as Ic(max) for TR2. A Darlington pair is sufficiently sensitive to respond to the small current passed by your skin and it can be used to make a touch-switch as shown in the diagram. For this circuit which just lights an LED the two transistors can be any general purpose low power transistors. The 100k resistor protects the transistors if the contacts are linked with a piece of wire. Using a transistor as a switch When a transistor is used as a switch it must be either OFF or fully ON. In the fully ON state the voltage VCE across the transistor is almost zero and the transistor is said to be saturated because it cannot pass any more collector current Ic. The output device switched by the transistor is usually called the 'load'. The power developed in a switching transistor is very small: • In the OFF state: power = Ic × VCE, but Ic = 0, so the power is zero. • In the full ON state: power = Ic × VCE, but VCE = 0 (almost), so the power is very small. This means that the transistor should not become hot in use and you do not need to consider its maximum power rating. The important ratings in switching circuits are the maximum collector current Ic(max) and the minimum current gain hFE(min). The transistor's voltage ratings may be ignored unless you are using a supply voltage of more than about 15V. There is a table showing technical data for some popular transistors on the transistors page. For information about the operation of a transistor please see the functional model above. Protection diode If the load is a motor, relay or solenoid (or any other device with a coil) a diode must be connected across the load to protect the transistor from the brief high voltage produced when the load is switched off. The diagram shows how a protection diode is connected 'backwards' across the load, in this case a relay coil. Current flowing through a coil creates a magnetic field which collapses suddenly when the current is switched off. The sudden collapse of the magnetic field induces a brief high voltage across the coil which is very likely to damage transistors and ICs. The protection diode allows the induced voltage to drive a brief
  • 79. current through the coil (and diode) so the magnetic field dies away quickly rather than instantly. This prevents the induced voltage becoming high enough to cause damage to transistors and ICs. When to use a relay Transistors cannot switch AC or high voltages (such as mains electricity) and they are not usually a good choice for switching large currents (> 5A). In these cases a relay will be needed, but note that a low power transistor may still be needed to switch the current for the relay's coil! Advantages of relays: • Relays can switch AC and DC, transistors can only switch DC. • Relays can switch high voltages, transistors cannot. • Relays are a better choice for switching large currents (> 5A). • Relays can switch many contacts at once. Disadvantages of relays: • Relays are bulkier than transistors for switching small currents. • Relays cannot switch rapidly, transistors can switch many times per second. • Relays use more power due to the current flowing through their coil. • Relays require more current than many ICs can provide, so a low power transistor may be needed to switch the current for the relay's coil. Connecting a transistor to the output from an IC Relays Photographs © Rapid Electronics
  • 80. Most ICs cannot supply large output currents so it may be necessary to use a transistor to switch the larger current required for output devices such as lamps, motors and relays. The 555 timer IC is unusual because it can supply a relatively large current of up to 200mA which is sufficient for some output devices such as low current lamps, buzzers and many relay coils without needing to use a transistor. A transistor can also be used to enable an IC connected to a low voltage supply (such as 5V) to switch the current for an output device with a separate higher voltage supply (such as 12V). The two power supplies must be linked, normally this is done by linking their 0V connections. In this case you should use an NPN transistor. A resistor RB is required to limit the current flowing into the base of the transistor and prevent it being damaged. However, RB must be sufficiently low to ensure that the transistor is thoroughly saturated to prevent it overheating, this is particularly important if the transistor is switching a large current (> 100mA). A safe rule is to make the base current IB about five times larger than the value which should just saturate the transistor. Choosing a suitable NPN transistor The circuit diagram shows how to connect an NPN transistor, this will switch on the load when the IC output is high. If you need the opposite action, with the load switched on when the IC output is low (0V) please see the circuit for a PNP transistor below. The procedure below explains how to choose a suitable switching transistor. 1. The transistor's maximum collector current Ic(max) must be greater than the load current Ic. load current Ic = supply voltage Vs load resistance RL NPN transistor switch (load is on when IC output is high) Using units in calculations Remember to use V, A and or V, mA and k . For more details please see the Ohm's Law page.
  • 81. 2. The transistor's minimum current gain hFE(min) must be at least five times the load current Ic divided by the maximum output current from the IC. hFE(min) > 5 × load current Ic max. IC current 3. Choose a transistor which meets these requirements and make a note of its properties: Ic(max) and hFE(min). There is a table showing technical data for some popular transistors on the transistors page. 4. Calculate an approximate value for the base resistor: RB = Vc × hFE where Vc = IC supply voltage (in a simple circuit with one supply this is Vs)5 × Ic 5. For a simple circuit where the IC and the load share the same power supply (Vc = Vs) you may prefer to use: RB = 0.2 × RL × hFE 6. Then choose the nearest standard value for the base resistor. 7. Finally, remember that if the load is a motor or relay coil a protection diode is required. Example The output from a 4000 series CMOS IC is required to operate a relay with a 100 coil. The supply voltage is 6V for both the IC and load. The IC can supply a maximum current of 5mA. 1. Load current = Vs/RL = 6/100 = 0.06A = 60mA, so transistor must have Ic(max) > 60mA. 2. The maximum current from the IC is 5mA, so transistor must have hFE(min) > 60 (5 × 60mA/5mA). 3. Choose general purpose low power transistor BC182 with Ic(max) = 100mA and hFE(min) = 100. 4. RB = 0.2 × RL × hFE = 0.2 × 100 × 100 = 2000 . so choose RB = 1k8 or 2k2. 5. The relay coil requires a protection diode. Choosing a suitable PNP transistor The circuit diagram shows how to connect a PNP transistor, this will switch on the load when the IC output is low (0V). If you need the opposite action, with the load switched on when the IC output is high please see the circuit for an NPN transistor above. PNP transistor switch (load is on when IC output is low)
  • 82. The procedure for choosing a suitable PNP transistor is exactly the same as that for an NPN transistor described above. Using a transistor switch with sensors The top circuit diagram shows an LDR (light sensor) connected so that the LED lights when the LDR is in darkness. The variable resistor adjusts the brightness at which the transistor switches on and off. Any general purpose low power transistor can be used in this circuit. The 10k fixed resistor protects the transistor from excessive base current (which will destroy it) when the variable resistor is reduced to zero. To make this circuit switch at a suitable brightness you may need to experiment with different values for the fixed resistor, but it must not be less than 1k . If the transistor is switching a load with a coil, such as a motor or relay, remember to add a protection diode across the load. The switching action can be inverted, so the LED lights when the LDR is brightly lit, by swapping the LDR and variable resistor. In this case the fixed resistor can be omitted because the LDR resistance cannot be reduced to zero. LED lights when the LDR is dark LED lights when the LDR is bright
  • 83. Note that the switching action of this circuit is not particularly good because there will be an intermediate brightness when the transistor will be partly on (not saturated). In this state the transistor is in danger of overheating unless it is switching a small current. There is no problem with the small LED current, but the larger current for a lamp, motor or relay is likely to cause overheating. Other sensors, such as a thermistor, can be used with this circuit, but they may require a different variable resistor. You can calculate an approximate value for the variable resistor (Rv) by using a multimeter to find the minimum and maximum values of the sensor's resistance (Rmin and Rmax): Variable resistor, Rv = square root of (Rmin × Rmax) For example an LDR: Rmin = 100 , Rmax = 1M , so Rv = square root of (100 × 1M) = 10k . You can make a much better switching circuit with sensors connected to a suitable IC (chip). The switching action will be much sharper with no partly on state. A transistor inverter (NOT gate) Inverters (NOT gates) are available on logic ICs but if you only require one inverter it is usually better to use this circuit. The output signal (voltage) is the inverse of the input signal: • When the input is high (+Vs) the output is low (0V). • When the input is low (0V) the output is high (+Vs). Any general purpose low power NPN transistor can be used. For general use RB = 10k and RC = 1k , then the inverter output can be connected to a device with an input impedance (resistance) of at least 10k such as a logic IC or a 555 timer (trigger and reset inputs). If you are connecting the inverter to a CMOS logic IC input (very high impedance) you can increase RB to 100k and RC to 10k , this will reduce the current used by the inverter.
  • 84. List of activities to be carried Out to complete the Project- 0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2 Study PCB design Troubleshooting Weeks In First weeks I will collect study material and circuit diagram. I will finalized circuit and detail. In next week I will test circuit on simulation softare proteus or bread board. Proteus is simulation software. In Next we will make PCB on copper clad Board. After it we will do programming and soldering. After soldering we will Test circuit. If there will be any problem then we will do repair of it. After completion of project we will make report. Applications: 1. Attendance System 2.electronics voting machine for polls
  • 85. 3.for commercial voting machine 4. for quiz purposes. 5. Access control System Advantages: low cost flexible portable easy to make component easily available Conclusion: Finally project is working . it was tough to program controller . it was tough to interface to mcu with RFID reader. Program 1. #include<reg51.h> sbit RS=P3^7; sbit EN=P3^6; sbit R=P3^2; sbit bz=P1^7; void Rxmsg(void); void lcdinit(void); void lcdData(unsigned char l); void lcdcmd(unsigned char k); void DelayMs(unsigned int count); void sucessRx(void); void unknown(void); void display(unsigned char s, t);
  • 86. void welcome(void); void main() { unsigned char i=0; unsigned int j=0; unsigned char c[15]; TMOD=0x20; // Configure the serial port to 9600 baud rate TH1=0xFD; SCON=0X50; TR1=1; R=0; lcdinit(); welcome(); bz=1; while(1) { back: for(i=0;i<15;i++) //command to recv data { c[i]=0xFF; } while(RI==0); for(i=0;i<15;i++)
  • 87. //command to recv data { j=0; while(RI==0) { if(j>=1000) goto timeout; j++; } c[i]=SBUF; RI=0; } timeout: for(i=0;i<15;i++) { if(c[i]=='1' && c[i+1]=='E' && c[i+2]=='0' && c[i+3]=='0' && c[i+4]=='7' && c[i+5]=='C' && c[i+6]=='A' && c[i+7]=='0' && c[i+8]=='3' && c[i+9]=='C') { sucessRx(); DelayMs(1000); R=1; bz=0; DelayMs(1000); R=0; bz=1; DelayMs(1000); lcdinit(); DelayMs(100); welcome(); goto back; } } unknown(); DelayMs(2000); bz=0; DelayMs(2000);
  • 88. bz=1; DelayMs(1000); lcdinit(); DelayMs(100); welcome(); } } void sucessRx() { unsigned int i=0; unsigned char c[]="ACCESS GRANTED "; lcdcmd(0x01); DelayMs(10); lcdcmd(0x80); DelayMs(10); while(c[i]!='0') { lcdData(c[i]); i++; } } void unknown(void) { unsigned int i=0; unsigned char c[]="ACCESS DENIED"; lcdcmd(0x01); DelayMs(10); lcdcmd(0x80); DelayMs(10); while(c[i]!='0') { lcdData(c[i]); i++; }
  • 89. } //--------------------------------------- // Lcd initialization subroutine //--------------------------------------- void lcdinit(void) { lcdcmd(0x38); DelayMs(250); lcdcmd(0x0E); DelayMs(250); lcdcmd(0x01); DelayMs(250); lcdcmd(0x06); DelayMs(250); lcdcmd(0x80); DelayMs(250); } //--------------------------------------- // Lcd data display //--------------------------------------- void lcdData(unsigned char l) { P2=l; RS=1; EN=1; DelayMs(1); EN=0; return; } //--------------------------------------- // Lcd command //--------------------------------------- void lcdcmd(unsigned char k) { P2=k; RS=0; EN=1;
  • 90. DelayMs(1); EN=0; return; } //--------------------------------------- // Delay mS function //--------------------------------------- void DelayMs(unsigned int count) { // mSec Delay 11.0592 Mhz unsigned int i; // Keil v7.5a while(count) { i = 115; // 115 exact value while(i>0) i--; count--; } } void welcome(void) { unsigned int i=0; unsigned char c[]="RFID READER"; unsigned char d[]="SYSTEM"; lcdcmd(0x01); DelayMs(10); lcdcmd(0x80); DelayMs(10); while(c[i]!='0') { lcdData(c[i]);
  • 91. i++; } lcdcmd(0xc0); i=0; while(d[i]!='0') { lcdData(d[i]); i++; } } ; ************************************************************* ***** RS BIT P2.5 RW BIT P2.4 E BIT P2.3 FL BIT P0.7 buzz BIT P3.7 LCD EQU P0 C1 EQU 31H C2 EQU 32H C3 EQU 33H ORG 00H AJMP START ORG 30H START: MOV LCD,#00H MOV C1,#0 MOV C2,#0 MOV C3,#0 MOV A,#38H ;2*16 MATRIX ACALL COMMAND MOV A,#38H ;2*16 MATRIX ACALL COMMAND MOV A,#02 ;RETURN HOME ACALL COMMAND
  • 92. MOV A,#01 ;CLEAR DISPLAY SCREEN ACALL COMMAND MOV A,#0CH ;DISPLAY ON CURSOR OFF ACALL COMMAND MOV A,#80H ;MOVE CURSOR TO FIRST LINE SECOND COLOUMN ACALL COMMAND MOV DPTR,#TABLE1 ;DISPLAY ERP ACALL DISPLAY ACALL DELAY1 MOV R1,#00 MOV R0,#00 MOV R2,#00 MOV R3,#00 MOV R4,#00 MOV R5,#00 MOV A,#80H ;MOVE CURSOR TO FIRST LINE SECOND COLOUMN ACALL COMMAND MOV DPTR,#TABLE1 ;DISPLAY ERP ACALL DISPLAY MOV A,#0C0H ;MOVE CURSOR TO FIRST LINE SECOND COLOUMN ACALL COMMAND MOV DPTR,#TABLE7 ;DISPLAY ERP ACALL DISPLAY MAIN: jnb p1.0,act1 jnb p1.1,act2 jnb p1.2,act3 jnb p1.3,act4 jnb p1.4,act5 ; CHECK ATTENDENCE jnb p1.5,act6 jnb p1.6,act7 jnb p1.7,act8 JNB P3.0,START JB P3.1,MAIN acall READING41 SJMP MAIN
  • 93. act1: INC R0 INC R4 cpl p2.0 ACALL BUZZE ACALL READING5 SJMP MAIN act2: INC R1 INC R4 ACALL BUZZE cpl p2.1 ACALL READING5 SJMP MAIN act3: INC R2 INC R4 ACALL BUZZE cpl p2.2 ACALL READING5 SJMP MAIN act4: INC R3 INC R4 ACALL BUZZE cpl p2.6 ACALL READING5 SJMP MAIN act5: ACALL READING1 SJMP MAIN act6: ACALL READING2 SJMP MAIN act7: ACALL READING3 SJMP MAIN act8: ACALL READING4
  • 94. SJMP MAIN READING5: ACALL LCDCLR MOV A,#0C0H ;MOVE CURSOR TO FIRST LINE SECOND COLOUMN ACALL COMMAND MOV DPTR,#TABLE6 ;DISPLAY ERP ACALL DISPLAY SJMP MAIN READING1: ACALL LCDCLR MOV A,#0C0H ACALL COMMAND MOV DPTR,#TABLE2 ACALL DISPLAY MOV A,#0CAH ACALL COMMAND MOV A,R0 ACALL HTD ACALL OUT1 AJMP MAIN READING2: ACALL LCDCLR MOV A,#0C0H ACALL COMMAND MOV DPTR,#TABLE3 ACALL DISPLAY MOV A,#0CAH ACALL COMMAND MOV A,R1 ACALL HTD ACALL OUT1 AJMP MAIN READING3: ACALL LCDCLR MOV A,#0C0H ACALL COMMAND
  • 95. MOV DPTR,#TABLE4 ACALL DISPLAY MOV A,#0CAH ACALL COMMAND MOV A,R2 ACALL HTD ACALL OUT1 AJMP MAIN READING4: ACALL LCDCLR MOV A,#0C0H ACALL COMMAND MOV DPTR,#TABLE5 ACALL DISPLAY MOV A,#0CAH ACALL COMMAND MOV A,R3 ACALL HTD ACALL OUT1 AJMP MAIN READING41: ACALL LCDCLR MOV A,#0C0H ACALL COMMAND MOV DPTR,#TABLE8 ACALL DISPLAY MOV A,#0CAH ACALL COMMAND MOV A,R4 ACALL HTD ACALL OUT1 AJMP MAIN BUZZE: clr buzz acall delay1
  • 96. ACALL delay1 ACALL delay1 ACALL delay1 SETB BUZZ RET HTD: ;CONVERT HEX(BINARY) TO ASCII MOV B,#10 DIV AB MOV C1,B MOV B,#10 DIV AB MOV C2,B MOV C3,A RET OUT1: MOV A,C3 ORL A,#30H ACALL WRITE MOV A,C2 ORL A,#30H ACALL WRITE MOV A,C1 ORL A,#30H ACALL WRITE RET LCDCLR: MOV A,#01H ;CLEAR DISPLAY SCREEN ACALL COMMAND RET ; DISPLAY DATA ON LCD DISPLAY: CLR A MOVC A,@A+DPTR JZ NEXT ACALL WRITE INC DPTR JMP DISPLAY NEXT: RET WRITE:
  • 97. ACALL CHKBUSY MOV LCD,A SETB RS CLR RW SETB E acall delay1 CLR E RET COMMAND: ACALL CHKBUSY MOV LCD,A CLR RS CLR RW SETB E acall delay1 CLR E RET delay1: MOV R6,#255 AGAIN1: MOV R7,#255 BACK1: DJNZ R7,BACK1 DJNZ R6,AGAIN1 RET TABLE1: DB 'ATTENDANCE SYSTEM',0 TABLE7: DB 'MARK THE ATTENDANCE ',0 TABLE2: DB 'CAND NO.1',0 TABLE3: DB 'CAND NO.2',0 TABLE4: DB 'CAND NO.3',0 TABLE5: DB 'CAND NO.4',0 TABLE6: DB 'ATTENDANCE MARKED',0 TABLE8: DB 'TOTAL ATTENDANCE',0 Statement of problem: 1. EEprom not working- when I was testing project voter rfid did not saved in eeprom. . I tested no. of time my program. Reason- problem in eeprom connection with Microcontroller.
  • 98. 2. RFid controller not giving output port0 and input to attendance ic at port1 Reason- Port 0 is open collector port. So it need pull up resistor. So I used 10k+5% -1/4 watt resistor. Structure- First of all bring RFid tag close to RFid reader RFID reader will display on LCD. When card in contact it will show card no and will show valid/invalid Mcu will give low pulse at pin p0.0 when card 1 detected P0.0 is connected to p1.0 of mcu2. It will show attendance marked Every time system will ask for rfid tag to mark attendance
  • 99. Final Result: Finally project is working. We marked the attendance with different card to different candidates. Hardware is working properly. Scope of Future Study- Benefit of this project is that a electronics RFID +GSM Attendance system could be provided to each candidate. It can be used for the safety & security purpose. Problems RFID reader rarely available in the market. BIBILIOGRAPHY 1. HAND BOOK OF ELECTRONICS A.K. MAINI. 2.HAND BOOK OF ELECTRONICS GUPTA & KUMAR. 3.LET US C YASHWANT KANITKAR. 4.SHYAM SERIES TATA MC GRILL. 5.DIGITAL SYSTEMS PRINCIPLES AND APPLICATION RONALD LTOCCI. (Sixth addition) 6.ELECTRONICS FOR YOU (MARCH 1998). 7.DIGITAL DESIGN MORIS MANO.
  • 100. (Second addition) 8.RELAYS AND ITS APPLICATION SHARMA, MC. (Bpb-publishers) 9.MODERN ALL ABOUT MOTHERBOARD LOTHIA, M. (Bpb-publishers) 10.POWER SUPPLY FOR ALL OCCASION SHARMA, MC. (Bpb-publishers) 11.CMOS DATA BOOK (74SERIES) ECA. (Bpb-publishers) 12.PRACTICAL VALUE AND TRANSISTOR DATA POPE. (Bpb-publishers) 13.PRACTICAL TRANSFORMER DESIGN HAND BOOK LABON. E. (Bpb-publishers) 14 MODERN IC MANAHAR LOTIA. (DATA AND SUBSTITUTIONAL MANUAL)