Rfid based system for healthcare service

1,351 views
1,240 views

Published on

0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
1,351
On SlideShare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
81
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

Rfid based system for healthcare service

  1. 1. RFID Based System For Healthcare Service 1. INTRODUCTION 1.1 Objective The main objective of this project is to provide the patient’s information to the Doctors. Although substantial progress was made in improving the sharing of patient medical information among healthcare providers, professionals still need to address the issue of efficient electronic medical records. Thus, real-time information presents a persistent challenge to the emergency response community. In emergency situations, particularly with unconscious, incoherent and unaccompanied patients, providing emergency physicians with a patient’s accurate medical history could be the difference between life and death. The RFID technology has penetrated the healthcare sector due to its increased functionality, low cost, high reliability and easy-to-use capabilities. As the present paper demonstrates, our major aim was to design an RFID-based system architecture and data model that would provide efficient means to perform essential information management for emergency care across hospital and country boundaries. 1.2 Approach RFID based healthcare system utilizes AT89S52 microcontroller, RFID reader, RFID tags, keypad, Liquid Crystal Display, RS232. In this system we are using RFID tags for storing the patient’s information. To write or read the information to the tag or from the tag we use the RFID reader. To enter the information we are using keypad and for display purpose we are using Liquid Crystal Display. 1.3 Principle of Operation In this system we have to provide the information about the patients to the doctors in terms of electronic records. In this when we put the tag before the reader it reads the information present in the tag and send it to the microcontroller through the serial communication RS232. The microcontroller sends the information to the LCD to display the information and if we want to change the information then we can use the keypad. www.final-yearproject.com | www.finalyearthesis.com
  2. 2. RFID Based System For Healthcare Service EmbeddedSystems Embedded System is a combination of hardware and software used to achieve a single specific task. An embedded system is a microcontroller-based, software driven, reliable, realtime control system, autonomous, or human or network interactive, operating on diverse physical variables and in diverse environments and sold into a competitive and cost conscious market. An embedded system is a special-purpose computer system designed to perform a dedicated function. Unlike a general-purpose computer, such as a personal computer, an embedded system performs one or a few pre-defined tasks, usually with very specific requirements, and often includes task-specific hardware and mechanical parts not usually found in a generalpurpose computer. Since the system is dedicated to specific tasks, design engineers can optimize it, reducing the size and cost of the product. Embedded systems are often massproduced, benefiting from economies of scale. Physically, embedded systems range from portable devices such as digital watches and MP3 players, to large stationary installations like traffic lights, factory controllers, or the systems controlling nuclear power plants. In terms of complexity embedded systems run from simple, with a single microcontroller chip, to very complex with multiple units, peripherals and networks mounted inside a large chassis or enclosure. Mobile phones or handheld computers share some elements with embedded systems, such as the operating systems and microprocessors which power them, but are not truly embedded systems themselves because they tend to be more general purpose, allowing different applications to be loaded and peripherals to be connected. Characteristics of Embedded System: • An embedded system is any computer system hidden inside a product other than a computer • There will encounter a number of difficulties when writing embedded system software in addition to those we encounter when we write applications 1. Throughput – Our system may need to handle a lot of data in a short period of time. www.final-yearproject.com | www.finalyearthesis.com
  3. 3. RFID Based System For Healthcare Service 2. Response–Our system may need to react to events quickly 3. Testability–Setting up equipment to test embedded software can be difficult 4. Debugability–Without a screen or a keyboard, finding out what the software is doing wrong (other than not working) is a troublesome problem 5. Reliability – embedded systems must be able to handle any situation without human intervention 6. Memory space – Memory is limited on embedded systems, and you must make the software and the data fit into whatever memory exists 7. Program installation – you will need special tools to get your software into embedded systems 8. Power consumption – Portable systems must run on battery power, and the software in these systems must conserve power 9. Processor hogs – computing that requires large amounts of CPU time can complicate the response problem 10. Cost – Reducing the cost of the hardware is a concern in many embedded system projects; software often operates on hardware that is barely adequate for the job. • Embedded systems have a microprocessor/ microcontroller and a memory. Some have a serial port or a network connection. They usually do not have keyboards, screens or disk drives. 1.4 Applications  To provide the information about the patients to the doctors  This equipment can be employed in any organization, industry for recognition purpose.  This can also be used in Payment systems such as Road tolls, Electronic tickets. www.final-yearproject.com | www.finalyearthesis.com
  4. 4. RFID Based System For Healthcare Service 2. BLOCK DIAGRAM AND DESCRIPTION 2.1 Block Diagram Figure 2.1 Block Diagram of Project 2.2 Block DiagramDescription The block diagram and its brief description are explained in block wise and this consists of following blocks  Microcontroller  RFID Module  RS-232 Cable, MAX-232.  LCD (Liquid Crystal Display)  Power supply  Key pad www.final-yearproject.com | www.finalyearthesis.com
  5. 5. RFID Based System For Healthcare Service AT89S52Microcontroller The major heart of this project is AT89s52 microcontroller, the reasons why we selected this in our project?,. The AT89S52 provides the following standard features: 8K bytes of Flash, 256 bytes of RAM, 32 I/O lines, Watchdog timer, two data pointers, three 16-bit timer/counters, a six-vector two-level interrupt architecture, a full duplex serial port, on-chip oscillator, and clock circuitry. In addition, the AT89S52 is designed with static logic for operation down to zero frequency and supports two software selectable power saving modes. The Idle Mode stops the CPU while allowing the RAM, timer/counters, serial port, and interrupt system to continue functioning. The Power-down mode saves the RAM con-tents but freezes the oscillator, disabling all other chip functions until the next interrupt or hardware reset. RFID Module Radio Frequency Identification (RFID) is a general term that is used to describe a system that transmits the identity (in the form of a unique serial number) of an object wirelessly, using radio waves. RFID is evolving as a major technology enabler for tracking goods and assets around the world. A great deal of attention is being paid to RFID by the IT industry, media and analysts. According to studies by Benchmark Research, in 2004 three quarters of manufacturing companies are now aware of RFID, of which a third are already using, piloting or investigating RFID applications for their organizations. Anticipating the potential benefits of RFID, many of the world’s major retailers are trialing RFID tagging for pallets and cases shipped into and out of their distribution centers. The consequence of this RFID activity in the retail sector is likely to impact on around 200,000 manufacturers and suppliers globally, and will fuel the market for hardware and software to support RFID. LCD A liquid crystal is a material (normally organic for LCDs) that will flow like a liquid but whose molecular structure has some properties normally associated with solids. The Liquid Crystal Display (LCD) is a low power device. The power requirement is typically in the order of microwatts for the LCD. However, an LCD requires an external or internal light www.final-yearproject.com | www.finalyearthesis.com
  6. 6. RFID Based System For Healthcare Service source. It is limited to a temperature range of about 0C to 60C and lifetime is an area of concern, because LCDs can chemically degrade There are two major types of LCDs which are: 1. Dynamic-scattering LCDs 2. Field-effect LCDs Field-effect LCDs are normally used in such applications where source of energy is a prime factor (e.g., watches, portable instrumentation etc.).They absorb considerably less power than the light-scattering type. However, the cost for field-effect units is typically higher, and their hoight is limited to 2 inches. On the other hand, light-scattering units are available up to 8 inches in height. Field-effect LCD is used in the project for displaying the appropriate information. Power supply The Entire Project needs power for its operation. However, from the study of this project it comes to know that we supposed to design 5v and 12v dc power supply. So by utilizing the following power supply components, required power has been gained. (230/12v (1A and 500mA) – Step down transformers, Bridge rectifier to converter ac to dc, booster capacitor and +5v (7805) and +12v (7812) regulator to maintain constant 5v & 12 supply for the controller circuit and Fingerprint module). Keypad Keypads are the most widely used input devices of the AT89S52, and a basic understanding of them is essential. At the lowest level, keyboards are organized in a matrix of rows and columns. The CPU accesses both rows and column through ports; therefore, with 8bit ports, an 4*4 matrix of keys can be connected to a microprocessor. When a key pressed, a row and column make a connect; otherwise, there is no connection between row and column. In IBM PC keyboards, a single microcontroller (consisting of microprocessor, RAM and EPROM, and several ports all on a single chip) takes care of software and hardware interfacing of keyboard. In such systems it is the function of programs stored in the EPROM of microcontroller to scan the keys continuously, identify which one has been activated, and present it to the motherboard. In this section we look at the mechanism by which the AT89S52 scans and identifies the key. www.final-yearproject.com | www.finalyearthesis.com
  7. 7. RFID Based System For Healthcare Service 3. RFIDMODULE 3.1 History of RFID In a very interesting article, the San Jose Mercury News tells us about Charles Walton, the manbehind the radio frequency identification technology (RFID). Since his first patent about it in1973, Walton, now 83 years old, collected about $3 million from royalties coming from hispatents. Unfortunately for him, his latest patent about RFID expired in the mid-1990s. So he willnot make any money from the billions of RFID tags that will appear in the years to come. But hecontinues to invent and his latest patent about a proximity card with incorporated PIN codeprotection was granted in June 2004. 3.2 RFID RFID is short for Radio Frequency Identification. Generally a RFID system consists of 2 parts.A Reader, and one or more Transponders, also known as Tags. RFID systems evolved frombarcode labels as a means to automatically identify and track products and people. You willbe generally familiar with RFIDsystems as seen in 1. Access Control RFID Readers placed at entrances that require a person to pass their proximity card (RFtag) to be” read” before the access can be made. 2. Contact less Payment Systems RFID tags used to carry payment information. RFIDs are particular suited to electronicToll collectionsystems. Tags attached to vehicles, or carried by people transmit payment information toa fixedreader attached to a Toll station. Payments are then routinely deducted from a usersaccount, orinformation is changed directly on the RFID tag. 3. Product Tracking and Inventory Control RFID systems are commonly used to track and record the movement of ordinary items such as library books, clothes, factory pallets, electrical goods and numerous items. www.final-yearproject.com | www.finalyearthesis.com
  8. 8. RFID Based System For Healthcare Service Working of RFID Figure 3.2 Working of RFID Shown above is a typical RFID system. In every RFID system the transponder Tags containinformation. This information can be as little as a single binary bit , or be a large array of bitsrepresenting such things as an identity code, personal medical information, or literally any typeof information that can be stored in digital binary format.Shown is a RFID transceiver that communicates with a passive Tag. Passive tags have nopower source oftheir own and instead derive power from the incident electromagnetic field. Commonly theheart of each tagis a microchip. When the Tag enters the generated RF field it is able to draw enoughpower from the field toaccess its internal memory andtransmit its stored information.When the transponder Tag draws power in this way the resultant interaction of the RF fieldscauses the voltageat the transceiver antenna to drop in value. This effect is utilized by the Tag to communicate itsinformation tothe reader. The Tag is able to control the amount of power drawn from the field and bydoingso it can modulatethe voltage sensed at the Transceiver according to the bit pattern it wishes to transmit. 3.3 Componentsof RFID A basic RFID system consists of three components: 1. An antenna or coil 2. A transceiver (with decoder) 3. A transponder (RF tag) electronically programmed with unique information These are described below: www.final-yearproject.com | www.finalyearthesis.com
  9. 9. RFID Based System For Healthcare Service 1. Antenna The antenna emits radio signals to activate the tag and read and write data to it. Antennas are theconduits between the tag and the transceiver, which controls the system's data acquisition andcommunication. Antennas are available in a variety of shapes and sizes; they can be built into adoor frame to receive tag data from persons or things passing through the door, or mounted on aninterstate tollbooth to monitor traffic passing by on a freeway. The electromagnetic fieldproduced by an antenna can be constantly present when multiple tags are expected continually. Ifconstant interrogation is not required, a sensor device can activate the field.Often the antenna is packaged with the transceiver and decoder to become a reader(a.k.a.interrogator), which can be configured either as a handheld or a fixed-mount device. The readeremits radio waves in ranges of anywhere from one inch to 100 feet or more, depending upon itspower output and the radio frequency used. When an RFID tag passes through theelectromagnetic zone, it detects the reader's activation signal. The reader decodes the dataencoded in the tag's integrated circuit (silicon chip) and the data is passed to the host computerfor processing. Figure 3.3.1 Antenna www.final-yearproject.com | www.finalyearthesis.com
  10. 10. RFID Based System For Healthcare Service 2. Tags (Transponders) An RFID tag is comprised of a microchip containing identifying information and an antenna thattransmits this data wirelessly to a reader. At its most basic, the chip will contain a serializedidentifier, or license plate number, that uniquely identifies that item, similar to the way many bar codes are used today. A key difference, however is that RFID tags have a higher data capacity than their bar code counterparts. This increases the options for thetype of information that can be encoded on the tag, including the manufacturer, batch or lot number, weight, ownership, destination and history (such as the temperature range to which anitem has been exposed). In fact, an unlimited list of other types of information can be stored onRFID tags, depending on application needs. An RFID tag can be placed on individual items,cases or pallets for identification purposes, as well as on fixed assets such as trailers ,containers,totes, etc. Tags come in a variety of types, with a variety of capabilities. Key variables include “Read-only" versus "read-write" There are three options in terms of how data can be encoded on tags: (1) Read-only tags containdata such as a serialized tracking number, which is pre-written onto them by the tagmanufacturer or distributor. These are generally the least expensive tags because they cannothave any additional information included as they move throughout the supply chain. Any updatesto that information would have to be maintained in the application software that tracks SKUmovement and activity. (2) "Write once" tags enable a user to write data to the tag one time inproduction or distribution processes. Again, this may include a serial number, but perhaps otherdata such as a lot or batch number. (3) Full "read-write" tags allow new data to be written to thetag as needed—and even written over the original data. Examples for the latter capability mightinclude the time and dateof ownership transfer or updating the repair history of a fixed asset. While these are the mostcostly of the three tag types and are not practical for tracking inexpensive items, future standardsfor electronic product codes (EPC) appear to be headed in this direction. www.final-yearproject.com | www.finalyearthesis.com
  11. 11. RFID Based System For Healthcare Service Figure 3.3.2RFID Tags Data capacity The amount of data storage on a tag can vary, ranging from 16 bits on the low end to as much asseveral thousand bits on the high end. Of course, the greater the storage capacity, the highertheprice per tag. Form factor The tag and antenna structure can come in a variety of physical form factors and can either beself-contained or embedded as part of a traditional label structure (i.e., the tag is inside what looks like a regular bar code label—this is termed a 'Smart Label') companies must choose theappropriate form factors for the tag very carefully and should expect to use multiple form factorsto suit the tagging needs of different physical products and units of measure. For example, apallet may have an RFID tag fitted only to an area of protected placement on the pallet itself. Onthe other hand, cartons on the pallet have RFID tags inside bar code labels that also provideoperators human-readable information and a back-up should the tag fail or pass through nonRFID-capable supply chain links. Passive versus active “Passive” tags have no battery and "broadcast" their data only when energized by a reader. Thatmeans they must be actively polled to send information. "Active" tags are capable ofbroadcasting their data using their own battery power. In general, this means that the read rangesare much greater for active tags than they are for passive tags—perhaps a read range of www.final-yearproject.com | www.finalyearthesis.com
  12. 12. RFID Based System For Healthcare Service 100 feetor more, versus 15 feet or less for most passive tags. The extra capability and read ranges ofactive tags, however, come with a cost; they are several times more expensive than passive tags.Today, active tags are much more likely to be used for high-value items or fixed assets such astrailers, where the cost is minimal compared to item value, and very long read ranges arerequired. Most traditional supply chain applications, such as the RFID-based tracking andcompliance programs emerging in the consumer goods retail chain, will use the less expensivepassive tags. Frequencies Like all wireless communications, there are a variety of frequencies or spectra through whichRFID tags can communicate with readers. Again, there are trade-offs among cost, performanceand application requirements. For instance, low-frequency tags are cheaper than ultra highfrequency(UHF) tags, use less power and are better able to penetrate non-metallic substances.They are ideal for scanning objects with high water content, such as fruit, at close range. UHFfrequencies typically offer better range and can transfer data faster. But they use more power andare less likely to pass through some materials. UHF tags are typically best suited for use with ornear wood, paper, cardboard or clothing products. Compared to lowfrequency tags, UHF tagsmight be better for scanning boxes of goods as they pass through a bay door into a warehouse.While the tag requirements for compliance mandates may be narrowly defined, it is likely that avariety of tag types will be required to solve specific operational issues. You will want to workwith a company that is very knowledgeable in tag and reader technology to appropriately identifythe right mix of RFID technology for your environment and applications. EPC Tags EPC refers to "electronic product code," an emerging specification for RFID tags, readers andbusiness applications first developed at the Auto-ID Center at the Massachusetts Institute ofTechnology. This organization has provided significant intellectual leadership toward the use andapplication of RFID technology. EPC represents a specific approach to item identification,including an emerging standard for the tags themselves, including both the data content of the tagand open wireless communication protocols. In a sense, the EPC movement is combining thedata standards embodied in certain bar code specifications, such as the UPC www.final-yearproject.com | www.finalyearthesis.com
  13. 13. RFID Based System For Healthcare Service or UCC-128 barcode standards, with the wireless datacommunication standards that have been developed by ANSI and other groups. 3. RF Transceiver The RF transceiver is the source of the RF energy used to activate and power the passive RFIDtags. The RF transceiver may be enclosed in the same cabinet as the reader or it may be aseparate piece of equipment. When provided as a separate piece of equipment, the transceiver iscommonly referred to as an RF module. The RF transceiver controls and modulates the radiofrequencies that the antenna transmits and receives. The transceiver filters and amplifies thebackscatter signal from a passive RFID tag. 3.4 Typical Applications for RFID 1. Logistics & Tracking  Item visibility and status  Anti theft/tamper evidence  Authentication 2. Manufacturing  Shop floor tracking  Location tracking  Status control  Compliance 3. Asset Tracking  Equipment movement  Calibration 4. MaintenanceHealthcare  Patient dosing  Traceability www.final-yearproject.com | www.finalyearthesis.com
  14. 14. RFID Based System For Healthcare Service 5. Personnel Identification  Access control  Animal tagging  Car immobilizers 6. Payment systems  Road tolls  Electronic tickets  Mass transit ticketing Advantages of RFID Over Bar Coding 1. No "line of sight" requirements: Bar code reads can sometimes be limited orproblematic due to the need to have a direct "line of sight" between a scanner and a bar code.RFID tags can be read through materials without line of sight. 2. More automated reading: RFID tags can be read automatically when a taggedproduct comes past or near a reader, reducing the labor required to scan product and allowingmore proactive, real-time tracking. 3. Improved read rates: RFID tags ultimately offer the promise of higher readrates than bar codes, especially in high-speed operations such as carton sortation. 4. Greater data capacity: RFID tags can be easily encoded with item details suchas lot and batch, weight, etc. 5. "Write" capabilities: Because RFID tags can be rewritten with new data as supplychain activities are completed, tagged products carry updated information as theymove throughout the supply chain. Common Problems with RFID Some common problems with RFID are reader collision and tag collision. Reader collisionoccurs when the signals from two or more readers overlap. The tag is unable to respond tosimultaneous queries. Systems must be carefully set up to avoid this problem. Tag collisionoccurs when many tags are present in a small area; but since the read time is very fast, it is easierfor vendors to develop systems that ensure that tags respond one at a time. See Problems withRFID for more details. www.final-yearproject.com | www.finalyearthesis.com
  15. 15. RFID Based System For Healthcare Service 4. MICROCONTROLLER 4.1 Introduction to Microcontroller A microcontroller (or MCU) is a computer-on-a-chip. It is a type of microprocessor emphasizing self-sufficiency and cost-effectiveness, in contrast to a general-purpose microprocessor (the kind used in a PC). A microprocessor is a programmable digital electronic component that incorporates the functions of a central processing unit (CPU) on a single semi conducting integrated circuit (IC). The microprocessor was born by reducing the word size of the CPU from 32 bits to 4 bits, so that the transistors of its logic circuits would fit onto a single part. One or more microprocessors typically serve as the CPU in a computer system, embedded system, or handheld device. Typical Microcontroller Architecture and Features The basic internal designs of microcontrollers are pretty similar. Figure1 shows the block diagram of a typical microcontroller. All components are connected via an internal bus and are all integrated on one chip. The modules are connected to the outside world via I/O pins. Figure 4.1 Basic Layout of Microcontroller The following list contains the modules typically found in a microcontroller. You can find a more detailed description of these components in later sections. www.final-yearproject.com | www.finalyearthesis.com
  16. 16. RFID Based System For Healthcare Service Processor Core The CPU of the controller.It contains the arithmetic logic unit, the control unit, and the registers (stack pointer, program counter, accumulator register, register file . . .). Memory The memory is sometimes split into program memory and data memory. In larger controllers, a DMA controller handles data transfers between peripheral components and the memory. Interrupt Controller Interrupts are useful for interrupting the normal program flow in case of (important) external or internal events. In conjunction with sleep modes, they help to conserve power. Timer/Counter Most controllers have at least one and more likely 2-3 Timer/Counters, which can be used to timestamp events, measure intervals, or count events. Many controllers also contain PWM (pulse width modulation) outputs, which can be used to drive motors or for safe breaking (antilock brake system, ABS). Furthermore the PWM output can, in conjunction with an external filter, be used to realize a cheap digital/analog converter. Digital I/O Parallel digital I/O ports are one of the main features of microcontrollers. The number of I/O pins varies from 3-4 to over 90, depending on the controller family and the controller type. Analog I/O Apart from a few small controllers, most microcontrollers have integrated analog/digital converters, which differ in the number of channels (2-16) and their resolution (8-12 bits). The analog module also generally features an analog comparator. In some cases, the microcontroller includes digital/analog converters. The UART The Universal Asynchronous Receiver/Transmitter (UART) controller is the key component of the serial communications subsystem of a computer. The UART takes bytes of data and transmits the individual bits in a sequential fashion. At the destination, a second www.final-yearproject.com | www.finalyearthesis.com
  17. 17. RFID Based System For Healthcare Service UART re-assembles the bits into complete bytesSerial transmission is commonly used with modems and for non-networked communication between computers, terminals and other devices. There are two primary forms of serial transmission: Synchronous and Asynchronous. Depending on the modes that are supported by the hardware, the name of the communication sub-system will usually include aA if it supports Asynchronous communications, and a S if it supports Synchronous communications. Both forms are described below. Synchronous Serial Transmission Synchronous serial transmission requires that the sender and receiver share a clock with one another, or that the sender provide a strobe or other timing signal so that the receiver knows when to “read” the next bit of the data. In most forms of serial Synchronous communication, if there is no data available at a given instant to transmit, a fill character must be sent instead so that data is always being transmitted. Synchronous communication is usually more efficient because only data bits are transmitted between sender and receiver, and synchronous communication can be more costly if extra wiring and circuits are required to share a clock signal between the sender and receiver. A form of Synchronous transmission is used with printers and fixed disk devices in that the data is sent on one set of wires while a clock or strobe is sent on a different wire. Printers and fixed disk devices are not normally serial devices because most fixed disk interface standards send an entire word of data for each clock or strobe signal by using a separate wire for each bit of the word. In the PC industry, these are known as Parallel devices. The standard serial communications hardware in the PC does not support Synchronous operations. This mode is described here for comparison purposes only Asynchronous Serial Transmission Asynchronous transmission allows data to be transmitted without the sender having to send a clock signal to the receiver. Instead, the sender and receiver must agree on timing www.final-yearproject.com | www.finalyearthesis.com
  18. 18. RFID Based System For Healthcare Service parameters in advance and special bits are added to each word which are used to synchronize the sending and receiving units. When a word is given to the UART for Asynchronous transmissions, a bit called the "Start Bit" is added to the beginning of each word that is to be transmitted. The Start Bit is used to alert the receiver that a word of data is about to be sent, and to force the clock in the receiver into synchronization with the clock in the transmitter. These two clocks must be accurate enough to not have the frequency drift by more than 10% during the transmission of the remaining bits in the word. (This requirement was set in the days of mechanical teleprinters and is easily met by modern electronic equipment.) After the Start Bit, the individual bits of the word of data are sent, with the Least Significant Bit (LSB) being sent first. Each bit in the transmission is transmitted for exactly the same amount of time as all of the other bits, and the receiver “looks” at the wire at approximately halfway through the period assigned to each bit to determine if the bit is a 1 or a 0. For example, if it takes two seconds to send each bit, the receiver will examine the signal to determine if it is a 1 or a 0 after one second has passed, then it will wait two seconds and then examine the value of the next bit, and so on. The sender does not know when the receiver has “looked” at the value of the bit. The sender only knows when the clock says to begin transmitting the next bit of the word.When the entire data word has been sent, the transmitter may add a Parity Bit that the transmitter generates. The Parity Bit may be used by the receiver to perform simple error checking. Then at least one Stop Bit is sent by the transmitter. When the receiver has received all of the bits in the data word, it may check for the Parity Bits (both sender and receiver must agree on whether a Parity Bit is to be used), and then the receiver looks for a Stop Bit. 4.2AT89S52 MICROCONTROLLER Features www.final-yearproject.com | www.finalyearthesis.com
  19. 19. RFID Based System For Healthcare Service • Compatible with MCS-51® Products • 8K Bytes of In-System Programmable (ISP) Flash Memory • 4.0V to 5.5V Operating Range • Fully Static Operation: 0 Hz to 33 MHz • Three-level Program Memory Lock • 256 x 8-bit Internal RAM • 32 Programmable I/O Lines • Three 16-bit Timer/Counters • Eight Interrupt Sources • Full Duplex UART Serial Channel • Low-power Idle and Power-down Modes • Interrupt Recovery from Power-down Mode • Watchdog Timer • Dual Data Pointer • Power-off Flag Description The AT89S52 is a low-power, high-performance CMOS 8-bit microcontroller with 8K bytes of in-system programmable Flash memory. The device is manufactured using Atmel’s high-density nonvolatile memory technology and is compatible with the industrystandard 80C51 instruction set and pin out. The on-chip Flash allows the program memory to be reprogrammed in-system or by a conventional nonvolatile memory programmer. By combining a versatile 8-bit CPU with in-system programmable Flash on a monolithic chip, the Atmel AT89S52 is a powerful microcontroller which provides a highly-flexible and costeffective solution to many embedded control applications. www.final-yearproject.com | www.finalyearthesis.com
  20. 20. RFID Based System For Healthcare Service The AT89S52 provides the following standard features: 8K bytes of Flash, 256 bytes of RAM, 32 I/O lines, Watchdog timer, two data pointers, three 16-bit timer/counters, a sixvector two-level interrupt architecture, a full duplex serial port, on-chip oscillator, and clock circuitry. In addition, the AT89S52 is designed with static logic for operation down to zero frequency and supports two software selectable power saving modes. Pin diagram of AT89S52 Figure 4.2.1 Pin diagram ofAT89S52 Block Diagram of AT89S52 www.final-yearproject.com | www.finalyearthesis.com
  21. 21. RFID Based System For Healthcare Service Fig 4.2.2 Block Diagramof AT89S52 Pin Description VCC Pin 40 provides supply voltage to the chip. The voltage source is + 5V. GND www.final-yearproject.com | www.finalyearthesis.com
  22. 22. RFID Based System For Healthcare Service Pin 20 provides 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. Table 4.2.1 Port1 Specificationsof AT89S52 Port 2 www.final-yearproject.com | www.finalyearthesis.com
  23. 23. RFID Based System For Healthcare Service 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. Port 2 also receives the high-order address bits and some control signals during Flash programming and verification. Port 3 Port 3 is an 8-bit 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 also serves the functions of various special features of the AT89S52, as shown in the following table. Port 3 also receives some control signals for Flash programming and verification. Table 4.2.2 Port3 Specificationsof AT89S52 RST www.final-yearproject.com | www.finalyearthesis.com
  24. 24. RFID Based System For Healthcare Service Reset input. A high on this pin for two machine cycles while the oscillator is running resets the device. This pin drives High for 96 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 (ALE) 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. Note, however, that one ALE pulse is skipped during each access to external data memory. 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 (PSEN) is the read strobe to external program memory. When the AT89S52 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. XTAL1 www.final-yearproject.com | www.finalyearthesis.com
  25. 25. RFID Based System For Healthcare Service Input to the inverting oscillator amplifier and input to the internal clock operating circuit. XTAL2 Output from the inverting oscillator amplifier. Special Function Registers A map of the on-chip memory area called the Special Function Register (SFR) space is shown in Table 1. Note that not all of the addresses are occupied, and unoccupied addresses may not be implemented on the chip. Read accesses to these addresses will in general return random data, and write accesses will have an indeterminate effect. User software should not write 1s to these unlisted locations, since they may be used in future products to invoke new features. In that case, the reset or inactive values of the new bits will always be 0. Timer 2 Registers Control and status bits are contained in registers T2CON (shown in Table 2) and T2MOD (shown in Table 3) for Timer 2. The register pair (RCAP2H, RCAP2L) is the Capture/Reload registers for Timer 2 in 16-bit capture mode or 16-bit auto-reload mode. Interrupt Registers The individual interrupt enable bits are in the IE register. Two priorities can be set for each of the six interrupt sources in the IP register. Dual Data Pointer Registers To facilitate accessing both internal and external data memory, two banks of 16-bit Data Pointer Registers are provided: DP0 at SFR address locations 82H-83H and DP1 at 84H-85H. Bit DPS = 0 in SFR AUXR1 selects DP0 and DPS = 1 selects DP1. The user should always initialize the DPS bit to the appropriate value before accessing the respective Data Pointer Register. Power off Flag www.final-yearproject.com | www.finalyearthesis.com
  26. 26. RFID Based System For Healthcare Service The Power Off Flag (POF) is located at bit 4 (PCON.4) in the PCON SFR. POF is set to “1” during power up. It can be set and rest under software control and is not affected by reset. Memory Organization MCS-51 devices have a separate address space for Program and Data Memory. Up to 64K bytes each of external Program and Data Memory can be addressed. Program Memory If the EA pin is connected to GND, all program fetches are directed to external memory. On the AT89S52, if EA is connected to VCC, program fetches to addresses 0000H through 1FFFH are directed to internal memory and fetches to addresses 2000H through FFFFH are to external memory. Data Memory The AT89S52 implements 256 bytes of on-chip RAM. The upper 128 bytes occupy a parallel address space to the Special Function Registers. This means that the upper 128 bytes have the same addresses as the SFR space but are physically separate from SFR space. When an instruction accesses an internal location above address 7FH, the address mode used in the instruction specifies whether the CPU accesses the upper 128 bytes of RAM or the SFR space. Instructions which use direct addressing access of the SFR space. For example, the following direct addressing instruction accesses the SFR at location 0A0H (which is P2). MOV 0A0H, #data Instructions that use indirect addressing access the upper 128 bytes of RAM. For example, the following indirect addressing instruction, where R0 contains 0A0H, accesses the data byte at address 0A0H, rather than P2 (whose address is 0A0H). MOV @R0, #data Note that stack operations are examples of indirect addressing, so the upper 128 bytes of data RAM are available as stack space. Watchdog Timer(One-time Enabled with Reset-out) www.final-yearproject.com | www.finalyearthesis.com
  27. 27. RFID Based System For Healthcare Service The WDT is intended as a recovery method in situations where the CPU may be subjected to software upsets. The WDT consists of a 13-bit counter and the Watchdog Timer Reset (WDTRST) SFR. The WDT is defaulted to disable from exiting reset. To enable the WDT, a user must write 01EH and 0E1H in sequence to the WDTRST register (SFR location 0A6H). When the WDT is enabled, it will increment every machine cycle while the oscillator is running. The WDT timeout period is dependent on the external clock frequency. There is no way to disable the WDT except through reset (either hardware reset or WDT overflow (reset). When WDT overflows, it will drive an output RESET HIGH pulse at the RST pin. Using the WDT To enable the WDT, a user must write 01EH and 0E1H in sequence to the WDTRST register (SFR location 0A6H). When the WDT is enabled, the user needs to service it by writing 01EH and 0E1H to WDTRST to avoid a WDT overflow. The 13-bit counter overflows when it reaches 8191 (1FFFH), and this will reset the device. When the WDT is enabled, it will increment every machine cycle while the oscillator is running. This means the user must reset the WDT at least every 8191 machine cycles. To reset the WDT the user must write 01EH and 0E1H to WDTRST. DTRST is a write-only register. The WDT counter cannot be read or written. When WDT overflows, it will generate an output RESET pulse at the RST pin. The RESET pulse duration is 96xTOSC, where TOSC=1/FOSC. To make the best use of the WDT, it should be serviced in those sections of code that will periodically be executed within the time required to prevent a WDT reset. UART Serial data communication uses two methods, asynchronous and synchronous. The synchronous method transfers a block of data (characters) at a time, while the asynchronous method transfers a single byte at a time. It is possible to write software to use either of these methods, but programs can be tedious and long. For this reason, there are special IC chips made by the manufacturers for the serial data communications. These chips are commonly referred to as UART (universal asynchronous receiver-transmitter) and USART (universal synchronous receiver-transmitter). The 8052 has built-in UART. Timer 0 www.final-yearproject.com | www.finalyearthesis.com
  28. 28. RFID Based System For Healthcare Service The 16-bit register of timer 0 is accessed as low byte and high byte. The low byte register is called TL0 (Timer 0 low byte) and the high byte register is referred to as TH0 (Timer 0 high byte). These registers can be accessed like any other registers, such as A, B, R0, R1, R2 etc. for example the instruction “MOV TL0, #4FH” moves the value 4FH into TL0, the low byte of Timer 0. These registers can also be read like any other register. For example, “MOV R5, TH0” saves TH0 (high byte of Timer 0) in R5. Timer1 Timer 1 is also 16 bits and its 16-bit register is split into two bytes, referred to as TL1 (Timer 1 low byte) and TH1 ( Timer 1 high byte). These registers are accessible in the same way as the registers of Timer 0. Timer 2 Timer 2 is a 16-bit Timer/Counter that can operate as either a timer or an event counter. The type of operation is selected by bit C/T2 in the SFR T2CON (shown in Table 2). Timer 2 has three operating modes: capture, auto-reload (up or down counting), and baud rate generator. The modes are selected by bits in T2CON, as shown in Table 3. Timer 2 consists of two 8-bit registers, TH2 and TL2. In the Timer function, the TL2 register is incremented every machine cycle. Since a machine cycle consists of 12 oscillator periods, the count rate is 1/12 of the oscillator frequency. Table 4.2.3 Timer2 Operating Modes of AT89S52 In the Counter function, the register is incremented in response to a 1-to-0 transition at its corresponding external input pin, T2. In this function, the external input is sampled during S5P2 of every machine cycle. When the samples show a high in one cycle and a low in the next cycle, the count is incremented. The new count value appears in the register during S3P1 of the cycle following the one in which the transition was detected. Since two machine cycles www.final-yearproject.com | www.finalyearthesis.com
  29. 29. RFID Based System For Healthcare Service (24 oscillator periods) are required to recognize a 1-to-0 transition, the maximum count rate is 1/24 of the oscillator frequency. To ensure that a given level is sampled at least once before it changes, the level should be held for at least one full machine cycle. Interrupts The AT89S52 has a total of six interrupt vectors: two external interrupts (INT0 and INT1), three timer interrupts (Timers 0, 1, and 2), and the serial port interrupt. These interrupts are all shown in Figure 10. Each of these interrupt sources can be individually enabled or disabled by setting or clearing a bit in Special Function Register IE. IE also contains a global disable bit, EA, which disables all interrupts at once. Note that Table 5 shows that bit position IE.6 is unimplemented. In the AT89S52, bit position IE.5 is also unimplemented. User software should not write 1s to these bit positions, since they may be used in future AT89 products. Timer 2 interrupt is generated by the logical OR of bits TF2 and EXF2 in register T2CON. Neither of these flags is cleared by hardware when the service routine is vectored to. In fact, the service routine may have to determine whether it was TF2 or EXF2 that generated the interrupt, and that bit will have to be cleared in software. The Timer 0 and Timer 1 flags, TF0 and TF1, are set at S5P2 of the cycle in which the timers overflow. The values are then polled by the circuitry in the next cycle. However, the Timer 2 flag, TF2, is set at S2P2 and is polled in the same cycle in which the timer overflows. Oscillator Characteristics XTAL1 and XTAL2 are the input and output, respectively, of an inverting amplifier that can be configured for use as an on-chip oscillator, as shown in Figure 11. 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, as shown in Figure 12. 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. Oscillator connections www.final-yearproject.com | www.finalyearthesis.com
  30. 30. RFID Based System For Healthcare Service Figure4.2.3 Oscillator Connectionsof AT89S52 Note: C1, C2 = 30 pF ± 10 pF for Crystals = 40 pF ± 10 pF for Ceramic Resonators External Clock Drive Configuration Figure 4.2.4 External Clock Drive Configurationof AT89S52 Idle Mode In idle mode, the CPU puts itself to sleep while all the on chip peripherals remain active. The mode is invoked by software. The content of the on-chip RAM and all the specialfunctions registers remain unchanged during this mode. The idle mode can be terminated by any www.final-yearproject.com | www.finalyearthesis.com
  31. 31. RFID Based System For Healthcare Service enabled interrupt or by a hardware reset. Note that when idle mode is terminated by a hardware reset, the device normally resumes program execution from where it left off, up to two machine cycles before the internal reset algorithm takes control. On-chip hardware inhibits access to internal RAM in this event, but access to the port pins is not inhibited. To eliminate the possibility of an unexpected write to a port pin when idle mode is terminated by a reset, the instruction following the one that invokes idle mode should not write to a port pin or to external memory. Power-down Mode In the Power-down mode, the oscillator is stopped, and the instruction that invokes Powerdown is the last instruction executed. The on-chip RAM and Special Function Registersretain their values until the Power-down mode is terminated. Exit from Power-down mode can be initiated either by a hardware reset or by an enabled external interrupt. Reset redefines the SFRs but does not change the on-chip RAM. The reset should not be activated before VCC is restored to its normal operating level and must be held active long enough to allow the oscillator to restart and stabilize. Status of External Pins during Idle and Power-down Modes Table 4.2.4 Power down and Idle Modesof AT89S52 5. FUNCTIONAL DESCRIPTIONS 5.1 Liquid Crystal Display www.final-yearproject.com | www.finalyearthesis.com
  32. 32. RFID Based System For Healthcare Service Liquid crystal display (LCD) has material which combines the properties of both liquid and crystals. They have a temperature range within which the molecules are almost as mobile as they would be in a liquid, but are grouped together in an order form similar to a crystal. First thing to begin with is to know what LCD driver/controller is used in LCD.Yes, your LCD is dumb it does not know to talk with your microcontroller. LCD driver is a link between the microcontroller and LCD. You can refer the datasheet of LCD to know the LCD driver for e.g. JHD 162A is name of LCD having driver HD44780U.You have to interface the LCD according to the driver specification. To understand the algorithm of LCD interfacing user must have datasheet of both LCD and LCD driver. Many people ignore the datasheets and end up in troubles. If you want to interface LCD successfully you must have datasheets. Figure5.1.1 LCD Module More microcontroller devices are using 'smart LCD' displays to output visual information. The following discussion covers the connection of a Hitachi LCD display to a PIC microcontroller. LCD displays designed around Hitachi's LCD HD44780 module, are inexpensive, easy to use, and it is even possible to produce a readout using the 8 x 80 pixels of the display. Hitachi LCD displays have a standard ASCII set of characters plus Japanese, Greek and mathematical symbols. Hardware Diagram www.final-yearproject.com | www.finalyearthesis.com
  33. 33. RFID Based System For Healthcare Service 16 x 2 Char LCD A D0 EN RW K D7 RS Vf GND ACK Vcc D0 – D7 R1 R2 Figure 5.1.2 LCD pin configuration For an 8-bit data bus, the display requires a +5V supply plus 11 I/O lines. For a 4-bit data bus it only requires the supply lines plus seven extra lines. When the LCD display is not enabled, data lines are tri-state which means they are in a state of high impedance (as though they are disconnected) and this means they do not interfere with the operation of the microcontroller when the display is not being addressed. The LCD also requires 3 "control" lines from the microcontroller. When the LCD is initialized, it is ready to continue receiving data or instructions. If it receives a character, it will write it on the display and move the cursor one space to the right. The Cursor marks the next location where a character will be written. When we want to write a string of characters, first we need to set up the starting address, and then send one character at a time. Pins description www.final-yearproject.com | www.finalyearthesis.com
  34. 34. RFID Based System For Healthcare Service Table 5.1 LCD Pin Description Logic status on control lines RS (Command / Data): This bit is to specify weather received byte is command or data. So that LCD can recognize the operation to be performed based on the bit status. RS = 0 => Command RS = 1 => Data RW (Read / Write) RW bit is to specify weather controller wants READ from LCD or WRITE to LCD. The READ operation here is just ACK bit to know weather LCD is free or not. RW = 0 => Write RW = 1 => Read EN (Enable LCD) EN bit is to ENABLE or DISABLE the LCD. When ever controller wants to write some thing into LCD or READ acknowledgment from LCD it needs to enable the LCD. EN = 0 => High Impedance www.final-yearproject.com | www.finalyearthesis.com
  35. 35. RFID Based System For Healthcare Service EN = 1 => Low Impedance ACK (LCD Ready) ACK bit is to acknowledge the MCU that LCD is free so that it can send new command or data to be stored in its internal Ram locations. ACK = 1 => Not ACK ACK = 0 => ACK Reading data from the LCD is done in the same way, but control line R/W has to be high. When we send a high to the LCD, it will reset and wait for instructions. Typical instructions sent to LCD display after a reset are: turning on a display, turning on a cursor and writing characters from left to right. Characters that can be shown on the display are stored in data display (DD) RAM. The size of DDRAM is 80 bytes. Before we access DD RAM after defining a special character, the program must set the DD RAM address. Writing and reading data from any LCD memory is done from the last address which was set up using set-address instruction. Once the address of DD RAM is set, a new written character will be displayed at the appropriate place on the screen. Until now we discussed the operation of writing and reading to an LCD as if it were an ordinary memory. But this is not so. The LCD controller needs 40 to 120 microseconds (uS) for writing and reading. Other operations can take up to 5 mS. During that time, the microcontroller can not access the LCD, so a program needs to know when the LCD is busy. We can solve this in two ways.One way is to check the BUSY bit found on data line D7. This is not the best method because LCD's can get stuck, and program will then stay forever in a loop checking the BUSY bit. The other way is to introduce a delay in the program. The delay has to be long enough for the LCD to finish the operation in process. At the beginning we mentioned that we needed 11 I/O lines to communicate with an LCD. However, we can communicate with an LCD through a 4-bit data bus. Thus we can reduce the total number of communication lines to seven. 5.2 Power Supply Unit The input to the circuit is applied from the regulated power supply. The a.c. input i.e., 230V from the mains supply is step down by the transformer to 12V and is fed to a rectifier. The output obtained from the rectifier is a pulsating d.c voltage. So in order to get a pure d.c www.final-yearproject.com | www.finalyearthesis.com
  36. 36. RFID Based System For Healthcare Service voltage, the output voltage from the rectifier is fed to a filter to remove any a.c components present even after rectification. Now, this voltage is given to a voltage regulator to obtain a pure constant dc voltage. Block diagram Figure 5.2.1 power supply Power supply unit consists of following units i) Step down transformer ii) Rectifier unit iii) Input filter iv).Regulator unit v) Output filter Stepdown Transformer The Step down Transformer is used to step down the main supply voltage from 230V AC to lower value. This 230 AC voltage cannot be used directly, thus it is stepped down. The Transformer consists of primary and secondary coils. To reduce or step down the voltage, the transformer is designed to contain less number of turns in its secondary core. The output from the secondary coil is also AC waveform. Thus the conversion from AC to DC is essential. This conversion is achieved by using the Rectifier Circuit/Unit. Step down transformers can step down incoming voltage, which enables you to have the correct voltage input for your electrical needs. For example, if our equipment has been specified for input voltage of 12 volts, and the main power supply is 230 volts, we will need a www.final-yearproject.com | www.finalyearthesis.com
  37. 37. RFID Based System For Healthcare Service step down transformer, which decreases the incoming electrical voltage to be compatible with your 12 volt equipment. Rectifier Unit The Rectifier circuit is used to convert the AC voltage into its corresponding DC voltage. The most important and simple device used in Rectifier circuit is the diode. The simple function of the diode is to conduct when forward biased and not to conduct in reverse bias. Now we are using three types of rectifiers. They are 1. Half-wave rectifier 2. Full-wave rectifier 3. Bridge rectifier Half-Wave Rectifier In half wave rectification, either the positive or negative half of the AC wave is passed, while the other half is blocked. Because only one half of the input waveform reaches the output, it is very inefficient if used for power transfer. Half-wave rectification can be achieved with a single diode in a one phase supply, or with three diodes in a three-phase supply Bridge Rectifier A bridge rectifier makes use of four diodes in a bridge arrangement to achieve fullwave rectification. This is a widely used configuration, both with individual diodes wired as shown and with single component bridges where the diode bridge is wired internally. A diode bridge or bridge rectifier is an arrangement of four diodes in a bridge configuration that provides the same polarity of output voltage for either polarity of input voltage. When used in its most common application, for conversion of alternating current (AC) input into direct current (DC) output, it is known as a bridge rectifier. A bridge rectifier provides full-wave rectification from a two-wire AC input, resulting in lower cost and weight as compared to a center-tappedtransformer design. The Forward Bias is achieved by connecting the diode’s positive with positive of the battery and negative with battery’s negative. The efficient circuit used is the Full wave Bridge www.final-yearproject.com | www.finalyearthesis.com
  38. 38. RFID Based System For Healthcare Service rectifier circuit. The output voltage of the rectifier is in rippled form, the ripples from the obtained DC voltage are removed using other circuits available. The circuit used for removing the ripples is called Filter circuit. Input Filter Capacitors are used as filter. The ripples from the DC voltage are removed and pure DC voltage is obtained. And also these capacitors are used to reduce the harmonics of the input voltage. The primary action performed by capacitor is charging and discharging. It charges in positive half cycle of the AC voltage and it will discharge in negative half cycle. So it allows only AC voltage and does not allow the DC voltage. This filter is fixed before the regulator. Thus the output is free from ripples. Regulator Unit Regulator regulates the output voltage to be always constant. The output voltage is maintained irrespective of the fluctuations in the input AC voltage. As and then the AC voltage changes, the DC voltage also changes. Thus to avoid this Regulators are used. Also when the internal resistance of the power supply is greater than 30 ohms, the output gets affected. Thus this can be successfully reduced here. The regulators are mainly classified for low voltage and for high voltage. Further they can also be classified as i) Positive regulator 1. input pin 2. ground pin 3. output pin It regulates the positive voltage. ii) Negative regulator 1. ground pin 2. input pin 3. output pin It regulates the negative voltage. Fixed Regulators www.final-yearproject.com | www.finalyearthesis.com
  39. 39. RFID Based System For Healthcare Service Figure 5.2.2 An Assortment of 78xx Series ICs "Fixed" three-terminal linear regulators are commonly available to generate fixed voltages of plus 3 V, and plus or minus 5 V, 9 V, 12 V, or 15 V when the load is less than about 7 amperes. 7805 Voltage Regulator The 7805 provides circuit designers with an easy way to regulate DC voltages to 5v. Encapsulated in a single chip/package (IC), the 7805 is a positive voltage DC regulator that has only 3 terminals. They are: Input voltage, Ground, Output Voltage. General Features  Output Current up to 1A  Output Voltages of 5, 6, 8, 9, 10, 12, 15, 18, 24V  Thermal Overload Protection  Short Circuit Protection  Output Transistor Safe Operating Area Protection Output Filter The Filter circuit is often fixed after the Regulator circuit. Capacitor is most often used as filter. The principle of the capacitor is to charge and discharge. It charges during the positive half cycle of the AC voltage and discharges during the negative half cycle. So it allows only AC voltage and does not allow the DC voltage. This filter is fixed after the Regulator circuit to filter any of the possibly found ripples in the output received finally. Here we used 0.1µF capacitor. The output at this stage is 5V and is given to the Microcontroller. The output voltage overshoots when the load is removed or a short clears. When the load is removing from a switching mode power supply with a LC low-pass output filter, the only thing the control loop can do is stop the switching action so no more energy is taken from the source. www.final-yearproject.com | www.finalyearthesis.com
  40. 40. RFID Based System For Healthcare Service The energy that is stored in the output filter inductor is dumped into the output capacitor causing a voltage overshoot. The magnitude of the overshoot is the vector sum of two orthogonal voltages, the output voltage before the load is removed and the current through the inductor times the characteristic impedance of the output filter, Zo = (L/C)^1/2. This can be derived from conservation of energy considerations. The two energies are equal when the load is removed, since the load is no longer taking energy from the system. Equating the two energies, substituting zero current for the final inductor current, then the solution for the final voltage Vf is: This is the orthogonal vector sum of the output voltage and the load current times the characteristic impedance and is illustrated in Figure .The problem becomes worse if the current in the inductor is established by a short circuit on the output and the short circuit clears. In this case, the initial voltage is zero (short circuit) and the overshoot is I*Zo, where I can be very large, resulting in a ruinous overshoot. 5.3Serial Communication Theinformation from micro controller is sent to system through serial communication by using MAX-232 ic in between micro controller and RS232 DB9 connector. This MAX232 acts as voltage level translator i.e., the TTL logic voltage level is to be transformed to RS232 DB9 connector voltage level of the system. In short a MAX –232 is nothing but a clamper circuit, which consists of diodes and capacitors i.e., the voltage level translator. is done through clamping circuit here diodes are inbuilt, whereas the capacitors are to be connected externally . Introduction In this chapter we are going to cover basic concepts involved in the project such as serial communication and modem activation commands. The serial communication is between the modem and MCU and also between modem and PC. Serial Communication www.final-yearproject.com | www.finalyearthesis.com
  41. 41. RFID Based System For Healthcare Service In order to connect micro controller to a modem or a pc to modem a serial port is used. Serial is a very common protocol for device communication that is standard on almost every PC. Most computers include two RS-232 based serial ports. Serial is also a common communication protocol that is used by many devices for instrumentation; numerous GPIBcompatible devices also come with an RS-232 port. Furthermore, serial communication can be used for data acquisition in conjunction with a remote sampling device The concept of serial communication is simple. The serial port sends and receives bytes of information one bit at a time. Although this is slower than parallel communication, which allows the transmission of an entire byte at once, it is simpler and can be used over longer distances. For example, the IEEE 488 specifications for parallel communication state that the cabling between equipment can be no more than 20 meters total, with no more than 2 meters between any two devices. serial, however, can extend as much as 1200 meters. Typically, serial is used to transmit ASCII data. Communication is completed using 3 transmission lines: (1) Ground, (2) Transmit, and (3) Receive. Since serial is asynchronous, the port is able to transmit data on one line while receiving data on another. Other lines are available for handshaking, but are not required. The important serial characteristics are baud rate, data bits, stop bits, and parity. For two ports to communicate, these parameters must match. Baud rate It is a speed measurement for communication. It indicates the number of bit transfers per second. For example, 300 baud is 300 bits per second. When a clock cycle is referred it means the baud rate. For example, if the protocol calls for a 4800 baud rate, then the clock is running at 4800Hz. This means that the serial port is sampling the data line at 4800Hz. Common baud rates for telephone lines are 14400, 28800, and 33600. Baud rates greater than these are possible, but these rates reduce the distance by which devices can be separated. These high baud rates are used for device communication where the devices are located together, as is typically the case with GPIB devices. Data bits A measurement of the actual data bits in a transmission. When the computer sends a packet of information, the amount of actual data may not be a full 8 bits. Standard values for the data packets are 5, 7, and 8 bits. Which setting choosen depends on what information www.final-yearproject.com | www.finalyearthesis.com
  42. 42. RFID Based System For Healthcare Service transferred? For example, standard ASCII has values from 0 to 127 (7 bits). Extended ASCII uses 0 to 255 (8 bits). If the data being transferred is simple text (standard ASCII), then sending 7 bits of data per packet is sufficient for communication. A packet refers to a single byte transfer, including start/stop bits, data bits, and parity. Since the number of actual bits depends on the protocol selected, the term packet is used to cover all instances. Stop bits Used to signal the end of communication for a single packet. Typical values are 1, 1.5, and 2 bits. Since the data is clocked across the lines and each device has its own clock, it is possible for the two devices to become slightly out of sync. Therefore, the stop bits not only indicate the end of transmission but also give the computers some room for error in the clock speeds. The more bits that are used for stop bits, the greater the lenience in synchronizing the different clocks, but the slower the data transmission rate. Parity A simple form of error checking that is used in serial communication. There are four types of parity: even, odd, marked, and spaced. The option of using no parity is also available. For even and odd parity, the serial port sets the parity bit (the last bit after the data bits) to a value to ensure that the transmission has an even or odd number of logic high bits. For example, if the data is 011, then for even parity, the parity bit is 0 to keep the number of logic-high bits even. If the parity is odd, then the parity bit is 1, resulting in 3 logic-high bits. Marked and spaced parity does not actually check the data bits, but simply sets the parity bit high for marked parity or low for spaced parity. This allows the receiving device to know the state of a bit to enable the device to determine if noise is corrupting the data or if the transmitting and receiving device clocks are out of sync. RS –232 RS-232 (ANSI/EIA-232 Standard) is the serial connection found on IBM-compatible PCs. It is used for many purposes, such as connecting a mouse, printer, or modem, as well as industrial instrumentation. Because of improvements in line drivers and cables, applications often increase the performance of RS-232 beyond the distance and speed listed in the standard. RS-232 is limited to point-to-point connections between PC serial ports and devices. RS-232 hardware can be used for serial communication up to distances of 50 feet . www.final-yearproject.com | www.finalyearthesis.com
  43. 43. RFID Based System For Healthcare Service DB-9 pin connector 12345 6789 Pin Functions: Data: TxD on pin 3, RxD on pin 2 Handshake: RTS on pin 7, CTS on pin 8, DSR on pin 6, CD on pin 1, DTR on pin 4 Common: Common pin 5(ground) Other: RI on pin 9 The method used by RS-232 for communication allows for a simple connection of three lines: Tx, Rx, and Ground. The three essential signals for 2 way RS232Communications are these: TXD: carries data from DTE to the DCE. RXD: carries data from DCE to the DTE SG: signal ground Here in our project DTE is the micro controller at the remote station and PC at the base station, DCE is the modem at both the stations. However the data to be transmitted, both sides have to be clocking the data at the same baud rate. Even though this method is sufficient for most applications, it is limited in being able to respond to problems such as the receiver getting overloaded. This is where serial handshaking can help. This method uses actual hardware lines. There are two pairs of hand shaking signals DTR/DSR and www.final-yearproject.com | www.finalyearthesis.com
  44. 44. RFID Based System For Healthcare Service MAX232 Pin Diagram Of Max232 Figure 5.3 Max232 Pin Diagram This module is primary of interest for people building their own electronics with an RS-232 interface. Off-the-shelf computers with RS-232 interfaces already contain the necessary electronics, and there is no need to add the circuitry as described here. Serial RS-232 (V.24) communication works with voltages (-15V ... -3V for high [sic]) and +3V ... +15V for low [sic]) which are not compatible with normal computer logic voltages. On the other hand, classic TTL computer logic operates between 0V ... +5V (roughly 0V ... +0.8V for low, +2V ... +5V for high). Modern low-power logic operates in the range of 0V ... +3.3V or even lower. So, the maximum RS-232 signal levels are far too high for computer logic electronics, and the negative RS-232 voltage for high can't be grokked at all by computer logic. Therefore, to receive serial data from an RS-232 interface the voltage has to be reduced, and the low and high voltage level inverted. In the other direction (sending data from some logic over RS-232) the low logic voltage has to be "bumped up", and a negative voltage has to be generated, too. www.final-yearproject.com | www.finalyearthesis.com
  45. 45. RFID Based System For Healthcare Service Table 5.3.1 Voltage levels for RS232 and TTL All this can be done with conventional analog electronics, e.g. a particular power supply and a couple of transistors or the once popular 1488 (transmitter) and 1489 (receiver) ICs. However, since more than a decade it has become standard in amateur electronics to do the necessary signal level conversion with an integrated circuit (IC) from the MAX232 family (typically a MAX232A or some clone). In fact, it is hard to find some RS-232 circuitry in amateur electronics without a MAX232A or some clone. The MAX232 from Maxim was the first IC which in one package contains the necessary drivers (two) and receivers (also two), to adapt the RS-232 signal voltage levels to TTL logic. It became popular, because it just needs one voltage (+5V) and generates the necessary RS-232 voltage levels (approx. -10V and +10V) internally. This greatly simplified the design of circuitry. Circuitry designers no longer need to design and build a power supply with three voltages (e.g. -12V, +5V, and +12V), but could just provide one +5V power supply, e.g. with the help of a simple 78x05 voltage converter. The MAX232 has a successor, the MAX232A. The ICs are almost identical, however, the MAX232A is much more often used (and easier to get) than the original MAX232, and the MAX232A only needs external capacitors 1/10th the capacity of what the original MAX232 needs. It should be noted that the MAX232(A) is just a driver/receiver. It does not generate the necessary RS-232 sequence of marks and spaces with the right timing, it does not decode the RS-232 signal, it does not provide a serial/parallel conversion. All it does is to convert signal voltage levels. Generating serial data with the right timing and decoding serial data has to be done by additional circuitry, e.g. by a 16550 UART or one of these small micro controllers (e.g. Atmel AVR, Microchip PIC) getting more and more popular. www.final-yearproject.com | www.finalyearthesis.com
  46. 46. RFID Based System For Healthcare Service The MAX232 and MAX232A were once rather expensive ICs, but today they are cheap. It has also helped that many companies now produce clones (i.e. Sipex). These clones sometimes need different external circuitry, e.g. the capacities of the external capacitors vary. It is recommended to check the data sheet of the particular manufacturer of an IC instead of relying on Maxim's original data sheet. The original manufacturer (and now some clone manufacturers, too) offers a large series of similar ICs, with different numbers of receivers and drivers, voltages, built-in or external capacitors, etc. E.g. The MAX232 and MAX232A need external capacitors for the internal voltage pump, while the MAX233 has these capacitors built-in. The MAX233 is also between three and ten times more expensive in electronic shops than the MAX232A because of its internal capacitors. It is also more difficult to get the MAX233 than the garden variety MAX232A.A similar IC, the MAX3232 is nowadays available for low-power 3V logic. MAX232Application The MAX232(A) has two receivers (converts from RS-232 to TTL voltage levels) and two drivers (converts from TTL logic to RS-232 voltage levels). This means only two of the RS-232 signals can be converted in each direction. The old MC1488/1498 combo provided four drivers and receivers. Typically a pair of a driver/receiver of the MAX232 is used for TX and RX and the second one for CTS and RTS. There are not enough drivers/receivers in the MAX232 to also connect the DTR, DSR, and DCD signals. Usually these signals can be omitted when e.g. communicating with a PC's serial interface. If the DTE really requires these signals either a second MAX232 is needed, or some other IC from the MAX232 family can be used (if it can be found in consumer electronic shops at all). An alternative for DTR/DSR is also given below.Maxim's data sheet explains the MAX232 family in great detail, including the pin configuration and how to connect such an IC to external circuitry. Exactly to connect the RS232 signals to the IC. So here is one possible example: www.final-yearproject.com | www.finalyearthesis.com
  47. 47. RFID Based System For Healthcare Service MAX232 Pin Nbr. MAX232 Pin Name Signal Voltage DB9 Pin 7 T2out CTS RS-232 7 8 R2in RTS RS-232 8 9 R2out RTS TTL n/a 10 T2in CTS TTL n/a 11 T1in TX TTL n/a 12 R1out RX TTL n/a 13 R1in RX RS-232 2 14 T1out TX RS-232 3 15 GND GND 0 5 Table 5.3.2 RS232-DB9 pin Diagram specifications 5.4 Keypad Keypads and LCDs are the most widely used input/output devices of the 8051, and a basic understanding of them is essential. At the lowest level, keyboards are organized in a matrix of rows and columns. The CPU accesses both rows and column through ports; therefore, with 8-bit ports, an 4*4 matrix of keys can be connected to a microprocessor. When a key pressed, a row and column make a connect; otherwise, there is no connection between row and column. In IBM PC keyboards, a single microcontroller (consisting of microprocessor, RAM and EPROM, and several ports all on a single chip) takes care of software and hardware interfacing of keyboard. In such systems it is the function of programs stored in the EPROM of microcontroller to scan the keys continuously, identify which one has been activated, and present it to the motherboard. In this section we look at the mechanism by which the 8051 scans and identifies the key. www.final-yearproject.com | www.finalyearthesis.com
  48. 48. RFID Based System For Healthcare Service A 4*4 matrix connected to two ports. The rows are connected to an output port and the columns are connected to an input port. If no key has been pressed, reading the input port will yield 1s for all columns since they are all connected to high (Vcc) If all the rows are grounded and a key is pressed, one of the columns will have 0 since the key pressed provides the path to ground. It is the function of the microcontroller to scan the keyboard continuously to detect and identify the key pressed. How it is done is explained next. Figure 5.4 4*4 Keypad To detect a pressed key, the microcontroller grounds all rows by providing 0 to the output latch, and then it reads the columns. If the data read from the columns is D3-D0=1111, no key has been pressed and the process continues until a key press is detected. However, if one of the column bits has a zero, this means that a key press has occurred. For example, if D3D0=1101, this means that a key in the D1 column has been pressed. After a key press is detected, the microcontroller will go through the process of identifying the key. Starting with the top row, the microcontroller grounds it by providing a low to row D0 only; then it reads the columns. If the data read is all1s, no key in that row is activated and the process is moved to the next row. It grounds the next row, reads the columns, and checks for any zero. This process continues until the row is identified. After identification of the row in which the key has been pressed, the next task is to find out which column the pressed key belongs to. This should be easy since the microcontroller knows at any time which row and column are being accessed. www.final-yearproject.com | www.finalyearthesis.com
  49. 49. RFID Based System For Healthcare Service Assembly language program for detection and identification of key activation is given below. In this program, it is assumed that P1 and P2 are initialized as output and input, respectively. Program13.1 goes through the following four major stages: 1. To make sure that the preceding key has been released, 0s are output to all rows at once, and the columns are read and checked repeatedly until all the columns are high. When all columns are found to be high, the program waits for a short amount of time before it goes to the next stage of waiting for a key to be pressed. 2. To see if any key is pressed, the columns are scanned over and over in an infinite loop until one of them has a 0 on it. Remember that the output latches connected to rows still have their initial zeros (provided in stage 1), making them grounded. After the key press detection, it waits 20ms for the bounce and then scans the columns again. This serves two functions: (a) it ensures that the first key press detection was not an erroneous one due to spike noise, and(b) the 20ms delay prevents the same key press from being interpreted as a multiple key press. If after the 20-ms delay the key is still pressed, it goes to the next stage to detect which row it belongs to; otherwise, it goes back into the loop to detect a real key press 3. To detect which row the key press belongs to, it grounds one row at a time, reading the columns each time. If it finds that all columns are high, this means that the key press cannot belong to that row; therefore, it grounds the next row and continues until it finds the row the key press belongs to. Upon finding the row that the key press belongs to, it sets up the starting address for the look-up table holding the scan codes (or the ASCII value) for that row and goes to the next stage to identify the key. 4. To identify the key press, it rotates the column bits, one bit at a time, into the carry flag and checks to see if it is low. Upon finding the zero, it pulls out the ASCII code for that key from the look-up table; Otherwise, it increments the pointer to point to the next element of the look-up table. While the key press detection is standard for all keyboards, the process for determining which key is pressed varies. The look-up table method shown in program can be modified to work with any matrix up to 8*8. www.final-yearproject.com | www.finalyearthesis.com
  50. 50. RFID Based System For Healthcare Service 6. SOFTWARE REQUIREMENTS Keil an ARM Company makes C compilers, macro assemblers, real-time kernels, debuggers, simulators, integrated environments, evaluation boards, and emulators for ARM7/ARM9/Cortex-M3, XC16x/C16x/ST10, 251, and 8051 MCU families. The Keil 8051 Development Tools are designed to solve the complex problems facing embedded software developers Keil development tools for the 8051 Microcontroller Architecture support every level of software developer from the professional applications engineer to the student just learning about embedded software development. When starting a new project, simply select the microcontroller you use from the Device Database and the µVision IDE sets all compiler, assembler, linker, and memory options for you. Numerous example programs are included to help you get started with the most popular embedded 8051 devices. The Keil µVision Debugger accurately simulates on-chip peripherals (I²C, CAN, UART, SPI, Interrupts, I/OPorts, A/D Converter, D/A Converter, and PWM Modules) of your 8051 device. Simulation helps you understand hardware configurations and avoids time wasted on setup problems. Additionally, with simulation, you can write and test applications before target hardware is available Embedded ‘C’: Ex: Hitec – c, Keil – c HI-TECH Software makes industrial-strength software development tools and C compilers that help software developers write compact, efficient embedded processor code. For over two decades HI-TECH Software has delivered the industry's most reliable embedded software development tools and compilers for writing efficient and compact code to run on the most popular embedded processors. Used by tens of thousands of customers including General Motors, Whirlpool, Qualcomm, John Deere and many others, HI-TECH's reliable development tools and C compilers, combined with world-class support have helped www.final-yearproject.com | www.finalyearthesis.com
  51. 51. RFID Based System For Healthcare Service serious embedded software programmers to create hundreds of breakthrough new solutions.Whichever embedded processor family you are targeting with your software, whether it is the ARM, PICC or 8051 series, HI-TECH tools and C compilers can help you write better code and bring it to market faster. HI-TECH PICC is a high-performance C compiler for the Microchip PIC micro 10/12/14/16/17 series of microcontrollers. HI-TECH PICC is an industrial-strength ANSI C compiler - not a subset implementation like some other PIC compilers. The PICC compiler implements full ISO/ANSI C, with the exception of recursion. All data types are supported including 24 and 32 bit IEEE standard floating point. HI-TECH PICC makes full use of specific features and using an intelligent optimizer, can generate high-quality code easily rivaling hand-written assembler. Automatic handling of page and bank selection frees the programmer from the trivial details of assembler code. Embedded “C” Compiler  ANSI C - full featured and portable.  Reliable - mature, field-proven technology.  Multiple C optimization levels .  An optimizing assembler.  Full linker, with overlaying of local variables to minimize RAM usage.  Comprehensive C library with all source code provided.  Includes support for 24-bit and 32-bit IEEE floating point and 32-bit long data types.  Mixed C and assembler programming.  Unlimited number of source files.  Listings showing generated assembler.  Compatible - integrates into the MPLAB IDE, MPLAB ICD .  Runs on multiple platforms: Windows, Linux, UNIX, Mac OS X, Solaris. Embedded System Tools Assembler An assembler is a computer program for translating assembly languageessentially, a mnemonic representation of machine language into object code. A cross assembler (see cross compiler) produces code for one type of processor, but runs on another. The computational www.final-yearproject.com | www.finalyearthesis.com
  52. 52. RFID Based System For Healthcare Service step where an assembler is run is known as assembly time. Translating assembly instruction mnemonics into opcodes, assemblers provide the ability to use symbolic names for memory locations (saving tedious calculations and manually updating addresses when a program is slightly modified), and macro facilities for performing textual substitution typically used to encode common short sequences of instructions to run inline instead of in a subroutine. Assemblers are far simpler to write than compilers for high-level languages. Assembly Language Has Several Benefits Speed: Assembly language programs are generally the fastest programs around. Space: Assembly language programs are often the smallest. Capability: You can do things in assembly which are difficult or impossible in High level languages. Knowledge: Your knowledge of assembly language will help you write better programs, even when using High level languages. An example of an assembler we use in our project is RAD 51. Simulator Simulator is a machine that simulates an environment for the purpose of training or research. We use a UMPS simulator for this purpose in our project. UMPS Universal microprocessor program simulator simulates a microcontroller with its external environment. UMPS is able to simulate external components connected to the microcontroller. Then, debug step is dramatically reduced. UMPS is not dedicated to only one microcontroller family, it can simulate all kind of microcontrollers. The main limitation is to have less than 64K-Bytes of RAM and ROM space and the good microcontroller library. UMPS provide all the facilities other low-cost simulator does not have. It offers the user to see the "real effect" of a program and a way to change the microcontroller family without changing IDE. UMPS provide a low-cost solution to the problems. UMPS is really the best solution to your evaluation. www.final-yearproject.com | www.finalyearthesis.com
  53. 53. RFID Based System For Healthcare Service UMPS Key Features The speed, UMPS can run as fast as 1/5 the real microcontroller speed. No need to wait 2 days to see the result of a LCD routine access. All the microcontroller parts are simulated, interrupts, communication protocol, parallel handshake, timer and so on. UMPS have an integrated assembler/disassembler and debugger. It is able to accept an external assembler or compiler. It has a text editor which is not limited to 64K-bytes and shows keyword with color. It can also communicate with an external compiler to integrate all the debug facilities you need.UMPS is universal, it can easily be extended to other microcontroller with a library. Ask us for toolkit development.External resource simulation is not limited. It can be extended to your proper needs by writing your own DLL.UMPS allows you to evaluate at the lowest cost the possibility to build a microcontroller project without any cable. - UMPS include a complete documentation on each microcontroller which describe special registers and each instruction. User Interfaces User interfaces for embedded systems vary widely, and thus deserve some special comment. User interface is the ultimate aim for an embedded module as to the user to check the output with complete convenience. One standard interface, widely used in embedded systems, uses two buttons (the absolute minimum) to control a menu system (just to be clear, one button should be "next menu entry" the other button should be "select this menu entry"). Another basic trick is to minimize and simplify the type of output. Designs sometimes use a status light for each interface plug, or failure condition, to tell what failed. A cheap variation is to have two light bars with a printed matrix of errors that they select- the user can glue on the labels for the language that he speaks. For example, most small computer printers use lights labeled with stick-on labels that can be printed in any language. In some markets, these are delivered with several sets of labels, so customers can pick the most comfortable language. In many organizations, one person approves the user interface. Often this is a customer, the major distributor or someone directly responsible for selling the system. www.final-yearproject.com | www.finalyearthesis.com
  54. 54. RFID Based System For Healthcare Service Platform There are many different CPU architectures used in embedded designs such as ARM, MIPS, Coldfire/68k, PowerPC, X86, PIC, 8051, Atmel AVR, H8, SH, V850, FR-V, M32R etc. This in contrast to the desktop computer market, which as of this writing (2003)is limited to just a few competing architectures, mainly the Intel/AMDx86, and the Apple/Motorola/IBMPowerPC, used in the Apple Macintosh. With the growing acceptance of Java in this field, there is a tendency to even further eliminate the dependency on specific CPU/hardware (and OS) requirements. Standard PC/104 is a typical base for small, low-volume embedded and ruggedized system design. These often use DOS, Linux or an embedded real-time operating system such as QNX or Inferno. A common configuration for very-high-volume embedded systems is the system on a chip, an application-specific integrated circuit, for which the CPU was purchased as intellectual property to add to the IC's design. A related common scheme is to use a fieldprogrammable gate array, and program it with all the logic, including the CPU. Most modern FPGAs are designed for this purpose. Tools Like typical computer programmers, embedded system designers use compilers, assemblers, and debuggers to develop embedded system software. However, they also use a few tools that are unfamiliar to most programmers. Software companies that specialize in the embedded market Ported from the GNU software development tools. Sometimes, development tools for a personal computer can be used if the embedded processor is a close relative to a common PC processor. Embedded system designers also use a few software tools rarely used by typical computer programmers. One common tool is an "in-circuit emulator" (ICE) or, in more modern designs, an embedded debugger. This debugging tool is the fundamental trick used to develop embedded code. It replaces or plugs into the microprocessor, and provides facilities to quickly load and debug experimental code in the system. A small pod usually provides the special electronics to plug into the system. Often a personal computer with special software attaches to the pod to provide the debugging interface. www.final-yearproject.com | www.finalyearthesis.com
  55. 55. RFID Based System For Healthcare Service Another common tool is a utility program (often home-grown) to add a checksum or CRC to a program, so it can check its program data before executing it. An embedded programmer that develops software for digital signal processing often has a math workbench such as MathCad or Mathematical to simulate the mathematics. Less common are utility programs to turn data files into code, so one can include any kind of data in a program. A few projects use Synchronous programming languages for extra reliability or digital signal processing. Debugging Debugging is usually performed with an in-circuit emulator, or some type of debugger that can interrupt the microcontroller's internal microcode. The microcode interrupt lets the debugger operate in hardware in which only the CPU works. The CPU-based debugger can be used to test and debug the electronics of the computer from the viewpoint of the CPU. This feature was pioneered on the PDP-11. As the complexity of embedded systems grows, higher level tools and operating systems are migrating into machinery where it makes sense. For example, cell phones, personal digital assistants and other consumer computers often need significant software that is purchased or provided by a person other than the manufacturer of the electronics. In these systems, an open programming environment such as Linux, OSGi or Embedded Java is required so that the third-party software provider can sell to a large market. Operating System Embedded systems often have no operating system, or a specialized embedded operating system (often a real-time operating system), or the programmer is assigned to port one of these to the new system. Built- In Self- Test Most embedded systems have some degree or amount of built-in self-test. There are several basic types. 1. Testing the computer. 2. Test of peripherals. www.final-yearproject.com | www.finalyearthesis.com
  56. 56. RFID Based System For Healthcare Service 3. Tests of power. 4. Communication tests. 5. Cabling tests. 6. Rigging tests. 7. Consumables test. 8. Operational test. www.final-yearproject.com | www.finalyearthesis.com
  57. 57. RFID Based System For Healthcare Service 7. CODE GENERATION #include<reg51.h> #include<string.h> void Delay_1ms(void); void Delay_30ms(void); void Delay(unsigned int); void MSDelay(unsigned char); void lcd_cmd(unsigned char); void lcd_pos(unsigned char); //set the lcd address void lcd_char(unsigned char); //convert the integer value to writing format void lcd_print(unsigned char *); unsigned char keypad(void); void lcd_init(void); //write the string to LCD void lcd_clear(void); void uart_init(void); void lcd_print(unsigned char *); sbit RS =P2^7; //RESET sbit RW =P2^6; //READ/WRITE sbit EN =P2^5; //ENABLE sfr LCD=0x80; void reader(void); void database(void); www.final-yearproject.com | www.finalyearthesis.com
  58. 58. RFID Based System For Healthcare Service unsigned char temp,blood,heart; unsigned char rf[13]; #define COLROW P1 unsigned char code keypadMatrix[4][4]={"1234", "5678", "90AB", "CDE#"}; unsigned char t[3],b[3],h[3]; void main() { unsigned char key1; lcd_init(); lcd_print("LCD READY"); Delay(200); lcd_clear(); uart_init(); lcd_print("UART READY"); Delay(200); lcd_clear(); lcd_cmd(0x83); lcd_print("RFID BASED"); lcd_cmd(0xC2); lcd_print("SYSTEM FOR"); www.final-yearproject.com | www.finalyearthesis.com
  59. 59. RFID Based System For Healthcare Service Delay(500); lcd_clear(); lcd_cmd(0x82); lcd_print("HEALTH CARE"); lcd_cmd(0xC4); lcd_print("SERVICES"); Delay(500); lcd_clear(); while(1) { lcd_clear(); lcd_print("PRESS 1 TO"); lcd_pos(0xc0); lcd_print("STORE DATA"); Delay(500); Delay(500); lcd_clear(); lcd_print("PRESS 2 TO"); lcd_pos(0xc0); lcd_print("READ DATA"); Delay(500); Delay(500); lcd_clear(); www.final-yearproject.com | www.finalyearthesis.com
  60. 60. RFID Based System For Healthcare Service key1=keypad(); lcd_char(key1); Delay(500); Delay(500); lcd_clear(); if(key1 == '1') reader(); else if(key1== '2') database(); else { lcd_clear(); lcd_print("INVALID INPUT"); } Delay(500); Delay(500); } } void reader(void) { unsigned char id[5],key; unsigned char i,k; www.final-yearproject.com | www.finalyearthesis.com
  61. 61. RFID Based System For Healthcare Service lcd_clear(); lcd_print("PLACE THE TAG"); lcd_pos(0xc0); lcd_print("BEFORE READER"); Delay(500); Delay(500); for(k=0;k<12;k++) { while(!RI); rf[k] = SBUF; RI=0; } rf[12]='0'; if(!strcmp(rf,"26006FCA6FEC")) { lcd_clear(); lcd_print(rf); Delay(200); Delay(200); lcd_clear(); lcd_print("ENTER 3 DIGIT ID"); Delay(200); lcd_clear(); www.final-yearproject.com | www.finalyearthesis.com
  62. 62. RFID Based System For Healthcare Service for(i=0;i<3;i++) { Delay(100); key=keypad(); lcd_char(key); id[i]=key; } id[i]='0'; Delay(200); if(!strcmp(id,"123")) { lcd_clear(); lcd_print("ACCESS OK"); Delay(200); Delay(200); lcd_clear(); lcd_print("ENTER TEMP"); Delay(200); lcd_clear(); for(i=0;i<3;i++) { Delay(100); key=keypad(); www.final-yearproject.com | www.finalyearthesis.com
  63. 63. RFID Based System For Healthcare Service lcd_char(key); t[i]=key; } temp=t[0]*100+t[1]*10+t[2]*1; lcd_clear(); lcd_print("ENTER BP"); Delay(200); lcd_clear(); for(i=0;i<3;i++) { Delay(100); key=keypad(); lcd_char(key); b[i]=key; } blood=b[0]*100+b[1]*10+b[2]*1; lcd_clear(); lcd_print("ENTER HEART BEAT"); Delay(200); lcd_clear(); for(i=0;i<3;i++) { Delay(100); www.final-yearproject.com | www.finalyearthesis.com
  64. 64. RFID Based System For Healthcare Service key=keypad(); lcd_char(key); h[i]=key; } heart=h[0]*100+h[1]*10+h[2]*1; } } } void database(void) { unsigned char i,k,id[5],key; lcd_clear(); lcd_print("PLACE THE TAG"); lcd_pos(0xc0); lcd_print("BEFORE READER"); Delay(500); Delay(500); for(k=0;k<12;k++) { while(!RI); rf[k] = SBUF; RI=0; } www.final-yearproject.com | www.finalyearthesis.com
  65. 65. RFID Based System For Healthcare Service rf[12]='0'; if(!strcmp(rf,"2600709EE62E")) { lcd_clear(); lcd_print(rf); Delay(200); Delay(200); lcd_clear(); lcd_print("ENTER 3 DIGIT ID"); Delay(200); Delay(200); lcd_clear(); for(i=0;i<3;i++) { Delay(100); key=keypad(); lcd_char(key); id[i]=key; } id[i]='0'; Delay(200); if(!strcmp(id,"123")) { www.final-yearproject.com | www.finalyearthesis.com

×