Latest Seminar Topics for Engineering CS|IT|ME|EE|EC|AE|CA



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 ALOK KUMAR SINGH (0126EC083D03)

AMIT SINGH CHAUHAN (0126EC083D04)

JITENDRA S. SISODIA (0126EC083D06)

ROUNAK DIWAKAR (0126EC083D07)

RUCHI MAHOR (0126EC083D09)

[pic]

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 Director

DEPTT OF ECE TCT, Bhopal 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. |Introduction |01 |

|2. |Block Daigram | |

| |2.1 Block diagram of working model transmitter |02 |

| |2.2 Block diagram of working model reiever |03 |

| |2.3 Block diagram of practical system implementation |04 |

|3. |Circuit Diagram | |

| |3.1 Circuit diagram of transmitter card |05 |

| |3.2 Circuit diagram of receiver card |06 |

|4. |Construction and working | |

| |4.1 Description of working model |07 |

| |4.2 Construction of working model |10 |

| |4.3 Operating principle and working of model transmiter |10 |

| |4.4 Parameters of transmission |11 |

| |4.5 Frame format of transmitting frame |12 |

| |4.6 Construction of working model receiver |13 |

| |4.7 Operating principle and working of working model receiver |14 |

| |4.8 Present design of practical vehicle system |15 |

| |4.9 Required design of practical vehicle system |17 |

| |4.10 Overall design of Practical system |18 |

|5. |Flow Chart | |

| |5.1 Flow Chart of transmitter |20 |

| |5.2 Flow chart of receiver |21 |

|6. |PCB Layout | |

| |6.1 PCB Layout of transmitter |22 |

| |6.2 PCB Layout of receiver |23 |

|7. |List of Components |24 |

|8. |Specifications of Components |27 |

| |8.1 Specification of resistor |31 |

| |8.2 Specification of switch |32 |

| |8.3 Specification of rectifiers |34 |

| |8.4 Specification of didoe |35 |

|9. |PCB Manufacturing Process |38 |

|10. |Advantages |42 |

|11. |Future Enhancement |45 |

|12. |Software Coding of Microcontroller |46 |

|13. |Precautions |130 |

|14. |Bibliography |131 |

|15. |Data Sheet | |

| |15.1 Data sheet of Microcontroller | |

| |15.2 Data sheet of LCD | |

| |15.3 Data sheet of RF module | |

| |15.4 Data Sheet of DC Motor | |

| |15.5 Data sheet of optocoupler | |

| |15.6 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.

[pic]

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. Block Diagram

2.1 Block Diagram of Working model transmitter

[pic]

2.2 Block Diagram of Working model Receiver

[pic]

2.2 Block Diagram of overall system design of practical system

[pic]

3.1 Circuit Diagram

3.1 Circuit Diagram of Transmitter Card

3.2 Circuit Diagram of Receiver Card

4. Construction And Working

4.1 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. Transmitter.

2. 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. Lcd. Display: - It has 16x2 LCD display to see the status of the transmitter.

2. 4x4 keyboard: - it has 16 switch key board to set the varios parameter. Such as:-

Switch1:- To set the speed limit of speed zone. When this switch is press Speed setting screen is shown. As follows Speed=10%.

Switch2:- To increase the speed limit, for e.g. If this press Speed=12%.

Switch3:- To decrease the speed limit, for e.g. If this press Speed=10%.

Switch4:- 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:- 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)

Switch8 :- 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:- by using this U are in transmiiter mode.

Switch11:- by using this U are in Remote mode.

Switch12:- by using this U are in save the state if power is off.

Switch13:- 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:- Only work in remote mode By using stop the car.

Switch16:- Exit without saving in any mode.

3).Rf module:- 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:-

• 12 v step down transformer (500m amp)

• Full wave rectifier.

• Filter.

• linear regulator.

a. 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 Construction of Working Model Receiver

1. 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.

• The control section driving section.

1. 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

[pic]

4.10 Required Design of Practical Vehicle System

[pic]

4.11 Overall Design of practical system

[pic]

5. Flow Chart

5.1 Flow Chart of Transmitter

[pic]

6. PCB Layout

6.1 PCB Layout of Transmitter Receiver

[pic]

[pic]

7. List of Components

Semiconductors :

• IC (7805 5V regulator) =1

• IC (PIC16f876amicrocontroller) =1

• D ( 1N4148 ) =4

• D (4007 rectifier diode) =4

• LED1 (3mm LED) =2

• IC Base (14 pin ) =2

Resistors (all ¼ watt +% carbon):

• R (1-kilo-ohm) = 1

• R (10-kilo-ohm) =5

• R (4.7- kilo-ohm) =1

• R (50 E ohm) =1

Capacitor :

• C (1000uf ,25V electrolytic) =1

• C2,C3,(100/25) =2

Miscellaneous :

• X( 230VAC primary to 12V/500mA ) =1

• S (Puch-to on switch) =17

• XTal (16 MHZ ) =1

• 16*2LCD =1

• Mains Cable =1

• Barg strip (16 pin ) =1

• Ferric Cloride -100gms.

• Soldering Wire - 20gms.

• Connecting wires - 2mtrs.

• Soldering Paste -10gms.

• PCB 4”x6” =1

• RF module (433 MHz)Tx =1

Receiver Components

Semiconductors :

IC (7805 5V regulator) =1

IC (78012 12V regulator) =1

IC (PIC16f876amicrocontroller) =1

D (4007 rectifier diode) =8

LED1 (3mm LED ) =7

Optocupler (pc817) =4

IC Base (14 pin ) 3

IC Base (16 pin ) 1

Resistors (all ¼ watt +% carbon):

R (1-kilo-ohm) = 7

R (10-kilo-ohm) =5

R (50 E ohm) =1

R (4.7-kilo-ohm) =4

Capacitor :

C (1000uf ,25V electrolytic) =1

C2,C3,(100/25) =2

C3 104 Ceramic =2

Miscellaneous :

X( 230VAC primary to 12V/1A ) =1

S (Push-to on switch) =5

XTal (16 MHZ ) =1

16*2LCD =1

Mains Cable =1

Barg strip (16 pin ) =1

DC motor = 2

Wire (5 m ) =1

Connector ( 2pin ) =4

Ferric Cloride -100gms.

Soldering Wire - 20gms.

Connecting wires - 2mtrs.

Soldering Paste -10gms.

PCB 4”x6” =1

RF module (433 MHz)reciver =1

8. Specification of Components

Resistors

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.

[pic]

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.

8.1 Resistor Colour Code Calculator

|The Resistor |

|Colour Code |

|Colour |Number |

|Black |0 |

|Brown |1 |

|Red |2 |

|Orange |3 |

|Yellow |4 |

|Green |5 |

|Blue |6 |

|Violet |7 |

|Grey |8 |

|White |9 |

The Resistor Colour Code Calculator can be used to identify resistors. 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 value or colour code required. Simple but effective!

There are two versions to download and print on A4 white card (two per sheet):

• 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. Half wave rectifier

2. Full wave rectifier

3. Full wave bridge rectifier

Half-wave rectifier circuit.

[pic]

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.

[pic]

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.

[pic]

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. [pic]

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.

[pic]

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).

[pic][pic]

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

BANK2 MACRO

BCF STATUS,RP0

BSF STATUS,RP1

ENDM

BANK3 MACRO

BSF STATUS,RP0

BSF STATUS,RP1

ENDM

include "P16F877.inc"

org 0

GOTO INITIALIZE

org 4

GOTO INTERRUPT

ASCII

ANDLW B'00001111'

ADDWF PCL,F

RETLW H'30';0

RETLW 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 SCREEN

CALL SWITCH

CALL TRANSFER_TRASM

CALL TRANSFER_REMOTE

GOTO 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 UP

GOTO AN1

MOVLW "U"

CALL TX_COM

MOVLW "P"

CALL TX_COM

GOTO NEX1

AN1

BTFSS DWN

GOTO AN2

MOVLW "D"

CALL TX_COM

MOVLW "W"

CALL TX_COM

GOTO NEX1

AN2

BTFSS STOP

GOTO EN1

MOVLW "S"

CALL TX_COM

MOVLW "T"

CALL TX_COM

GOTO NEX1

NEX1

MOVLW "?"

CALL TX_COM

MOVLW "}"

CALL TX_COM

MOVLW H'20'

CALL PR_DELAY

EN1

BCF UP

BCF DWN

BCF STOP

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 CL2

BSF SWT1,1

BTFSS CL2

BCF SWT1,1

BTFSC CL3

BSF SWT1,2

BTFSS CL3

BCF SWT1,2

BTFSC CL4

BSF SWT1,3

BTFSS CL4

BCF SWT1,3

BCF RL1

BSF RL2

BCF RL3

BCF RL4

CALL DELAY255

BTFSC CL1

BSF SWT1,4

BTFSS CL1

BCF SWT1,4

BTFSC CL2

BSF SWT1,5

BTFSS CL2

BCF SWT1,5

BTFSC CL3

BSF SWT1,6

BTFSS CL3

BCF SWT1,6

BTFSC CL4

BSF SWT1,7

BTFSS CL4

BCF SWT1,7

BCF RL1

BCF RL2

BSF RL3

BCF RL4

CALL DELAY255

BTFSC CL1

BSF SWT2,0

BTFSS CL1

BCF SWT2,0

BTFSC CL2

BSF SWT2,1

BTFSS CL2

BCF SWT2,1

BTFSC CL3

BSF SWT2,2

BTFSS CL3

BCF SWT2,2

BTFSC CL4

BSF SWT2,3

BTFSS CL4

BCF SWT2,3

BCF RL1

BCF RL2

BCF RL3

BSF RL4

CALL DELAY255

BTFSC CL1

BSF SWT2,4

BTFSS CL1

BCF SWT2,4

BTFSC CL2

BSF SWT2,5

BTFSS CL2

BCF SWT2,5

BTFSC CL3

BSF SWT2,6

BTFSS CL3

BCF SWT2,6

BTFSC CL4

BSF SWT2,7

BTFSS CL4

BCF 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 SWT1

XORWF SWT2,W

BTFSC STATUS,Z

RETURN

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 SWT2

XORLW 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 SWT1,1

BCF FSW2

BTFSS SWT1,1

GOTO N2

BTFSC FSW2

GOTO N2

BSF FSW2

BTFSS PR_SPEED

RETURN

MOVLW H'02'

ADDWF SPEED,F

MOVFW SPEED

SUBLW H'64'

GOTO DF1

MOVLW H'64'

MOVWF 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

DF2

CALL SPEED_DISPLAY

RETURN

N3

BTFSS SWT1,3

BCF FSW4

BTFSS SWT1,3

GOTO N4

BTFSC FSW4

GOTO N4

BSF FSW4

BTFSS PR_SPEED

RETURN

BCF PR_SPEED

BCF PR_MESSAGE

BCF PR_TRANS_REMO

BCF SCR

MOVLW H'01'

MOVWF LCD_CMD

CALL CMD_WRITE

CLRW ;SELECTING EEPROM 00 ADDRESS T0 READ

CALL EEPROM_READ

MOVFW READBACK

XORWF SPEED,W

BTFSC STATUS,Z

RETURN

MOVFW SPEED

BANK2

CLRF EE_ADD

CALL EEPROM_WRITE

RETURN

N4

BTFSS SWT1,4

BCF FSW5

BTFSS SWT1,4

GOTO N5

BTFSC FSW5

GOTO N5

BSF FSW5

BCF PR_SPEED

BSF PR_MESSAGE

BCF 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

MS

CALL MESSAGE_DISPLAY

RETURN

N6

BTFSS SWT1,6

BCF FSW7

BTFSS SWT1,6

GOTO N7

BTFSC FSW7

GOTO N7

BSF FSW7

BTFSS PR_MESSAGE

RETURN

DECFSZ MESS_COUNT,F

GOTO MS1

MOVLW H'05'

MOVWF MESS_COUNT

MS1

CALL MESSAGE_DISPLAY

RETURN

N7

BTFSS SWT1,7

BCF FSW8

BTFSS SWT1,7

GOTO N8

BTFSC FSW8

GOTO N8

BSF FSW8

BTFSS PR_MESSAGE

RETURN

BCF PR_SPEED

BCF PR_MESSAGE

BCF PR_TRANS_REMO

BCF 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

MOVLW H'01'

MOVWF EE_ADD

BANK0

MOVFW MESS_COUNT

CALL EEPROM_WRITE

RETURN

N8

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

N10

BTFSS SWT2,2

BCF FSW11

BTFSS SWT2,2

GOTO N11

BTFSC FSW11

GOTO N11

BSF FSW11

BCF TRANS

BSF REMOTE

CALL TRANS_REMOTE

RETURN

N11

BTFSS SWT2,3

BCF FSW12

BTFSS SWT2,3

GOTO N12

BTFSC FSW12

GOTO N12

BSF FSW12

BCF PR_SPEED

BCF PR_MESSAGE

BCF PR_TRANS_REMO

BCF 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

RETURN

N12

BTFSS SWT2,4

BCF FSW13

BTFSS SWT2,4

GOTO N13

BTFSC FSW13

GOTO N13

BSF FSW13

BSF UP

BCF DWN

BCF STOP

RETURN

N13

BTFSS SWT2,5

BCF FSW14

BTFSS SWT2,5

GOTO N14

BTFSC FSW14

GOTO N14

BSF FSW14

BCF UP

BSF DWN

BCF STOP

RETURN

N14

BTFSS SWT2,6

BCF FSW15

BTFSS SWT2,6

GOTO N15

BTFSC FSW15

GOTO N15

BSF FSW15

BCF UP

BCF DWN

BSF STOP

RETURN

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 PR_SPEED

MOVLW H'80' ;cursor HOME POSTION positon

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 R1

XORLW H'00'

BTFSC STATUS,Z

GOTO S0

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 "%" ;DISPLAY R AT 80

MOVWF LCD_DATA

CALL DATA_WRITE

RETURN

;***********************************************************************************************************

;TRANSMITER AND REMOTE SELECTION ROUTINE

;***********************************************************************************************************

TRANS_REMOTE

BTFSC PR_SPEED

RETURN

BTFSC PR_MESSAGE

RETURN

BTFSS PR_TRANS_REMO

RETURN

MOVLW H'80' ;cursor HOME POSTION positon

MOVWF LCD_CMD

CALL CMD_WRITE

MOVLW H'01'

MOVWF LCD_CMD

CALL CMD_WRITE

BTFSC REMOTE

GOTO RE1

BTFSC TRANS

GOTO TI1

RETURN

RE1

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 "d"

MOVWF 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 PR_SPEED

RETURN

BTFSS PR_MESSAGE

RETURN

MOVLW H'80' ;cursor HOME POSTION positon

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 MESS_COUNT

XORLW H'00'

BTFSS STATUS,Z

GOTO MS2

MOVLW " "

MOVWF FIRST_WORD

MOVLW " "

MOVWF SECOND_WORD

MOVLW " "

MOVWF THIRD_WORD

GOTO SHOW

MS2

MOVFW MESS_COUNT

XORLW H'01'

BTFSS STATUS,Z

GOTO MS3

MOVLW "L"

MOVWF FIRST_WORD

MOVLW "T"

MOVWF SECOND_WORD

MOVLW "N"

MOVWF THIRD_WORD

GOTO SHOW

MS3

MOVFW MESS_COUNT

XORLW H'02'

BTFSS STATUS,Z

GOTO MS4

MOVLW "B"

MOVWF FIRST_WORD

MOVLW "R"

MOVWF SECOND_WORD

MOVLW "D"

MOVWF THIRD_WORD

GOTO SHOW

MS4

MOVFW MESS_COUNT

XORLW H'03'

BTFSS STATUS,Z

GOTO MS5

MOVLW "W"

MOVWF FIRST_WORD

MOVLW "I"

MOVWF SECOND_WORD

MOVLW "P"

MOVWF THIRD_WORD

GOTO SHOW

MS5

MOVFW MESS_COUNT

XORLW H'04'

BTFSS STATUS,Z

GOTO MS6

MOVLW "N"

MOVWF FIRST_WORD

MOVLW "H"

MOVWF SECOND_WORD

MOVLW "R"

MOVWF THIRD_WORD

GOTO SHOW

MS6

MOVFW MESS_COUNT

XORLW H'05'

BTFSS STATUS,Z

GOTO SHOW

MOVLW "R"

MOVWF FIRST_WORD

MOVLW "T"

MOVWF SECOND_WORD

MOVLW "N"

MOVWF 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

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

MOVLW H'C3' ;cursor HOME POSTION positon

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 LCD_DATA,1

BSF REVDATA,6

BTFSS LCD_DATA,1

BCF REVDATA,6

BTFSC LCD_DATA,2

BSF REVDATA,5

BTFSS LCD_DATA,2

BCF REVDATA,5

BTFSC LCD_DATA,3

BSF REVDATA,4

BTFSS LCD_DATA,3

BCF REVDATA,4

BTFSC LCD_DATA,4

BSF REVDATA,3

BTFSS LCD_DATA,4

BCF REVDATA,3

BTFSC LCD_DATA,5

BSF REVDATA,2

BTFSS LCD_DATA,5

BCF REVDATA,2

BTFSC LCD_DATA,6

BSF REVDATA,1

BTFSS LCD_DATA,6

BCF REVDATA,1

BTFSC LCD_DATA,7

BSF REVDATA,0

BTFSS LCD_DATA,7

BCF REVDATA,0

MOVFW REVDATA ;LCD COMMAND TRANFER TO W

MOVWF PORTB ;LCD DATA COMMAND TO LCD PINS

BSF EN ;EN THE TRANSFER

NOP

NOP

BCF EN

NOP

NOP

RETLW H'00'

;***********************************LCD COMMAND SEND ROUTINE ROUTINE***************************************************************************

CMDWRT

BCF RS ;RS PULL TO LOW

BCF RW ;RW PULL TO LOW

BTFSC LCD_CMD,0

BSF REVDATA,7

BTFSS LCD_CMD,0

BCF REVDATA,7

BTFSC LCD_CMD,1

BSF REVDATA,6

BTFSS LCD_CMD,1

BCF REVDATA,6

BTFSC LCD_CMD,2

BSF REVDATA,5

BTFSS LCD_CMD,2

BCF REVDATA,5

BTFSC LCD_CMD,3

BSF REVDATA,4

BTFSS LCD_CMD,3

BCF REVDATA,4

BTFSC LCD_CMD,4

BSF REVDATA,3

BTFSS LCD_CMD,4

BCF REVDATA,3

BTFSC LCD_CMD,5

BSF REVDATA,2

BTFSS LCD_CMD,5

BCF REVDATA,2

BTFSC LCD_CMD,6

BSF REVDATA,1

BTFSS LCD_CMD,6

BCF REVDATA,1

BTFSC LCD_CMD,7

BSF REVDATA,0

BTFSS LCD_CMD,7

BCF REVDATA,0

MOVFW REVDATA ;LCD COMMAND TRANFER TO W

MOVWF PORTB ;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 PORTB,1

BSF REVDATA,6

BTFSS PORTB,1

BCF REVDATA,6

BTFSC PORTB,2

BSF REVDATA,5

BTFSS PORTB,2

BCF REVDATA,5

BTFSC PORTB,3

BSF REVDATA,4

BTFSS PORTB,3

BCF REVDATA,4

BTFSC PORTB,4

BSF REVDATA,3

BTFSS PORTB,4

BCF REVDATA,3

BTFSC PORTB,5

BSF REVDATA,2

BTFSS PORTB,5

BCF REVDATA,2

BTFSC PORTB,6

BSF REVDATA,1

BTFSS PORTB,6

BCF REVDATA,1

BTFSC PORTB,7

BSF REVDATA,0

BTFSS PORTB,7

BCF 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 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 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 TXREG

BANK1

BTFSS TXSTA,TRMT

GOTO $-1

BANK0

CALL DELAY255

RETURN

;**************************************************************************************************************************************************

; 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

MOVLW H'80' ;cursor HOME POSTION positon

MOVWF LCD_CMD

CALL CMD_WRITE

RETURN

;;*****************************************************************************************************************************************************************

;TIMER 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 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 ;GOTO BANK0

MOVLW H'50' ;THIS IS FOR RAM REGISTER COUNT TO BE CLEARED

MOVWF TMP_COUNT ;TRANSFER TO TMP_COUNT REGISTER

MOVLW H'70' ;THIS IS START RAM REGISTER

MOVWF FSR ;TRANSFER TO FSR REGISTER FOR INDIRECT ADDRESSING

MOVLW H'FF' ;MAKE ALL BITS OF THE REGISTER UNDER CONSIDERATION TO 1

STEP1

MOVWF INDF ;TRANSFER TO FSR REGISTER DIRECTED REGISTER

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 "FF"

GOTO STEP1 ;IF NOT GOTO 3 STEPS UP

MOVLW H'50' ;THIS IS FOR RAM REGISTER COUNT TO BE CLEARED

MOVWF TMP_COUNT ;TRANSFER TO TMP_COUNT REGISTER

MOVLW H'70' ;THIS IS START RAM REGISTER

MOVWF FSR ;TRANSFER TO FSR REGISTER FOR INDIRECT ADDRESSING

STEP2

MOVLW H'FF' ;FEED ALL BITS OF W 1

XORWF INDF,F ;XOR WITH THE INDIRECTLY ADDRESSED REGISTER

BTFSS STATUS,Z ;SKIP IF ALL BITS IN W ARE ZERO

GOTO CHECK_RAM ;ELSE GOTO CHECK_RAM LABEL

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 ;macro to select data RAM bank 0

BCF STATUS,RP0

BCF STATUS,RP1

ENDM

BANK1 MACRO ;macro to select data RAM bank 1

BSF STATUS,RP0

BCF STATUS,RP1

ENDM

BANK2 MACRO ;macro to select data RAM bank 2

BCF STATUS,RP0

BSF STATUS,RP1

ENDM

BANK3 MACRO ;macro to select data RAM bank 3

BSF STATUS,RP0

BSF STATUS,RP1

ENDM

include "P16F877.inc"

org 0

GOTO INITIALIZE

org 4

GOTO INTERRUPT

ASCII

ANDLW B'00001111'

ADDWF PCL,F

RETLW H'30';0

RETLW 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 ; 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, W ; TRANSFER DATA OF TEMPPCLATH TO W

MOVWF PCLATH ; TRANSFER DATA OF W TO PCLATH

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 RSDATA

MOVWF RSDATA1

GOTO INC_BYTE_COUNT

STORE_2B

MOVFW RSDATA

MOVWF RSDATA2

GOTO INC_BYTE_COUNT

STORE_3B

MOVFW RSDATA

MOVWF RSDATA3

GOTO INC_BYTE_COUNT

STORE_4B

MOVFW RSDATA

MOVWF RSDATA4

GOTO INC_BYTE_COUNT

STORE_5B

MOVFW RSDATA

XORLW "}"

BTFSC STATUS,Z

GOTO RS232RECIVE

GOTO RESET_BYTE_COUNT

RS232RECIVE

MOVFW RSDATA1

XORLW "R"

BTFSC STATUS,Z

GOTO REM

MOVFW RSDATA1

XORLW "T"

BTFSC STATUS,Z

GOTO TRA

REM

MOVFW RSDATA4

XORLW "?"

BTFSS STATUS,Z

GOTO RESET_BYTE_COUNT

MOVFW RSDATA2

XORLW "U"

BTFSS STATUS,Z

GOTO CHD

MOVFW RSDATA3

XORLW "P"

BTFSS STATUS,Z

GOTO ER

CALL RUP

GOTO ER

CHD

MOVFW RSDATA2

XORLW "D"

BTFSS STATUS,Z

GOTO CHS

MOVFW RSDATA3

XORLW "W"

BTFSS STATUS,Z

GOTO ER

CALL RDW

GOTO ER

CHS

MOVFW RSDATA2

XORLW "S"

BTFSS STATUS,Z

GOTO ER

MOVFW RSDATA3

XORLW "T"

BTFSS STATUS,Z

GOTO ER

BSF STP

ER

CLRF RSDATA1

CLRF RSDATA2

CLRF RSDATA3

CLRF RSDATA4

GOTO RESET_BYTE_COUNT

TRA

MOVFW RSDATA3

ANDLW H'0F'

MOVWF RX_MESSAGE

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 ;GOTO TIMER1 INTERRUPT PROCESSING

BCF TIMER_ON

BTFSC TON

GOTO ON_CYCLE

BTFSC TOFF

GOTO OFF_CYCLE

GOTO DATA_RETURN

ON_CYCLE

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 H'F0'

MOVWF TLOFF

MOVLW H'0F'

MOVWF THOFF

CLRW ;SELECTING EEPROM 00 ADDRESS T0 READ

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

DECFSZ COUNTER26,F

RETURN

MOVLW H'7F'

MOVWF COUNTER26

CALL RDW

RETURN

OK_SPEED

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 SPEED_DIS

XORWF SPEED_DISP,W

BTFSC STATUS,Z

RETURN

DIS_AS

MOVFW RX_MESSAGE

MOVWF RX_MESSAGEP

MOVLW H'01' ;cursor HOME POSTION positon

MOVWF LCD_CMD

CALL CMD_WRITE

MOVLW H'80' ;cursor HOME POSTION positon

MOVWF LCD_CMD

CALL CMD_WRITE

MOVLW "S" ;DISPLAY R AT 80

MOVWF LCD_DATA

CALL DATA_WRITE

MOVLW "p" ;DISPLAY R AT 80

MOVWF LCD_DATA

CALL DATA_WRITE

MOVLW "e" ;DISPLAY R AT 80

MOVWF LCD_DATA

CALL DATA_WRITE

MOVLW "e" ;DISPLAY R AT 80

MOVWF LCD_DATA

CALL DATA_WRITE

MOVLW "d" ;DISPLAY R AT 80

MOVWF LCD_DATA

CALL DATA_WRITE

MOVLW "=" ;DISPLAY R AT 80

MOVWF LCD_DATA

CALL DATA_WRITE

MOVFW SPEED_DIS

MOVWF L_BYTE

CLRF M_BYTE

CLRF H_BYTE

CALL B2_BCD

MOVFW R1

XORLW H'00'

BTFSC STATUS,Z

GOTO PO

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 RX_MESSAGE

XORLW H'00'

BTFSC STATUS,Z

GOTO FR1

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

MOVLW H'C0' ;cursor HOME POSTION positon

CALL CMD_WRITE

MOVLW "M" ;DISPLAY R AT 80

MOVWF LCD_DATA

CALL DATA_WRITE

MOVLW "P" ;DISPLAY R AT 80

MOVWF LCD_DATA

CALL DATA_WRITE

MOVLW "0" ;DISPLAY R AT 80

MOVWF LCD_DATA

CALL DATA_WRITE

MOVLW "4" ;DISPLAY R AT 80

MOVWF LCD_DATA

CALL DATA_WRITE

MOVLW "-" ;DISPLAY R AT 80

MOVWF LCD_DATA

CALL DATA_WRITE

MOVLW "N" ;DISPLAY R AT 80

MOVWF LCD_DATA

CALL DATA_WRITE

MOVLW "-" ;DISPLAY R AT 80

MOVWF LCD_DATA

CALL DATA_WRITE

MOVLW "9" ;DISPLAY R AT 80

MOVWF LCD_DATA

CALL DATA_WRITE

MOVLW "6" ;DISPLAY R AT 80

MOVWF LCD_DATA

CALL DATA_WRITE

MOVLW "4" ;DISPLAY R AT 80

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

MOVLW " "

MOVWF LCD_DATA

CALL DATA_WRITE

MOVLW " "

MOVWF LCD_DATA

CALL DATA_WRITE

MOVFW RX_MESSAGE

XORLW H'00'

BTFSS STATUS,Z

GOTO MS2

MOVLW " "

MOVWF FIRST_WORD

MOVLW " "

MOVWF SECOND_WORD

MOVLW " "

MOVWF THIRD_WORD

GOTO SHOW

MS2

MOVFW RX_MESSAGE

XORLW H'01'

BTFSS STATUS,Z

GOTO MS3

MOVLW "L"

MOVWF FIRST_WORD

MOVLW "T"

MOVWF SECOND_WORD

MOVLW "N"

MOVWF THIRD_WORD

GOTO SHOW

MS3

MOVFW RX_MESSAGE

XORLW H'02'

BTFSS STATUS,Z

GOTO MS4

MOVLW "B"

MOVWF FIRST_WORD

MOVLW "R"

MOVWF SECOND_WORD

MOVLW "D"

MOVWF THIRD_WORD

GOTO SHOW

MS4

MOVFW RX_MESSAGE

XORLW H'03'

BTFSS STATUS,Z

GOTO MS5

MOVLW "W"

MOVWF FIRST_WORD

MOVLW "I"

MOVWF SECOND_WORD

MOVLW "P"

MOVWF THIRD_WORD

GOTO SHOW

MS5

MOVFW RX_MESSAGE

XORLW H'04'

BTFSS STATUS,Z

GOTO MS6

MOVLW "N"

MOVWF FIRST_WORD

MOVLW "H"

MOVWF SECOND_WORD

MOVLW "R"

MOVWF THIRD_WORD

GOTO SHOW

MS6

MOVFW RX_MESSAGE

XORLW H'05'

BTFSS STATUS,Z

GOTO SHOW

MOVLW "R"

MOVWF FIRST_WORD

MOVLW "T"

MOVWF SECOND_WORD

MOVLW "N"

MOVWF 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 SPEED_DIS

MOVWF SPEED_DISP

CLRW ;SELECTING EEPROM 00 ADDRESS T0 READ

CALL EEPROM_READ

MOVFW READBACK

XORWF NUM,W

BTFSC STATUS,Z

RETURN

MOVFW NUM

BANK2

CLRF EE_ADD ;SELECTING EEPROM 00 ADDRESS T0 WRITE

RETURN

;*****************************************************************************************************************************************************************

;SWITCH FETCHING AND DESION ROUTINE

;*****************************************************************************************************************************************************************

SWITCH

BTFSS SPUP

BCF SW

BTFSS SPUP

GOTO NEXT1

BTFSC SW

GOTO NEXT1

BSF SW

BTFSC UP_RES

RETURN

RUP

MOVLW H'02'

ADDWF SPEED_DIS,F

MOVFW SPEED_DIS

SUBLW H'64'

BTFSC STATUS,C

GOTO OP

MOVLW H'64'

MOVWF SPEED_DIS

MOVLW H'F0'

MOVWF TLON

MOVLW H'0F'

MOVWF THON

MOVLW H'50'

MOVWF TLOFF

MOVLW H'00'

MOVWF THOFF

RETURN

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

BTFSS SPDWN

BCF SW1

BTFSS SPDWN

GOTO NEXT2

BTFSC SW1

GOTO NEXT2

BSF SW1

RDW

MOVLW H'02'

SUBWF SPEED_DIS,F

BTFSC STATUS,C

GOTO OP1

MOVLW H'00'

MOVWF SPEED_DIS

MOVLW H'50'

MOVWF TLON

MOVLW H'00'

MOVWF THON

MOVLW H'F0'

MOVWF TLOFF

MOVLW H'0F'

MOVWF THOFF

RETURN

OP1

MOVLW H'50'

ADDWF TLOFF,F

BTFSC STATUS,C

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

NEXT3

BTFSS NUMDWN

BCF SW3

BTFSS NUMDWN

RETURN

BTFSC SW3

RETURN

BSF SW3

MOVLW H'0A'

MOVWF SPEED_DISP

MOVLW H'01'

SUBWF NUM,F

BTFSC STATUS,C

RETURN

MOVLW H'00'

MOVWF NUM

RETURN

;*****************************************************************************************************************************************************************

;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 LCD_DATA

DATA_WRITE

CALL READY

CALL DATAWRT

RETURN

;;*****************************************************************************************************************************************************************

;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 LCD_DATA,1

BSF REVDATA,6

BTFSS LCD_DATA,1

BCF REVDATA,6

BTFSC LCD_DATA,2

BSF REVDATA,5

BTFSS LCD_DATA,2

BCF REVDATA,5

BTFSC LCD_DATA,3

BSF REVDATA,4

BTFSS LCD_DATA,3

BCF REVDATA,4

BTFSC LCD_DATA,4

BSF REVDATA,3

BTFSS LCD_DATA,4

BCF REVDATA,3

BTFSC LCD_DATA,5

BSF REVDATA,2

BTFSS LCD_DATA,5

BCF REVDATA,2

BTFSC LCD_DATA,6

BSF REVDATA,1

BTFSS LCD_DATA,6

BCF REVDATA,1

BTFSC LCD_DATA,7

BSF REVDATA,0

BTFSS LCD_DATA,7

BCF REVDATA,0

MOVWF PORTB ;LCD DATA COMMAND TO LCD PINS

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 LCD_CMD,0

BSF REVDATA,7

BTFSS LCD_CMD,0

BCF REVDATA,7

BTFSC LCD_CMD,1

BSF REVDATA,6

BTFSS LCD_CMD,1

BCF REVDATA,6

BTFSC LCD_CMD,2

BSF REVDATA,5

BTFSS LCD_CMD,2

BCF REVDATA,5

BTFSC LCD_CMD,3

BSF REVDATA,4

BTFSS LCD_CMD,3

BCF REVDATA,4

BTFSC LCD_CMD,4

BSF REVDATA,3

BTFSS LCD_CMD,4

BCF REVDATA,3

BTFSC LCD_CMD,5

BSF REVDATA,2

BTFSS LCD_CMD,5

BCF REVDATA,2

BTFSC LCD_CMD,6

BSF REVDATA,1

BTFSS LCD_CMD,6

BCF REVDATA,1

BTFSC LCD_CMD,7

BSF REVDATA,0

BTFSS LCD_CMD,7

BCF REVDATA,0

MOVFW REVDATA ;LCD COMMAND TRANFER TO W

MOVWF PORTB ;LCD DATA COMMAND TO LCD PINS

BSF EN ;EN THE TRANSFER

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 PORTB,1

BSF REVDATA,6

BTFSS PORTB,1

BCF REVDATA,6

BTFSC PORTB,2

BSF REVDATA,5

BTFSS PORTB,2

BCF REVDATA,5

BTFSC PORTB,3

BSF REVDATA,4

BTFSS PORTB,3

BCF REVDATA,4

BTFSC PORTB,4

BSF REVDATA,3

BTFSS PORTB,4

BCF REVDATA,3

BTFSC PORTB,5

BSF REVDATA,2

BTFSS PORTB,5

BCF REVDATA,2

BTFSC PORTB,6

BSF REVDATA,1

BTFSS PORTB,6

BCF REVDATA,1

BTFSC PORTB,7

BSF REVDATA,0

BTFSS PORTB,7

BCF 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 H'80' ;cursor HOME POSTION positon

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 ;GOTO BANK0

MOVLW H'50' ;THIS IS FOR RAM REGISTER COUNT TO BE CLEARED

MOVWF TMP_COUNT ;TRANSFER TO TMP_COUNT REGISTER

MOVLW H'70' ;THIS IS START RAM REGISTER

MOVWF FSR ;TRANSFER TO FSR REGISTER FOR INDIRECT ADDRESSING

MOVLW H'FF' ;MAKE ALL BITS OF THE REGISTER UNDER CONSIDERATION TO 1

STEP1

MOVWF INDF ;TRANSFER TO FSR REGISTER DIRECTED REGISTER

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 "FF"

GOTO STEP1 ;IF NOT GOTO 3 STEPS UP

MOVLW H'50' ;THIS IS FOR RAM REGISTER COUNT TO BE CLEARED

MOVWF TMP_COUNT ;TRANSFER TO TMP_COUNT REGISTER

MOVLW H'70' ;THIS IS START RAM REGISTER

MOVWF FSR ;TRANSFER TO FSR REGISTER FOR INDIRECT ADDRESSING

STEP2

MOVLW H'FF' ;FEED ALL BITS OF W 1

XORWF INDF,F ;XOR WITH THE INDIRECTLY ADDRESSED REGISTER

BTFSS STATUS,Z ;SKIP IF ALL BITS IN W ARE ZERO

GOTO CHECK_RAM ;ELSE GOTO CHECK_RAM LABEL

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

15. Precautions

1) Frist check all component as per the circuit.

2) Check transistor.

3) Pay proper attention to the polarity of capacitors and diodes while assembling.

4) While mounting transistor be sure that you have connected collector, emitter and base properly.

5) Clean PCB after soldering so those components do not short.

6) Remember the anode and cathode of diode before fitting.

7) Remember to check dry soldering and short circuit.

8) IC should be mounted on IC base.

9) Take care in wiring the circuit to avid loose connection.

10) Check for print short after soldering.

11) Please use resistance of the exact value as given in the circuit.

12) Check primary and secondary winding of the transformer before connecting.

13) The insulation of the wire inside the modes should be of good quality.

16. bibliography

Books :

1. Electronic devices and circuit theory

2. Electronic projects.

3. Microelectronic circuits

4. Electronic for you.

Websites :

1.

2.

3.

4.

................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download