Documentos de Académico
Documentos de Profesional
Documentos de Cultura
Chapter 1
Introduction
1.1 Introduction:
The project aims automated toll collection system using the active RFID tags, vehicles are made to pass through a sensor system that is embedded on the highway just before the tollgate. The system will electronically classify the vehicle and calculate the exact amount to be paid by the vehicle owner, ensuring no pilferage of the toll amount.
BRECW, Hyderabad
Page 1
Mini-project report
Chapter 2
Overview of the technologies used
2.1 Embedded Systems:
An embedded system can be defined as a computing device that does a specific focused job. Appliances such as the air-conditioner, VCD player, DVD player, printer, fax machine, mobile phone etc. are examples of embedded systems. Each of these appliances will have a processor and special hardware to meet the specific requirement of the application along with the embedded software that is executed by the processor for meeting that specific requirement. The embedded software is also called firm ware. The desktop/laptop computer is a general purpose computer. You can use it for a variety of applications such as playing games, word processing, accounting, software development and so on. In contrast, the software in the embedded systems is always fixed. Embedded systems do a very specific task, they cannot be programmed to do different things. Embedded systems have very limited resources, particularly the memory. Generally, they do not have secondary storage devices such as the CDROM or the floppy disk. Embedded systems have to work against some deadlines. A specific job has to be completed within a specific time. In some embedded systems, called realtime systems, the deadlines are stringent. Missing a deadline may cause a catastropheloss of life or damage to property. Embedded systems are constrained for power. As many embedded systems operate through a battery, the power consumption has to be very low. Some embedded systems have to operate in extreme environmental conditions such as very high temperatures and humidity. Following are the advantages of Embedded Systems: 1. They are designed to do a specific task and have real time performance constraints which must be met. 2. They allow the system hardware to be simplified so costs are reduced. 3. They are usually in the form of small computerized parts in larger devices which serve a general purpose.
BRECW, Hyderabad
Page 2
Mini-project report
4. The program instructions for embedded systems run with limited computer hardware resources, little memory and small or even non-existent keyboard or screen.
Fig: 2.1 Three different RFID tags they come in all shapes and sizes.
BRECW, Hyderabad
Page 3
Mini-project report
Chapter 3
Hardware Implementation of the Project
This chapter briefly explains about the Hardware Implementation of the project. It discusses the design and working of the design with the help of block diagram and circuit diagram and explanation of circuit diagram in detail. It explains the features, timer programming, serial communication, interrupts of P89V51RD2 microcontroller. It also explains the various modules used in this project.
BRECW, Hyderabad
Page 4
Mini-project report
POWER SUPPLY
P 8
RF READER
MAX 232
9 V 5
LCD DISPLAY
CRYSTAL OSCILLATOR
L293D
MOTOR
1 R
RESET CIRCUIT
D 2
BRECW, Hyderabad
Page 5
Mini-project report
Fig 3.2 Components of a regulated power supply 3.2.1 Voltage regulator: As the name itself implies, it regulates the input applied to it. A voltage regulator is an electrical regulator designed to automatically maintain a constant voltage level. In this project, power supply of 5V and 12V are required. In order to obtain these voltage levels, 7805 and 7812 voltage regulators are to be used. The first number 78 represents positive supply and the numbers 05, 12 represent the required output voltage levels.
3.3 Microcontrollers:
Microprocessors and microcontrollers are widely used in embedded systems products. Microcontroller is a programmable device. A microcontroller has a CPU in addition to a fixed amount of RAM, ROM, I/O ports and a timer embedded all on a single chip. The fixed amount of on-chip ROM, RAM and number of I/O ports in microcontrollers makes them ideal for many applications in which cost and space are critical. Features of P89V51RD2: 80C51 CPU 5 V operating voltage from 0 MHz to 40 MHz 16/32/64 kB of on-chip ash user code memory with ISP and IAP Supports 12-clock (default) or 6-clock mode selection via software or ISP SPI and enhanced UART PCA with PWM and capture/compare functions Four 8-bit I/O ports with three high-current port 1 pins (16 mA each) Three 16-bit timers/counters Programmable watchdog timer Eight interrupt sources with four priority levels Second DPTR register
Page 6
BRECW, Hyderabad
Mini-project report
Low EMI mode (ALE inhibit) TTL- and CMOS-compatible logic levels
Fig 3.3 Pin diagram 3.3.1 Pin description: Vcc: Pin 40 provides supply voltage to the chip. The voltage source is +5V.
GND: Pin 20 is the ground. Port 0: Port 0 is an 8-bit open drain bidirectional I/O port. As an output port, each pin can sink eight TTL inputs. When 1s are written to port 0 pins, the pins can be used as high impedance inputs. Port 0 can also be configured to be the multiplexed low-order address/data bus during accesses to external program and data memory. In this mode, P0 has internal pull-ups. Port 0 also receives the code bytes during Flash programming and outputs the code bytes during Program verification. External pull-ups are required during program verification. Port 1: Port 1 is an 8-bit bidirectional I/O port with internal pull-ups. The Port 1 output buffers can sink/source four TTL inputs. When 1s are written to Port 1 pins, they are pulled high by the internal pull-ups and can be used as inputs. As inputs, Port 1 pins that are externally being pulled low will source current (IIL) because of the internal pull-ups. In addition, P1.0 and P1.1 can be configured to be the timer/counter 2 external count input (P1.0/T2) and the timer/counter 2 trigger input (P1.1/T2EX), respectively, as shown in the following table. Port 1 also receives the low-order address bytes during Flash programming and verification.
BRECW, Hyderabad
Page 7
Mini-project report
Port 2: Port 2 is an 8-bit bidirectional I/O port with internal pull-ups. The Port 2 output buffers can sink/source four TTL inputs. When 1s are written to Port 2 pins, they are pulled high by the internal pull-ups and can be used as inputs. As inputs, Port 2 pins that are externally being pulled low will source current (IIL) because of the internal pull-ups. Port 2 emits the high-order address byte during fetches from external program memory and during accesses to external data memory that uses 16-bit addresses (MOVX @ DPTR). In this application, Port 2 uses strong internal pull-ups when emitting 1s. During accesses to external data memory that uses 8-bit addresses (MOVX @ RI), Port 2 emits the contents of the P2 Special Function Register. The port also receives the high-order address bits and some control signals during Flash programming and verification. Port 3: Port 3 is an 8-bit bidirectional I/O port with internal pull-ups. The Port 3 output buffers can sink/source four TTL inputs. When 1s are written to Port 3 pins, they are pulled high by the internal pull-ups and can be used as inputs. As inputs, Port 3 pins that are externally being pulled low will source current (IIL) because of the pull-ups. Port 3 receives some control signals for Flash programming and verification. Port 3 also serves the functions of various special features of the P89V51RD2, as shown in the following table.
BRECW, Hyderabad
Page 8
Mini-project report
RST: Reset input high on this pin for two machine cycles while the oscillator is running resets the device. This pin drives high for 98 oscillator periods after the Watchdog times out. The DISRTO bit in SFR AUXR (address 8EH) can be used to disable this feature. In the default state of bit DISRTO, the RESET HIGH out feature is enabled. ALE/PROG (Address Latch Enable) is an output pulse for latching the low byte of the address during accesses to external memory. This pin is also the program pulse input (PROG) during Flash programming. In normal operation, ALE is emitted at a constant rate of 1/6 the oscillator frequency and may be used for external timing or clocking purposes. If desired, ALE operation can be disabled by setting bit 0 of SFR location 8EH. With the bit set, ALE is active only during a MOVX or MOVC instruction. Otherwise, the pin is weakly pulled high. Setting the ALE-disable bit has no effect if the microcontroller is in external execution mode. PSEN (Program Store Enable) is the read strobe to external program memory. When the P89V51RD2 is executing code from external program memory, PSEN is activated twice each machine cycle, except that two PSEN activations are skipped during each access to external data memory. EA/VPP (External Access Enable) EA must be strapped to GND in order to enable the device to fetch code from external program memory locations starting at 0000H up to FFFFH. Note, however, that if lock bit 1 is programmed, EA will be internally latched on reset. EA should be strapped to VCC for internal program executions. This pin also receives the 12-volt programming enable voltage (VPP) during Flash programming.
BRECW, Hyderabad Page 9
Mini-project report
XTAL1 Input to the inverting oscillator amplifier and input to the internal clock operating circuit. XTAL2 Output from the inverting oscillator amplifier.
Fig 3.3.2 External clock drive configuration XTAL1 and XTAL2 are the input and output, respectively, of an inverting amplifier that can be configured for use as an on-chip oscillator. Either a quartz crystal or ceramic resonator may be used. To drive the device from an external clock source, XTAL2 should be left unconnected while XTAL1 is driven. There are no requirements on the duty cycle of the external clock signal, since the input to the internal clocking circuitry is through a divide-by-two flip-flop, but minimum and maximum voltage high and low time specifications must be observed.
BRECW, Hyderabad
Page 10
Mini-project report
BRECW, Hyderabad
Page 11
Mini-project report
The schematic diagram for 'Power down' mode and 'Idle' mode is given as follows:
Fig 3.6 Schematic diagram for power down and idle mode implementation 3.6.1 Idle Mode: Idle mode is entered by setting IDL bit to 1 (i.e., IDL=1). The clock signal is gated off to CPU, but not to interrupt, timer and serial port functions. SP, PC, PSW, Accumulator and other registers maintain their data during IDLE mode. The port pins hold their logical states they had at the time Idle was initialized. ALE and PSEN (bar) are held at logic high levels. Ways to exit Idle Mode: 1. Activation of any enabled interrupt will clear PCON.0 bit and hence the Idle Mode is exited. The program goes to the Interrupt Service Routine (ISR). After RETI is executed at the end of ISR, the next instruction will start from the one following the instruction that enabled the Idle Mode. 2. A hardware reset exits the idle mode. The CPU starts from the instruction following the instruction that invoked the Idle mode. 3.6.2 Power Down Mode: The Power Down Mode is entered by setting the PD bit to 1. The internal clock to the entire microcontroller is stopped. However, the program is not dead. The Power down Mode is exited (PCON.1 is cleared to 0) by Hardware Reset only. The CPU starts from the next instruction where the Power down Mode was invoked. Port values are not changed/ overwritten in power down mode. Vcc can be reduced to 2V in Power down
BRECW, Hyderabad Page 12
Mini-project report
Mode. However Vcc has to be restored to normal value before Power down Mode is exited.
Table 3.6 Status of External pins during Idle and Power down Modes 3.7 Programming the Flash Parallel Mode:
The P89V51RD2 is shipped with the on-chip Flash memory array ready to be programmed. The programming interface needs a high-voltage (12-volt) program enable signal and is compatible with conventional third-party Flash or EPROM programmers. The P89V51RD2 code memory array is programmed byte-by-byte. 3.7.1 Programming Algorithm: Before programming the P89V51RD2, the address, data and control signals should be set up according to the Flash Programming Modes. To program the P89V51RD2, take the following steps: 1. Input the desired memory location on the address lines. 2. Input the appropriate data byte on the data lines. 3. Activate the correct combination of control signals. 4. Raise EA/VPP to 12V. 5. Pulse ALE/PROG once to program a byte in the Flash array or the lock bits. The byte write cycle is self-timed and typically takes no more than 50 s. Repeat steps 1 through 5, changing the address and data for the entire array or until the end of the object file is reached. 3.7.2 Serial Programming Algorithm To program and verify the P89V51RD2 in the serial programming mode, the following sequence is recommended: 1. Power-up sequence: a. Apply power between VCC and GND pins. b. Set RST pin to H. If a crystal is not connected across pins XTAL1 and XTAL2, apply a 3 MHz to 33 MHz clock to XTAL1 pin and wait for at least 10 milliseconds.
BRECW, Hyderabad Page 13
Mini-project report
2. Enable serial programming by sending the Programming Enable serial instruction to pin MOSI/P1.5. The frequency of the shift clock supplied at pin SCK/P1.7 needs to be less than the CPU clock at XTAL1 divided by 16. 3. The Code array is programmed one byte at a time in either the Byte or Page mode. The write cycle is self-timed and typically takes less than 0.5 ms at 5V. 4. Any memory location can be verified by using the Read instruction which returns the content at the selected address at serial output MISO/P1.6. 5. At the end of a programming session, RST can be set low to commence normal device operation.
Fig 3.7 Programming the flash memory After Reset signal is high, SCK should be low for at least 64 system clocks before it goes high to clock in the enable data bytes. No pulsing of Reset signal is necessary. SCK should be no faster than 1/16 of the system clock at XTAL1. For Page Read/Write, the data always starts from byte 0 to 255. After the command byte and upper address byte are latched, each byte thereafter is treated as data until all 256 bytes are shifted in/out. Then the next instruction will be ready to be decoded.
BRECW, Hyderabad
Page 14
Mini-project report
Chapter 4
Radio Frequency Identification
4.1 RFID principles:
Many types of RFID exist, but at the highest level, we can divide RFID devices into two classes: active and passive.
Fig 4.1 RFID devices 1. Active tags require a power source i.e., they are either connected to a powered infrastructure or use energy stored in an integrated battery. In the latter case, a tags lifetime is limited by the stored energy, balanced against the number of read operations the device must undergo. However, batteries make the cost, size, and lifetime of active tags impractical for the retail trade. 2. Passive RFID is of interest because the tags dont require batteries or maintenance. The tags also have an indefinite operational life and are small enough to fit into a practical adhesive label. A passive tag consists of three parts: an antenna, a semiconductor chip attached to the antenna and some form of encapsulation. The tag reader is responsible for powering and communicating with a tag. The tag antenna captures energy and transfers the tags ID (the tags chip coordinates this process). The encapsulation maintains the tags integrity and protects the antenna and chip from environmental conditions or reagents.
BRECW, Hyderabad
Page 15
Mini-project report
In an RFID system, the RFID tag which contains the tagged data of the object generates a signal containing the respective information which is read by the RFID reader, which then may pass this information to a processor for processing the obtained information for that particular application. Thus, an RFID System can be visualized as the sum of the following three components:
Fig 4.2 Working of RFID module An RFID tag is composed of an antenna, a wireless transducer and an encapsulating material. These tags can be either active or passive. While the active tags have on-chip power, passive tags use the power induced by the magnetic field of the RFID reader. Thus passive tags are cheaper but with lower range (<10mts) and more sensitive to regulatory and environmental constraints, as compared to active tags. An RFID reader consists of an antenna, transceiver and decoder, which sends periodic signals to inquire about any tag in vicinity. On receiving any signal from a tag it passes on that information to the data processor. The data processing subsystem provides the means of processing and storing the data.
Mini-project report
Fig 4.4 Near power mechanism of RFID tags operating at less than 10MHz The range for which we can use magnetic induction approximates to c/2f, where c is a constant (the speed of light) and f is the frequency. Thus, as the frequency of operation increases, the distance over which near-field coupling can operate
BRECW, Hyderabad Page 17
Mini-project report
decreases. A further limitation is the energy available for induction as a function of distance from the reader coil. The magnetic field drops off at a factor of 1/r3, where r is the separation of the tag and reader, along a center line perpendicular to the coils plane. These design pressures have led to new passive RFID designs based on far-field communication.
Fig 4.5 RFID module An RFID system consists of two separate components: a tag and a reader. Tags are analogous to barcode labels and come in different shapes and sizes. The tag contains an antenna connected to a small microchip containing up to two kilobytes of data. The reader or scanner functions similarly to a barcode scanner. However, while a barcode scanner uses a laser beam to scan the barcode, an RFID scanner uses electromagnetic waves. To transmit these waves, the scanner uses an antenna that transmits a signal communicating with the tags antenna. The tags antenna receives data from the scanner and transmits its particular chip information to the scanner. The data on the chip is usually stored in one of two types of memory. The most common is Read-Only Memory (ROM), as its name suggests, read-only memory cannot be altered once programmed onto the chip during the manufacturing process. The second type of memory is Read/Write Memory, though it is also programmed during the manufacturing process, it can later be altered by certain devices.
BRECW, Hyderabad
Page 18
Mini-project report
Mini-project report
delivering innovative, high value RFID solutions assisting companys track assets, people and documents. Agile Sense provides robust and complete RFID solutions built On top of its extensible middleware/ framework for Government, Healthcare, Manufacturing and Aerospace industries. 4.6.4 Current and Potential Uses of RFID: 4.6.4.1 People Tracking: People tracking system are used just as asset tracking system. Hospitals and jails are most general tracking required places. Hospital uses RFID tags for tracking their special patients. In emergency patient and other essential equipment can easily track. It will be mainly very useful in mental care hospitals where doctors can track each and every activity of the patient. Hospitals also use these RFID tags for locating and tracking all the activities of the newly born babies. The best use of the people tracking system will be in jails. It becomes an easy tracking system to track their inmates. Many jails of different US states like Michigan, California, and Arizona are already using RFID-tracking systems to keep a close eye on jail inmates. 4.6.4.2 Healthcare: Patient safety is a big challenge of healthcare vertical. Reducing medication errors, meeting new standards, staff shortages, and reducing costs are the plus points of use of RFID solutions. RFID wristbands containing patient records and medication history address several of these concerns. 4.6.4.3 Promotion tracking: Manufacturers of products sold through retailers promote their products by offering discounts for a limited period on products sold to retailers with the expectation that the retailers will pass on the savings to their customers. However, retailers typically engage in forward buying, purchasing more product during the discount period than they intend to sell during the promotion period. Some retailers engage in a form of arbitrage, reselling discounted product to other retailers, a practice known as diverting. To combat this practice, manufacturers are exploring the use of RFID tags on promoted merchandise so that they can track exactly which product has sold through the supply chain at fully discounted prices.
BRECW, Hyderabad
Page 20
Mini-project report
4.6.5
Manufacturing: RFID has been used in manufacturing plants for more than a decade. It's used to
track parts and work in process and to reduce defects, increase throughput and manage the production of different versions of the same product.
GATE : Every timer has a means of starting and stopping. Some timers do this by software, some by hardware and some have both software and hardware controls. The timers in the 8051 have both. The start and stop of the timer are controlled by the way
BRECW, Hyderabad Page 21
Mini-project report
of software by the TR (timer start) bits TR0 and TR1. These instructions start and stop the timers as long as GATE=0 in the TMOD register. The hardware way of starting and stopping the timer by an external source is achieved by making GATE=1 in the TMOD register. C/T: Timer or counter selected. Cleared for timer operation and set for counter operation. M1 Mode bit 1 M0 Mode bit 0 Mode Selection Table 4.7.1 Mode selection M1 0 0 1 1 M0 0 1 0 1 mode 0 1 2 3 Operating mode 13-bit mode 16-bit mode 8-bit auto reload mode Split mode
The mode used here to generate a time delay is MODE 2. This mode 2 is an 8bit timer and therefore it allows only values of 00H to FFH to be loaded into the timers register TH. After TH is loaded with the 8-bit value, the 8051 give a copy of it to TL. When the timer starts, it starts to count up by incrementing the TL register. It counts up until it reaches its limit of FFH. When it rolls over from FFH to 00H, it sets high the TF (timer flag). If Timer 0 is used, TF0 goes high and if Timer 1 is used, TF1 goes high. When the TL register rolls from FFH to 0 and TF is set to 1, TL is reloaded automatically with the original value kept by the TH register. 4.7.1Asynchronous and Synchronous Serial Communication: Computers transfer data in two ways: parallel and serial. In parallel data transfers, often 8 or more lines are used to transfer data to a device that is only a few feet away. Although a lot of data can be transferred in a short amount of time by using many wires in parallel, the distance cannot be great. To transfer to a device located many meters away, the serial method is best suitable.
BRECW, Hyderabad Page 22
Mini-project report
In serial communication, the data is sent one bit at a time. The 8051 has serial communication capability built into it, thereby making possible fast data transfer using only a few wires. The fact that serial communication uses a single data line instead of the 8-bit data line instead of the 8-bit data line of parallel communication not only makes it cheaper but also enables two computers located in two different cities to communicate over the telephone. Serial data communication uses two methods, asynchronous and synchronous. The synchronous method transfers a block of data at a time, while the asynchronous method transfers a single byte at a time. With synchronous communications, the two devices initially synchronize themselves to each other, and then continually send characters to stay in sync. Even when data is not really being sent, a constant flow of bits allows each device to know where the other is at any given time. That is, each character that is sent is either actual data or an idle character. Synchronous communications allows faster data transfer rates than asynchronous methods, because additional bits to mark the beginning and end of each data byte are not required. The serial ports on IBM-style PCs are asynchronous devices and therefore only support Asynchronous serial communications .Asynchronous means "no synchronization", and thus does not require sending and receiving idle characters. However, the beginning and end of each byte of data must be identified by start and stop bits. The start bit indicates when the data byte is about to begin and the stop bit signals when it ends. The requirement to send these additional two bits causes asynchronous communication to be slightly slower than synchronous however it has the advantage that the processor does not have to deal with the additional idle characters. There are special IC chips made by many manufacturers for serial data communications (universal asynchronous receiver-transmitter) and USART(universal synchronous-asynchronous receiver-transmitter). The 8051 has a built-in UART. In the asynchronous method, the data such as ASCII characters are packed between a start and a stop bit. The start bit is always one bit, but the stop bit can be one or two bits. The start bit is always a 0 (low) and stop bit (s) is 1 (high). This is called framing. The rate of data transfer in serial data communication is stated as bps (bits per second). Another widely used terminology for bps is baud rate. The data transfer rate of
BRECW, Hyderabad Page 23
Mini-project report
a given computer system depends on communication ports incorporated into that system. And in asynchronous serial data communication, this baud rate is generally limited to 100,000bps. The baud rate is fixed to 9600bps in order to interface with the microcontroller using a crystal of 11.0592MHz. 4.7.2 RS232 CABLE: To allow compatibility among data communication equipment, an interfacing standard called RS232 is used. Since the standard was set +long before the advent of the TTL logic family, its input and output voltage levels are not TTL compatible. For this reason, to connect any RS232 to a microcontroller system, voltage converters such as MAX232 are used to convert the TTL logic levels to the RS232 voltage levels and vice versa. 4.7.3 MAX 232: Max232 IC is a specialized circuit which makes standard voltages as required by RS232 standards. This IC provides best noise rejection and very reliable against discharges and short circuits. MAX232 IC chips are commonly referred to as line drivers. To ensure data transfer between PC and microcontroller, the baud rate and voltage levels of Microcontroller and PC should be the same. The voltage levels of microcontroller are logic1 and logic 0 i.e., logic 1 is +5V and logic 0 is 0V. But for PC, RS232 voltage levels are considered and they are: logic 1 is taken as -3V to -25V and logic 0 as +3V to +25V. So, in order to equal these voltage levels, MAX232 IC is used. Thus this IC converts RS232 voltage levels to microcontroller voltage levels and vice versa.
BRECW, Hyderabad
Page 24
Mini-project report
Fig 4.7.3.1 Interfacing MAX232 with microcontroller 4.7.4 SCON (serial control) register: The SCON register is an 8-bit register used to program the start bit, stop bit and data bits of data framing.
Table 4.7.2 Functions of SCON register SM0 SM1 SM2 REN TB8 RB8 TI SCON.7 SCON.6 SCON.5 SCON.4 SCON.3 SCON.2 SCON.1 Serial port mode specifier Serial port mode specifier Serial port mode specifier Set or Cleared by software to enable or disable reception Not widely used Not widely used Transmit interrupt flag. Set by hardware at the beginning of the stop bit in mode 1. Must be cleared by software. RI SCON.0 Receive interrupt flag. Set by hardware at the beginning of the stop bits in mode 1. Must be cleared by software.
BRECW, Hyderabad
Page 25
Mini-project report
Table 4.7.3 Modes of Operation of SCON register SM0 0 0 SM1 0 1 Mode Of Operation Serial Mode 0 Serial Mode 1, 8-bit data, 1 stop bit, 1 start bit 1 1 0 1 Serial Mode 2 Serial Mode 3
Of the four serial modes, only mode 1 is widely used. In the SCON register, when serial mode 1 is chosen, the data framing is 8 bits, 1 stop bit and 1 start bit, which makes it compatible with the COM port of IBM/ compatible PCs. And the most important is serial mode 1 allows the baud rate to be variable and is set by Timer 1 of the 8051. In serial mode 1, for each character a total of 10 bits are transferred, where the first bit is the start bit, followed by 8 bits of data and finally 1 stop bit. 8051 Interface with any External Devices using Serial Communication:
Fig: 4.7.4 8051 Interface with any external devices using serial communication
BRECW, Hyderabad
Page 26
Mini-project report
Fig 4.8 Switches and Push button This is about something commonly unnoticeable when using these components in everyday life. It is about contact bounce, a common problem with mechanical switches. If contact switching does not happen so quickly, several consecutive bounces can be noticed prior to maintain stable state. The reasons for this are: vibrations, slight rough spots and dirt. Anyway, this whole process does not last long (a few micro- or milliseconds), but long enough to be registered by the microcontroller. Concerning the pulse counter, error occurs in almost 100% of cases.
Fig 4.8.1 Connection between reset pin and micro controller The simplest solution is to connect simple RC circuit which will suppress each quick voltage change. Since the bouncing time is not defined, the values of elements are not strictly determined. In the most cases, the values shown on figure are sufficient. If complete safety is needed, radical measures should be taken. The circuit (RS flip-flop) changes logic state on its output with the first pulse triggered by contact bounce. Even though this is more expensive solution (SPDT switch), the problem is definitely resolved. Besides, since the condensator is not used, very short pulses can be also registered in this way. In addition to these hardware solutions, a simple software
BRECW, Hyderabad Page 27
Mini-project report
solution is also commonly applied. When a program tests the state of some input pin and finds changes, the check should be done one more time after certain time delay. If the change is confirmed, it means that switch (or pushbutton) has changed its position. The advantages of such solution are: it is free of charge, effects of disturbances are eliminated and it can be adjusted to the worst-quality contacts. 4.8.1 Switch Interfacing with 8051: In 8051 PORT 1, PORT 2 & PORT 3 have internal 10k Pull-up resistors whereas this Pull-up resistor is absent in PORT 0. Hence PORT 1, 2 & 3 can be directly used to interface a switch whereas we have to use an external 10k pull-up resistor for PORT 0 to be used for switch interfacing or for any other input. Figure 4.8 shows switch interfacing for PORT 1, 2 & 3.Shows switch interfacing to PORT 0.
Fig: 4.8.2 Switch interfacing with ports For any pin to be used as an input pin, a HIGH (1) should be written to the pin if the pin will always to be read as LOW. In the above figure, when the switch is not pressed, the 10k resistor provides the current needed for LOGIC 1 and closure of switch provides LOGIC 0 to the controller PIN.
BRECW, Hyderabad
Page 28
Mini-project report
These components are specialized for being used with the microcontrollers, which means that they cannot be activated by standard IC circuits. They are used for writing different messages on a miniature LCD.
Fig 4.9 LCD display A model described here is for its low price and great possibilities most frequently used in practice. It is based on the HD44780 microcontroller (Hitachi) and can display messages in two lines with 16 characters each. It displays all the alphabets, Greek letters, punctuation marks, mathematical symbols etc. In addition, it is possible to display symbols that user makes up on its own. Automatic shifting message on display (shift left and right), appearance of the pointer, backlight etc. are considered as useful characteristics. 4.9.1 Pins Functions: There are pins along one side of the small printed board used for connection to the microcontroller. There are total of 14 pins marked with numbers (16 in case the background light is built in). Their function is described in the table below:
Table 4.9.1 LCD pin description Function Ground Power supply Contrast Pin Number 1 2 3 Name Vss Vdd Vee Logic State 0 1 Description 0V +5V 0 Vdd D0 D7 are interpreted as commands D0 D7 are interpreted as data Write data (from controller to 5 R/W 0 1 LCD) Read data (from LCD to
4 Control of operating
RS
controller)
Page 29
BRECW, Hyderabad
Mini-project report
0 6 E 1
From 1 to Data/commands are transferred 0 to LCD Bit 0 LSB Bit 1 Bit 2 Bit 3 Bit 4 Bit 5 Bit 6 Bit 7 MSB
7 8 9 10 Data/ commands 11 12 13 14
D0 D1 D2 D3 D4 D5 D6 D7
4.9.2 LCD screen: LCD screen consists of two lines with 16 characters each. Each character consists of 5x7 dot matrix. Contrast on display depends on the power supply voltage and whether messages are displayed in one or two lines. For that reason, variable voltage 0-Vdd is applied on pin marked as Vee. Trimmer potentiometer is usually used for that purpose. Some versions of displays have built in backlight (blue or green diodes). When used during operating, a resistor for current limitation should be used (like with any LE diode).
Fig 4.9.2 LCD screen 4.9.3 LCD Basic Commands: All data transferred to LCD through outputs D0-D7 will be interpreted as commands or as data, which depends on logic state on pin RS: RS = 1 - Bits D0 - D7 are addresses of characters that should be displayed. Built in processor addresses built in map of characters and displays corresponding
BRECW, Hyderabad Page 30
Mini-project report
symbols. Displaying position is determined by DDRAM address. This address is either previously defined or the address of previously transferred character is automatically incremented. RS = 0 - Bits D0 - D7 are commands which determine display mode. Table 4.9.3 Description of LCD commands Command Clear display Cursor home Entry mode set Display on/off control Cursor/Display Shift Function set Set CGRAM address Set DDRAM address Read BUSY flag (BF) Write DDRAM Read from CGRAM or DDRAM 1 1 D7 D6 D5 D4 D3 D2 D1 D0 40uS to CGRAM or RS RW D7 D6 D5 D4 D3 D2 D1 D0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 1 0 0 0 1 0 0 1 D 0 1 1 x Execution Time 1.64mS 1.64mS 40uS
I/D S
D/C R/L x F x
DL N
CGRAM address
DDRAM address
BF DDRAM address
D7 D6 D5 D4 D3 D2 D1 D0 40uS
4.9.4 LCD Connection: Depending on how many lines are used for connection to the microcontroller, there are 8-bit and 4-bit LCD modes. The appropriate mode is determined at the beginning of the process in a phase called initialization. In the first case, the data are transferred through outputs D0-D7 as it has been already explained. In case of 4-bit LED mode, for the sake of saving valuable I/O pins of the microcontroller, there are only 4 higher bits (D4-D7) used for communication, while other may be left unconnected.
BRECW, Hyderabad
Page 31
Mini-project report
Consequently, each data is sent to LCD in two steps: four higher bits are sent first (that normally would be sent through lines D4-D7), four lower bits are sent afterwards. With the help of initialization, LCD will correctly connect and interpret each data received. Besides, with regards to the fact that data are rarely read from LCD (data mainly are transferred from microcontroller to LCD) one more I/O pin may be saved by simple connecting R/W pin to the Ground. Even though message displaying will be normally performed, it will not be possible to read from busy flag since it is not possible to read from display. 4.9.5 LCD Initialization : Once the power supply is turned on, LCD is automatically cleared. This process lasts for approximately 15mS. After that, display is ready to operate. The mode of operating is set by default. This means that: 1. Display is cleared 2. Mode DL = 1 Communication through 8-bit interface N = 0 Messages are displayed in one line F = 0 Character font 5 x 8 dots 3. Display/Cursor on/off D = 0 Display off U = 0 Cursor off B = 0 Cursor blink off 4. Character entry ID = 1 Addresses on display are automatically incremented by 1 S = 0 Display shift off Automatic reset is mainly performed without any problems. If for any reason power supply voltage does not reach full value in the course of 10mS, display will start perform completely unpredictably. If voltage supply unit cannot meet this condition or if it is needed to provide completely safe operating, the process of initialization by which a new reset enabling display to operate normally must be applied. Algorithm according to the initialization is being performed depends on whether connection to the microcontroller is through 4- or 8-bit interface. All left over to be done after that is to give basic commands and of course- to display messages.
BRECW, Hyderabad
Page 32
Mini-project report
Chapter 5
Firmware Implementation of the project design
BRECW, Hyderabad Page 33
Mini-project report
This chapter briefly explains about the firmware implementation of the project. The required software tools are discussed in section 5.1. Section 5.2 shows the flow diagram of the project design. It presents the firmware implementation of the project design.
BRECW, Hyderabad
Page 34
Mini-project report
BRECW, Hyderabad
Page 35
Mini-project report
Mini-project report
Chapter 6
Results and Discussions
6.1 Results:
Fig 6.1 Electronic toll collection system The implementation of RFID Toll Plaza using microcontroller is done successfully. The communication is properly done without any interference between different modules in the design. Design is done to meet all the specifications and requirements. Software tools like Keil U vision Simulator, Flash Magic to dump the
BRECW, Hyderabad Page 37
Mini-project report
source code into the microcontroller, Orcad Lite for the schematic diagram have been used to develop the software code before realizing the hardware. The performance of the system is more efficient. Reading the tag and verifying the tag information with the already stored data and perform the specified task is the main job of the microcontroller. The mechanism is controlled by the microcontroller. Circuit is implemented in Orcad and implemented on the microcontroller board. The performance has been verified both in software simulator and hardware design. The total circuit is completely verified functionally and is following the application software. It can be concluded that the design implemented in the present work provide portability, flexibility and the data transmission is also done with low power consumption.
BRECW, Hyderabad
Page 38
Mini-project report
6.3 Advantages:
Cost effective Low power consumption No line-of-sight contact necessary Speed of an RFID system (almost less than 100ms) Bidirectional communication Reliability in tough environments
6.4 Applications:
There are many applications related to RFID. Some of them are People tracking Asset tracking Document tracking Government library
BRECW, Hyderabad
Page 39
Mini-project report
6.6 References:
1. http://www.rfidjournal.com/faq 2. http://www.technovelgy.com/ct/Technology-Article.asp 3. http://csrc.nist.gov/publications/nistpubs/800-98/SP800-98_RFID-2007.pdf 4. www.ieee.org 5. http://www.taltech.com/TALtech_web/resources/intro-sc.html 6. http://focus.ti.com/lit/ds/symlink/max232.pdf 7. http://www.microdigitaled.com/8051/Software/keil_tusstorial.pdf 8. Microprocessor and Microcontroller book by S.V. Altaf 9. www.keil.com/dd/docs/datashts/philips/p89v51rd2.pdf
BRECW, Hyderabad
Page 40