Project Report (CS499) - Albert Maira
Project Report (CS499) - Albert Maira
Project Report (CS499) - Albert Maira
PROJECT REPORT CS499 PROJECT TITLE: MICROCONTROLLER BASED TAXI BILLING SYSTEM
A Project Report in Partial Fulfilment for the Award of Bachelor of Science in Computer Engineering & Information Technology
Name of Candidate: Maira, Albert M. Registration Number: 2006-04-05608 Supervisor: Dr. M.M. Kissaka Submission Date: 9th July 2010
Table of Contents
Content Page
TABLE OF CONTENTS .............................................................................................................................. I DECLARATION ........................................................................................................................................ III ABSTRACT ................................................................................................................................................ IV ACKNOWLEDGEMENTS .........................................................................................................................V LIST OF FIGURES .................................................................................................................................... VI LIST OF TABLES ...................................................................................................................................... VI LIST OF ABBREVIATIONS AND ACRONYMS .................................................................................VII CHAPTER 1 ................................................................................................................................................. 1 INTRODUCTION ........................................................................................................................................ 1 1.1 WHAT IS A TAXIMETER? ....................................................................................................................... 1 1.2 CURRENT SITUATION ............................................................................................................................ 1 1.3 PROBLEM STATEMENTS ........................................................................................................................ 2 1.4 OBJECTIVES .......................................................................................................................................... 2 1.5 SIGNIFICANCE OF THE PROJECT ............................................................................................................. 3 1.6 SCOPE OF THE PROJECT ......................................................................................................................... 3 1.7 METHODOLOGY .................................................................................................................................... 3 CHAPTER 2 ................................................................................................................................................. 5 LITERATURE REVIEW ............................................................................................................................ 5 2.1 MICROCONTROLLER ............................................................................................................................. 5 2.2 LCD ..................................................................................................................................................... 7 2.3 TAXIMETERS ......................................................................................................................................... 7 2.3.1 Mechanical taximeters ................................................................................................................. 7 2.3.2 Microprocessor taximeters .......................................................................................................... 8 2.3.3 Microcontroller taximeters .......................................................................................................... 9 2.4 DIGITAL LOGIC ..................................................................................................................................... 9 2.5 ODOMETRY ..........................................................................................................................................10 2.6 INTERRUPTS .........................................................................................................................................10 CHAPTER3 .................................................................................................................................................12 INITIAL DESIGN .......................................................................................................................................12 3.1 SYSTEM MODELLING ...........................................................................................................................12 3.1.1 System Requirements...................................................................................................................12 3.1.2 Block Diagram of the System ......................................................................................................12 3.1.3 System flow chart ........................................................................................................................13 3.1.4 Resource management ................................................................................................................15 3.2 COMPONENTS SELECTION ....................................................................................................................15 3.2.1 PIC16F877A microcontroller .....................................................................................................15 3.2.2 JHD162A DISPLAY ....................................................................................................................18 3.2.3 Keypad ........................................................................................................................................19 3.2.4 Pushbutton switch .......................................................................................................................20 CHAPTER 4 ................................................................................................................................................21 DEVICE CONFIGURATION ....................................................................................................................21 4.1 POWER CONFIGURATION ......................................................................................................................21
4.1.1 Power-On Reset (POR) ...............................................................................................................22 4.1.2 MCLR Reset during normal operation ........................................................................................23 4.1.3 MCLR reset during sleep ............................................................................................................23 4.1.4 WDT reset (During normal operation) .......................................................................................24 4.1.5 WDT Wake-up (during SLEEP) ..................................................................................................24 4.1.6 Brown-out Reset (BOR) ..............................................................................................................24 Power Control/Status Register (PCON) ..............................................................................................25 Device Configuration Word Register ...................................................................................................26 4.2 OSCILLATOR CONFIGURATION .............................................................................................................27 4.3 INTERRUPT CONFIGURATION ...............................................................................................................29 4.3.1 INTCON register .........................................................................................................................30 4.3.2 OPTION_REG register ...............................................................................................................31 4.3.3 PIE1 register ...............................................................................................................................32 4.3.4 PIR1 register ...............................................................................................................................33 4.3.5 T1CON register ...........................................................................................................................34 4.4 I/O PORTS DIRECTION .........................................................................................................................36 4.4.1 Port A ..........................................................................................................................................36 4.4.2 Port B ..........................................................................................................................................37 4.4.3 Port C ..........................................................................................................................................38 4.4.4 Port D .........................................................................................................................................38 4.4.5 Port E ..........................................................................................................................................38 CHAPTER 5 ................................................................................................................................................40 SOFTWARE IMPLEMENTATION .........................................................................................................40 5.1 MAIN PROGRAM THREAD .....................................................................................................................41 5.1.1 Initialisation ................................................................................................................................41 5.1.2 Update LCD display....................................................................................................................42 5.2 DISTANCE COST ISR THREAD ..............................................................................................................42 5.3 TIME COST ISR THREAD.......................................................................................................................42 CHAPTER 6 ................................................................................................................................................43 HARDWARE IMPLEMENTATION ........................................................................................................43 6.1 POWER SUPPLY ....................................................................................................................................44 6.2 DEVICE INTERFACING ..........................................................................................................................46 6.2.1 Interfacing PIC16F877A and LCD screen..................................................................................46 6.2.2 Interfacing PIC16F877A and Keypad.........................................................................................47 6.2.3 Interfacing PIC16F877A with sensor .........................................................................................47 6.3 RESET CIRCUIT.....................................................................................................................................48 6.4 CIRCUIT SIMULATION ..........................................................................................................................50 CHAPTER 7 ................................................................................................................................................52 CONCLUSION ............................................................................................................................................52 7.1 CHALLENGES .......................................................................................................................................52 7.2 SUCCESSES ..........................................................................................................................................52 7.3 FAILURES .............................................................................................................................................53 7.4 RECOMMENDATIONS ...........................................................................................................................53 REFERENCES: ...........................................................................................................................................54 APPENDIX A: APPLICATION SOFTWARE CODE. ...........................................................................55 APPENDIX B: PROJECT ACTIVITIES .................................................................................................59 APPENDIX C: PROJECT COSTS ............................................................................................................60
ii
I declare that the work in this report was carried out in accordance with the regulations of the University of Dar es Salaam and has not been presented to any other University for examination either in Tanzania or overseas. Any views expressed in the report are those of the author and in no way represent those of the University of Dar es Salaam.
Maira, Albert M.
SIGNED: .
DATE: .
iii
Abstract
Within our modern day towns and cities in Tanzania taxicabs are a common means of transportation, but the billing of the taxicabs is currently done through negotiation between the taxicab driver and a prospective customer. This situation can lead into several inconveniences to both the taxicab driver and the customer.
This design project proposes a prototype microcontroller circuit that will enable to implement a computerised billing mechanism to be used to automate the billing in taxicabs.
In this design an external wheel revolution sensor is used to generate an interrupt to the microcontroller each time the wheels make a single revolution; and from this interrupt, distance travelled is deduced by using wheel dimensions (circumference). Also time duration of the journey is obtained from an internal timer in the microcontroller which is set to overflow after every two seconds; and from this interrupt, hiring time of the journey is obtained for billing purposes.
Then finally, the microcontroller by using the predetermined billing rate which is based on parameters of cost per 100metres distance and cost per 1minute time of the journey, it calculates the cost (in T.Shs) incurred by the customer and displays it on the LCD screen.
iv
Acknowledgements
The first and the foremost to be thanked is the almighty God, who gave me strength, courage, and direction to perform this project. Secondly, I would like to acknowledge Dr. M.M. Kissaka my supervisor for providing me assistance, guidance and constructive criticism throughout the design of my project.
Also I would like to give my sincere thanks to all Electrical and Computer Systems engineering (ECSE) department staffs for their constructive suggestions and help toward my project.
List of figures
Figure 1: System block diagram ....................................................................................... 13 Figure 2: System flow chart .............................................................................................. 14 Figure 3: Reset circuit ....................................................................................................... 23 Figure 4: PIC power stabilisation supply.......................................................................... 45 Figure 5: LCD Power stabilisation circuit ........................................................................ 46 Figure 6: Microcontroller reset circuit .............................................................................. 49 Figure 7: Taxicab choices ................................................................................................. 50 Figure 8: Taxicab billing................................................................................................... 51 Figure 9: Display bill ........................................................................................................ 51
List of tables
Table 1:PIC16F877A features .......................................................................................... 17 Table 2: Oscillator frequency configuration choices ........................................................ 28 Table 3: Recommended capacitors for crystal oscillator .................................................. 28 Table 4: Prescaler rate select bits ...................................................................................... 32 Table 5: Bill of materials (BOM)...................................................................................... 49
vi
vii
Chapter 1 Introduction
Microcontroller based taxi billing system is a computerised electronic billing system for rented personal transportation services of a taxicab, which are commonly found within our modern day towns and cities as one of transportation means.
Microcontrollers are virtually everywhere in our modern society such that they can be found in practically every digital electronic device that furnishes an independent functionality to its user be it at home, industry or office. For example we can find microcontrollers in our televisions, fridges, microwave ovens, personal computers and printers.
Taximeters arose out of a need to automate the taxi fare since in our present day society we tend to seek efficiency and quality in our lives, with minimum resources in terms of cost and time through the use automatic or semi-automatic mechanisation.
There is no clear billing structure used to arrive at the cost rather billing is assumed depending on the case by case basis and bargain power of the parties, this design project 1
will address this shortage by proposing a microcontroller based billing system which uses billing structure based on the measured distance and time to determine the cost.
1.4 Objectives
Due to the aforementioned problems of the present situation this design project will address the situation by proposing a microcontroller billing system whose main objective is to computerise and thus automate the billing system of rented transportation services of the taxicab by achieving the following specific objectives. To design a microcontroller circuit that is capable of measuring time and distance. To design a microcontroller circuit that calculates the cost by using time and distance as the billing parameters. To design a microcontroller circuit that displays the measured distance, time and cost on the alphanumeric LCD screen.
1.7 Methodology
Since the system to be designed is an embedded electronics application then both principles of hardware and software design methodologies are adopted in order to accomplish the intended designed system then the following development approach will be used. Literature review in design, interfacing and practical limitations and challenges of microcontroller systems. Functional requirements elicitation from the users of the proposed system. System requirements identification. System plan design and circuit simulation. Implementation of system plan and circuit on to a breadboard prototype circuit. Testing of prototype to ascertain that the requirements have been met and to account for the subtle practical challenges.
The current situation has been outlined in this chapter together with its associated problems and a design methodology has been identified as an approach to achieve the design goals and solve the present problems. So the next chapter is about literature review on the different implementation of taximeters together with associated technologies so as to achieve an efficient and useful design in this project.
2.1 Microcontroller
A microcontroller is a single chip, self contained computer which incorporates all the basic components of a much familiar personal computer but on a much smaller scale. Thats why microcontrollers are often referred to as single chip devices or single chip computers. The main consequence of the microcontrollers small size is that its resources are far more limited than those of a personal computer microprocessor.
In functional terms, a microcontroller is a programmable single chip which controls a process or system. Microcontrollers are typically used as embedded controllers where they control part of a larger system such as an appliance, automobile device, scientific instrument or a computer peripheral to name a few. In this design a microcontroller will be used to control a process that is the billing process.
Physically, a microcontroller is an integrated circuit with pins. The pins present on a microcontroller are used for power, ground, oscillator clock signals, I/O ports, interrupt request signals, reset and control pins. In contrast the pins present on a microprocessor are most often memory bus signals (rather than I/O ports). A typical microcontroller has the following building parts CPU: this is a part that does all the computing and supervisory functions within a microcontroller as it; fetches, decodes and executes program instructions and directs the flow of data to and from memory. The CPU performs the calculations as required by program instructions and places the results of these calculations into memory space.
ROM: this is a non-volatile memory used for storage of program codes and data in the microcontroller. The microcontroller uses ROM memory space to store program instructions so that they can not be affected by loss of power.
RAM: this is the data memory used to store all of the program variables, thus it is used to read and write data values as a program runs. RAM uses volatile memory (hence when the power is off its contents are lost) type of technology whose access time does not depend on the spatial locality of the given memory address.
I/O PORTS: these are the pins used to provide communication access to/from the microcontroller and other electronic peripheral devices and systems.
Just as any other computer architecture microcontrollers are of two basic types; Harvard architecture microcontroller: in this architecture the microcontroller uses separate memory space for program instructions and data. This allows two or more internal data buses which allow simultaneous access to both instructions and data. for example the CPU fetches instruction on the program memory bus if fetched instruction requires an operation on data memory the CPU can fetch the next program instruction while it uses the data bus for its data operation this gives high throughput and speeds up execution time, but at the cost of more hardware complexity as this architecture requires much more internal buses for data and program instruction. In this design a microcontroller with Harvard architecture will be used due to good performance. Von Neumann architecture microcontroller: in this microcontroller architecture there is a single common memory space where both program instructions and data are stored, thus there is a single data bus which fetches both instructions and data. Each time the PU fetches a program instruction it may have to perform one or more read/write operations to data memory space. It must wait until these subsequent operations are complete before it can fetch and decode the next program instruction. The advantage of this architecture lies in its simplicity and economy.
2.2 LCD
LCDs are alphanumeric displays which are commonly used in microcontroller circuit applications due to their advantages of low cost and low power consumption. And thus are ideal in low power battery operated portable devices. There are basically two types of LCDs as far as the interface technique is concerned namely parallel and serial LCDs.
Parallel LCDs are connected to the microcontroller I/O pins using four or eight data wires and data is transferred from the microcontroller to the LCD in parallel form either one nibble at a time if four data wire mode or one byte if eight data wire mode is used. This has the advantage of being economical and with better performance.
Serial LCDs are connected to the microcontroller using only one data line and data is transferred to the LCD using the standard RS232 asynchronous data communication protocols. Serial LCDs are easier to use but they usually cost more than the parallel ones due to presence of serial controller chip such as RS232.however they have an advantage that only one wire is used to interface them to a microcontroller, thus saving the number of I/O pins required.
In this design a parallel LCD with eight data wires will be used due to better performance and relatively smaller cost as compared to serial LCD.
2.3 Taximeters
Apart from the microcontroller approach chosen in this design there are other two more methods which can be used to provide a billing mechanism of taxicabs.
They have good temperature performance. They are immune from electrical and electromagnetic interference.
The mechanical taximeters have the following disadvantages They are heavy and bulky. They are difficulty to calibrate accurately on a timely basis. They suffer from poor accuracy. They lack adequate resolution. They have limitations on the number of optional rates. They have limited feature capability. They do not take advantage of available electronic technology. The process of calibrating mechanical taximeters to new fare rates is awkward and expensive as it usually requires change in computing gears. Mechanical computing gears with time are subject to corrosion and wear and this introduces errors in fare calculations. In general the use of mechanical taximeters does not provide much room for flexibility in the billing requirements and it does not fit well with present day ubiquitous electronics technologies which are much more efficient and cheap.
However the microprocessor taximeters have the following disadvantages They have poor temperature performance. They have high cost. They are susceptible from electrical and electromagnetic interference.
In general the use of general purpose microprocessor in taximeters is uneconomical as the microprocessors have so many capabilities (which must be paid for at a high cost), but which are not normally needed in the operation of taximeters.
main reason CMOS logic has become the dominant form of logic used for large complex ICs.
Thus for this design CMOS based electronic devices will be used.
2.5 Odometry
Odometry is the technique of measuring distance travelled by a vehicle, generally by measuring wheel revolutions. A pushbutton switch in this design will be used to measure angular displacement of a wheel. By knowing the wheel dimensions (i.e. circumference) it is not difficult to calculate the actual distance moved this is a simple technique but, it can take no account of wheel slippage, or inaccuracies in wheel dimensions due to change in tyre pressure or other parts of the measurement chain.
2.6 Interrupts
Interrupts are a mechanism of a microcontroller which enables it to respond to some events at the moment when they occur, regardless of what microcontroller is doing at the time. This is a very important part in this design, because it provides connection between a microcontroller and environment which surrounds it. Generally, each interrupt changes the program flow, interrupts it and after executing an interrupt subprogram (interrupt routine) it continues from that same point onwards.
There are basically two types of interrupts namely; Hardware interrupts these are interrupts that are initiated by a peripheral hardware module event for example the timer module could issue an interrupt on overflow to the central processing unit. Software interrupts are software instructions that make calls to interrupt-handler routines. Software interrupts are not often used in smaller microcontrollers, but they are very common in microprocessor architectures as trap handlers.
In typical microcontroller architecture there are multiple hardware interrupt sources and when an interrupt request is acknowledged the execution jumps to the handler, the address the program jumps to is known as the interrupt vector.
10
Depending on the architecture of the microcontroller the interrupts can be either be vectored or non vectored interrupts. For vectored interrupts architectures this address is specified by the application while for non-vectored architectures a specific address is used by the processor.
The midrange PIC16FXXX MCU architecture (to be used in this project) uses nonvectored approach; whereby whenever an interrupt occurs the program goes to constant ISR address constant at 0004h. Thus it is the duty of the programmer to test which specific interrupt indeed occurred (i.e. by testing specific interrupt flag bits) and take appropriate action accordingly. Some processors with vectored interrupt approach (e.g. high end architecture devices PIC24FXXX) have multiple interrupt vectors for handling multiple interrupt sources with different interrupt handlers at programmer specified memory location.
11
12
Wheel revolution sensor: this is a digital switch that triggers a wheel revolution interrupt to a microcontroller each time it is triggered by a wheel revolution. LCD screen: this is the display used to show the measured distance, time and calculated cost. Microcontroller: this is the workhorse of the system and performs all the decision making and computations.
Display
Keypad
Microcontroller
Revolution sensor
13
Start Disable time interrupt Initialisation Save main program registers to be affected No Wait for START key Increment seconds time counter Is the start key pressed? Yes Is 100 metres reached? Yes Increment distance metres counter Save main program registers to be affected Disable sensor interrupt
Increment cost due to 100 metres distance Update display No No No Reset hundred metres counter
Is the stop key pressed? Restore main program registers Restore main program registers
Return
Return
14
15
Microchip's efforts at continually improving and enhancing the PIC MCU family based on customer's needs. High-Performance RISC CPU which means all instructions are single-cycle except for program branches which needs two instruction cycles. It has enhanced flash program memory (EEPROM) package with typical 100,000 erase/write cycle. It has Data EEPROM memory with a typical 1,000,000 erase/write cycle. Data EEPROM Retention time of at least 40 years. It has a Low-power CMOS Technology with a fully static design and a wide operating voltage range (2.0V to 5.5V). Internal Watchdog Timer (WDT) with its own on-chip RC oscillator for reliable operation Programmable code protection capability. Power saving Sleep mode ability. Selectable oscillator options.
These strengths have contributed to the Microchip PIC8-bit MCU being the second most popular microcontroller product in the world today (1as of 2010). This is up from the twentieth position in 1995.
www.microchip.com
16
The PIC16F877A microcontroller belongs in a midrange family of microchips microcontroller products. It is a 40 pins flash based 8-bit CMOS microcontroller with the following main features
Table 1:PIC16F877A features Key Features Operating Frequency Resets (and Delays) Flash Program Memory (14-bit words) Data Memory (bytes) EEPROM Data Memory (bytes) Interrupts I/O Ports Timers Capture/Compare/PWM modules Serial Communications Parallel Communications 10-bit Analogue-to-Digital Module Analogue Comparators Instruction Set Packages PIC16F877A DC 20 MHz POR, BOR (PWRT, OST) 8K 368 256 15 Ports A, B, C, D, E 3 2 MSSP, USART PSP 8 input channels 2 35 Instructions 40-pin PDIP 44-pin PLCC 44-pin TQFP 44pin QFN
The other important features of PIC16F877A which are important in this design include It contains internal 16bit TIMER1 which can be used to monitor the elapsed time for billing purposes. This timer will cause an interrupt each moment it overflows and its interrupt on overflow can be monitored for elapsed time for billing. It has PORTB 0 external interrupt which can be used to monitor the wheel revolution sensor interrupt, such that each moment the PORTB 0 changes from low to high by an external sensor; an interrupt for a wheel revolution will be generated. The PORTB 0 has internal pull capability which means the pins on this port can be configured to be internally tied to logic HIGH by being internally connected to V dd , and thus when they change to logic LOW via a grounding switch caused by
17
an external event such as key press an appropriate action can be taken due to this external interrupt by a microcontroller. Brown-out detection circuitry for Brown-out Reset (BOR) which has the ability of detecting the unsafe operation voltage and will reset the MCU should it detect anomalous power state.
JHD162A contains HD44780U internal display controller which is capable of accepting data sent in either 4bit two operations or 8bit one operation ,so that it is capable of interfacing with both 4bit or 8bit microprocessor cores. Since in this design an 8bit mode will be used because the PIC16F877A microcontroller has an 8bit data processing core, in addition to that so as to achieve better performance an 8bit mode is preferred as few operations will be needed which consequently give short execution time as compared to 4bit mode which needs twice as much operations and thus time to display the same number of characters.
When the JHD162A display is not enabled, data lines are in tri-state mode which means they are in a state of high impedance (i.e. they appear as if they are disconnected) and this means they do not interfere with the operation of the microcontroller when the display is not being addressed.
JHD162A display has 16pin connector for interfacing the display to a microcontroller V ss this is the 0V grounding pin.
18
V dd this is the pin which is connected to the positive power supply, the manufacturers recommended supply is 5V,however the module can be operated as low as 3V or as high as 6V.
V ee this is the pin used to control the contrast of the display and thus should be connected to a variable voltage supply or it can be connected to ground if contrast adjustment is not needed.
RS this is the register select pin when it is low data transferred to the display is treated as commands on the other hand when RS is high a character can be transferred to or from the module.
R / W Pin this is the pin which is pulled low in order to write commands or
character data to the LCD module, also when this pin is high character data or status information can be read from the module. This pin is usually connected to ground because we normally write to the LCD module rather than read from it.
EN pin this is an enable pin which is used to initiate the transfer of commands or data between LCD module and microcontroller. when writing to the display data is transferred only on the high to low transition of this pin .when reading from the display data becomes available after the low to high transition of the enable pin and this data remains valid so long as the enable pin is high.
Pins 7 to 14 are eight data bus lines (D 0 to D 7 ) and will be used to transfer display characters to the LCD module.
Pin 15 provides an anode connection pin for LED backlight. Pin 16 provides a cathode for LED backlight.
3.2.3 Keypad
This is the twelve button 43 switch matrix keypad which allows the microcontroller to capture user settings and supervisory commands from the user. Functionally the keypad is simply a set of switches connected in a row and column arrangement and accessed by a scanning routine.
19
If the row inputs (A, B, C, D) are all set high initially and no button is pressed all the column outputs (1, 2, 3) will be high (i.e. pulled up to 5V). However if a logical LOW is output on each row in turn and a button pressed that LOW will appear at the column output and thus can be read into the PIC, the combination of active row and column identifies the pressed key by the microcontroller.
This is achieved in this design by internally puling up the PORTB 0 to V dd such that when this push button is pressed due to wheel revolution the PORTB 0 will go LOW and this will generate an external interrupt on the microcontroller. The pushbutton switch is chosen in this design due its following features It is simple to interface with the microcontroller since it is a passive sensor which means it does not require any signal conditioning mechanism. It is very economical as compared to other active sensors such as optoelectronic sensors which contain transduction mechanism to transform optical signal in to electrical signal. It does not require any analogue to digital conversion.
20
The device configuration relevant to this design has four main distinct categories namely Power configuration Oscillator configuration Interrupts configuration I/O ports configuration
OST module is the module that is intended to keep the chip in Reset until the crystal oscillator is stable The Oscillator Start-up Timer (OST) provides a delay of 1024 oscillator cycles (from OSC1 input) after the PWRT delay is over (i.e. if PWRT is
21
enabled). This helps to ensure that the crystal oscillator or resonator has started and has stabilised. The OST time-out is invoked only for XT, LP and HS modes and only on Power-on Reset or wake-up from Sleep.
The PIC16F877A differentiates between various kinds of RESET conditions Power-on Reset (POR) MCLR Reset during normal operation MCLR Reset during SLEEP WDT Reset (during normal operation) WDT Wake-up (during SLEEP) Brown-out Reset (BOR)
22
23
The TO and PD bits in the Status register can be used to determine the cause of device Reset. The PD bit, which is set on power-up, is cleared when Sleep is invoked. The TO bit is cleared if a WDT time-out occurred and caused wake-up.
24
T BOR , a RESET may not occur. This feature will be implemented so as to have a reliable microcontroller system which is intelligent enough to shut down when supplied power falls below optimal operating values.
Once the brown-out occurs, the device will remain in Brown-out Reset until V dd rises above V BOR . The Power-up Timer then keeps the device in RESET for T PWRT (about 72msec). If V dd should fall below V BOR during power-up timer (T PWRT ), the Brown-out Reset process will restart when V dd rises above V BOR with the Power-up Timer Reset. The Power-up Timer is always enabled when the Brown-out Reset circuit is enabled, regardless of the state of the PWRT configuration bit.
The above configurations choices are controlled and/or monitored by the microcontroller by using the following two registers; Power control/status registers (PCON) Configuration word register
25
0:
BOR : Brown-out Reset Status bit 1 = No Brown-out Reset occurred 0 = A Brown-out Reset occurred (must be set in software after a Brown-out Reset or Power-on Reset occurs)
Bit 0 is Brown-out Reset Status bit this bit is unknown on a Power-on Reset. It is recommended to the user to set it and check its status on subsequent RESETS to see if bit BOR cleared, indicating a BOR occurred. However when the Brown-out Reset is disabled, the state of the BOR bit is unpredictable and is, therefore, not valid at any time. Bit 1 is POR (Power-on Reset Status bit). It is cleared on a Power-on Reset and unaffected otherwise. The user must set this bit following a Power-on Reset.
The configuration bits can be programmed (read as '0') or left un-programmed (read as '1') to select various device configurations. The ability to change these settings once they have been programmed depends on the memory technology and the package type. For Read Only Memory (ROM) devices, these bits are specified at time of ROM code submittal and once the device is masked may not be changed for those devices (would require a new mask code).For One Time Programmable (OTP) devices, once these bits are programmed (0), they may not be changed. For windowed EPROM devices, once these bits are programmed (0), the device must be UV erased to return the configuration word to the erased state. UV erasing the device also erases the program memory. For Flash devices, these bits may be erased and reprogrammed.
26
In this design due to advantage of flexibility in prototyping the flash memory device is used. The program word register is then programmed as; Bit# 13 12 1 1 Bit# 13: 12: Flash memory code protection is DISABLED Unimplemented bit (recommended to read as 1)
11 1
10 1
9 1
8 1
7 0
6 1
5 1
4 1 0
3 0
2 0
0 1
10-9: WRT flash program memory write is DISABLED as the result the unprotected memory location can be written by EECON control 8: 7: CPD data EE memory code protection is DISABLED LVP: low voltage in circuit serial programming is DISABLED as the result RB3 is digital I/O and high voltage programming must be used on MCLR pin for downloading application code to the chip. 6: 5-4: 3: 2: 1-0: BOREN brown-out reset control bit is ENABLED Unimplemented manufacturer recommends to read as 1
27
Table 2: Oscillator frequency configuration choices Configuration bits OSC OSC Comment FOSC1:FOSC0 Mode Feedback Inverter Gain 11 RC Least expensive solution for device oscillation (only an external resistor and capacitor is required). Most variation in time-base. Devices default mode. 10 HS High Gain High frequency application. Oscillator circuits mode consumes the most current of the three crystal modes. 01 XT Medium Standard crystal/resonator frequency. Gain Oscillator circuits mode consumes the middle current of the three crystal modes. 00 LP Low Gain Low power/frequency applications. Oscillator circuits mode consumes the least current of the three crystal modes. In XT, LP or HS modes, a crystal or ceramic resonator is connected to the OSC1/CLKIN and OSC2/CLKOUT pins to establish oscillation. The PIC16F876 oscillator design requires the use of a parallel cut crystal. Use of a series cut crystal may give a frequency out of the crystal manufacturers specifications. When in XT, LP or HS modes, the device can have an external clock source to drive the OSC1/CLKIN pin.
In this design a XT mode is preferred since it requires the optimum current out of the three possible crystal oscillator modes which is crucial since the source of power will come from dry cell batteries. In addition to that, also due to small frequency of XT mode the effects of the electromagnetic interference are minimal, this is important so as to minimize the interference to the electronics systems of the taxicab. Table 3: Recommended capacitors for crystal oscillator Oscillator type Crystal Freq. Cap. Range C1 Cap. Range C2 LP 32 kHz 33pF 33 pF 200 kHz 15 pF 15 pF XT 200 kHz 47-68 pF 47-68 pF 1MHz 15 pF 15 pF 4 MHz 15 pF 15 pF HS 4 MHz 15 pF 15 pF 8 MHz 18-33 pF 15-33 pF 20 MHz 15-33 pF 15-33pF
28
In this design a clock rate of 1MHz ( 10 6 Hz) is chosen because a 2second interval interrupt is desired from an internal 16bit TIMER1 which has the maximum pre-scale value of 1:8 Then 1 instruction takes 4 10 6 sec = 4sec Selecting the prescale value of 1:8 then the counter increments every: 84sec= 32sec For the 16bit TIMER1 counter to overflow it will have to reach 65536 in 6553632 = 2.097seconds 2seconds Then after every 2 seconds an interrupt will be received by the microcontroller with a 1MHz clock, this interrupt will be used to monitor the time of the journey for billing purposes.
29
In this design I will use only two interrupt sources namely; TIMER1 OVERFLOW INTERRUPT for managing the billing time and PORTB0/INT EXTERNAL INTERRUPT from the pushbutton switch which is used to monitor the distance covered. There are five registers used in the control and status of the two interrupts required in this design. The registers needed to be configured for the interrupts are INTCON register OPTION_REG register PIE1 register PIR1 register T1CON register
6 1 0
5 1
4 0
2 T0IF
1 INTF
0 RBIF
2:
T0IF: TMR0 Overflow Interrupt Flag bit 1 = TMR0 register has overflowed (must be cleared in software) 0 = TMR0 register did not overflow
1:
INTF: RB0/INT External Interrupt Flag bit 1 = The RB0/INT external interrupt occurred (must be cleared in software) 0 = The RB0/INT external interrupt did not occur
0:
RBIF: RB Port Change Interrupt Flag bit 1 = At least one of the RB7:RB4 pins changed state; a mismatch condition will continue to set the bit. Reading PORTB will end the mismatch condition and allow the bit to be cleared (must be cleared in software). 0 = none of the RB7:RB4 pins have changed state
5: 4: 3: 2-0:
31
Bit Value 000 001 010 011 100 101 110 111
Table 4: Prescaler rate select bits TMR0 Rate WDT Rate 1:2 1:1 1:4 1:2 1:8 1:4 1:16 1:8 1:32 1:16 1:64 1:32 1:128 1:64 1:256 1:128
32
- The initiated Acknowledge condition was completed by the SSP module. - A START condition occurred while the SSP module was idle (Multi-Master system). - A STOP condition occurred while the SSP module was idle (Multi-Master system). 0 = No SSP interrupt condition has occurred 2: CCP1IF: CCP1 Interrupt Flag bit Capture mode: 1 = A TMR1 register capture occurred (must be cleared in software) 0 = No TMR1 register capture occurred Compare mode: 1 = A TMR1 register compare match occurred (must be cleared in software) 0 = No TMR1 register compare match occurred PWM mode: Unused in this mode 1: TMR2IF: TMR2 to PR2 Match Interrupt Flag bit 1 = TMR2 to PR2 match occurred (must be cleared in software) 0 = No TMR2 to PR2 match occurred 0: TMR1IF: TMR1 Overflow Interrupt Flag bit 1 = TMR1 register overflowed (must be cleared in software) 0 = TMR1 register did not overflow
TIMER1 can operate in one of three modes, the operating mode is determined by clock select bit, TMR1CS (T1CON<1>), and the synchronization bit, T1SYNC.the three possible operation modes are As a synchronous timer As a synchronous counter As an asynchronous counter
In timer mode, TIMER1 increments every instruction cycle while in counter mode, it increments on every rising edge of the external clock input on pin T1CKI.
TIMER1 can be turned on and off using theTMR1ON control bit (T1CON<0>). TIMER1 also has an internal reset input, which can be generated by a CCP module.Timer1 has the capability to operate off an external crystal. When the Timer1 oscillator is enabled (T1OSCEN is set), the T1OSI and T1OSO pins become inputs. That is, their corresponding TRIS values are ignored.
In this design the TIMER1 will be used as a synchronous timer to provide an interrupt after every 2 seconds. Bit# 7 0 Bit# 7-6: 5-4: 6 0 1 5 1 4 0 3 1 2 0 1 1 0
Unimplemented (read as 0) T1CKPS1:T1CKPS0: Timer1 Input Clock Prescale Select bits 1:8 ENABLED 11 = 1:8 Prescale value 10 = 1:4 Prescale value 01 = 1:2 Prescale value 00 = 1:1 Prescale value
3:
T1OSCEN: Timer1 Oscillator Control bit is DISABLED this implies then the counter increment on every prescaled instruction cycle
35
2:
1: 0:
TMR1CS: Timer1 Clock Source Select bit internal clock is used TMR1ON: Timer1 On CONTROL bit is ENABLED
4.4.1 Port A
PORTA is a 6-bit wide, bi-directional port, only PORTA<4> pin is a Schmitt Trigger input and an open drain output. All other PORTA port pins have TTL input levels and full CMOS output drivers. All pins have data direction bits (TRIS registers) which can configure these pins as either output or input.
36
Setting a TRISA register bit puts the corresponding output driver in a hi-impedance mode. Clearing a bit in the TRISA register puts the contents of the output latch on the selected pin(s). In this design the PORTA is unused, left for further improvement of the design hence the TRIS register is left programmed as Bit# 7 0 6 0 0 5 0 4 0 3 0 2 0 1 0 0
4.4.2 Port B
PORTB is an 8-bit wide, bi-directional port the appropriate register for direction of data is TRISB at address 86h; each of the PORTB pins has a weak internal pull-up resistor (i.e. resistor that defines the line to logic HIGH). A single control bit in OPTION_REG can turn on all the pull-ups this is performed by clearing bit RBPU (OPTION<7>). The weak pull-up is automatically turned off when the port pin is configured as an output and the pull-ups are disabled on a Power-on Reset so we need to enable it at initialisation routine just after the device powers up.
Four of the PORTB pins, RB7:RB4, have an interrupt on change feature. Only pins configured as inputs can cause this interrupt to occur (i.e., any RB7:RB4 pin configured as an output is excluded from the interrupt on change comparison). The input pins (of RB7:RB4) are compared with the old value latched on the last read of PORTB. The mismatch outputs of RB7:RB4 are ORed together to generate the RB Port Change Interrupt with flag bit RBIF (INTCON<0>). RB0/INT is an external interrupt input pin and is configured using the INTEDG bit (OPTION_REG<6>) in this design this will be used to monitor an interrupt from wheel revolution sensor, then the TRIS register for port B becomes. Bit# 7 0 6 0 0 5 0 4 0 3 0 2 0 1 1 0
37
4.4.3 Port C
PORTC is an 8-bit bi-directional port. Each pin is individually configurable as an input or output through the TRISC register. PORTC pins have Schmitt Trigger input buffers and it will be used to provide interface to the 43 keypad, then the TRIS register for port C is programmed as. Bit# 7 1 6 1 1 5 1 4 1 3 0 2 0 1 0 0
4.4.4 Port D
PORTD is an 8-bit port with Schmitt Trigger input buffers. Each pin is individually configurable as an input or output. PORTD can also be configured as an 8-bit wide microprocessor port (Parallel Slave Port) by setting control bit, PSPMODE (TRISE<4>). In such a mode, the input buffers are TTL, however this design will use this port as a normal I/O port with 8bit parallel data bus to the LCD screen Bit# 7 0
6 0 0
5 0
4 0
3 0
2 0
1 0
4.4.5 Port E
PORTE has three pins (RE0/RD/AN5, RE1/WR/AN6 and RE2/CS/AN7) which are individually configurable as inputs or outputs. These pins have Schmitt Trigger input buffers. The PORTE pins become the I/O control inputs for the microprocessor port when bit PSPMODE (TRISE<4>) is set.
In this mode, the user must make certain that the TRISE<2:0> bits are set and that the pins are configured as digital inputs. Also, ensure that ADCON1 is configured for digital I/O. In this mode, the input buffers are TTL. The TRISE register also controls the Parallel Slave Port operation.
38
PORTE pins are multiplexed with analogue inputs. When selected for analogue input, these pins will read as 0s. TRISE controls the direction of the RE pins, even when they are being used as analogue inputs. The user must make sure to keep the pins configured as inputs when using them as analogue inputs.
In this design this port is left unused for further improvement of the design, and thus the TRISE register is programmed as; Bit# 7 0 6 0 0 5 0 4 0 3 0 2 0 1 0 0
39
In addition to the above advantages, high-level languages also have some disadvantages. For example, the length of the code in memory is usually larger when a high-level language is used, and the programs developed using the assembly language usually run faster than those developed using a high-level language. The application software code was implemented by using MikroC MikroElektronika cooperation C compiler for Microchip PIC microcontrollers version: 8.0.0.0. This high level language C compiler was chosen for software implementation due to its following advantages The C compiler (MikroC) is well documented in a downloadable user manual. Includes a good range of peripheral driver libraries, including CAN, Ethernet, and graphical LCD drivers as part of a comprehensive I/O library. The packages are oriented toward the educational and hobby market, offering additional features designed to assist the beginner in developing C applications.
The pseudo code derived from the modelled system flow chart in chapter2 has the following sequence of activities.
40
1. Program initialises. 2. User prompted for choice from available options. 3. IF start key chosen continue to step4 ELSE go back to step2. 4. Update the display screen. 5. Check for keypad status. 6. IF stop key is pressed from keypad stop and wait for start key press ELSE go back to step4.
In this design the modelled system flow chart of the application program has three parallel threads that implements the above pseudo code namely Main program thread block. TIMER1 overflow interrupt time cost ISR thread. PORTB 0 external interrupt distance cost ISR thread.
5.1.1 Initialisation
In this stage the main program sets the configuration registers with appropriate values and ensures that the microcontroller is within a desirable initial state for safe and reliable operation of the microcontroller. In this routine the configuration registers are programmed with the desired values and the program global variables are initialised to their default values.
41
42
Proteus VSM is an interactive electronics design package from Labcenter Electronics that allows analogue, digital, and microprocessor circuits to be subjected to virtual testing before the creation of a PCB layout for the construction of real hardware. ISIS is the schematic capture package, and ARES is the layout package.
The circuit is entered directly onto the schematic by selecting components from a library of parts, which have associated mathematical models (e.g., V= IR for a resistor). When completed, the wiring schematic is converted to a set of nodes connected by components, represented by a set of simultaneous equations derived from the model for each component. The network is solved for any given set of inputs and the outputs are displayed via active on-screen components, virtual instruments, or charts.
The microcontroller is simulated on the basis of its internal architecture and the specific program being executed, which must be attached to complete the model. In our case, the program is written in C and the HEX byte file produced by the compiler is attached to the MCU. This file contains the program machine code and some additional information to help with debugging the program. ISIS allows the source code and variables to be displayed so that the program operation can be studied step by step and any functional errors corrected.
43
When the plates touch, heat is generated by the short circuit, which boils away more
dielectric. This process snowballs until the part explodes or catches fire. By derating the capacitor values, the dielectric layer is thicker, minimizing the opportunity for pinholes to develop. Decoupling capacitors are to be placed across V dd and V ss of LCD and MCU, because these are the components in this design which can develop significant current transients. This does complicate the wiring somewhat, but does make a more reliable microcontroller circuit. From PIC16F877A datasheet the maximum current into V dd pin 250 mA and maximum current out of V ss pin 300 mA. To be on the safe side current in to V dd is de-rated by 40%, then I dd = 150mA. Now to protect the microcontroller from voltage spikes I allow 0.5V to drop across the protection resistance such that i have V dd =4.5V. Then from Ohms law the protection resistance is obtained as:
3
44
r=
Then by using the standard resistor value i have R PIC = 3.3 with I dd at 150mA
5V DC SUPPLY
3.3
Vdd
PIC16 F 877 A
0.1F
V ss
Similarly from LCD screen datasheet the maximum supply current is 3mA then derating this by 40% i have 1.8mA, and by allowing 0.5V to drop across the protection resistor the value of protective resistor for display is obtained as; By ohms law
r= 0.5v v = 277.78 270 i 1.8mA
45
Then using the standard value I have R LCD =270 with the I dd at 1.8mA
5V DC SUPPLY
270
Vdd
JHD162 A
0.1F
V ss
46
Since in this design chosen V dd is 4.5V this means the PORTB and PORTD output logical high voltage will be 3.8V at a maximum operational current of 3mA.
Now from the LCD display datasheet the maximum input current value for the each data pin of LCD module is 3mA and logical high voltage ranges from 2.2V to V dd (i.e. 2.2V to 4.5V) and then this means the LCD module can be safely directly connected to the microcontroller without any protection resistors.
From the PIC16F877A datasheet the maximum output high voltage is obtained as above to be 3.8V at a maximum current of 3mA, this will be the output high voltage for the keypad columns that is PORTC pin 4 to 6.
Now since the keypad will be scanned within the same PORTC at pins 0 to 3 and PORTC has Schmitt triggered I/O buffers then the input high voltage needs to be from 0.8 V dd to V dd that is from 3.8V to 4.5V (with V dd =4.5V). From the above paragraph i have deduced that the output from the keypad column will be 3.8V, and then this means this will be enough to trigger a Schmitt buffer input of rows at the maximum input current of 25mA. This implies the keypad can be directly connected to the microcontroller since their logical levels are compatible.
47
of PORTB have been internally tied to V dd .which makes the job of this pushbutton is just to bring logical low voltage to the PORTB 0 and this shall cause an external interrupt on the rising edge of PORTB 0 .
Since the PORTB 0 has a Schmitt trigger buffer this implies the logical low is from V ss to 0.2 V dd that is from 0V to 0.9V (with V dd =4.5V), this is achieved by directly tying the PORTB 0 via a pushbutton switch.
To prevent the device from resetting several times during power up transitioning the coupling capacitor is provided in this circuit so as to eliminate the effect of harmful power transients that could set and reset the microcontroller several times when the power is initially applied.
From the RC charging equation Vc = Vdd (1 e t / RC ) For V c to reach 99% of V dd five time constants are essential this time will be enough to allow the power to stabilise i.e. t=5=5RC= 539k0.1 =19.5msec Then 19.5msec after power up the system will be stable and ready for operation.
48
5V
39k
1.8k
MCLR
RESET
PIC16 F 877 A
0.1F
Figure 6: Microcontroller reset circuit From the above identified hardware requirements the following is a summary of required materials for prototype implementation Table 5: Bill of materials (BOM) Quantity: 1 1 2 1 1 1 1 1 1 1 1 1 References RESISTOR1 RESISTOR2 CAPACITOR1, CAPACITOR2 CAPACITOR3 CAPACITOR4 LCD DISPLAY KEYPAD MICROCONTROLLER PARALLEL CUT CRYSTAL OSCILLATOR LCD PROTECTION RESISTOR PIC PROTECTION RESISTOR MINI-PUSH BUTTON SWITCH Value 39k 1.8k 15pF 0.85nF 0.1F JHD162A 43 PIC16F877A 1MHz 270 3.3 SENSOR
49
PROTECTION RESISTOR
VDD 280
LCD1
LM016L
RS RW E 4 5 6
SENSOR OSCILLATOR
1MHz
100n
1 2 3
15p 13 14 2 3 4 5 6 7
MICROCONTROLLER
OSC1/CLKIN OSC2/CLKOUT RB0/INT RB1 RB2 RB3/PGM RB4 RB5 RB6/PGC RB7/PGD 33 34 35 36 37 38 39 40 15 16 17 18 23 24 25 26 19 20 21 22 27 28 29 30
C2
15p
R1
39k
8 9 10
R2
2k
RA0/AN0 RA1/AN1 RA2/AN2/VREF-/CVREF RA3/AN3/VREF+ RA4/T0CKI/C1OUT RA5/AN4/SS/C2OUT RC0/T1OSO/T1CKI RE0/AN5/RD RC1/T1OSI/CCP2 RE1/AN6/WR RC2/CCP1 RE2/AN7/CS RC3/SCK/SCL RC4/SDI/SDA MCLR/Vpp/THV RC5/SDO RC6/TX/CK RC7/RX/DT RD0/PSP0 RD1/PSP1 RD2/PSP2 RD3/PSP3 RD4/PSP4 RD5/PSP5 RD6/PSP6 RD7/PSP7 PIC16F877A
C3
0.85n
KEYPAD
1 2 3
4 BY 3
1 4 7
2 5 8 0
3 6 9 #
50
7 8 9 10 11 12 13 14
D0 D1 D2 D3 D4 D5 D6 D7
C1
C4
Step2: System goes in to continuous billing loop when start key is pressed to update display and while checking for stop key.
PROTECTION RESISTOR
VDD 280
LCD1
LM016L
RS RW E 4 5 6
4 BY 3
SENSOR OSCILLATOR
1MHz
100n
1 2 3
15p 13 14 2 3 4 5 6 7
MICROCONTROLLER
RB0/INT RB1 RB2 RB3/PGM RA0/AN0 RB4 RA1/AN1 RB5 RA2/AN2/VREF-/CVREF RA3/AN3/VREF+ RB6/PGC RB7/PGD RA4/T0CKI/C1OUT RA5/AN4/SS/C2OUT RC0/T1OSO/T1CKI RC1/T1OSI/CCP2 RE0/AN5/RD RC2/CCP1 RE1/AN6/WR RC3/SCK/SCL RE2/AN7/CS RC4/SDI/SDA MCLR/Vpp/THV RC5/SDO RC6/TX/CK RC7/RX/DT OSC1/CLKIN OSC2/CLKOUT RD0/PSP0 RD1/PSP1 RD2/PSP2 RD3/PSP3 RD4/PSP4 RD5/PSP5 RD6/PSP6 RD7/PSP7 PIC16F877A 33 34 35 36 37 38 39 40 15 16 17 18 23 24 25 26 19 20 21 22 27 28 29 30
C2
15p
R1
39k
8 9 10
R2
2k
C3
0.85n
KEYPAD
1 2
A
1 4 7
2 5 8 0
3 6 9 #
Figure 8: Taxicab billing Step3: When destination is reached and the user presses STOP button (#key) to stop billing here the cost is displayed and the system waits for start key for new billing.
PROTECTION RESISTOR
VDD 280
RS RW E 4 5 6
4 BY 3
SENSOR OSCILLATOR
1MHz
100n
1 2 3
15p 13 14 2 3 4 5 6 7
MICROCONTROLLER
OSC1/CLKIN OSC2/CLKOUT RB0/INT RB1 RB2 RB3/PGM RB4 RB5 RB6/PGC RB7/PGD 33 34 35 36 37 38 39 40 15 16 17 18 23 24 25 26 19 20 21 22 27 28 29 30
C2
15p
R1
39k
8 9 10
R2
2k
RA0/AN0 RA1/AN1 RA2/AN2/VREF-/CVREF RA3/AN3/VREF+ RA4/T0CKI/C1OUT RA5/AN4/SS/C2OUT RC0/T1OSO/T1CKI RC1/T1OSI/CCP2 RE0/AN5/RD RC2/CCP1 RE1/AN6/WR RC3/SCK/SCL RE2/AN7/CS RC4/SDI/SDA MCLR/Vpp/THV RC5/SDO RC6/TX/CK RC7/RX/DT RD0/PSP0 RD1/PSP1 RD2/PSP2 RD3/PSP3 RD4/PSP4 RD5/PSP5 RD6/PSP6 RD7/PSP7 PIC16F877A
C3
0.85n
KEYPAD
1 2
A
1 4 7
2 5 8 0
3 6 9 #
7 8 9 10 11 12 13 14
D0 D1 D2 D3 D4 D5 D6 D7
C1
C4
LCD1
LM016L
7 8 9 10 11 12 13 14
D0 D1 D2 D3 D4 D5 D6 D7
C1
C4
Chapter 7 Conclusion
In the course of working on this project many things came up, both positive and negative, however to a good extent things have been under control and the system was successful designed. The design worked fine under the emulation environment. However during implementation several challenges were encountered.
7.1 Challenges
Numerous challenges were encountered during the project work implementation firstly was parts availability because initially I had planned to use a four line display screen but had to settle with two line display.
Secondly, parts cost affordability; the real world commercial taxi meters use optical sensors or Hall Effect sensors for rotation detection, due to design budget constraint, I had to use the pushbutton switch which is not durable, since it will wear out in a very short time when implemented on the real world situation.
Thirdly, was the difficulty of obtaining the microcode programmer since there was none within our department then I had to borrow the one from electronics science department this caused many unnecessary hustles and wasted much valuable time during design testing.
7.2 Successes
The system plan was successfully designed, simulated and then tested on the breadboard hardware prototyping circuit, so I could claim that my project objectives have been duly met.
52
7.3 Failures
Although I have been able to model and finally design the prototype; I have failed to come up with quantifiable data and/or mathematical model that justifies by how much my proposed system will reduce the inconveniences suffered by the customers and taxicab drivers due to the present situation.
7.4 Recommendations
The following are my recommendations for the improvement of the proposed microcontroller based TAXI billing system for future works. 1. Sensor improvement: The design could be improved by replacing the pushbutton switch with the optocoupler as a wheel revolution sensor. Because an Optocoupler is a device that combines a LED and photo-transistor in the same case so when a light beam is interrupted (e.g. by a spoke on the wheel) a revolution will be sensed each time the light is interrupted, and the transistor will produce a pulse. In this design this implementation was not used due to prohibitive cost of optocoupler sensors. 2. Statistical records: Keeping statistical records by the microcontroller could improve the financial management usefulness of the system to the users; this could be achieved by attaching to the microcontroller retrievable special flash memory to be used to store a billing log file so that it can be used for later auditing and printing. 3. The government revenue authority (i.e. TRA) can use taximeters to increase the source of revenues from taxi businesses by charging value added tax (VAT) on taxicab business transactions.
53
References:
Ball, S.R (2006),Embedded Microprocessor systems - real world design, Newnes press, New York, 2nd edition. Di Jasio et al (2008); PIC Microcontrollers (know it all), Newnes press, Burlington, M.A, Gardner Nigel (1998); An introduction to programming the microchip PIC in C, Character Press Ltd, U.K. Hitachi cooperation (2000);LMO41L display datasheet Ibrahim, Dogan (2006); Microcontroller Based Digital Control. John Wiley and Sons. Iovine, John (2000); PIC Microcontroller Project Book. McGraw Hill, Inc. Sanchez, Julio, and Maria P Canton (2007); Microcontroller Programming. CRC press Nagy, C. (2003);Embedded Systems Design using the TI MSP 430 series,Newnes press, Burlington M.A. MikroElektronika cooperation (2006); mikroC Users Manual Microchip technology (2001); PIC16F87XA datasheet Microchip technology (2001);PIC Microcontrollers midrange MCU Family Reference Manual Microchip technology incorporated (2009);Microchip Compiled Tips N Tricks Guide Steiner Jack (1980); Taximeter US Patent 4205388 Wilmshurst, T. (2001). An Introduction to the Design of Small-Scale Embedded Systems. Palgrave.
54
55
56
57
58
59
1 rim 2 1 dozen 5 1
2 3 4 5 6
60