Está en la página 1de 125

BHOPAL (M.

P)
Session-2011 -2012 A

MAJOR PROJECT REPORT


ON
INTELLIGENT SPEED ADAPTATION

Submitted in fulfillment for requirement of B.E. in Electronics &

communication engg.
GUIDED BY SUBMITTED BY

Mr. VISHAL THAKUR (0126EC083D03)

ALOK KUMAR SINGH AMIT SINGH CHAUHAN

(0126EC083D04) JITENDRA S. SISODIA (0126EC083D06) ROUNAK DIWAKAR (0126EC083D07) RUCHI MAHOR (0126EC083D09)

BHOPAL (M.P.)

CERTIFICATE
SESSION 2010 This is to certify that the work embodies in this major project entitled INTELLIGENT SPEED ADAPTATION being submitted by Jitendra Singh Sisodia (0126EC083D06) in partial fulfillment of the requirement for the award of BACHELOR OF ENGINEERING (Electronics Communication & Engineering) to Rajiv Gandhi Proudyogiki Vishwavidyalaya, Bhopal( M.P) during the academic year 2011 is a record

of bonafide piece of work, carried out by him under our/my supervision and guidance in the Department of Electronics Communication & Engineering, Thakral Collage Of Technology, Bhopal(M.P.).
Guided & Approved by:

Mr. VISHAL THAKUR


HOD, Department of Electronics Communications and Engineering
Forwarded by:

HOD DEPTT OF ECE TCT, Bhopal

Director TCT, Bhopal

ACKNOWLEDGMENT
It is our profound privilege and pleasure to express overwhelming sense of gratitude devotion and regard to out esteemed and learned teacher Mr. VISHAL THAKUR. Whose initiation and timely guidance and valuable suggestions helped us to carry out this project. We do not have words to express our heartily gratitude to Mr. VISHAL THAKUR HOD of electronics & communication for unhearing continuous and expert guidance and valuable work which has to be undertaken during the forth year of bachelor of engineering in Electronics and communication Engineering as required by the academic curriculum.

This project INTELLIGENT SPEED ADAPTATION has bee submitted as report work which has to be undertaken during the forth year of bachelor of engineering in Electronics and communication Engineering as required by the academic curriculum.

Table of contents
1. 2. INTRODUCTION BLOCK DAIGRAM 2.1 Block diagram of working model transmitter 2.2 3. Block diagram of working model reiever 2.3 Block diagram of practical system implementation CIRCUIT DIAGRAM 3.1 Circuit diagram of transmitter card 3.2 Circuit diagram of receiver card CONSTRUCTION AND WORKING 4.1 Description of working model 4.2 Construction of working model 4.3 Operating principle and working of model transmiter 4.4 Parameters of transmission 4.5 Frame format of transmitting frame 4.6 Construction of working model receiver 4.7 Operating principle and working of working model receiver 4.8 Present design of practical vehicle system 4.9 Required design of practical vehicle system 4.10 Overall design of Practical system FLOW CHART 5.1 Flow Chart of transmitter 5.2 Flow chart of receiver PCB LAYOUT 6.1 PCB Layout of transmitter 6.2 PCB Layout of receiver 01 02 03 04 05 06 07 10 10 11 12 13 14 15 17 18 20 21 22 23

4.

5. 6.

7. 8.

LIST OF COMPONENTS SPECIFICATIONS OF COMPONENTS 8.1 Specification of resistor 8.2 8.3 Specification of switch Specification of rectifiers

24 27 31 32 34 35 38 42 45 46 130 131

9. 10. 11. 12. 13. 14. 15.

8.4 Specification of didoe PCB MANUFACTURING PROCESS ADVANTAGES FUTURE ENHANCEMENT SOFTWARE CODING OF MICROCONTROLLER PRECAUTIONS BIBLIOGRAPHY DATA SHEET 15.1 15.2 15.3 15.4 15.5 15.6 Data sheet of Microcontroller Data sheet of LCD Data sheet of RF module Data Sheet of DC Motor Data sheet of optocoupler Data sheet of uln 2003

1.

INTRODUCTION-

Excessive or inappropriate speed is a significant factor in serious road accidents. Road safety authorities around the world devote considerable resources to addressing the speeding problem particularly compliance with speed limits. One countermeasure that is gaining increasing attention is the use in vehicle technology to assist drivers keep to speed limits or even prevent the vehicle from exceeding speed limits on all roads at all times. This is known as Intelligent speed Adaptation.

Intelligent speed Adaptation (ISA) is the generic name for advanced system in which the vehicle knows the speed limit for the road currently being travelled on. That Information can be used to display the current speed limit inside the vehicle and warn the driver when he or she is speeding. The technology is of interest because of the known relationship between speed and risk of an accident and also because of the relationship between speed and injury severity in an accident.

2.
2.1

Block Diagram
Block Diagram of Working model transmitter

2.2

Block Diagram of Working model Receiver

2.2 Block Diagram of overall system design of practical system

3.1 Circuit Diagram 3.1 Circuit Diagram of Transmitter Card

3.2 Circuit Diagram of Receiver Card

4.
4.1

CONSTRUCTION AND WORKING


Description of Working Model

For showing the implementation of our concept of project, we construct of working model in which we use one transmitter card, a receiver card and a toy car. The transmitter and receiver card is same as for practical system implementation. The only difference lies between the practical vehicle system and our used toy car the toy car we use here is a gear car which uses dc motor for its movement. For transferring of signals of information between transmitter and receiver, we use RF communication through RF module. So the whole system is designed around two parts 1. 2. Transmitter. Receiver

4.2

Construction of working model Transmitter

Major Component of the Transmitter is 1. LCD display 2. 4 x 4 keyboards 3. RF Module 4. Microcontroller 5. Power Supply Section 1. 2.

Lcd. Display: - It has 16x2 LCD display to see the status of the transmitter. 4x4 keyboard: - it has 16 switch key board to set the varios parameter. Such as:To set the speed limit of speed zone. When this switch is press Speed setting screen is shown. As follows Speed=10%.

Switch1:-

Switch2:Switch3:Switch4:-

To increase the speed limit, for e.g. If this press Speed=12%. To decrease the speed limit, for e.g. If this press Speed=10%. To save the speed limit and exit the screen, for e.g. If this press. Return to home screen. RKDFCE BHOPAL

Switch5:-

When this switch is press system then you set the sending message. Shows you a previous message. Message=Rtn(Right

turn) Switch6 and 7: Switch8 :by using this u can change the message. Message=Rtn(Right turn) Message=Ltn(left turn) Message=Brd(Bridge) Message=nhn(no horn) Message=wip (work in progress) by using this u can save the message for transmission and exit you home screen. Switch9:by using this u can select the mode of system.By default it will shows the previous save mode. And remain in this. Switch10:Switch11:Switch12:Switch13:by using this U are in transmiiter mode. by using this U are in Remote mode. by using this U are in save the state if power is off. Only work in remote mode By using this increase the speed of car remotely. Switch14:Only work in remote mode By using this decrease the speed of car remotely. Switch15:Switch16:3).Rf module:Only work in remote mode By using stop the car. Exit without saving in any mode. This module is used to transfer data in rf. Form. This module is working on a 433 mhz. and Ask modulation is used. And support the data below the 1200 bps.

4. Microcontroler. :- In this system we are using mc of microchip company which is PIC16f877a. which is RISC based controller. Only has 35 set of commands set. Has various paripherel inbuilt such as USART,TIMER,ADC,SPI,I2C,EEPROM and has 8k of program memory and also has various features. 5). Power Supply: - In the whole system we are using +5v regulated power supply. It is obtained by the 230v ac. This section is covered by these parts: a. 12 v step down transformer (500m amp) Full wave rectifier. Filter. linear regulator.

12 v step down transformer(500m amp):- Step down transformer is used to


convert 230v ac to 12v ac. With current rating of 500 mump.

b.

Full wave rectifier: - The full wave Bridge rectifier is used to convert 12 ac to the
pulsating dc which is equal to average value.

c.

Filter: - Filter is a used to convert pulsating dc to constant dc. It may me


capacitor, RC network, inductance. depends upon the current following in the circuit or impedance of circuit. But in this system we use capacitor.

d.

Linear regulator:- regulator are used the system is used to convert high
voltage to +5v constant dc.

4.3

Operating Principle and working of working model transmitter

Basic function of a transmitter is to control the speed of the moving vehicle also send a message to the drive if any for road. For e.g. on a road there is left turn, right turn, work

in progressed. When the system is in the transmitter mode it controls the speed of car. It continuously transmit the Transmitting frame and the contains following informations's Message. Format. { ?} First byte is opening bracket and last is closing is used to synchronies the reciver and this 3 also check for errors .If message is in not this format then reciver discard it. T -second byte is use to tell the receiver come in Transmiter is in control mode. Third byte is use to tell the reciver for speed if speed is greater than permited then decrease speed to the set value which has been recived -fourth byte is to give the message.

When the system is in Remote mode it controls the speed of car. Its sends first and last byte as usual. Second byte is R which tells the reciver it also contol by remote Third forth and fifth are if its UP. then receiver increase the speed DW. then receiver decrease the speed St. Then receiver decrease to zero the speed.

4.4

Parameters of transmission:Transmission is done on 1200 baud rate , 8 data bits ,no parity.

4.5 Frame Format of Transmitting Frame

4.5
1.

CONSTRUCTION OF WORKING MODEL RECEIVER


Lcd. Display: - It has 16x2 LCD display to see the status of the speed and message send by the transmitter.

2.

Swithes:- first switch is use to increase the speed of car Second switch is use to decrease the speed of car.

3.

Microcontroler. :-

In this system we are using mc of microchip company

which is PIC16f877a. which is RISC based controller. Only has 35 set of commands set. Has various paripherel inbuilt such as USART, TIMER, ADC, SPI, I2C, EEPROM and has 8k of program memory and also has various features. 4. RF Module :- This module is used to receive the data in RF form. This module is working on a 433 MHz frequency. ASK demodulation is used in this module. it support the data below the 1200 bps. 5. Power Supply :- The receiver section has a two power supplies. One for microcontroller and other for motor driving section. Micro-controller power supply section is same as in transmitter. For dc motor supply we use a 12v regulator which is used to give 12v power supply to the motor. 6. DC Motor :- For the movement of toy car in our working model and also fopr movement of carburetor plate in practical system, we use a DC motor. Motor driving section has following more circuitry as 1. Leds :- change the bridge ness as the duty cycle change. 2. Optocoupler: - isolate the high voltage to the micocontroler. Has four

optocupler used to increase the current for motor 3. ULN2003:- It has seven transistor which are in parallel. Also for increasing the current.

4.6

OPERATING PRINCIPLE AND WORKING OF WORKING MODEL RECEIVER

The receiver program works in two section. The motor driving section. 1. The control section driving section. The motor driving section:-Speed of the motor of the car is increase and

decrease by the pulse width modulation whose frequency is 1khz.when we want to increase the speed of car we increase the duty cycle and it is shown on screen in a form of percentage. When we decrease the speed of the car we decrease the duty cycle. 2. The control section driving section.:-This system is active any valid frame is

received. For eg Its receive a transmitting frame it extract speed and message and first shows the message check the current speed with received speed. If it is greater the it decrease the amout of duty cycle. If it is lesser or equal it takes no decision.

4.7 DESCRIPTION OF PRACTICAL SYSTEM IMPLIMENTATION In our system our carburetor is designed in such a way that a new slide is introduced below the older slide of the carburetor which was fully controlled by the driver section and ECU. Our new slide is now controlled by the receiver circuitry of the receiver of speed adaptation system. The movement of this new slide is done by the high resolution DC or stepper motor whose speed is controlled according to the received signal, which is transmitted by transmitter section. A digital Speedometer is also used in this system. This digital speedometer measures the running speed of the vehicle for PID LOOP. At first receiver section takes the transmitted data and check the running speed of the vehicle through PID LOOP. if the running speed is greater then received speed limit then an optimal target opening degree of the throttle valve is calculated by the ECU and PID LOOP of the driving section of vehicle and hence calculated opening degree of the throttle valve is done by the new introduced slide below the older slide by the dc motor. As the speed of the vehicle increases beyond the speed limit then our receiver system decreases the opening of the new slide and adjust the amount of intake air fuel supplied to the engine and hence the speed is maintained at safe optimal speed level. If driver want to move above the speed limit of a particular zone then he/she can not increases the speed above the safe limit .the reason is that when he/she want to increases the speed of the vehicle system then he/she increases the opening of slide of throttle through accelerator .now even he/she fully open the throttle slide to increases the speed, our new introduced slide which is located below the older slide maintained the safe speed of the vehicle according to the received signal. Hence our vehicle is within the safe limit. 4.8 TRANSMISSION LINK OF THE PRACTICAL SYSTEM In our practical system implementation, remote mode of working is excluded from the transmitter card. Error detection system is also excluded. The transmission link in the practical implementation will be GSM or satellite link.

4.9

Present Designing of Practical Vehicle Systems

4.10

Required Design of Practical Vehicle System

4.11

Overall Design of practical system

5.
5.1

FLOW CHART
Flow Chart of Transmitter

6.
6.1

PCB LAYOUT
PCB Layout of Transmitter Receiver

7.
Semiconductors :

LIST OF COMPONENTS
IC (7805 5V regulator) IC (PIC16f876amicrocontroller) D ( 1N4148 ) D (4007 rectifier diode) LED1 (3mm LED) IC Base (14 pin ) R (1-kilo-ohm) R (10-kilo-ohm) R (4.7- kilo-ohm) R (50 E ohm) C (1000uf ,25V electrolytic) C2,C3,(100/25) X( 230VAC primary to 12V/500mA ) S (Puch-to on switch) XTal (16 MHZ ) 16*2LCD Mains Cable Barg strip (16 pin ) Ferric Cloride Soldering Wire Connecting wires Soldering Paste PCB 4x6 -100gms. - 20gms. - 2mtrs. -10gms. =1 =1 =1 =4 =4 =2 =2 =1 =5 =1 =1 =1 =2 =1 =17 =1 =1 =1 =1

Resistors (all watt +% carbon):

Capacitor :

Miscellaneous :

RF module (433 MHz)Tx

=1

RECEIVER COMPONENTS
Semiconductors : IC (7805 5V regulator) IC (78012 12V regulator) IC (PIC16f876amicrocontroller) D (4007 rectifier diode) LED1 (3mm LED ) Optocupler (pc817) IC Base (14 pin ) IC Base (16 pin ) Resistors (all watt +% carbon): R (1-kilo-ohm) R (10-kilo-ohm) R (50 E ohm) R (4.7-kilo-ohm) Capacitor : C (1000uf ,25V electrolytic) C2,C3,(100/25) C3 104 Ceramic Miscellaneous : X( 230VAC primary to 12V/1A ) S (Push-to on switch) XTal (16 MHZ ) 16*2LCD Mains Cable Barg strip (16 pin ) DC motor Wire (5 m ) Connector ( 2pin ) Ferric Cloride -100gms. Soldering Wire - 20gms. Connecting wires - 2mtrs. Soldering Paste -10gms. =1 =5 =1 =1 =1 =1 =2 =1 =4 =7 =5 =1 =4 =1 =2 =2 =1 =1 =1 =8 =7 =4 3 1

PCB

4x6 RF module (433 MHz)reciver

=1

=1

8.
Resistors

SPECIFICATION OF COMPONENTS

A resistor is an electrical component, which has been manufacture with a specified amount of resistance. The resistors can conduct current in both the directions. The resistors may be connected in an electric circuit without concern for lead polarization. The resistors are used mainly for two purposes, namely controlling the flow of electric current and providing desired amounts of voltage in electric in electric or electronic circuits.

Resistor specifications
The resistors are specified in terms of their resistance values, tolerance power rating and thermal stability. By tolerance, we mean the allowed variation permitted in the normal or marred value or the resistor. It means that the actual value of the resistor may be either greater or smaller than that of the indicated value, by a factor given by the specified tolerance. Thus resistors are manufactured with a specified tolerance. For example, a 5000 resistor with a tolerance of + 10% will have an actual resistance value anywhere between 4500 and 5500 or in other words 500 greater or smaller them the rated value. The power rating of a resistor is given by the maximum wattage it can dissipate, without excessive heating. Since the power rating is proportional to the square of a current, there fore current must not be higher than its safe value. If the current exceeds the safe value, the resistance will burn out. Usually, carbon composition resistors will fail, if operated at near the rated power values. In this case, the resistor will not burn out. But the failure is gradual, which takes many months. It changes gradually to a much lower amount of resistance. This causes an improper operation of an electronic of an electronic circuit particularly in amplifier. Thus in order to increase the life of use a power dissipation of about half of the rating of the resistor.

The thermal stability of a resistor is indicated by the temperature coefficient specification, which is usually expressed in parts per million per degree centigrade (+ ppm/C). The smaller value of temperature coefficient will have less variation in the resistance value. Therefore, smaller value of temperature coefficient means a higher thermal stability of a resistor. CLASSIFICATION OF RESISTORS Shows the classification of resistors in the from of a family tree. The resistors are basically of two types, namely linear resistors and non- linear resistors. Each type is further subdivided into many types as shown in the figure. Linear resistors. The resistors through which the current is directly proportional to the applied voltage, are called linear resistors. Such resistors have a property that their resistance value do not change with the variation in applied voltage, temperature or light intensity. The linear resistors are of two types namely fixed resistors and variable resistors. Non-linear. The resistors through which the current is not directly proportional to the applied voltage, are called non-linear resistors. Such resistors have a property that their resistance values change with variation in applied voltage, temperature of light intensity. The non-linear resistors are of three namely thermostat, photo resistor and varistor. Fixed Resistors The fixed resistors are those whose do not change with the variation in applied voltage, temperature and light intensity. Such resistors are available in various shapes and sizes, with both axial and radial leads as shown in Fig.7.2. In addition to this, the fixed resistors are available with sugs for installation by soldering or mounting with screws and rivets.

The Resistor Colour Code

8.1 RESISTOR COLOUR CODE CALCULATOR

Colour Number Black Red 0 2 Brown 1 Orange 3

The Resistor Colour Code Calculator can be used to identify resistors. Yellow 4 It consists of three card discs showing the colours and values, these are fastened together so you can simply turn the discs to select the Green 5 value or colour code required. Simple but effective! Blue 6 Violet 7 There are two versions to download and print on A4 white card (two Grey 8 per sheet): White 9 Coloured (for a colour printer) B/Wfor a black only printer) This version must be coloured manually, it is easiest to do this before cutting out. To make the calculator, carefully cut out the three discs and fasten them together with a small brass paper fastener. The calculator design is copyright but it may be freely copied for educational purposes. The Resistor Colour Code Calculator is supplied as a PDF file. To view and print PDF files you need an Acrobat Reader which may be downloaded free for Windows Mac,RISE OS, or Unix Linex computers. If you are not sure which type of computer you have it is probably Windows.

8.2 SPECIFICATION OF SWITCHES


An electrical switch is a device usually used to open or close an electrical circuit. Mostly switches are manually operated devices. Switches play important role in electronics, to stop the flow of current or send the current.

TYPES OF SWITCHES Push Button Switches : Both locking a latching (contacts remaining operated after the button is pressed) and non locking (contacts release after removal of the finger) designs are available. Other design variations have multiple contacts, snap action and wiper action. In most design, state of the switch (operated or not) is determined by visual observation only. Some designs have an indication light either self-contained or separate. Keyboards : A wide variety of keyboards or key pads are used for providing manual input to electronic instrument such as telephone sets and adding machines. The most commonly available keyboard has a 12 button (4 rows and 3 columns) arrangement identical to the telephone instruments although keyboards with 16 and 20 button arrangement are also available.

8.3 SPECIFICATIONS OF RECTIFIER


A rectifier is a circuit that converts the ac supply voltage to the pulsating dc voltage, There are mainly 3 types of rectifier circuits 1. 2. 3. Half wave rectifier Full wave rectifier Full wave bridge rectifier

Half-wave rectifier circuit.

For most power applications, half-wave rectification is insufficient for the task. The harmonic content of the rectifier's output waveform is very large and consequently difficult to filter. Furthermore, the AC power source only supplies power to the load once every half-cycle, meaning that much of its capacity is unused. Half-wave rectification is, however, a very simple way to reduce power to a resistive load. Some two-position lamp dimmer switches apply full AC power to the lamp filament for full brightness and then half-wave rectify it for a lesser light output. Full-wave rectifier, center-tapped design.

This circuit's operation is easily understood one half-cycle at a time. Consider the first half-cycle, when the source voltage polarity is positive (+) on top and negative (-) on bottom. At this time, only the top diode is conducting; the bottom diode is blocking current, and the load sees the first half of the sine wave, positive on top and negative on bottom. Only the top half of the transformer's secondary winding carries current during this half-cycle as in Figure below.

Full-wave center-tap rectifier: Top half of secondary winding conducts during positive half-cycle of input, delivering positive half-cycle to load.. During the next half-cycle, the AC polarity reverses. Now, the other diode and the other half of the transformer's secondary winding carry current while the portions of the circuit formerly carrying current during the last half-cycle sit idle. The load still sees half of a

sine wave, of the same polarity as before: positive on top and negative on bottom.

Full-wave center-tap rectifier: During negative input half-cycle, bottom half of secondary winding conducts, delivering a positive half-cycle to the load.

8.4 SPECIFICATION OF DIODES


It is s two terminal device consisting of a P-N junction formed either in GE or SI crystal. The P and N type regions are referred to as anode and cathode respectively. Commercially available diodes usually have some means to indicate which lead is P and which lead is N. Standard notations consists the number proceeded by IN such as In 240 & 250. Here 240 and 250 correspond to color band. Diodes are polarized, which means that they must be inserted into the PCB the correct way round. This is because an electric current will only flow through them in one direction (like air will only flow one way through a tyre valve).Diodes have two connections, an anode and a cathode. The cathode is always identified by a dot, ring or some other mark.

The pcb is often marked with a + sign for the cathode end. Diodes come in all shapes and sizes. They are often marked with a type number. Detailed characteristics of a diode can be found by looking up the type number in a data book. If you know how to measure resistance with a meter then test some diodes. A good one has low resistance in one direction and high in the other. There are specialized types of diode available such as the zener and light emitting diode (LED).

9.

PCB MANUFACTURING PROCESS :

9.1 PCB LAYOUT Lay out of the desired circuit is the most important in any circuit board manufacturing process. The following points are to be observed while performing the layout of the PCB Sufficient space should be maintained between two components. High heat dissipation components like high voltage resistors should be mounted at a sufficient distance from the semiconductors and electrolytic capacitors. Components layout should make proper combination with copper side circuit layout. Circuit copper line thickness should be decided taking into account the current drain in the circuit. 9.2 PREPARATION OF SCREEN: Nylon bolting cloth (Silk screen cloth) is stretched and attached to a wooden frame. Photosensitive chemical (silcot-6) and ammonium bicarbonate is spread on cloth and dried in total darkness. The screen is exposed to UV light and is developed in water. 9.3 PRINTING: The screen is placed on suitable copper laminated sheet on copper side and circuit black printing ink (acid resistant paint) is spread on it. After printing the PCB should be allowed to dry for at least 10 hrs. in a dust proof chamber. 9.4 ETCHING: The removal of excess copper on the copper laminated PCB apart from the printed circuit is known as etching. Generally PCB is placed in F3C13 solution and kept for one hour. 9.5 DRILLING: Under this operation drilling should be done as per circuit lay with the suitable drill and high speed machine. Drilling should always be done from copper side to avoid possibility of coming out of copper circuit and chipping out of Bakelite. 9.6 THINNING: It is an electroplating process (tin plating) done to increases the conductivity of the conducting medium and to avoid oxidizing effect. 9.7 COMPONENT MOUNTING: All components are mounted at their respective position as per the components layout. Proper precautions should be taken during mounting process.

ETCHING PROCESS:
Etching process requires the use of chemicals acid resistant dishes and running water supply Ferric chloride is maximum used solution but other enchants such as ammonium per sulfate can be used. Nitric acid can be used but in general it is not used due to poisonous fumes. The pattern prepared is glued to the copper surface of the board using a latex type of adhesive that can be cubed after use. The pattern is laid firmly on the copper use a very sharp knife to cut round the pattern carefully a remove the paper

corresponding to the required copper pattern areas. Then apply the resist solutions, which can be kind of ink proportion fort the purpose maintaining smoothing clean outlines as far as possible. While the board is drying test all the components. Before going to next stage, check the whole gotten and cross cheek against the circuit diagram check for any freeing matte on the copper. The etching bath should be in a galls or enamels disc. If using crystal of ferric-chloride these should be thoroughly dissolved in water to the proportional suggested. There should be 0.5 Lt. Of water for 125 Gm. of crystal. Water liquid should be thoroughly deflated and druid in water land; never pour down the drain. To prevent particles of copper hindering further etching, agitate the solutions carefully be gently twisting or rocking the tray. The board should not be left in the bath a moment longer than is needed to remove just the right amount of copper. In spite of there being a resist coating there is no protection against etching away through exposed copper edges; this leads to over etching. Have running water ready so that etched board can be removed properly and rinsed; this will hall etching immediately. Drilling is one of those operations that call for great care because most of the holes will be made a very small drill. For most purposes a 1 mm drill is used Drill all holes with this size first those that need to be larger can be easily drilled again with the appropriate lager size.

COMPONENT ASSEMBLES:
From the greatest variety of electronic components available today, which runs into tent of thousands of different types it is often a perplexing task to know which the right task for a given job is. There should be damage such as hair line crack intuit opera on PCB that could age a seriousfiec on the operational ability to the completed assemble. If there are than they can and should be repaired fiesta bye soldering a short link of bare copper wire over the affected part. The most popular method of holding all the items is to been the wires future apart after they even been indebted in the appropriate holes. This will hold the component in position ready for soldering. Some components will be considerably larger than other occupying and possible partially obscuring neighboring components. Because of this best to start by mounting the smallest first and progressing through to the largest. Before starting make certain that no further drilling I likely to be necessary because access may be impossible later. Next will probably be the resistor small signal diodes of other similar size components some capacitor are very small but it would be best to fit these after words when fitting each group of components marks of each one on the components its as it is fitted and if we have to leave the job we know where to recommence. Although transistor & integrated circuit are small items there are good reasons for leaving the soldering of these until the last step the main pint is that these components are sensitive to heart and is subjected to prolonged application to the soldering iron they could be internally damaged. All the components before mounting are rubbed with sandpaper so that oxide layer is removed from their tips. Now they are mounted according to the components layout.

SOLDERING TECHNIQUES:

A soldered connection ensures metal continuity. The soldering process involves: Melting of the flux which in turn removes the oxide films on the metal to be soldered. Melting the solder which removes the impurities. The solder partially dissolve of the metal in the connection. The solder cools and fuses wit the metal. The soldering techniques involves knowledge of : Soldering iron Soldering wire Soldering procedure Replacing components

10.

ADVANTAGES
Road Accident Savings with the help of ISA, there is a decrement in road accidents due to unlimited and uncontrolled speed of the vehicles. By using ISA, all the vehicles will be run in the maximum speed limit of respective areas.

Environmental benefits As it is clear from the description of ISA, it reduces the consumption of fuels. This ultimately results in reduced harmful emission. There are also noise and amenity benefits with the implementation of ISA.

Displaying traffic related information inside the Vehicle in the ISA implemented vehicles, we can display any useful information inside the vehicle which will helpful to the driver during the travelling periods. as an example if there is any blind curve ahead the traveling path or there is any construction is going on in a highway then these useful information's can be displayed in the display section inside the vehicle before reaching to that particular zone.

Increment or decrement in the speed limit according to the traffic requirement with the implementation of ISA, we can change in the speed limit of a particular are by changing the speed limit at the transmitting section. So according to traffic conditions we can increase or decrease the speed limit of vehicles.

Simpler and reliable technology ISA technology do work, are robust and reliable. This is technically simple, much simpler than other automatic devices such as collision avoidance system.

11 DISADVANTAGES
There are following disadvantages of the ISA system.
Increases the traveling time the implementation of the ISA system

directly and indirect increase the traveling time of the person, because due to restriction in the speed, one can not drive its vehicle above a safe speed as can drive in the absence of the ISA.
Causing problem of overtaking ISA system could potentially cause a

problem if speed will limited in mid-overtaking. There will be overtaking problem between the ISA ISA and ISA NONISA systems.
Risky for high speed moving light vehicles ISA system is risky for

those light vehicles which are move at a very high speed the reason is that when ISA implemented vehicle which are moving at a very high speed in non ISA implemented zone, entering in a new zone where the required speed is very low compared to speed of moving vehicle then ISA system of the vehicle tries to reduce the speed of the vehicle immediately which will causing an unbalancing problem to drivers.

12 LIMITATIONS
There are some limitations of the ISA system such as
Not working when more number of vehicles are passing from a

particular zone ISA system will not work in such type of zones from where more number of vehicles are passing every time or at any particular instant such as after any gathering etc. this is because of jamming of GSM network. The jamming condition will occurred because there will be only one tramsitter for controlling of all the vehicles i.e. for transmitting the signals and receiver i.e. vehicles are more in numbers and hence will causing jamming of network.

13.

FUTURE ENHANCEMENTS

There are following future Enhancement of the ISA System.


Find the route of a particular vehicle in the future if we will transfer

the data bidirectionally i.e. from transmitter to vehicle and also from vehicle to transmitter then we can find the route of a particular vehicle which will very helpful in some special cases such as in case of stolling of a vehicle.
Predict the speed limit through digital map if we will uses the GPS

system in the vehicle then we can predict the upcoming speed ahead the way as well as of the any other path / zone through a digital map.
Displaying other traffic and whether related information's we will

also display some traffic condition related information's as well as some whether related information's to the driver through the GPS System implementation which will helpful to driver during traveling.

;*******************************************LCD ********************************************************* *********************** ; IST LINE HOME ADDRESS ;80H 81H _ _ 8F ; 2ND LINE HOME ADDRESS ;C0H C1H _ _ CF ; 00- SAVING SPEED ; 01- SAVING MESSAGE ; 02- CONTROLER AND REMOTE SELECTION cblock 0x20 READBACK COUNTER LCD_CMD LCD_DATA LCD_READBACK PRCOUNTER REVDATA COUNT TEMP H_BYTE M_BYTE L_BYTE R0 R1 R2 FLAG0 FLAG1 FLAG2 FLAG3 SWT1 SWT2 SPEED TIME1 FIRST_WORD SECOND_WORD THIRD_WORD MESS_COUNT TX_COUNTER CONT_REMOTE endc BAUD_CONSTANT EQU D'207'; BAUDRATE= 1200 EE_ADD EQU H'120' ;****************************************************PINS DECLARATION********************************************** ******************

#DEFINE EN PORTA,0 ; FOR LCD #DEFINE RW PORTA,1 ; FOR LCD #DEFINE RS PORTA,2 ; FOR LCD #DEFINE CL1 PORTA,3 ; INPUT #DEFINE CL2 PORTA,4 ; INPUT #DEFINE CL3 PORTA,5 ; INPUT #DEFINE CL4 PORTC,0 ; INPUT #DEFINE RL1 PORTC,1 ; OUTPUT #DEFINE RL2 PORTC,2 ; OUTPUT #DEFINE RL3 PORTC,3 ; OUTPUT #DEFINE RL4 PORTC,4 ; OUTPUT #DEFINE LED PORTC,5 ; OUTPUT #DEFINE FSW1 FLAG0,0 #DEFINE FSW2 FLAG0,1 #DEFINE FSW3 FLAG0,2 #DEFINE FSW4 FLAG0,3 #DEFINE FSW5 FLAG0,4 #DEFINE FSW6 FLAG0,5 #DEFINE FSW7 FLAG0,6 #DEFINE FSW8 FLAG0,7 #DEFINE FSW9 FLAG1,0 #DEFINE FSW10 FLAG1,1 #DEFINE FSW11 FLAG1,2 #DEFINE FSW12 FLAG1,3 #DEFINE FSW13 FLAG1,4 #DEFINE FSW14 FLAG1,5 #DEFINE FSW15 FLAG1,6 #DEFINE FSW16 FLAG1,7 #DEFINE PR_SPEED FLAG2,0 #DEFINE TIME_ER FLAG2,1 #DEFINE TIME_ON FLAG2,2 #DEFINE PR_MESSAGE FLAG2,3 #DEFINE SCR FLAG2,4 #DEFINE UP FLAG2,5 #DEFINE DWN FLAG2,6 #DEFINE PR_TRANS_REMO FLAG2,7 #DEFINE STOP FLAG3,0 #DEFINE REMOTE CONT_REMOTE,0 ; NOT USE THIS CONT_REMOTE ANY WHERE ELSE BECAUSE SAVE IN EEPROM #DEFINE TRANS CONT_REMOTE,1 ; NOT USE THIS CONT_REMOTE ANY WHERE ELSE BECAUSE SAVE IN EEPROM ;****************************************INTRUPT ROUTINE REGISTERS************************************************ **************

TEMPW EQU H'7B' TEMPSTATUS EQU H'7C' TEMPPCLATH EQU H'7D' ;****************************************RAM CLEANING ROUTINE REGISTERS************************************************ ******************* COUNT_REG1 EQU H'7E' TMP_COUNT EQU H'7F' ; ********************************************************* ********************************************************* ****************** ERRORLEVEL-302 BANK0 MACRO BCF STATUS,RP0 BCF STATUS,RP1 ENDM BANK1 MACRO BSF STATUS,RP0 BCF STATUS,RP1 ENDM MACRO BCF STATUS,RP0 BSF STATUS,RP1 ENDM MACRO STATUS,RP0 STATUS,RP1

BANK2

BANK3

BSF BSF ENDM include "P16F877.inc" org 0 GOTO INITIALIZE org 4 GOTO INTERRUPT ASCII ANDLW ADDWF RETLW RETLW B'00001111' PCL,F H'30';0 H'31';1

RETLW H'32';2 RETLW H'33';3 RETLW H'34';4 RETLW H'35';5 RETLW H'36';6 RETLW H'37';7 RETLW H'38';8 RETLW H'39';9 RETLW H'41';A RETLW H'42';B RETLW H'43';C RETLW H'44';D RETLW H'45';E RETLW H'46';F ;***********************************************I S R******************************************************** ******************** INTERRUPT MOVWF TEMPW SWAPF STATUS, W CLRF STATUS MOVWF TEMPSTATUS MOVF PCLATH, W MOVWF TEMPPCLATH CLRF PCLATH CLRWDT BTFSC PIR1,CCP1IF GOTO TIMER_1 BTFSC PIR1,RCIF GOTO RX_INTERRUPT BTFSC PIR1,CCP1IF GOTO TIMER_1 DATA_RETURN MOVF TEMPPCLATH, W MOVWF PCLATH SWAPF TEMPSTATUS, W MOVWF STATUS MOVF TEMPW, W RETFIE RX_INTERRUPT BCF PIR1,RCIF MOVFW RCREG GOTO DATA_RETURN

TIMER_1

BCF T1CON,TMR1ON BCF PIR1,CCP1IF BTFSC TIME_ER CALL TIMER1_INITIALIZATION INCF TIME1,F XORLW H'05' BTFSC STATUS,Z GOTO CLEAR_FLAG BCF TIME_ON CALL TIMER1_INITIALIZATION GOTO DATA_RETURN CLEAR_FLAG CLRF TIME1 BCF TIME_ON CALL TIMER1_INITIALIZATION CLRF FLAG0 CLRF FLAG1 GOTO DATA_RETURN ; ********************************************************* PROGRAM STARTS*************************************************** ********** INITIALIZE CALL CHECK_RAM1 CALL PORT_INTITIALIZE CALL LCD_INITIALIZATION CLRW CALL EEPROM_READ MOVFW READBACK MOVWF SPEED MOVLW H'01' CALL EEPROM_READ MOVFW READBACK MOVWF MESS_COUNT MOVLW H'02' CALL EEPROM_READ MOVFW READBACK MOVWF CONT_REMOTE

CALL TIMER1_INITIALIZATION CALL RS232_RECIEVE_INITIALIZATION

START CALL CALL CALL CALL GOTO SCREEN SWITCH TRANSFER_TRASM TRANSFER_REMOTE START

; ********************************************************* ********************************************************* ******************************** ; REMOTE TRANSMING ROUTING ; ********************************************************* ********************************************************* ******************************** TRANSFER_REMOTE BTFSC PR_MESSAGE RETURN BTFSC TRANS RETURN BTFSS REMOTE RETURN CLRF TX_COUNTER BTFSC UP GOTO PRO1 BTFSC DWN GOTO PRO1 BTFSC STOP GOTO PRO1 RETURN PRO1

MOVLW "{" CALL TX_COM MOVLW "R" CALL TX_COM BTFSS GOTO AN1 UP

AN1

MOVLW "U" CALL TX_COM MOVLW "P" CALL TX_COM GOTO NEX1 BTFSS GOTO AN2 DWN

MOVLW "D" CALL TX_COM MOVLW "W" CALL TX_COM GOTO NEX1 AN2 BTFSS GOTO EN1 STOP

NEX1

MOVLW "S" CALL TX_COM MOVLW "T" CALL TX_COM GOTO NEX1 MOVLW "?" CALL TX_COM MOVLW "}" CALL TX_COM MOVLW H'20' CALL PR_DELAY BCF BCF BCF UP DWN STOP

EN1

RETURN ; ********************************************************* ********************************************************* ******************************** ; TRANSMITER TRANSMING ROUTING ROUTINE ; ********************************************************* ********************************************************* ******************************** TRANSFER_TRASM BTFSC PR_MESSAGE RETURN BTFSC PR_SPEED RETURN BTFSC REMOTE RETURN BTFSS TRANS RETURN DECFSZ TX_COUNTER,F RETURN MOVLW "{" CALL TX_COM MOVLW "T" CALL TX_COM MOVFW SPEED CALL TX_COM MOVFW MESS_COUNT CALL TX_COM MOVLW "?" CALL TX_COM

MOVLW "}" CALL TX_COM MOVLW H'20'

CALL PR_DELAY RETURN ; ********************************************************* ********************************************************* ******************************** ; SWITCH CONDITION FETCHING AND DESION ROUTINE ; ********************************************************* ********************************************************* ******************************** SWITCH BSF RL1 BCF RL2 BCF RL3 BCF RL4 CALL DELAY255 BTFSC CL1 BSF SWT1,0 BTFSS CL1 BCF SWT1,0 BTFSC BSF BTFSS BCF BTFSC BSF BTFSS BCF BTFSC BSF BTFSS BCF BCF BSF CL2 SWT1,1 CL2 SWT1,1 CL3 SWT1,2 CL3 SWT1,2 CL4 SWT1,3 CL4 SWT1,3 RL1 RL2

BCF RL3 BCF RL4 CALL DELAY255 BTFSC CL1 BSF SWT1,4 BTFSS CL1 BCF SWT1,4 BTFSC BSF BTFSS BCF BTFSC BSF BTFSS BCF BTFSC BSF BTFSS BCF CL2 SWT1,5 CL2 SWT1,5 CL3 SWT1,6 CL3 SWT1,6 CL4 SWT1,7 CL4 SWT1,7

BCF RL1 BCF RL2 BSF RL3 BCF RL4 CALL DELAY255 BTFSC CL1 BSF SWT2,0 BTFSS CL1 BCF SWT2,0 BTFSC BSF BTFSS BCF BTFSC BSF BTFSS BCF CL2 SWT2,1 CL2 SWT2,1 CL3 SWT2,2 CL3 SWT2,2

BTFSC BSF BTFSS BCF

CL4 SWT2,3 CL4 SWT2,3

BCF RL1 BCF RL2 BCF RL3 BSF RL4 CALL DELAY255 BTFSC CL1 BSF SWT2,4 BTFSS CL1 BCF SWT2,4 BTFSC BSF BTFSS BCF BTFSC BSF BTFSS BCF BTFSC BSF BTFSS BCF CL2 SWT2,5 CL2 SWT2,5 CL3 SWT2,6 CL3 SWT2,6 CL4 SWT2,7 CL4 SWT2,7

MOVFW SWT1 XORLW H'00' BTFSC STATUS,Z GOTO TEST1 GOTO TEST2 TEST1 MOVFW SWT2 XORLW H'00' BTFSC STATUS,Z GOTO ONE_BUTTON

GOTO OKTEST TEST2 MOVFW SWT2 XORLW H'00' BTFSC STATUS,Z GOTO OKTEST RETURN

OKTEST

MOVFW XORWF BTFSC RETURN

SWT1 SWT2,W STATUS,Z

MOVFW SWT1 XORLW H'01' BTFSC STATUS,Z GOTO ONE_BUTTON MOVFW SWT1 XORLW H'02' BTFSC STATUS,Z GOTO ONE_BUTTON MOVFW SWT1 XORLW H'04' BTFSC STATUS,Z GOTO ONE_BUTTON MOVFW SWT1 XORLW H'08' BTFSC STATUS,Z GOTO ONE_BUTTON MOVFW SWT1 XORLW H'10' BTFSC STATUS,Z GOTO ONE_BUTTON MOVFW SWT1 XORLW H'20' BTFSC STATUS,Z GOTO ONE_BUTTON

MOVFW SWT1 XORLW H'40' BTFSC STATUS,Z GOTO ONE_BUTTON MOVFW SWT1 XORLW H'80' BTFSC STATUS,Z GOTO ONE_BUTTON MOVFW SWT2 XORLW H'01' BTFSC STATUS,Z GOTO ONE_BUTTON MOVFW SWT2 XORLW H'02' BTFSC STATUS,Z GOTO ONE_BUTTON MOVFW SWT2 XORLW H'04' BTFSC STATUS,Z GOTO ONE_BUTTON MOVFW SWT2 XORLW H'08' BTFSC STATUS,Z GOTO ONE_BUTTON MOVFW SWT2 XORLW H'10' BTFSC STATUS,Z GOTO ONE_BUTTON MOVFW SWT2 XORLW H'20' BTFSC STATUS,Z GOTO ONE_BUTTON MOVFW XORLW SWT2 H'40'

BTFSC STATUS,Z GOTO ONE_BUTTON MOVFW SWT2 XORLW H'80' BTFSC STATUS,Z GOTO ONE_BUTTON RETURN

ONE_BUTTON BCF FSW1 BTFSS SWT1,0 GOTO N1 BTFSC FSW1 GOTO N1 BSF FSW1 BSF PR_SPEED BCF PR_MESSAGE BCF PR_TRANS_REMO CLRW CALL EEPROM_READ MOVFW READBACK MOVWF SPEED CALL SPEED_DISPLAY RETURN N1 BTFSS BCF BTFSS GOTO N2 BTFSC GOTO N2 BSF BTFSS RETURN MOVLW ADDWF MOVFW SUBLW GOTO DF1 MOVLW MOVWF SWT1,1 FSW2 SWT1,1 FSW2 FSW2 PR_SPEED H'02' SPEED,F SPEED H'64' H'64' SPEED

DF1 CALL SPEED_DISPLAY RETURN N2 BTFSS SWT1,2 BCF FSW3 BTFSS SWT1,2 GOTO N3 BTFSC FSW3 GOTO N3 BSF FSW3 BTFSS PR_SPEED RETURN MOVLW H'02' SUBWF SPEED,F BTFSC STATUS,C GOTO DF2 CLRF SPEED CALL SPEED_DISPLAY RETURN N3 BTFSS BCF BTFSS GOTO N4 BTFSC GOTO N4 BSF BTFSS RETURN BCF BCF BCF BCF SWT1,3 FSW4 SWT1,3 FSW4 FSW4 PR_SPEED PR_SPEED PR_MESSAGE PR_TRANS_REMO SCR

DF2

MOVLW H'01' MOVWF LCD_CMD CALL CMD_WRITE CLRW READ ;SELECTING EEPROM 00 ADDRESS T0

CALL EEPROM_READ MOVFW READBACK XORWF SPEED,W

BTFSC STATUS,Z RETURN MOVFW SPEED BANK2 CLRF EE_ADD CALL EEPROM_WRITE RETURN N4 BTFSS BCF BTFSS GOTO N5 BTFSC GOTO N5 BSF BCF BSF BCF SWT1,4 FSW5 SWT1,4 FSW5 FSW5 PR_SPEED PR_MESSAGE PR_TRANS_REMO

MOVLW H'01' CALL EEPROM_READ MOVFW READBACK MOVWF MESS_COUNT CALL MESSAGE_DISPLAY RETURN N5 BTFSS SWT1,5 BCF FSW6 BTFSS SWT1,5 GOTO N6 BTFSC FSW6 GOTO N6 BSF FSW6 BTFSS PR_MESSAGE RETURN INCF MESS_COUNT,F MOVFW MESS_COUNT XORLW H'06' BTFSS STATUS,Z GOTO MS CLRF MESS_COUNT CALL MESSAGE_DISPLAY

MS

RETURN N6 BTFSS BCF BTFSS GOTO N7 BTFSC GOTO N7 BSF BTFSS RETURN DECFSZ GOTO MS1 MOVLW MOVWF SWT1,6 FSW7 SWT1,6 FSW7 FSW7 PR_MESSAGE MESS_COUNT,F H'05' MESS_COUNT

MS1 N7

CALL MESSAGE_DISPLAY RETURN BTFSS BCF BTFSS GOTO N8 BTFSC GOTO N8 BSF BTFSS RETURN BCF BCF BCF BCF SWT1,7 FSW8 SWT1,7 FSW8 FSW8 PR_MESSAGE PR_SPEED PR_MESSAGE PR_TRANS_REMO SCR

MOVLW H'01' MOVWF LCD_CMD CALL CMD_WRITE MOVLW H'01' CALL EEPROM_READ MOVFW READBACK XORWF MESS_COUNT,W BTFSC STATUS,Z RETURN BANK2

N8

MOVLW H'01' MOVWF EE_ADD BANK0 MOVFW MESS_COUNT CALL EEPROM_WRITE RETURN BTFSS SWT2,0 BCF FSW9 BTFSS SWT2,0 GOTO N9 BTFSC FSW9 GOTO N9 BSF FSW9 BCF PR_SPEED BCF PR_MESSAGE BSF PR_TRANS_REMO MOVLW H'02' CALL EEPROM_READ MOVFW READBACK MOVWF CONT_REMOTE CALL TRANS_REMOTE RETURN

N9

BTFSS SWT2,1 BCF FSW10 BTFSS SWT2,1 GOTO N10 BTFSC FSW10 GOTO N10 BSF FSW10 BSF TRANS BCF REMOTE CALL TRANS_REMOTE RETURN BTFSS BCF BTFSS GOTO N11 BTFSC GOTO N11 BSF BCF BSF SWT2,2 FSW11 SWT2,2 FSW11 FSW11 TRANS REMOTE

N10

N11

CALL TRANS_REMOTE RETURN BTFSS BCF BTFSS GOTO N12 BTFSC GOTO N12 BSF BCF BCF BCF BCF SWT2,3 FSW12 SWT2,3 FSW12 FSW12 PR_SPEED PR_MESSAGE PR_TRANS_REMO SCR

MOVLW H'01' MOVWF LCD_CMD CALL CMD_WRITE MOVLW H'02' CALL EEPROM_READ MOVFW READBACK XORWF CONT_REMOTE,W BTFSC STATUS,Z RETURN BANK2 MOVLW H'02' MOVWF EE_ADD BANK0 MOVFW CONT_REMOTE CALL EEPROM_WRITE RETURN N12 RETURN BTFSS BCF BTFSS GOTO N13 BTFSC GOTO N13 BSF BSF BCF BCF SWT2,4 FSW13 SWT2,4 FSW13 FSW13 UP DWN STOP

RETURN N13 BTFSS BCF BTFSS GOTO N14 BTFSC GOTO N14 BSF BCF BSF BCF RETURN BTFSS BCF BTFSS GOTO N15 BTFSC GOTO N15 BSF BCF BCF BSF RETURN SWT2,5 FSW14 SWT2,5 FSW14 FSW14 UP DWN STOP SWT2,6 FSW15 SWT2,6 FSW15 FSW15 UP DWN STOP

N14

N15

BTFSS SWT2,7 BCF FSW16 BTFSS SWT2,7 RETURN BTFSC FSW16 RETURN BSF FSW16 MOVLW H'01' MOVWF LCD_CMD CALL CMD_WRITE BCF PR_SPEED BCF PR_MESSAGE BCF PR_TRANS_REMO BCF SCR RETURN RETURN

; ********************************************************* ************************************************** ;SPEED DISPALY & CONVERSION ROUTINE ; ********************************************************* ************************************************** SPEED_DISPLAY BTFSS positon MOVLW PR_SPEED H'80' ;cursor HOME POSTION

MOVWF LCD_CMD CALL CMD_WRITE MOVLW H'01' MOVWF LCD_CMD CALL CMD_WRITE MOVLW "E" MOVWF LCD_DATA CALL DATA_WRITE MOVLW "n" MOVWF LCD_DATA CALL DATA_WRITE MOVLW "t" MOVWF LCD_DATA CALL DATA_WRITE MOVLW "e" MOVWF LCD_DATA CALL DATA_WRITE MOVLW "r" MOVWF LCD_DATA CALL DATA_WRITE MOVLW MOVWF " " LCD_DATA

CALL DATA_WRITE MOVLW "S" MOVWF LCD_DATA CALL DATA_WRITE MOVLW "p" MOVWF LCD_DATA CALL DATA_WRITE MOVLW "e" MOVWF LCD_DATA CALL DATA_WRITE MOVLW "e" MOVWF LCD_DATA CALL DATA_WRITE MOVLW "d" MOVWF LCD_DATA CALL DATA_WRITE MOVLW "-" MOVWF LCD_DATA CALL DATA_WRITE MOVFW SPEED MOVWF L_BYTE CLRF M_BYTE CLRF H_BYTE CALL B2_BCD MOVFW XORLW BTFSC GOTO S0 R1 H'00' STATUS,Z

MOVFW R1 ANDLW H'0F' CALL ASCII MOVWF LCD_DATA CALL DATA_WRITE S0

SWAPF R2,W ANDLW H'0F' CALL ASCII MOVWF LCD_DATA CALL DATA_WRITE MOVFW R2 ANDLW H'0F' CALL ASCII MOVWF LCD_DATA CALL DATA_WRITE MOVLW "%" MOVWF LCD_DATA CALL DATA_WRITE RETURN ;DISPLAY R AT 80

; ********************************************************* ************************************************** ;TRANSMITER AND REMOTE SELECTION ROUTINE ; ********************************************************* ************************************************** TRANS_REMOTE BTFSC PR_SPEED RETURN BTFSC PR_MESSAGE RETURN BTFSS PR_TRANS_REMO RETURN MOVLW H'80' ;cursor positon MOVWF LCD_CMD CALL CMD_WRITE MOVLW H'01' MOVWF LCD_CMD CALL CMD_WRITE BTFSC REMOTE

HOME POSTION

RE1

GOTO RE1 BTFSC GOTO TI1 RETURN

TRANS

MOVLW "R" MOVWF LCD_DATA CALL DATA_WRITE MOVLW "e" MOVWF LCD_DATA CALL DATA_WRITE MOVLW "m" MOVWF LCD_DATA CALL DATA_WRITE MOVLW "o" MOVWF LCD_DATA CALL DATA_WRITE MOVLW "t" MOVWF LCD_DATA CALL DATA_WRITE MOVLW "e" MOVWF LCD_DATA CALL DATA_WRITE MOVLW "-" MOVWF LCD_DATA CALL DATA_WRITE MOVLW "M" MOVWF LCD_DATA CALL DATA_WRITE MOVLW "o" MOVWF LCD_DATA CALL DATA_WRITE MOVLW MOVWF "d" LCD_DATA

CALL DATA_WRITE MOVLW "e" MOVWF LCD_DATA CALL DATA_WRITE MOVLW "." MOVWF LCD_DATA CALL DATA_WRITE RETURN TI1 MOVLW "T" MOVWF LCD_DATA CALL DATA_WRITE MOVLW "r" MOVWF LCD_DATA CALL DATA_WRITE MOVLW "a" MOVWF LCD_DATA CALL DATA_WRITE MOVLW "n" MOVWF LCD_DATA CALL DATA_WRITE MOVLW "s" MOVWF LCD_DATA CALL DATA_WRITE MOVLW "m" MOVWF LCD_DATA CALL DATA_WRITE MOVLW "i" MOVWF LCD_DATA CALL DATA_WRITE MOVLW "t" MOVWF LCD_DATA CALL DATA_WRITE

MOVLW "e" MOVWF LCD_DATA CALL DATA_WRITE MOVLW "r" MOVWF LCD_DATA CALL DATA_WRITE MOVLW "-" MOVWF LCD_DATA CALL DATA_WRITE MOVLW "M" MOVWF LCD_DATA CALL DATA_WRITE MOVLW "o" MOVWF LCD_DATA CALL DATA_WRITE MOVLW "d" MOVWF LCD_DATA CALL DATA_WRITE MOVLW "e" MOVWF LCD_DATA CALL DATA_WRITE MOVLW "." MOVWF LCD_DATA CALL DATA_WRITE RETURN ; ********************************************************* ************************************************** ;MESSAGE DISPLAY ROUTINE

; ********************************************************* ************************************************** MESSAGE_DISPLAY BTFSC RETURN BTFSS RETURN MOVLW positon PR_SPEED PR_MESSAGE H'80' ;cursor HOME POSTION

MOVWF LCD_CMD CALL CMD_WRITE MOVLW H'01' MOVWF LCD_CMD CALL CMD_WRITE MOVLW "M" MOVWF LCD_DATA CALL DATA_WRITE MOVLW "e" MOVWF LCD_DATA CALL DATA_WRITE MOVLW "s" MOVWF LCD_DATA CALL DATA_WRITE MOVLW "s" MOVWF LCD_DATA CALL DATA_WRITE MOVLW "a" MOVWF LCD_DATA CALL DATA_WRITE MOVLW "g" MOVWF LCD_DATA CALL DATA_WRITE

MOVLW "e" MOVWF LCD_DATA CALL DATA_WRITE MOVLW "-" MOVWF LCD_DATA CALL DATA_WRITE MOVFW XORLW BTFSS GOTO MS2 MOVLW MOVWF MOVLW MOVWF MOVLW MOVWF GOTO SHOW MOVFW XORLW BTFSS GOTO MS3 MOVLW MOVWF MOVLW MOVWF MOVLW MOVWF GOTO SHOW MS3 MOVFW XORLW BTFSS GOTO MS4 MOVLW MOVWF MOVLW MOVWF MOVLW MOVWF GOTO SHOW MESS_COUNT H'00' STATUS,Z " " FIRST_WORD " " SECOND_WORD " " THIRD_WORD MESS_COUNT H'01' STATUS,Z "L" FIRST_WORD "T" SECOND_WORD "N" THIRD_WORD

MS2

MESS_COUNT H'02' STATUS,Z "B" FIRST_WORD "R" SECOND_WORD "D" THIRD_WORD

MS4 MOVFW XORLW BTFSS GOTO MS5 MOVLW MOVWF MOVLW MOVWF MOVLW MOVWF GOTO SHOW MOVFW XORLW BTFSS GOTO MS6 MOVLW MOVWF MOVLW MOVWF MOVLW MOVWF GOTO SHOW MOVFW XORLW BTFSS GOTO SHOW MOVLW MOVWF MOVLW MOVWF MOVLW MOVWF SHOW MOVFW FIRST_WORD MOVWF LCD_DATA CALL DATA_WRITE MOVFW MOVWF SECOND_WORD LCD_DATA MESS_COUNT H'03' STATUS,Z "W" FIRST_WORD "I" SECOND_WORD "P" THIRD_WORD MESS_COUNT H'04' STATUS,Z "N" FIRST_WORD "H" SECOND_WORD "R" THIRD_WORD MESS_COUNT H'05' STATUS,Z "R" FIRST_WORD "T" SECOND_WORD "N" THIRD_WORD

MS5

MS6

CALL DATA_WRITE MOVFW THIRD_WORD MOVWF LCD_DATA CALL DATA_WRITE RETURN ; ********************************************************* ************************************************** ;MESSAGE DISPLAY ROUTINE ; ********************************************************* ************************************************** SCREEN BTFSC PR_SPEED RETURN BTFSC PR_MESSAGE RETURN BTFSC SCR RETURN BSF SCR MOVLW H'01' MOVWF LCD_CMD CALL CMD_WRITE MOVLW H'84' ;cursor HOME POSTION

positon

MOVWF LCD_CMD CALL CMD_WRITE MOVLW "o" MOVWF LCD_DATA CALL DATA_WRITE MOVLW "i" MOVWF LCD_DATA CALL DATA_WRITE MOVLW "s" MOVWF LCD_DATA CALL DATA_WRITE MOVLW "T"

MOVWF LCD_DATA CALL DATA_WRITE MOVLW "." MOVWF LCD_DATA CALL DATA_WRITE positon MOVLW H'C3' ;cursor HOME POSTION

MOVWF LCD_CMD CALL CMD_WRITE MOVLW "B" MOVWF LCD_DATA CALL DATA_WRITE MOVLW "H" MOVWF LCD_DATA CALL DATA_WRITE MOVLW "O" MOVWF LCD_DATA CALL DATA_WRITE MOVLW "P" MOVWF LCD_DATA CALL DATA_WRITE MOVLW "A" MOVWF LCD_DATA CALL DATA_WRITE MOVLW "L" MOVWF LCD_DATA CALL DATA_WRITE RETURN ; ***********************************************READ ROUTINE************************************************** ******************** ; TAKE THE ADDRESS IN LCD_CMD GIVE U A DATAA IN LCD_READBACK

DATA_READ CALL CMD_WRITE CALL READY CALL READBACK_LCD RETURN ;***********************************LCD CLEARING ROUTINE ROUTINE************************************************** ************************* ; TAKE COMMAND IN LCD_CMD CMD_WRITE CALL READY CALL CMDWRT RETURN ;***********************************LCD CLEARING ROUTINE ROUTINE************************************************** ************************* ; TAKE COMMAND IN LCD_DATA DATA_WRITE CALL READY CALL DATAWRT RETURN ;***********************************LCD CLEARING ROUTINE ROUTINE************************************************** ************************* CLEAR_LCD CALL READY MOVLW H'01' ;CLEAR DISPLAY MOVWF LCD_CMD CALL CMDWRT RETURN ;***********************************LCD DATA SEND ROUTINE ROUTINE************************************************** ************************* DATAWRT BSF RS ;RS PULL TO HIGH BCF RW ;RW PULL TO HIGH BTFSC LCD_DATA,0 BSF REVDATA,7 BTFSS LCD_DATA,0 BCF REVDATA,7

BTFSC BSF BTFSS BCF BTFSC BSF BTFSS BCF BTFSC BSF BTFSS BCF BTFSC BSF BTFSS BCF BTFSC BSF BTFSS BCF BTFSC BSF BTFSS BCF BTFSC BSF BTFSS BCF MOVFW MOVWF LCD PINS BSF NOP NOP BCF NOP

LCD_DATA,1 REVDATA,6 LCD_DATA,1 REVDATA,6 LCD_DATA,2 REVDATA,5 LCD_DATA,2 REVDATA,5 LCD_DATA,3 REVDATA,4 LCD_DATA,3 REVDATA,4 LCD_DATA,4 REVDATA,3 LCD_DATA,4 REVDATA,3 LCD_DATA,5 REVDATA,2 LCD_DATA,5 REVDATA,2 LCD_DATA,6 REVDATA,1 LCD_DATA,6 REVDATA,1 LCD_DATA,7 REVDATA,0 LCD_DATA,7 REVDATA,0 REVDATA PORTB EN EN ;LCD COMMAND TRANFER TO W ;LCD DATA COMMAND TO ;EN THE TRANSFER

NOP RETLW H'00' ;***********************************LCD COMMAND SEND ROUTINE ROUTINE************************************************** ************************* CMDWRT BCF RS ;RS PULL TO LOW BCF RW ;RW PULL TO LOW BTFSC BSF BTFSS BCF BTFSC BSF BTFSS BCF BTFSC BSF BTFSS BCF BTFSC BSF BTFSS BCF BTFSC BSF BTFSS BCF BTFSC BSF BTFSS BCF BTFSC BSF LCD_CMD,0 REVDATA,7 LCD_CMD,0 REVDATA,7 LCD_CMD,1 REVDATA,6 LCD_CMD,1 REVDATA,6 LCD_CMD,2 REVDATA,5 LCD_CMD,2 REVDATA,5 LCD_CMD,3 REVDATA,4 LCD_CMD,3 REVDATA,4 LCD_CMD,4 REVDATA,3 LCD_CMD,4 REVDATA,3 LCD_CMD,5 REVDATA,2 LCD_CMD,5 REVDATA,2 LCD_CMD,6 REVDATA,1

BTFSS BCF BTFSC BSF BTFSS BCF MOVFW MOVWF

LCD_CMD,6 REVDATA,1 LCD_CMD,7 REVDATA,0 LCD_CMD,7 REVDATA,0 REVDATA PORTB ;LCD COMMAND TRANFER TO W ;LCD DATA COMMAND TO

LCD PINS

BSF EN ;EN THE TRANSFER NOP NOP BCF EN NOP NOP RETLW H'00' ;**************************************DATAREAD FRM LCD****************************************************** ***************** READBACK_LCD BSF RS BSF RW BANK1 MOVLW H'FF' MOVWF TRISB ; MAKE ALL PINS INPUT TO RECIVE DATA BANK0 BSF EN NOP NOP BTFSC PORTB,0 BSF REVDATA,7 BTFSS PORTB,0 BCF REVDATA,7 BTFSC BSF BTFSS BCF BTFSC PORTB,1 REVDATA,6 PORTB,1 REVDATA,6 PORTB,2

BSF BTFSS BCF BTFSC BSF BTFSS BCF BTFSC BSF BTFSS BCF BTFSC BSF BTFSS BCF BTFSC BSF BTFSS BCF BTFSC BSF BTFSS BCF

REVDATA,5 PORTB,2 REVDATA,5 PORTB,3 REVDATA,4 PORTB,3 REVDATA,4 PORTB,4 REVDATA,3 PORTB,4 REVDATA,3 PORTB,5 REVDATA,2 PORTB,5 REVDATA,2 PORTB,6 REVDATA,1 PORTB,6 REVDATA,1 PORTB,7 REVDATA,0 PORTB,7 REVDATA,0

MOVFW REVDATA ;LCD COMMAND TRANFER TO W MOVWF LCD_READBACK BCF EN NOP NOP BANK1 CLRF TRISB ; MAKE ALL PINS OUTPUT BANK0 RETLW H'00' ;***********************************LCD BUSY CHECK ROUTINE************************************************** ************************* READY

BCF PORTB,0 BANK1 BSF TRISB,0 BANK0 BCF RS ;FOR READING LCD BSF RW ;FOR READING LCD BCF EN NOP NOP BSF EN NOP NOP BTFSC PORTB,0 GOTO READY BANK1 BCF TRISB,0 BANK0 BCF RW RETURN ; ********************************************************* ********************************************************* ******************************** ; BINARY TO BCD CONVERION ROUTINE ; ********************************************************* ********************************************************* ******************************** B2_BCD BCF STATUS,0 ; clear the carry bit MOVLW .24 MOVWF COUNT CLRF R0 CLRF R1 CLRF R2 LOOP16 RLF L_BYTE, F RLF M_BYTE , F RLF H_BYTE , F RLF R2, F RLF R1, F RLF R0, F DECFSZ COUNT, F GOTO ADJDEC RETLW 0

ADJDEC MOVLW R2 MOVWF FSR CALL ADJBCD MOVLW R1 MOVWF FSR CALL ADJBCD MOVLW R0 MOVWF FSR CALL ADJBCD GOTO LOOP16 ADJBCD MOVLW ADDWF MOVWF BTFSC MOVWF MOVLW ADDWF MOVWF BTFSC MOVWF RETLW 3 0,W TEMP TEMP,3 ; test if result > 7 0 30 0,W TEMP TEMP,7 ; test if result > 7 0 ; save as MSD 0

; ********************************************************* ********************************************************* ******************************** ; EEPROM ROUTINES ROUTINE ; ********************************************************* ********************************************************* ******************************** EEPROM_WRITE BANK2 MOVWF EEDATA MOVWF EEADR BANK3 BCF EECON1,EEPGD BSF EECON1,WREN BCF INTCON,GIE MOVLW H'55' MOVWF EECON2 MOVLW H'AA' MOVWF EECON2

BSF EECON1,WR BSF INTCON,GIE BANK0 CALL DELAY255 BANK3 BTFSC EECON1,WR GOTO $-1 BCF EECON1,WREN BANK0 RETURN EEPROM_READ BANK2 MOVWF EEADR BANK3 BCF EECON1,EEPGD BSF EECON1,RD BANK2 MOVFW EEDATA BANK0 MOVWF READBACK RETURN ; ********************************************************* ********************************************************* ******************************** ; COMPUTER TRANSMITTING ROUTINE ; ********************************************************* ********************************************************* ******************************** TX_COM MOVWF BANK1 BTFSS GOTO $-1 BANK0 CALL RETURN TXREG TXSTA,TRMT DELAY255

; ********************************************************* ********************************************************* ******************************** ; LCD INTIALIZATION ROUTINE

; ********************************************************* ********************************************************* ******************************** LCD_INITIALIZATION CALL PR_DELAY ;30 MSEC START DELAY FOR LCD TO RISE POWER CALL PR_DELAY ;30 MSEC START DELAY FOR LCD TO RISE POWER MOVLW H'3B' ;FUNCTION SET[0,0,0,1(FOR LCD REQ.),1(DL, DATA LENGTH 8),1(N SET 2 LINES),1(F -FONT 5X10 DOTS,X,X) MOVWF LCD_CMD ; NO READY HAS BEEN CHECKED CALL CMDWRT

MOVLW H'0C' ;LCD SETTING(0,0,0,0,1(ALWAYS),1(D,TO INCREMENT ADDRESS AUTO),1(C-ON THE CURSOR),1(BTO BLINK THE CURSOR)) MOVWF LCD_CMD CALL CMD_WRITE CALL CLEAR_LCD positon MOVLW H'80' ;cursor HOME POSTION

MOVWF LCD_CMD CALL CMD_WRITE RETURN ;;******************************************************* ********************************************************* ************************************************* ;TIM ER INTIALIZING ROUITINE ; ********************************************************* ********************************************************* *********************************************** TIMER1_INITIALIZATION BTFSC TIME_ON RETURN BSF TIME_ON

CLRF TMR1L ; CLEAR LOW BYTE OF TIMER1 CLRF TMR1H ; CLEAR HIGH BYTE OF TIMER1 BANK1 BCF PIE1,CCP1IE ; ENABLE THE COMPARE MODE FOR TIMER1 BANK0 MOVLW H'50' ; TRANSFER THE DATA OF LOWER BYTE OF 10000 EQUIVALENT TO COMPARE DATA REG LOWER AT 16 MHZ MOVLW H'C3' MOVWF CCPR1H ; TRANSFER THE DATA OF HIGHER BYTE OF 10000 EQUIVALENT TO COMPARE DATA REG HIGHER AT 16 MHZ BSF TIME_ER BANK1 BSF PIE1,CCP1IE ; ENABLE THE COMPARE MODE FOR TIMER1 BANK0 BCF TIME_ER MOVLW B'00110101' ; TRANSFER THE DATA FOR ENABLEING TIMER1 CONTROL TO W MOVWF T1CON ; TRANSFER THE DATA FOR ENABLEING TIMER1 CONTROL TO TIMER1 CONTROL REG MOVLW B'00001010' ; TRANSFER THE DATA FOR ENABLEING COMPARE MODE CONTROL TO W MOVWF CCP1CON ; TRANSFER THE DATA FOR ENABLEING COMPARE MODE CONTROL TO COMPARE MODE CONTROL REG CLRF TMR1L ; CLEAR LOW BYTE OF TIMER1 CLRF TMR1H ; CLEAR HIGH BYTE OF TIMER1 RETURN ;;******************************************************* ********************************************************* ************************************************* ;PORT INTIALIZATION ROUTINE ; ********************************************************* ********************************************************* *********************************************** PORT_INTITIALIZE BANK1 MOVLW B'11111000' MOVWF TRISA

CLRF TRISB MOVLW B'10000001' ;C6 TX IS O/P MOVWF TRISC ;TRANSFER TO PORTC DIRECTION REGISTER MOVLW B'00000111' MOVWF ADCON1 BANK0 CLRF PORTA CLRF PORTB CLRF PORTC MOVLW B'11000000' ; TRANSFER THE DATA FOR ENABLEING GENERAL AND PERIPHERAL INTERPPT TO W MOVWF INTCON ; TRANSFER THE DATA FOR ENABLEING GENERAL AND PERIPHERAL INTERPPT TO INTERRUPT CONTROL REGISTER RETURN ;;******************************************************* ********************************************************* ************************************************* ;RS232 INTIALIZE ROUTINE ; ********************************************************* ********************************************************* *********************************************** RS232_RECIEVE_INITIALIZATION CLRF STATUS MOVLW BAUD_CONSTANT MOVWF SPBRG MOVLW B'10100000' MOVWF TXSTA BSF PIE1,RCIE CLRF STATUS MOVLW B'10010000' MOVWF RCSTA MOVLW B'11000000' ; TRANSFER THE DATA FOR ENABLEING GENERAL AND PERIPHERAL INTERPPT TO W MOVWF INTCON ; TRANSFER THE DATA FOR ENABLEING GENERAL AND PERIPHERAL INTERPPT TO INTERRUPT CONTROL REGISTER RETURN

;;******************************************************* ********************************************************* ************************************************* ;PROGRAMABLE DELAY ROUTINE ; ********************************************************* ********************************************************* *********************************************** PR_DELAY MOVWF PRCOUNTER OO1 CALL DELAY255 DECFSZ PRCOUNTER,F GOTO OO1 RETURN ;;******************************************************* ********************************************************* ************************************************* ;255 CYCLE DELAY ROUTINE ; ********************************************************* ********************************************************* *********************************************** DELAY255 DECFSZ COUNTER,F GOTO DELAY255 RETURN ;;******************************************************* ********************************************************* ************************************************* ;RAM CLEANING ROUNTINE ; ********************************************************* ********************************************************* *********************************************** CHECK_RAM1 MOVLW D'20' ;THIS IS FOR INITIAL POWER UP DELAY MOVWF COUNT_REG1 ;TRANSFER TO COUNT_REG1 REGISTER CHECK_RAM2

CALL CHECKING THE RAM CLRWDT TIMER DECFSZ AND AND CHECK IF GOTO LABEL RETURN CHECK_RAM

CHECK_RAM

;CALL SUBROUTINE FOR ;CLEAR WATCHDOG

COUNT_REG1,F ;DECREASE COUNT_REG1 ZERO THEN SKIP CHECK_RAM2 ;GOTO CHECK_RAM2

CLRF STATUS MOVLW H'50' REGISTER COUNT TO BE CLEARED MOVWF TMP_COUNT REGISTER MOVLW H'70' REGISTER MOVWF FSR REGISTER FOR INDIRECT ADDRESSING MOVLW H'FF' THE REGISTER UNDER CONSIDERATION STEP1 MOVWF INDF REGISTER DIRECTED REGISTER DECF FSR,F FOR NEXT REGISTER TO GO DECFSZ TMP_COUNT,F AND CHECH WHETHER ALL REGISTERED GOTO STEP1 STEPS UP MOVLW H'50' REGISTER COUNT TO BE CLEARED MOVWF TMP_COUNT REGISTER MOVLW H'70' REGISTER MOVWF FSR REGISTER FOR INDIRECT ADDRESSING STEP2 MOVLW H'FF' 1 XORWF INDF,F INDIRECTLY ADDRESSED REGISTER

;GOTO BANK0 ;THIS IS FOR RAM ;TRANSFER TO TMP_COUNT ;THIS IS START RAM ;TRANSFER TO FSR ;MAKE ALL BITS OF TO 1 ;TRANSFER TO FSR ;DECREASE FSR FOR ;DECREASE TMP_COUNT AS DESIRED MADE "FF" ;IF NOT GOTO 3 ;THIS IS FOR RAM ;TRANSFER TO TMP_COUNT ;THIS IS START RAM ;TRANSFER TO FSR ;FEED ALL BITS OF W ;XOR WITH THE

BTFSS ARE ZERO LABEL GOTO

STATUS,Z CHECK_RAM

;SKIP IF ALL BITS IN W ;ELSE GOTO CHECK_RAM

DECF FSR,F ;DECREASE FSR FOR FOR NEXT REGISTER TO GO DECFSZ TMP_COUNT,F ;DECREASE TMP_COUNT AND CHECH WHETHER ALL REGISTERED AS DESIRED MADE "00" GOTO STEP2 ;IF NOT GOTO 5 STEPS UP RETURN ;RETURN FROM THE SUB ROUTINE END

;*******************************************LCD ********************************************************* *********************** ; IST LINE HOME ADDRESS ;80H 81H _ _ 8F ; 2ND LINE HOME ADDRESS ;C0H C1H _ _ CF cblock 0x20 READBACK COUNTER LCD_CMD LCD_DATA LCD_READBACK PRCOUNTER REVDATA SPEED_DIS SPEED_DISP SEQUECE TLON THON TLOFF THOFF FLAG0 FLAG1 TL TH COUNT TEMP H_BYTE M_BYTE L_BYTE R0 R1 R2 NUM RSDATA RSDATA1 RSDATA2 RSDATA3 RSDATA4 BYTE_COUNT RX_SPEED RX_MESSAGE RX_MESSAGEP COUNTER25 COUNTER26

FIRST_WORD SECOND_WORD THIRD_WORD endc BAUD_CONSTANT EQU D'207'; BAUDRATE= 1200 EE_ADD EQU H'120' ;****************************************************PINS DECLARATION********************************************** ****************** #DEFINE EN PORTA,0 ; FOR LCD #DEFINE RW PORTA,1 ; FOR LCD #DEFINE RS PORTA,2 ; FOR LCD #DEFINE NUMUP PORTA,4 ; FOR SPEED DW #DEFINE NUMDWN PORTA,3 ; FOR SPEED DW #DEFINE SPDWN PORTA,5 ; FOR SPEED DW #DEFINE SPUP PORTC,0 ; FOR SPEED DW #DEFINE OVERSP PORTC,1 ; FOR SPEED DW #DEFINE MT1 PORTC,5 ; FOR MOTOR #DEFINE MT2 PORTC,4 ; FOR MOTOR #DEFINE MT3 PORTC,3 ; FOR MOTOR #DEFINE MT4 PORTC,2 ; FOR MOTOR #DEFINE TIME_ER FLAG1,0 #DEFINE TIMER_ON FLAG1,1 #DEFINE TON FLAG1,2 #DEFINE TOFF FLAG1,3 #DEFINE SW FLAG0,0 #DEFINE SW1 FLAG0,1 #DEFINE SW2 FLAG0,2 #DEFINE SW3 FLAG0,3 #DEFINE STP FLAG0,4 #DEFINE MS_SP FLAG0,5 #DEFINE UP_RES FLAG0,6 ;****************************************INTRUPT ROUTINE REGISTERS************************************************ ************** TEMPW EQU H'7B' TEMPSTATUS EQU H'7C' TEMPPCLATH EQU H'7D' ;****************************************RAM CLEANING ROUTINE REGISTERS************************************************ ******************* COUNT_REG1 EQU H'7E' TMP_COUNT EQU H'7F'

; ********************************************************* ********************************************************* ****************** ERRORLEVEL-302 BANK0 MACRO RAM bank 0 BCF STATUS,RP0 BCF STATUS,RP1 ENDM BANK1 MACRO RAM bank 1 BSF STATUS,RP0 BCF STATUS,RP1 ENDM BANK2 MACRO RAM bank 2 BCF STATUS,RP0 BSF STATUS,RP1 ENDM BANK3 MACRO RAM bank 3 BSF STATUS,RP0 BSF STATUS,RP1 ENDM include "P16F877.inc" org 0 GOTO INITIALIZE org 4 GOTO INTERRUPT ASCII ANDLW ADDWF RETLW RETLW RETLW RETLW RETLW RETLW RETLW B'00001111' PCL,F H'30';0 H'31';1 H'32';2 H'33';3 H'34';4 H'35';5 H'36';6 ;macro to select data

;macro to select data

;macro to select data

;macro to select data

RETLW H'37';7 RETLW H'38';8 RETLW H'39';9 RETLW H'41';A RETLW H'42';B RETLW H'43';C RETLW H'44';D RETLW H'45';E RETLW H'46';F ;***********************************************I S R******************************************************** ******************** INTERRUPT MOVWF TEMPW ; TRANSFER DATA OF W TO TEMPW SWAPF STATUS, W ; SWAP AND TRANSFER DATA OF STATUS TO W CLRF STATUS ; CLEAR STATUS MOVWF TEMPSTATUS ; TRANSFER DATA OF W TO TEMPSTATUS MOVF PCLATH, W ; TRANSFER DATA OF PCLATH TO W MOVWF TEMPPCLATH ; TRANSFER DATA OF W TO TEMPPCLATH CLRF PCLATH ; CLEAR PCLATH CLRWDT ;CLEAR WATCH DOG TIMER BTFSC PIR1,CCP1IF ;GOTO TIMER1 INTERRUPT PROCESSING GOTO TIME_DO BTFSC RCSTA,FERR GOTO FERR_ERR BTFSC RCSTA,OERR GOTO OVER_ERR BTFSC PIR1,RCIF ;CHECK WHETHER INTERRUPT GENERATED BY THE TIMER1 IF NO THEN SKIP GOTO RX_INTERRUPT ;GOTO TIMER1 INTERRUPT PROCESSING DATA_RETURN MOVF TEMPPCLATH TO W MOVWF W TO PCLATH TEMPPCLATH, W ; TRANSFER DATA OF PCLATH ; TRANSFER DATA OF

SWAPF TEMPSTATUS, W ; TRANSFER DATA OF TEMPSTATUS TO W MOVWF STATUS ; TRANSFER DATA OF W TO STATUS MOVF TEMPW, W ; TRANSFER DATA OF TEMPW TO W RETFIE ; RETURN FROM INTERRUPT FERR_ERR MOVFW RCREG CLRW BCF RCSTA,FERR GOTO RESET_BYTE_COUNT OVER_ERR BCF RCSTA,CREN MOVFW RCREG CLRW CALL DELAY255 BSF RCSTA,CREN GOTO RESET_BYTE_COUNT RX_INTERRUPT BCF PIR1,RCIF MOVFW RCREG MOVWF RSDATA MOVFW BYTE_COUNT XORLW H'01' BTFSC STATUS,Z GOTO CHECK_B1 MOVFW BYTE_COUNT XORLW H'02' BTFSC STATUS,Z GOTO STORE_1B MOVFW BYTE_COUNT XORLW H'03' BTFSC STATUS,Z GOTO STORE_2B MOVFW BYTE_COUNT XORLW H'04' BTFSC STATUS,Z GOTO STORE_3B MOVFW BYTE_COUNT XORLW H'05' BTFSC STATUS,Z GOTO STORE_4B MOVFW BYTE_COUNT

XORLW H'06' BTFSC STATUS,Z GOTO STORE_5B GOTO RESET_BYTE_COUNT CHECK_B1 MOVFW RSDATA XORLW "{" BTFSS STATUS,Z GOTO RESET_BYTE_COUNT INC_BYTE_COUNT INCF BYTE_COUNT,F GOTO DATA_RETURN RESET_BYTE_COUNT MOVLW H'01' MOVWF BYTE_COUNT GOTO DATA_RETURN STORE_1B MOVFW MOVWF GOTO MOVFW MOVWF GOTO MOVFW MOVWF GOTO MOVFW MOVWF GOTO RSDATA RSDATA1 INC_BYTE_COUNT RSDATA RSDATA2 INC_BYTE_COUNT RSDATA RSDATA3 INC_BYTE_COUNT RSDATA RSDATA4 INC_BYTE_COUNT

STORE_2B

STORE_3B

STORE_4B

STORE_5B

MOVFW RSDATA XORLW "}" BTFSC STATUS,Z GOTO RS232RECIVE GOTO RESET_BYTE_COUNT RS232RECIVE MOVFW XORLW RSDATA1 "R"

BTFSC GOTO REM MOVFW XORLW BTFSC GOTO TRA REM

STATUS,Z RSDATA1 "T" STATUS,Z

MOVFW RSDATA4 XORLW "?" BTFSS STATUS,Z GOTO RESET_BYTE_COUNT MOVFW XORLW BTFSS GOTO CHD MOVFW XORLW BTFSS GOTO ER CALL RUP GOTO ER CHD MOVFW XORLW BTFSS GOTO CHS MOVFW XORLW BTFSS GOTO ER CALL RDW GOTO ER CHS MOVFW XORLW BTFSS GOTO ER MOVFW XORLW RSDATA2 "S" STATUS,Z RSDATA3 "T" RSDATA2 "U" STATUS,Z RSDATA3 "P" STATUS,Z

RSDATA2 "D" STATUS,Z RSDATA3 "W" STATUS,Z

BTFSS GOTO ER BSF ER CLRF CLRF CLRF CLRF GOTO

STATUS,Z STP

RSDATA1 RSDATA2 RSDATA3 RSDATA4 RESET_BYTE_COUNT RSDATA3 H'0F' RX_MESSAGE

TRA MOVFW ANDLW MOVWF

MOVFW RSDATA4 XORLW "?" BTFSS STATUS,Z GOTO RESET_BYTE_COUNT BTFSC MS_SP GOTO RESET_BYTE_COUNT BSF MS_SP MOVFW RSDATA2 MOVWF RX_SPEED MOVFW RSDATA3 ANDLW H'0F' CLRF RSDATA1 CLRF RSDATA2 CLRF RSDATA3 CLRF RSDATA4 GOTO RESET_BYTE_COUNT

TIME_DO

BCF PIR1,CCP1IF PROCESSING BCF TIMER_ON BTFSC TON GOTO ON_CYCLE BTFSC TOFF GOTO OFF_CYCLE GOTO DATA_RETURN ON_CYCLE

;GOTO TIMER1 INTERRUPT

BSF TOFF BCF TON BSF MT1 BSF MT2 BSF MT3 BSF MT4 MOVFW TLON MOVWF TL MOVWF TH CALL TIMER1_INITIALIZATION GOTO DATA_RETURN OFF_CYCLE BSF TON BCF TOFF BCF MT1 BCF MT2 BCF MT3 BCF MT4 MOVFW TLOFF MOVWF TL MOVFW THOFF MOVWF TH CALL TIMER1_INITIALIZATION GOTO DATA_RETURN

; ********************************************************* PROGRAM STARTS*************************************************** ********** INITIALIZE CALL CHECK_RAM1 CALL RS232_RECIEVE_INITIALIZATION CALL LCD_INITIALIZATION BSF TON MOVLW H'50' MOVWF TLON MOVWF TL MOVWF SPEED_DISP MOVLW H'00' MOVWF THON MOVWF TH MOVLW H'7F' MOVWF COUNTER26

MOVLW MOVWF MOVLW MOVWF CLRW READ

H'F0' TLOFF H'0F' THOFF ;SELECTING EEPROM 00 ADDRESS T0

CALL EEPROM_READ MOVFW READBACK MOVWF NUM CALL TIMER1_INITIALIZATION

START

BTFSC STP GOTO INITIALIZE BTFSC MS_SP CALL CONTROL CALL SWITCH CALL DISPLAY GOTO START

; ********************************************************* ********************************************************* *********************************************** ;SPEED CONTROL ROUTINE ; ********************************************************* ********************************************************* *********************************************** CONTROL MOVFW SPEED_DIS SUBWF RX_SPEED,W BTFSC STATUS,C GOTO OK_SPEED BSF UP_RES BSF OVERSP DECFSZ COUNTER25,F RETURN

OK_SPEED

DECFSZ RETURN MOVLW MOVWF CALL RDW RETURN

COUNTER26,F H'7F' COUNTER26

BCF UP_RES BCF OVERSP BCF MS_SP CLRF RX_SPEED RETURN ; ********************************************************* ********************************************************* *********************************************** ;SPEED AND MESSAGE DISPALY ROUTINE ; ********************************************************* ********************************************************* *********************************************** DISPLAY MOVFW RX_MESSAGEP XORWF RX_MESSAGE,W BTFSS STATUS,Z GOTO DIS_AS MOVFW XORWF BTFSC RETURN MOVFW MOVWF MOVLW positon SPEED_DIS SPEED_DISP,W STATUS,Z RX_MESSAGE RX_MESSAGEP H'01' ;cursor HOME POSTION

DIS_AS

MOVWF LCD_CMD CALL CMD_WRITE

positon

MOVLW

H'80'

;cursor

HOME POSTION

MOVWF LCD_CMD CALL CMD_WRITE MOVLW "S" MOVWF LCD_DATA CALL DATA_WRITE MOVLW "p" MOVWF LCD_DATA CALL DATA_WRITE MOVLW "e" MOVWF LCD_DATA CALL DATA_WRITE MOVLW "e" MOVWF LCD_DATA CALL DATA_WRITE MOVLW "d" MOVWF LCD_DATA CALL DATA_WRITE MOVLW "=" MOVWF LCD_DATA CALL DATA_WRITE MOVFW SPEED_DIS MOVWF L_BYTE CLRF M_BYTE CLRF H_BYTE CALL B2_BCD MOVFW XORLW BTFSC GOTO PO R1 H'00' STATUS,Z ;DISPLAY R AT 80

;DISPLAY R

AT 80

;DISPLAY R

AT 80

;DISPLAY R

AT 80

;DISPLAY R

AT 80

;DISPLAY R

AT 80

MOVFW R1 ANDLW H'0F' CALL ASCII MOVWF LCD_DATA

CALL DATA_WRITE PO SWAPF R2,W ANDLW H'0F' CALL ASCII MOVWF LCD_DATA CALL DATA_WRITE MOVFW R2 ANDLW H'0F' CALL ASCII MOVWF LCD_DATA CALL DATA_WRITE MOVLW "%" MOVWF LCD_DATA CALL DATA_WRITE MOVLW " " MOVWF LCD_DATA CALL DATA_WRITE MOVFW XORLW BTFSC GOTO FR1 RX_MESSAGE H'00' STATUS,Z

MOVLW "C" MOVWF LCD_DATA CALL DATA_WRITE MOVLW "a" MOVWF LCD_DATA CALL DATA_WRITE MOVLW "u" MOVWF LCD_DATA CALL DATA_WRITE MOVLW "t" MOVWF LCD_DATA CALL DATA_WRITE

MOVLW "." MOVWF LCD_DATA CALL DATA_WRITE FR1 positon MOVLW H'C0' ;cursor HOME POSTION CALL CMD_WRITE MOVLW "M" MOVWF LCD_DATA CALL DATA_WRITE MOVLW "P" MOVWF LCD_DATA CALL DATA_WRITE MOVLW "0" MOVWF LCD_DATA CALL DATA_WRITE MOVLW "4" MOVWF LCD_DATA CALL DATA_WRITE MOVLW "-" MOVWF LCD_DATA CALL DATA_WRITE MOVLW "N" MOVWF LCD_DATA CALL DATA_WRITE MOVLW "-" MOVWF LCD_DATA CALL DATA_WRITE ;DISPLAY R AT 80

;DISPLAY R

AT 80

;DISPLAY R

AT 80

;DISPLAY R

AT 80

;DISPLAY R

AT 80

;DISPLAY R

AT 80

;DISPLAY R

AT 80

MOVLW "9" MOVWF LCD_DATA CALL DATA_WRITE

;DISPLAY R

AT 80

MOVLW "6" MOVWF LCD_DATA CALL DATA_WRITE MOVLW "4" MOVWF LCD_DATA CALL DATA_WRITE MOVFW NUM MOVWF L_BYTE CLRF M_BYTE CLRF H_BYTE CALL B2_BCD MOVFW R2 ANDLW H'0F' CALL ASCII MOVWF LCD_DATA CALL DATA_WRITE

;DISPLAY R

AT 80

;DISPLAY R

AT 80

MOVLW " " MOVWF LCD_DATA CALL DATA_WRITE MOVLW " " MOVWF LCD_DATA CALL DATA_WRITE MOVFW XORLW BTFSS GOTO MS2 MOVLW MOVWF MOVLW MOVWF MOVLW MOVWF GOTO SHOW MS2 MOVFW RX_MESSAGE H'00' STATUS,Z " " FIRST_WORD " " SECOND_WORD " " THIRD_WORD RX_MESSAGE

XORLW BTFSS GOTO MS3 MOVLW MOVWF MOVLW MOVWF MOVLW MOVWF GOTO SHOW MS3 MOVFW XORLW BTFSS GOTO MS4 MOVLW MOVWF MOVLW MOVWF MOVLW MOVWF GOTO SHOW MOVFW XORLW BTFSS GOTO MS5 MOVLW MOVWF MOVLW MOVWF MOVLW MOVWF GOTO SHOW MOVFW XORLW BTFSS GOTO MS6 MOVLW MOVWF MOVLW MOVWF MOVLW

H'01' STATUS,Z "L" FIRST_WORD "T" SECOND_WORD "N" THIRD_WORD

RX_MESSAGE H'02' STATUS,Z "B" FIRST_WORD "R" SECOND_WORD "D" THIRD_WORD RX_MESSAGE H'03' STATUS,Z "W" FIRST_WORD "I" SECOND_WORD "P" THIRD_WORD RX_MESSAGE H'04' STATUS,Z "N" FIRST_WORD "H" SECOND_WORD "R"

MS4

MS5

MS6

MOVWF THIRD_WORD GOTO SHOW MOVFW XORLW BTFSS GOTO SHOW MOVLW MOVWF MOVLW MOVWF MOVLW MOVWF RX_MESSAGE H'05' STATUS,Z "R" FIRST_WORD "T" SECOND_WORD "N" THIRD_WORD

SHOW MOVFW FIRST_WORD MOVWF LCD_DATA CALL DATA_WRITE MOVFW SECOND_WORD MOVWF LCD_DATA CALL DATA_WRITE MOVFW THIRD_WORD MOVWF LCD_DATA CALL DATA_WRITE MOVFW MOVWF READ CLRW SPEED_DIS SPEED_DISP ;SELECTING EEPROM 00 ADDRESS T0

CALL EEPROM_READ MOVFW READBACK XORWF NUM,W BTFSC STATUS,Z RETURN MOVFW NUM BANK2 CLRF EE_ADD ADDRESS T0 WRITE RETURN

;SELECTING EEPROM 00

; ********************************************************* ********************************************************* *********************************************** ;SWITCH FETCHING AND DESION ROUTINE ; ********************************************************* ********************************************************* *********************************************** SWITCH BTFSS SPUP BCF SW BTFSS SPUP GOTO NEXT1 BTFSC SW GOTO NEXT1 BSF SW BTFSC UP_RES RETURN MOVLW ADDWF MOVFW SUBLW BTFSC GOTO OP MOVLW MOVWF MOVLW MOVWF MOVLW MOVWF MOVLW MOVWF MOVLW MOVWF RETURN H'02' SPEED_DIS,F SPEED_DIS H'64' STATUS,C H'64' SPEED_DIS H'F0' TLON H'0F' THON H'50' TLOFF H'00' THOFF

RUP

OP

MOVLW H'50' ADDWF TLON,F BTFSC STATUS,C INCF THON,F MOVLW H'50' SUBWF TLOFF,F BTFSS STATUS,C DECF THOFF,F RETURN

NEXT1

RDW

BTFSS SPDWN BCF SW1 BTFSS SPDWN GOTO NEXT2 BTFSC SW1 GOTO NEXT2 BSF SW1 MOVLW SUBWF BTFSC GOTO OP1 MOVLW MOVWF MOVLW MOVWF MOVLW MOVWF MOVLW MOVWF MOVLW MOVWF RETURN H'02' SPEED_DIS,F STATUS,C H'00' SPEED_DIS H'50' TLON H'00' THON H'F0' TLOFF H'0F' THOFF H'50' TLOFF,F STATUS,C

OP1

MOVLW ADDWF BTFSC

INCF THOFF,F MOVLW H'50' SUBWF TLON,F BTFSS STATUS,C DECF THON,F RETURN NEXT2 BTFSS NUMUP BCF SW2 BTFSS NUMUP GOTO NEXT3 BTFSC SW2 GOTO NEXT3 BSF SW2 MOVLW H'0A' MOVWF SPEED_DISP INCF NUM,F MOVFW NUM SUBLW H'09' BTFSC STATUS,C RETURN MOVLW H'09' MOVWF NUM RETURN BTFSS BCF BTFSS RETURN BTFSC RETURN BSF MOVLW MOVWF MOVLW SUBWF BTFSC RETURN MOVLW MOVWF RETURN NUMDWN SW3 NUMDWN SW3 SW3 H'0A' SPEED_DISP H'01' NUM,F STATUS,C H'00' NUM

NEXT3

; ********************************************************* ********************************************************* *********************************************** ;MAIN LCD DATA_READ ROUTINE ; ********************************************************* ********************************************************* *********************************************** ; TAKE THE ADDRESS IN LCD_CMD GIVE U A DATAA IN LCD_READBACK DATA_READ CALL CMD_WRITE CALL READY CALL READBACK_LCD

RETURN ; ********************************************************* ********************************************************* *********************************************** ;MAIN LCD CMD_WRITE SEND ROUTINE ; ********************************************************* ********************************************************* *********************************************** ; TAKE COMMAND IN LCD_CMD CMD_WRITE CALL READY CALL CMDWRT RETURN ; ********************************************************* ********************************************************* *********************************************** ;MAIN LCD DATA SEND ROUTINE ; ********************************************************* ********************************************************* ***********************************************

; TAKE COMMAND IN DATA_WRITE CALL READY CALL DATAWRT RETURN

LCD_DATA

;;******************************************************* ********************************************************* ************************************************* ;LCD DATA SEND ROUTINE ; ********************************************************* ********************************************************* *********************************************** DATAWRT BSF RS ;RS PULL TO HIGH BCF RW ;RW PULL TO HIGH BTFSC LCD_DATA,0 BSF REVDATA,7 BTFSS LCD_DATA,0 BCF REVDATA,7 BTFSC BSF BTFSS BCF BTFSC BSF BTFSS BCF BTFSC BSF BTFSS BCF BTFSC BSF BTFSS BCF LCD_DATA,1 REVDATA,6 LCD_DATA,1 REVDATA,6 LCD_DATA,2 REVDATA,5 LCD_DATA,2 REVDATA,5 LCD_DATA,3 REVDATA,4 LCD_DATA,3 REVDATA,4 LCD_DATA,4 REVDATA,3 LCD_DATA,4 REVDATA,3

BTFSC BSF BTFSS BCF BTFSC BSF BTFSS BCF BTFSC BSF BTFSS BCF MOVWF

LCD_DATA,5 REVDATA,2 LCD_DATA,5 REVDATA,2 LCD_DATA,6 REVDATA,1 LCD_DATA,6 REVDATA,1 LCD_DATA,7 REVDATA,0 LCD_DATA,7 REVDATA,0 PORTB

LCD PINS

;LCD DATA COMMAND TO

BSF EN ;EN THE TRANSFER NOP NOP BCF EN NOP NOP RETLW H'00' ;;******************************************************* ********************************************************* ************************************************* ;LCD COMMAND SEND ROUTINE ; ********************************************************* ********************************************************* *********************************************** CMDWRT BCF RS ;RS PULL TO LOW BCF RW ;RW PULL TO LOW BTFSC BSF BTFSS BCF BTFSC BSF LCD_CMD,0 REVDATA,7 LCD_CMD,0 REVDATA,7 LCD_CMD,1 REVDATA,6

BTFSS BCF BTFSC BSF BTFSS BCF BTFSC BSF BTFSS BCF BTFSC BSF BTFSS BCF BTFSC BSF BTFSS BCF BTFSC BSF BTFSS BCF BTFSC BSF BTFSS BCF MOVFW MOVWF LCD PINS

LCD_CMD,1 REVDATA,6 LCD_CMD,2 REVDATA,5 LCD_CMD,2 REVDATA,5 LCD_CMD,3 REVDATA,4 LCD_CMD,3 REVDATA,4 LCD_CMD,4 REVDATA,3 LCD_CMD,4 REVDATA,3 LCD_CMD,5 REVDATA,2 LCD_CMD,5 REVDATA,2 LCD_CMD,6 REVDATA,1 LCD_CMD,6 REVDATA,1 LCD_CMD,7 REVDATA,0 LCD_CMD,7 REVDATA,0 REVDATA PORTB ;LCD COMMAND TRANFER TO W ;LCD DATA COMMAND TO ;EN THE TRANSFER

BSF EN NOP NOP BCF EN NOP NOP RETLW H'00'

;;******************************************************* ********************************************************* ************************************************* ;DATAREAD FRM LCD ROUTINE ; ********************************************************* ********************************************************* *********************************************** READBACK_LCD BSF RS BSF RW BANK1 MOVLW H'FF' MOVWF TRISB ; MAKE ALL PINS INPUT TO RECIVE DATA BANK0 BSF EN NOP NOP BTFSC PORTB,0 BSF REVDATA,7 BTFSS PORTB,0 BCF REVDATA,7 BTFSC BSF BTFSS BCF BTFSC BSF BTFSS BCF BTFSC BSF BTFSS BCF BTFSC BSF BTFSS PORTB,1 REVDATA,6 PORTB,1 REVDATA,6 PORTB,2 REVDATA,5 PORTB,2 REVDATA,5 PORTB,3 REVDATA,4 PORTB,3 REVDATA,4 PORTB,4 REVDATA,3 PORTB,4

BCF BTFSC BSF BTFSS BCF BTFSC BSF BTFSS BCF BTFSC BSF BTFSS BCF

REVDATA,3 PORTB,5 REVDATA,2 PORTB,5 REVDATA,2 PORTB,6 REVDATA,1 PORTB,6 REVDATA,1 PORTB,7 REVDATA,0 PORTB,7 REVDATA,0

MOVFW REVDATA ;LCD COMMAND TRANFER TO W MOVWF LCD_READBACK BCF EN NOP NOP BANK1 CLRF TRISB ; MAKE ALL PINS OUTPUT BANK0 RETLW H'00' ;;******************************************************* ********************************************************* ************************************************* ;LCD BUSY CHECK ROUTINE ; ********************************************************* ********************************************************* *********************************************** READY BCF PORTB,0 BANK1 BSF TRISB,0 BANK0 BCF RS ;FOR READING LCD BSF RW ;FOR READING LCD

BCF EN NOP NOP BSF EN NOP NOP BTFSC PORTB,0 GOTO READY BANK1 BCF TRISB,0 BANK0 BCF RW RETURN ;;******************************************************* ********************************************************* ************************************************* ;BINARY TO BCD CONVERION ; ********************************************************* ********************************************************* *********************************************** B2_BCD BCF STATUS,0 ; clear the carry bit MOVLW .24 MOVWF COUNT CLRF R0 CLRF R1 CLRF R2 LOOP16 RLF L_BYTE, F RLF M_BYTE , F RLF H_BYTE , F RLF R2, F RLF R1, F RLF R0, F DECFSZ COUNT, F GOTO ADJDEC RETLW 0 ADJDEC MOVLW R2 MOVWF FSR CALL ADJBCD MOVLW R1 MOVWF FSR

CALL ADJBCD MOVLW R0 MOVWF FSR CALL ADJBCD GOTO LOOP16 ADJBCD MOVLW 3 ADDWF 0,W MOVWF TEMP BTFSC TEMP,3 ; test if result > 7 MOVWF 0 MOVLW 30 ADDWF 0,W MOVWF TEMP BTFSC TEMP,7 ; test if result > 7 MOVWF 0 ; save as MSD RETLW 0 ;;******************************************************* ********************************************************* ************************************************* ;EEPROM ROUTINES ; ********************************************************* ********************************************************* *********************************************** EEPROM_WRITE BANK2 MOVWF EEDATA MOVFW EE_ADD BANK3 BCF EECON1,EEPGD BSF EECON1,WREN BCF INTCON,GIE MOVLW H'55' MOVWF EECON2 MOVLW H'AA' MOVWF EECON2 BSF EECON1,WR BSF INTCON,GIE BANK0 CALL DELAY255 BANK3 BTFSC EECON1,WR GOTO $-1 BCF EECON1,WREN

BANK0 RETURN EEPROM_READ BANK2 MOVWF EEADR BANK3 BCF EECON1,EEPGD BSF EECON1,RD BANK2 MOVFW EEDATA BANK0 MOVWF READBACK RETURN ;;******************************************************* ********************************************************* ************************************************* ;LCD INTIALIZATION ; ********************************************************* ********************************************************* *********************************************** LCD_INITIALIZATION CALL PR_DELAY ;30 MSEC START DELAY FOR LCD TO RISE POWER CALL PR_DELAY ;30 MSEC START DELAY FOR LCD TO RISE POWER MOVLW H'3B' ;FUNCTION SET[0,0,0,1(FOR LCD REQ.),1(DL, DATA LENGTH 8),1(N SET 2 LINES),1(F -FONT 5X10 DOTS,X,X) CALL CMDWRT CALL DELAY255 MOVLW H'0C' ;LCD SETTING(0,0,0,0,1(ALWAYS),1(D,TO INCREMENT ADDRESS AUTO),1(C-ON THE CURSOR),1(BTO BLINK THE CURSOR)) MOVWF LCD_CMD CALL CMD_WRITE MOVLW H'01' ;LCD SETTING(0,0,0,0,1(ALWAYS),1(D,TO INCREMENT ADDRESS AUTO),1(C-ON THE CURSOR),1(BTO BLINK THE CURSOR)) MOVWF LCD_CMD

CALL CMD_WRITE MOVLW positon H'80' ;cursor HOME POSTION

MOVWF LCD_CMD CALL CMD_WRITE RETURN ;;******************************************************* ********************************************************* ************************************************* ;PORT INTIALIZATION ROUTINE ; ********************************************************* ********************************************************* *********************************************** PORT_INTITIALIZE BANK1 MOVLW B'11111000' MOVWF TRISA CLRF TRISB MOVLW B'10000001' ;C6 TX IS O/P AND ALL ARE INPUT MOVWF TRISC ;TRANSFER TO PORTC DIRECTION REGISTER MOVLW B'00000111' MOVWF ADCON1 BANK0 CLRF PORTA CLRF PORTB CLRF PORTC MOVLW B'11000000' ; TRANSFER THE DATA FOR ENABLEING GENERAL AND PERIPHERAL INTERPPT TO W MOVWF INTCON ; TRANSFER THE DATA FOR ENABLEING GENERAL AND PERIPHERAL INTERPPT TO INTERRUPT CONTROL REGISTER RETURN ;;******************************************************* ********************************************************* ************************************************* ;RS232 INTIALIZE ROUTINE ; *********************************************************

********************************************************* *********************************************** RS232_RECIEVE_INITIALIZATION CLRF STATUS MOVLW BAUD_CONSTANT BANK1 MOVWF SPBRG MOVLW B'10100000' MOVWF TXSTA BSF PIE1,RCIE MOVLW B'10010000' MOVWF RCSTA MOVLW H'01' MOVWF BYTE_COUNT MOVLW B'11000000' ; TRANSFER THE DATA FOR ENABLEING GENERAL AND PERIPHERAL INTERPPT TO W MOVWF INTCON ; TRANSFER THE DATA FOR ENABLEING GENERAL AND PERIPHERAL INTERPPT TO INTERRUPT CONTROL REGISTER RETURN ;;******************************************************* ********************************************************* ************************************************* ;PROGRAMABLE DELAY ROUTINE ; ********************************************************* ********************************************************* *********************************************** PR_DELAY MOVWF PRCOUNTER OO1 CALL DELAY255 DECFSZ PRCOUNTER,F GOTO OO1 RETURN ;;******************************************************* ********************************************************* ************************************************* ;255 CYCLE DELAY ROUTINE ; *********************************************************

********************************************************* *********************************************** DELAY255 DECFSZ COUNTER,F GOTO DELAY255 RETURN ;;******************************************************* ********************************************************* ************************************************* ;25 USEC TIMER INTILIZATION ROUTINE ; ********************************************************* ********************************************************* *********************************************** TIMER1_INITIALIZATION BTFSC TIMER_ON RETURN BSF TIMER_ON BANK1 BCF PIE1,CCP1IE ; ENABLE THE COMPARE MODE FOR TIMER1 BANK0 MOVFW TL MOVFW TH MOVWF CCPR1H BSF TIME_ER BANK1 BSF PIE1,CCP1IE ; ENABLE THE COMPARE MODE FOR TIMER1 BANK0 BCF TIME_ER MOVLW B'00000101' ; TRANSFER THE DATA FOR ENABLEING TIMER1 CONTROL TO W MOVWF T1CON ; TRANSFER THE DATA FOR ENABLEING TIMER1 CONTROL TO TIMER1 CONTROL REG MOVLW B'00001010' ; TRANSFER THE DATA FOR ENABLEING COMPARE MODE CONTROL TO W MOVWF CCP1CON ; TRANSFER THE DATA FOR ENABLEING COMPARE MODE CONTROL TO COMPARE MODE CONTROL REG CLRF TMR1L ; CLEAR LOW BYTE OF TIMER1 CLRF TMR1H ; CLEAR HIGH BYTE OF TIMER1 RETURN

;;******************************************************* ********************************************************* ************************************************* ;RAM CLEANING ROUNTINE ; ********************************************************* ********************************************************* *********************************************** CHECK_RAM1 MOVLW D'20' ;THIS IS FOR INITIAL POWER UP DELAY MOVWF COUNT_REG1 ;TRANSFER TO COUNT_REG1 REGISTER CHECK_RAM2 CALL CHECK_RAM ;CALL SUBROUTINE FOR CHECKING THE RAM CLRWDT ;CLEAR WATCHDOG TIMER DECFSZ COUNT_REG1,F ;DECREASE COUNT_REG1 AND AND CHECK IF ZERO THEN SKIP GOTO CHECK_RAM2 ;GOTO CHECK_RAM2 LABEL RETURN CHECK_RAM CLRF STATUS MOVLW H'50' REGISTER COUNT TO BE CLEARED MOVWF TMP_COUNT REGISTER MOVLW H'70' REGISTER MOVWF FSR REGISTER FOR INDIRECT ADDRESSING MOVLW H'FF' THE REGISTER UNDER CONSIDERATION STEP1 MOVWF INDF REGISTER DIRECTED REGISTER DECF FSR,F FOR NEXT REGISTER TO GO DECFSZ TMP_COUNT,F AND CHECH WHETHER ALL REGISTERED ;GOTO BANK0 ;THIS IS FOR RAM ;TRANSFER TO TMP_COUNT ;THIS IS START RAM ;TRANSFER TO FSR TO 1 ;MAKE ALL BITS OF

;TRANSFER TO FSR ;DECREASE FSR FOR ;DECREASE TMP_COUNT AS DESIRED MADE "FF"

GOTO STEPS UP

STEP1

;IF NOT GOTO 3 ;THIS IS FOR RAM ;TRANSFER TO TMP_COUNT ;THIS IS START RAM ;TRANSFER TO FSR ;FEED ALL BITS OF W ;XOR WITH THE ;SKIP IF ALL BITS IN W ;ELSE GOTO CHECK_RAM ;DECREASE FSR FOR ;DECREASE TMP_COUNT AS DESIRED MADE "00" ;IF NOT GOTO 5 ;RETURN FROM THE

MOVLW H'50' REGISTER COUNT TO BE CLEARED MOVWF TMP_COUNT REGISTER MOVLW H'70' REGISTER MOVWF FSR REGISTER FOR INDIRECT ADDRESSING STEP2 MOVLW H'FF' 1 XORWF INDF,F INDIRECTLY ADDRESSED REGISTER BTFSS STATUS,Z ARE ZERO GOTO CHECK_RAM LABEL DECF FSR,F FOR NEXT REGISTER TO GO DECFSZ TMP_COUNT,F AND CHECH WHETHER ALL REGISTERED GOTO STEP2 STEPS UP RETURN SUB ROUTINE END

15.
1) 2) 3) 4) 5) 6) 7) 8) 9) 10) 11) 12) 13)

PRECAUTIONS
Frist check all component as per the circuit. Check transistor. Pay proper attention to the polarity of capacitors and diodes while assembling. While mounting transistor be sure that you have connected collector, emitter and base properly. Clean PCB after soldering so those components do not short. Remember the anode and cathode of diode before fitting. Remember to check dry soldering and short circuit. IC should be mounted on IC base. Take care in wiring the circuit to avid loose connection. Check for print short after soldering. Please use resistance of the exact value as given in the circuit. Check primary and secondary winding of the transformer before connecting. The insulation of the wire inside the modes should be of good quality.

16.
BOOKS :
1. 2. 3. 4.

BIBLIOGRAPHY

Electronic devices and circuit theory Electronic projects. Microelectronic circuits Electronic for you.

WEBSITES : 1. 2. 3. 4. www.efy.com www.nationalsemiconductor.com www.icdiscription.com www.electrosofts.com

También podría gustarte