Sie sind auf Seite 1von 65

TABLE OF CONTENTS

S.NO 1. 2. 3.
4.

TITLE ABSTRACT INTRODUCTION

PAGE NO

SYSTEM REQUIREMENT SPECIFICATION SOFTWARE SPECIFICATION HARDWARE SPECIFICATION TESTING FUTURE ENHANCEMENT CONCLUSION

5.
6.

7.
8.

Abstract
The main objective of our project TWO AXIS ROBO WITH AI deals with the positioning of the camera in azimuth and zenith position. It also handles the fire detection technique where the fire is detected using flame detector. We have also incorporated a technique for unauthorized entry using sensors.

The whole project is accomplished using C language.

Introduction
The need for high accuracy in the field of Satellite communication has led us to design this two-axis robot for positioning an antenna. The aim of our project is to position the antenna for multisatellite reception. This model makes use of stepper motors in bringing about the axes movements. Before the advent of our system such positioning had been done manually which resulted in increased inaccuracy and low signal to noise ratio. For multi-satellite reception earlier multiple antennas were used which resulted in higher costs. All the above mentioned disadvantages can be overcome by using the prototype we have designed. By the use of two axes we can position the antenna for any combination of azimuth and elevation. Thus by using just one antenna, multiple satellite reception is achieved. By increasing the cogs in the wheels of the stepper motors we can increase the accuracy and hence the signal to noise ratio. By little imagination we can use the prototype for multiple purposes. Following are a few. 1) Radar positioning in military application. 2) With the help of our system the life of the geosynchronous satellites can be increased. 3) Between two unconnected conveyor belts. 4) Camera positioning 5) Fire Detection

AUTOMATION: Automation is a technology concerned with the application of mechanical, electronic and computer based systems to operate and control. This technology includes Automatic positioning. Automatic material handling. Computer systems for data collection and decision Feedback control and computer process control.

making. Our project is limited to the field of automatic positioning. The type of automation used in the project is programmable automation. In this type of automation a program in C language controls the operation so that the system can read and interpret them. New programs can be prepared and entered for different application. REASONS FOR AUTOMATION: Increase in accuracy and precision. Decrease in cost. Decrease in labour force. Increase in safety. The purpose of automation is accomplished by using a robot and sensors. ROBOT: Robot is a reprogrammable, multifunctional manipulator designed to move parts or special devices through various programmed motions for the performance of various tasks. This is the

reason for pseudo naming our project as TWO AXIS ROBO WITH AI. The task accomplished here is the movement of dish antenna in two axes for signal reception. Our robot uses a rotational joint, which is a requirement of a robot, and this provides the movement in both azimuth and elevation. These are the two degrees of freedom associated with our robot. The sensors that are used in our robot are discussed later.

FIRE DETECTION:
In general fire in sub-station is subsequently low compared with other areas. But in some abnormal conditions fire may happen which must be detected and prevented. We use RS232 for our application. This helps in auto-flame detection. Here we use powerful and sensitive LDR (Light Dependent Resistor) for the flame detection. UNAUTHORIZED ENTRY : It is quite natural that a third person may enter into a sub-station which may create hazardous problem for his life and also to the system In such a case a sensor is required to find out a case and to inform the computer for further action. We use infra-red emitter and detector to overcome the problem. The description of the sensors will be studied later.

System Requirement Specification


Hardware Specification: Motor Type Magnetism Volt Current Torque Protection Software Specification: System Platform Software : : : Pentium Intel C : : : : : : Bi-Polar Stepper Motor Permanent Magnet Type 24V 0.6Amps 7Kg Opto Isolator

Software Specification
ABOUT C:
C is a general purpose structured programming language that is powerful, efficient and compact. C combines the features of the high level language with the elements of the assembler and is, thus close to both man and machine. IMPORTANCE OF C: The increasing popularity of C is probably due to its many desirable qualities. It is a robust language whose rich set of built-in functions and operators can be used to write any complex program. The C compiler combines the capabilities of an assembly language with the features of a high level language and therefore it is well suited for writing both system software and business package. Programs written in C are efficient and fast. This is due to its variety of data types and powerful operators. It is many times faster than BASIC. There are only 32 keywords and its strength lies in its built-in functions. Several standard functions are available which can be used for developing programs. C is highly portable. This means that C programs written for one computer can be run on another with little or no modification. Portability is important if we plan to use a new computer with a different operating system. C language is well suited for structured programming, thus requiring the user to think of a problem in terms of function modules

or blocks. A proper collection of these modules would make a complete program. This modular structure makes program debugging testing and maintenance easier. Another important feature of C is its ability to extend itself. A C program is basically a collection of functions that are supported by the C library. We can continuously add our own functions to the C library. With the availability of a larger number of functions, the programming task becomes simple. C supports a constructed data type known as structure which is a method for packing data of different types .A structure is a convenient tool for handling a group of logically related items. Unions are concepts borrowed from structures and therefore follow the same syntax as structures. Another important feature of C language are pointers. There are number of reasons for using pointers. A pointer enables us to access a variable that is defined outside the function. They are more efficient in handling the data tables It reduces the length and complexity of a program. It increases the execution speed. There is a necessity for storing the data and reading whenever necessary, without destroying the data. This method employs the concept of files to store the data. A file is a place on the disk where a group of related data is stored. C preprocessor Provides several tools that are unavailable in other languages. The programmer can use these tools to make his program easy to read, easy to modify, portable and more efficient.

Preprocessor is a program that processes the source code before it passes through the compiler.

Specification

Hardware

DETAILED DESIGN
STEPPER DRIVER LOGIC The stepper driver logic consists of buffer, opto-coupler, predriver and driver. Buffer Buffer interfaces 8255 with high-level circuits (such as MOS.) for driving high current loads. Opto-coupler: It consists of opto-emitter and phototransistor. The opto-emitter emits infra red radiation which in turn drives the phototransistor. Pre-Driver: We cannot directly couple the TIP122 (NPN) to the optocoupler since it requires large current for driving. We use the driver SL100 to boost the current level. Driver: The main principle of the driver is to amplify the current. It amplifies the 50mA current to 2A, which is needed to drive the motor. Control logic: It consists of an SL100 and relays. Whenever we need to rotate

the stepper motor we input high level through PA7 of PPI to SL100 70msec before. So SL100 produce logic low. Now the coil is energized and the 24v is connected to the coil of the driver by the relay. Buffer: It is the first stage of stepper driver logic unit. Its input is obtained from the output of PPI .Since the output current of PPI is very low we are using the buffer LS7406 (Hex inverter buffer) as a buffer .It is a driver with open collector high voltage output . So it is used for interfacing with high level circuits (such as MOS.), or for driving high current loads(such as lamps or relays), and are also characterized for use as inverter buffers for driving TTL inputs. LS7406 have minimum breakdown voltages of 30v, and maximum sink current of 40mA.The main advantages of this IC are 1.Converts TTL voltage level to MOS. level, 2. High sink current capability, 3. Input clamping diodes simplify system design, 4. Open collector driver for indicator lamps and relays, 5. Inputs fully compatible with most TTL circuits. The sink current required for our driver unit is I sink = V/R = 5000mV/180ohms = 27mA. Since our IC has maximum sink current of 40mA it is very much suitable for this driver unit. Opto coupler:It consists of Opto-emitter &Phototransistor. An opto coupler is essential to prevent the computer from hazardous conditions like voltage transients, back emf, and high voltage spikes.

We use dc Stepper motors for our robotic applications. Normally when we pass dc current to a coil it will get Electro -magnetized. When we with draw the dc source it wont get demagnetize. If it is not demagnetized, back EMF is produced which can create kick back current to subsequent devices or associated circuits. To avoid the above problems we require a device, which can isolate electrically & couples by other means. Opto-emitters anode is connected to 5v supply (Logic1). The cathode is connected to the buffers output. When logic 1 is given to the input of LS7406 we get logic 0 as the output. Sink current of optoemitter is lower than that of LS7406. Now this opto-emitter emits IR rays. This drives the phototransistor whose collector is forced to 24v. When IR rays are emitted from the opto-emitter the phototransistor conducts. The collector to emitter resistance becomes low,so the 24v will appear at emitter. It is given as input for the pre driver (CL100). We have used CNY 17-2 opto-coupler. It consists of Gallium Arsenide IR emitting diode optically coupled to a monolithic silicon photo transistor detector. Advantages are 1) Closely matched current transfer ratio (CTR) that has less conversion losses. 2) Guaranteed 70 volts V (Br.)CEO minimum. Application: Feed back control circuits. General purpose switching circuits. Interfacing and coupling systems of different potentials and references.

PULL DOWN RESISTOR: 10kohms resistor is used. It is used to verify the input of predriver stage which is low. When the IR detector is not conducting, the collector to emitter is high. Now the input at pre driver (SL 100 may be high or low. But it should be low. To make it sure we are using pull down resistor. PRE DRIVER: CL 100 power transistor is used here. It is used to boost the current. It is an NPN transistor when 24V is given from the opto coupler as an input to the base. It starts conducting and the O/P is low & 24V is grounded. DRIVER TIP 122 power transistor is used here. 24V supply is given to it through 470ohms resistor to its base. The logic 0 output from CL 100 is given to the base of TIP122. It is a NPN transistor so output is low. Package Lead information Vcb max Vce max Veb max Ic max Hfe Hfe Bias TOP66 L32 100V 100V 5V 5A 1KMN 3 amps When the TIP 122 transistor have high input signal its base, collector to emitter resistance is relatively low. So it produces a low output signal. When the output signal is low the coil is energized.

Now the motor can move forward or reverse as per the pattern given in the software routine. An reverse biased diode is connected in parallel with the coil. When the coil is demagnetizing it produces high back EMF which can destroy TIP122 which is in the cut-off state. This can be avoided by this diode. MANUFACTURING OF PCBs: The manufacturing process consist of two methods: Print and etch method and print plate etch method. PCB DESIGN AND FABRICATION: PCBS form the core of electronic equipment both domestic and industrial. Manufacturing of PCBs involve the following steps : a) Print and etch b) Print, plate and etch. The single sided PCBs usually uses the PRINT AND ETCH method. The double sided plated through hole boards are made by the PRINT PLATE AND ETCH method. The production of multilayer boards use both the methods. The general steps involved are 1) Panelisation 2) Drilling 3) Plating 4) Etching 5) Solder mask 6) Hot air levelling.

DESIGN AND FABRICATION OF PCBS: Printed circuit boards or PCBS form the core of electronic equipment, domestic and industrial. Some of the areas where PCBs are intensely used are computers, process control, telecommunication and instrumentation. Single sided PCBs are usually made using the print and etch method. The double sided plated through hole( PTH ) boards are made by the print plate etch method. The production of ti-layer boards uses both the methods. The inner layers are printed and etched while the outer layers are produced by print plate and etch method after pressing the inner layers. PANELLIZATION: This schematic or the artwork of the circuits applied by the customers is transformed to working positive/negative films. The circuit is repeated conveniently to accommodate economically as many circuits as possible in a panel, which can be operated in every sequence of subsequent steps in the PCB s process. This is called penalization. DRILLING: PCB drilling is the state of the art operation. Very small holes are drilled with high speed CNC drilling machines giving a well finished or epoxy required for void free through hole plating. PLATING: The heart of the PCB manufacturing prices lies in the electrodless through hole platting process. The holes drilled in the

board are treated both mechanically and chemically before depositing the copper by the electrodless copper plating process. ETCHING: Once a multi-layer board is drilled and electrodless copper deposited the image available in the form of a film is transferred on to the outside by photo printing process. The boards are then electrolytically plated on to the circuit pattern with copper and tin. The tin plated deposits serves as an etch resist when copper in the unwanted area is removed by conveyorised spray etching machine with chemical etchants. The etching machines are attached to an automated closing equipment which analyses and controls etchant concentrations. SOLDER MASK: Since a PCBs design may call for very call for very close spacing conductors, a solder mask has to be applied on both sides of the circuitry to avoid bridging of conductors. The solder mask ink is applied by screening, the ink is dried, exposed to UV, developed in a mild alkaline solution and finally cured by both UV and thermal energy. HOT AIR LEVELLING: After applying the solder mask the circuits pads are soldered using the hot air leveling process. While removing the board from the solder bath, hot air is blown on both the sides of the board through air knives in the machines, leaving the board soldered and leveled. This is one of the common finishes given to the boards. Thus the doublesided

plate through hole printed circuit board is manufactured and is now ready for the components to be soldered

COMPONENTS THAT ARE SOLDERED IN THE PCB POWER SUPPLY UNIT: All the electronic circuits such as transistors, integrated circuits generally require DC electric power for their operations. This means that before most electronic devices can be operated AC must be converted into DC power. This process is normally called rectification. AC current defers from DC current in the direction of electron flow. In AC current electrons flow first in one direction for a short time then in reverse direction and again in opposite direction for a short time. The flow of electrons in one direction and then in another direction is called a cycle of AC. The major blocks of the power supply unit that we use are 1) Step down transformer 2) Rectifier Diodes 3) Filters 4) Voltage Regulator. STEP DOWN TRANSFORMER: The instrument transformer for power supply in this project is to convert 230 V AC to the required low level of 12 VAC. This transformer apart from stepping down AC voltage gives isolation between power source and power supply circuitry.

RECTIFIER UNIT: In a power supply unit, rectification is normally achieved by a solid state diode. A diode contains two electrodes called the anode and the cathode. A diode has the property that will let electron flow easily in one direction but not in other direction. As a result when AC is applied to a diode, electrons only flow when the anode is positive and the cathode is negative. Reversing the polarity the voltage applied to a diode will not permit electron flow. The various methods of rectifying AC to DC are half wave, Full wave and Bridge rectification. Full wave bridge rectifier is employed in our project. A bridge structure of 4 diodes is commonly used in power supply units to achieve full wave rectification. When AC voltage is applied to the primary winding of the power transformer it is stepped down to 12 volts Ac across the secondary winding of the transformer. Normally one alternation of the input voltage will cause the top of the transformer to be positive and the bottom negative. The next alternation will reverse the polarities. For positive cycles two diodes at the top gets voltage and only one diode conducts for that cycle due to forward bias. At the same time one out of the other two idodes conduct for the negative voltage been applied from the bottom winding due to the forward bias of the diode. During positive half cycle diodes D1, D3 conduct to give 10.8 V pulsating DC of frequency 100 MHz. In the next aternation the other two dioes conduct as they are forward biased in this circuit. We note that the current through the load always flows in one direction only. This means that the AC is rectified to DC. The DC output has a ripple frequency of 100 Hz. Since each alternation produces a resulting output pulse.The ripple frequency is twice the value of the

alternating frequency that is 2*50 Hz= 100 Hz. The output is a pulsating DC which is not a pure DC.

FILTER UNIT: After a pulsating Dc has been produced by a rectifier it must be filtered in order for it to be used in a power supply. Filtering is changing the ripple frequency of a rectifier output into a constant DC voltage value. This is called smoothing out the ripples of the pulsating DC voltage. Filtering is achieved by connecting capacitors C1 and C2 of value 1000 microfarad, which bypasses the Ac component and allows only DC to pass through. VOLTAGE REGULATORS: The voltage regulators play an important role in any power supply unit. The primary purpose of the regulator is to aid the rectifier and filter in providing a more constant DC voltage to the device. Power supplies without a voltage regulator have an inherent problem of changing Dc voltage values due to variations in the load or fluctuations in the AC line voltage. With the regulator connected in the DC output the voltage can be maintained within a rather close tolerance of its desired output. OPTO COUPLER: It has a LED driving a phototransistor. This is a much more sensitive opto-coupler than the LED photo diode. The idea is that any change in Vs produces changes in LED current, which changes the

current through the transistor. In turn, this produces a changing voltage across the collector-emitter terminals. Therefore a signal voltage is coupled from the input circuit to the output circuit. The big advantage of an opto-coupler is the electrical isolation between the input and output circuits. Stated another way the common for the input circuit is different from the common for the output circuit. Because of this, no conductive path exist between the two circuits. This means that you can ground one of the circuits and float the other. For instance the input circuit can be grounded to the chassis of the equipment while the common of the output side is ungrounded. It consist of opto-emitter and photo transistor. An opto-coupler is essential to prevent the computer from hazardous conditions like voltage transients, back EMF and high voltage spikes. We use DC stepper motors for our robotic applications. Normally when we pass Dc current to a coil it will get electro magnetized. When we withdraw the DC source it wont get demagnetized. If it is not demagnetized back emf is produced which can create kick back current to the subsequent devices or associated circuitries. To avoid the above problems we require a device that can isolate electrically and couples by other means. Opto-emitters anode is connected to 5 V supply ( logic 1). Its cathode is connected to the buffer output. When logic 1 is given to the input of LS7406 we get logic 0 as the output. Sync current of the opto-emitter is lower than that of LS7406. Now this opto-emitter emits IR rays. This drives the phototransistor whose collector is forced to 24 V. When IR rays are emitted from the opto-emitter the phototransistor conducts. The collector to emitter resistance becomes low. So the 24 V will appear at

the emitter. It is given as input for the pre-driver (CL 100). We have used CNY 17-2 opto-coupler. It consists of GaAs IR emitting diode optically coupled to a monolithic silicon phototransistor detector. Advantages are Closely maintained current transfer ratio (CTR) that is less conversion losses. We use DC stepper motors for our robotic applications. Normally when we pass Dc current to a coil it will get electro magnetized. When we withdraw the DC source it wont get demagnetized. If it is not demagnetized back emf is produced which can create kick back current to the subsequent devices or associated circuitries. To avoid the above problems we require a device that can isolate electrically and couples by other means. Opto-emitters anode is connected to 5 V supply ( logic 1). Its cathode is connected to the buffer output. When logic 1 is given to the input of LS7406 we get logic 0 as the output. Sync current of the opto-emitter is lower than that of LS7406. Now this opto-emitter emits IR rays. This drives the phototransistor whose collector is forced to 24 V. When IR rays are emitted from the opto-emitter the phototransistor conducts. The collector to emitter resistance becomes low. So the 24 V will appear at the emitter. It is given as input for the pre-driver (CL 100). We have used CNY 17-2 opto-coupler. It consists of GaAs IR emitting diode optically coupled to a monolithic silicon phototransistor detector.

SENSORS IN ROBOTICS:
The sensors that are used in robotics can be classified into two categories. Those that are internal to the robot and external to the robot. Sensors are used for controlling position, velocity, speed etc.

They are also used to determine whether a part has been positioned properly or to indicate unnecessary interruptions. The sensors used in the project are flame sensors and unauthorized entry sensor.

FLAME SENSORS: In general fire in sub-station is subsequently low compared with other areas. But in some abnormal conditions fire may happen which must be detected and prevented. We use RS232 for our application. This helps in auto-flame detection. Here we use powerful and sensitive LDR (Light Dependent Resistor) for the flame detection. In our case we have to sense only blue and yellow flame and reject sunlight and other luminaries. We have provided necessary circuit to reject ambient and luminaries lighting and sensors only desired flame coloring. We use simple and effective potential divider to find out the flame. UNAUTHORIZED ENTRY SENSOR: It is quite natural that a third person may enter into a sub-station which may create hazardous problem for his life and also to the system In such a case a sensor is required to find out a case and to inform the computer for further action. We use infra-red emitter and detector to overcome the problem. IR rays has the highest wave length and is also invisible and harmless. IR rays can be generated by applying electric current to GaAs semiconductor material. Here we are using a current limiting resistor to safe guard IR emitter as well as to produce enough rays density which is necessary to drive IR

detector. We have used 1K resistor from 5V DC to the IR emitter to restrict current flow beyond 5 mA. Even though IR emitter can withstand up to 35mA We have used 5mA due to shorter distance. If the distance is more we have to increase the current flow to the emitter FIXED VOLTAGE SERIES REGULATOR:

78XX series are three terminal positive fixed voltage regulators. There are 7 output voltage options available such as 5,6,8,12,15,18 and 24 V. In 78XX the last 2 numbers indicate the output voltage and thus 7805 represents 5 V regulator. These regulators are available in two types of packages

1) metal package 2) plastic package

We have used 7805 plastic package IC regulator. Characteristics of 7805 voltage regulator V0: the regulator output voltage is fixed at a value as specified by the manufacturer 78XX series has output voltage at 5,6,8,etc. Our output is 5V. Vin : The unregulated input voltage must be at least 2 V more that the regulated voltage.

I0 max: The load current may vary from 0 to rated max output current. The IC is usually provided with the heat sink, otherwise it may not provide the rated maximum output current. Thermal Shutdown: The IC has a temperature sensor (Built In) which Turns of the IC when it become too hot (usually 125 deg- 150 deg).Line / Input regulation: It is defined as the percentage change in theOutput voltage for a change in the input voltage. Typical value of lineregulation of 7805 is 3 mV. Load regulation: It is defined as the change in the output voltage for achange in load current and is also expressed in mV. Typical value ofload regulation for 7805 is 15mV for 5 mA < I0< 1.5 A. Ripple Rejection: The IC regulator not only keeps the output voltage constant but also reduces the amount of ripple voltage. It is usually expressed in dB. Typical value for 7805 is 78 dB. SCHMITT TRIGGER: The fig a shows an inverting comparator with positive feedback. This circuit converts an irregular shaped waveform to a square wave or a pulse. This circuit is known as the Schmitt trigger or squaring circuit. The input voltage Vin triggers (changes the state of) the output Vo every time it exceeds certain voltage levels called the upper threshold voltage Vut and lower threshold voltage Vlt as shown in figure b. In fig a these threshold voltages are obtained by using the voltage divider R1-R2, where the voltage across R1 is fed back to the ( + ) input. The voltage across R1 is a variable reference threshold voltage that depends on the value and the polarity of the output

voltage Vo. When Vo = +Vsat, the voltage across R1 is called the upper threshold voltage, Vut. The input voltage Vin must be slightly more positive than Vut in order to cause the output Vo to switch from +Vsat. To Vsat. . As long as Vin <Vut, Vo is at +Vsat. Using the voltage divider rule R1 Vut = ____________ ( +Vsat ) R1 + R2 On the other hand, when Vo = -Vsat, the voltage across R1 is referred to as lower threshold voltage Vlt. Vin must be slightly more negative than Vlt in order to cause Vo to switch from _V sat to + Vsat.In other words, for Vin values > Vlt , Vo is at Vsat. Vlt is given by the following equation. R1 Vlt = ____________ ( - Vsat ) R1 + R2 Thus if threshold voltages Vut and Vlt are made larger than input noise voltages, the positive feedback will eliminate the false output transitions. Also the positive feedback because of its regenerative action will make Vo switch faster between +Vsat and Vsat. This is how a square wave is generated for the clock switch faster between +Vsat and Vsat. This is how a square wave is generated for the clock. BRIDGE RECTIFIER: Bridge rectifier is the most popular way to rectify because it features the full peak voltage of a half wave rectifier and the higher average value of a full wave rectifier. Fig a shows a bridge rectifier. During the positive half cycle of secondary voltage diodes D2 and D3

are forward biased; therefore the load voltage has the polarity that is on the left and + on the right. During the negative half cycle the diodes D1 and D4 are forward biased. On either half cycle the load voltage has the same polarity because the load current is in the same direction no matter which diodes are conducting. That is why the load voltage is the full wave rectified signal. OPERATION: STEPPER DRIVER LOGIC: The stepper driver logic consist of buffer, opto-coupler, pre driver and driver. Buffer: Buffer interfaces the 8255 with high level circuits and also for driving high current nodes. Opto- couplers: It consists of IR emitter and phototransistor. IR emitter emits infrared radiation, which in turn drives the phototransistor. Pre-driver: We cannot directly couple the TIP 122 (NPN) to the optocoupler since it requires large current for driving the stepper motor. We use the driver CL100 to boost the current level. Driver: The main principle of the driver is to amplify the current. It amplifies 50-mA current to 2 amps, which is needed to drive the motor. Control Logic: It consists of a CL 100 and relays. Whenever we need to rotate the stepper motor we input high through PA7 of the PPI to CL100 70-m sec before. So CL 100 produces logic low. Now the coil is energized and the 24 V is connected to the coil of the driver by the relay.

Buffer: it is the first stage of stepper driver logic. Its input is obtained from the output of the PPI. As the output current of the PPI is very low we are using the driver logic. LS7406 (HEX inverter buffer) is used as the buffer. It is a driver with open collector high voltage output. These are therefore used for interfacing ANTENNA PLACEMENT: An indoor antenna, which is to be positioned according to the co-ordinates fed into the computer, is connected by a lead screw to the stepper motor 2. The azimuth positioning is achieved by rotating the phylum disc with the help of stepper motor 1. The stepper motor 2 positions the antenna according to the elevation co-ordinates. The total rotation angle in the azimuthally plane is 360 degrees and in the plane of elevation, it is 0-90 and 90-0 degrees. This power source is 100% Isolated from analog areas of our project like Temp, Resp, Drop detector, Empty detector. Computer ground also isolated from this circuit. This power source does not have any TTL (or) CMOS ICs. Infusion driver module is designed to avoid back emfs from stepper motor coils. The ultimate o/p comes from PPI, is given to a buffer and to a opto coupler for 100% isolation. Opto coupler acts as a isolation device, which couples optically and provides 100%electrical isolation. Port A is used to drive the stepper motor through proper device circuitaries. The final output of the interface card will produce logical low and high, whose amplitude is approximately 20V.

20V power source generated for stepper operation is given to all the common (collectors) pins of opto coupler when ever opto coupler conducts, a logical high will be an output, otherwise a default low will be the output, because a 10Kohm pull down resister is employed to default zero volt. Pull Down Resistor: 20V dc given to the optp coupler, will be the input of our device card. A 10 K ohm resistor is used to discharge path of the opto coupler as well as for default zero. Current flowing through the opto coupler can be calculated approximately I=V/R V=20V, R=10Kohm, I=20/10=2ma Maximum 2 ma current passed through the opto coupler. According to the transducer concept, loading spoils transfer characters of transducers. We consume 2ma is negligible. To avoid loading effect and prevents failure of transducer any course of time. But 2ma wont be enough to drive stepper driver transistor TIP122. it requires minimum base current of 10ma. Essentially we require a pre driver transistor, which can accept 2ma as a input and amplifies upto certain level. We have used SL100 a medium power transistor, which can accept less than a milliamps and amplifies to 100ma. According to our calculations input bias base current is 2ma, max loading collector current is 2ma transistor SL100 is a NPN medium power type of transistor. Metal can packed transistor will with stand huge current. We call the above circuit as pre driver, which meets impedance matching between opto coupler and power driver.

Power driver we have used TIP122 high current SIP package. The max operatable volatage is 70v and current of 5amps. Pre driver drives the driver with a bias current of 20ma and the o/p current is determined by the stepper motor coil. Logical low will be the output of the tinal transistor because emitter is connected to the ground. An emulator LED is used to indicate the switching action. A current limiting resistor of 2.2Kohm is used to limit the current within 10amps. A pre wheeling diode IN407 is used to avoid minimum back emf. Other end of the stepper motor coil is forced to pass through a potential free relay. Which is driven by medium power transistor SL100. the transistor is driven from Pa7 of the 8255. Control Logic: Stepper motor consumes more current while stationary, because 2 of the coils are always energized and does not move. To avoid loading of power supply when motor operations are not required, we can switch it off using relay. Can be switched on as and when required by forcing a logical high from PA7 to the control transistor. When we send high from PA7 makes the transistor to conduct, thereby a low passed to relay and high is already forced. Now the relay can switch and provide 20v to the motor common pins. The relay common is connected to 20v and NO is connected to the stepper coils. If we require the motor operation must energize the relay first and the pulses of the stepper motor should be given next. The pulses given without control logic invalid, because positive will not be there.

An emulator LED is given for relay on identification. A pre wheeling IN4007 is used to avoid back emf , which may be generated by the relay coil. Power Source Stepper Motor: A step down transformer rating of 230v/15v and current of 1.5a is used to generate dc voltage for motor requirements. The total power requirement of the motor can be calculated by viewing the voltage and current datas of the motor. Motor voltage = 12v Current = 0.5amps Power = 12* 0.5 = 6 watts. Power supply designed by us is 15 x 1.5 = 22.5 watts. So the power source is well designed and there is no chance heating or failure. For full wave bridge rectification medium power diodes In5408 is used for 5amp application. The rectified output is given to a capacitor filter to remove 100Hz. The output voltage of a full wave bridge rectifier , according to the formula, VDC = (VAC-1.4) x root 2 VAC = 15 VDC = (15-1.4) x root2 = 13.6 x 1.414 = 19.23ma. The load resistor 1Kohm is used to consume 19.23ma in the power source to maintain regulation of output. This voltage positive is directly connected to the driver circuits, through relay it is connected to motors. Note:

This power source is 100% isolated from analog areas of our project and computer. This power source does not have any CMOS and TTL circuit which may be affected by back emf.

Testing is done to check the absolute and proper functioning of the system. Testing is vital to the success of the system. A small error can conceivably explode into a much larger problem.

System Testing
Testing is the process of executing a program with intends of finding an error. A good test case is one that has high probability of finding a yet undiscovered error. A successful test is one that uncovers a yet undiscovered error. Different levels of testing are done for the correctness of the system.

UNIT TESTING:

In this testing each module is individually tested and integrates the overall system. Unit testing focuses verification efforts and smallest unit of software design in the module. The modules of the system are tested separately. This testing is carried out during programming stage itself.

INTEGRATION TESTING:
Here the integration between the modules is tested. For this purpose, test cases are developed for each condition or combinations of inputs.By examining the results, it can be determined whether the program performs according to its specified requirement.

VALIDATION TESTING:
Validation testing may be defined in many ways, but a simple definition is that validation succeeds when the software functions in manner that can be responsibly expected by the user.

USER ACCEPTANCE TESTING:


The system under consideration is tested for user acceptance by constantly keeping in touch with prospective system user at the time of developing and making changes whenever required.

Future Enhancement
Radar positioning in military application: By using the model that we have designed we can locks on to any missile that is approaching a target. First we detect the missile using any radar that is a available and then position our counter missile in the constantly changing azimuth and elevation which is entered by a PC which

is connected to the radar that is detecting the incoming missile. Now the knowledge of the elevation and the azimuth helps us to lock on to the target and then by firing the missile we can destroy the incoming missile. For Extending The Useful Life Of A GEO Synchronous Satellite: Our prototype is a simple tracking system which makes it possible to use a geo-stationary communication satellite even when its orbital inclination builds up. As a geo-stationary satellite appears to remain always in the same position from the ground, a simple stationary satellite dish pointing directly at the satellite is used to communicate with it. The propellant in the thrusters is used to correct the satellites orientation always and so this often determines its life. When the fuel runs low, using the satellite thrusters to correct only its east west position can conserve the remaining propellant. By not correcting the satellites orbital plane, a maneuver which consumes more fuel than the east west correction fuel can be saved. But consequently the satellites orbital inclination builds up. So the satellite will now appear to be moving in a figure of 8 instead of being stationary. A stationary dish cannot be used now to have continuous contact with the satellite. This is where our prototype comes into use. If one knows the parameters of the satellites orbit its exact position can be calculated. This position is entered through a PC and a software turns a modified satellite dish to the required azimuth and elevation. Thus establishing contact always. ISRO is presently using this facility to control the INSAT-2A satellite. Movement Of Goods Between Two Conveyor Belts: In industries, manufacturing units etc, in which there is no continuity between the conveyor belts our prototype with the modification of the dish replaced by an arm, can be used to make the necessary transfer of goods. For

a set of conveyor belts we use only one set of azimuth and elevation coordinates. If the goods are placed on the conveyor belt at regular intervals judged by the time required for the arm to make the placement on the second conveyor regular transfer can be achieved. Again the operation is quite simple. We provide the two co-ordinates of the conveyor belt from which the goods have to be transferred. At this time the arm picks up the material from the first conveyor. Now we enter the co-ordinates of the second conveyor belt onto which the material has to be placed. This enables the arm to make the placement. Thus continuous transfer of goods between two distant conveyors are achieved. Camera Positioning: In this application we make the modification of replacing the dish by a camera. In a shopping mall where the presence of employees is not possible at all locations at all instances we use a camera in the place of the dish. A central controller can input any value of co-ordinates to view the shop and see if all operations are going on properly. By doing so he positions the camera to the desired values of azimuth and elevation in other words to any part of the shopping mall. And thus by employing fewer employees we can perform the same work that would have required larger number of people.

Software description
Software module is divided into two : 1. ASM coding 2. High level Language Coding ASM Coding: list p=16f877 ; list directive to define processor #include <p16f877.inc> ; processor specific variable definitions Rrdy_Flag Sync_Flag Count Temp EQU 0x20 EQU 0X21 EQU 0X22 EQU 0X23

H_Byte EQU 0X24 L_Byte EQU 0X25 R0 EQU 0X26 ; RAM Assignments R1 EQU 0X27 R2 EQU 0X28 H_Temp L_Temp EQU 0X29 EQU 0X2A ; temporary register ; temporary register

Byte0 Byte1 Byte2 Byte3 Rbuf0 Rbuf1 Rbuf2 Rbuf3 Rbuf4 Rbuf5 Rbuf6 Rbuf7 Rbuf8 Rbuf9

EQU EQU EQU EQU EQU EQU EQU EQU EQU EQU EQU EQU EQU EQU

0X2b 0X2c 0X2d 0X2e 0X30 0X31 0X32 0X33 0X34 0X35 0X36 0X37 0X38 0X39 ;0X21 TO 0X28

;************************************************************ ; Reset and Interrupt Vectors org 00000h goto Start ; Reset Vector

org 00004h ; Interrupt vector ;************************************************************ ; Interrupt Service Routine IntVector ; save context (WREG and STATUS registers) if needed. banksel PIR1 btfss PIR1,RCIF ; Did USART cause interrupt? goto ISREnd bcf PIR1,RCIF

movlw 06h ; Mask out unwanted bits andwf RCSTA,W ; Check for errors btfss STATUS,Z ; Was either error status bit set? goto RcvError ; Found error, flag it

Receive_Int btfss Sync_Flag,0 goto Syn_Rx movlw ']' Subwf RCREG,W btfss STATUS,Z goto Rxchar bsf Rrdy_Flag,0 bcf Sync_Flag,0 goto ISREnd Rxchar btfss RCREG,6 goto Numerals movlw 0X0F andwf RCREG,W addlw 0X09 Rxpro movwf INDF incf FSR,F goto ISREnd Numerals movlw 0X0F andwf RCREG,W goto Rxpro Syn_Rx movlw '[' subwf RCREG,W btfss STATUS,Z goto ISREnd bsf Sync_Flag,0 movlw 0X30 ;START ADDRESS OF RXBUF movwf FSR goto ISREnd return RcvError ; go to end of ISR, restore context,

bcf bsf

RCSTA,CREN RCSTA,CREN

; Clear receiver status

ISREnd ; Restore context if needed. retfie ;************************************************************ ; Program begins here org 00200h ; Beginning of program EPROM Start banksel TRISA movlw movwf movlw movwf movlw movwf 0xff TRISA 0xff TRISB 0xbf TRISC

movlw 0xff clrf TRISD movlw banksel movwf 0x40 ; 9600 baud @4MHz SPBRG SPBRG ; Enable transmit ; Select high baud rate

banksel TXSTA bsf TXSTA,TXEN bsf TXSTA,BRGH banksel RCSTA bsf RCSTA,SPEN bsf RCSTA,CREN

; Enable Serial Port ; Enable continuous reception

banksel PIR1 bcf PIR1,RCIF ; Clear RCIF Interrupt Flag

banksel PIE1 bsf PIE1,RCIE ; Set RCIE Interrupt Enable banksel movlw movwf banksel movlw movwf ADCON0 0x81 ADCON0 ADCON1 0x80 ADCON1 ; Enable peripheral interrupts ; Enable global interrupts

banksel INTCON bsf INTCON,PEIE bsf INTCON,GIE bcf bcf STATUS,RP0 STATUS,RP1

movlw 0x20 movwf FSR clrf INDF ClearNext incf FSR,F clrf INDF movf FSR,W xorlw 0x39 btfss STATUS,Z goto ClearNext ;************************************************************ ; Main loop call Send_Mess

Wait btfss Rrdy_Flag,0 ;s goto Wait clrf Rrdy_Flag

movf Rbuf0,W xorlw 0X01 ; btfss STATUS,Z ; s goto ChkNext1 swapf Rbuf1,F movf Rbuf2,W iorwf Rbuf1,W andlw 0x10 iorlw 0xef bsf STATUS,RP0 movwf TRISA PORT A bcf STATUS,RP0 ;

; ;SET DATA DIRECTION FOR ;

swapf Rbuf3,F ; movf Rbuf4,W ; iorwf Rbuf3,W ;WREG = RXBUF3 || RXBUF4 bsf STATUS,RP0 ; movwf TRISB ;SET DATA DIRECTION FOR PORT B bcf STATUS,RP0 ; swapf Rbuf5,F ; movf Rbuf6,W ; iorwf Rbuf5,W ;WREG = RXBUF5 || RXBUF6 andlw 0XBF ;(BCF WREG,6) CONFIGURE RXD LINE AS INPUT iorlw 0X80 ;(BSF WREG,7) CONFIGURE TXD LINE AS OUTPUT bsf STATUS,RP0 ; movwf TRISC ;SET DATA DIRECTION FOR PORT C bcf STATUS,RP0 ; swapf Rbuf7,F ; movf Rbuf8,W ; iorwf Rbuf7,W ;WREG = RXBUF7 || RXBUF8 bsf STATUS,RP0 ;

movwf TRISD PORT A bcf STATUS,RP0 goto Wait ChkNext1 movf Rbuf0,W xorlw 0X02 ; btfss STATUS,Z ; s goto ChkNext2 Wt0 btfss PIR1,TXIF ;s goto Wt0 movlw '{' movwf TXREG call call Delay Delay ;

;SET DATA DIRECTION FOR ;SELECT BANK 0

Wt1 btfss PIR1,TXIF ;s goto Wt1 swapf PORTA,W andlw 0x0f bsf PCLATH,1 bsf PCLATH,2 call HexTable bcf PCLATH,1 bcf PCLATH,2 movwf TXREG call call Delay Delay

Wt2 btfss PIR1,TXIF;s goto Wt2

movf PORTA,W andlw 0x0f bsf PCLATH,1 bsf PCLATH,2 call HexTable bcf PCLATH,1 bcf PCLATH,2 movwf TXREG call call Delay Delay

Wt3 btfss PIR1,TXIF ;s goto Wt3 swapf PORTB,W andlw 0x0f bsf PCLATH,1 bsf PCLATH,2 call HexTable bcf PCLATH,1 bcf PCLATH,2 movwf TXREG call call Delay Delay

Wt4 btfss PIR1,TXIF;s goto Wt4 movf PORTB,W andlw 0x0f bsf PCLATH,1 bsf PCLATH,2 call HexTable bcf PCLATH,1 bcf PCLATH,2 movwf TXREG

call call

Delay Delay

Wt5 btfss PIR1,TXIF ;s goto Wt5 swapf PORTC,W andlw 0x0f bsf PCLATH,1 bsf PCLATH,2 call HexTable bcf PCLATH,1 bcf PCLATH,2 movwf TXREG call call Delay Delay

Wt6 btfss PIR1,TXIF;s goto Wt6 movf PORTC,W andlw 0x0f bsf PCLATH,1 bsf PCLATH,2 call HexTable bcf PCLATH,1 bcf PCLATH,2 movwf TXREG call call Delay Delay

Wt7 btfss PIR1,TXIF ;s goto Wt7 swapf PORTD,W

andlw 0x0f bsf PCLATH,1 bsf PCLATH,2 call HexTable bcf PCLATH,1 bcf PCLATH,2 movwf TXREG call call Delay Delay

Wt8 btfss PIR1,TXIF;s goto Wt8 movf PORTD,W andlw 0x0f bsf PCLATH,1 bsf PCLATH,2 call HexTable bcf PCLATH,1 bcf PCLATH,2 movwf TXREG call call Delay Delay

Wt9 btfss PIR1,TXIF goto Wt9 movlw '}' movwf TXREG call call Delay Delay

goto Wait ChkNext2

movf Rbuf0,W xorlw 0X03 ; btfss STATUS,Z ; s goto ChkNext3 swapf Rbuf1,F movf Rbuf2,W iorwf Rbuf1,W movwf PORTA ;

swapf Rbuf3,F ; movf Rbuf4,W ; iorwf Rbuf3,W ;WREG = RXBUF3 || RXBUF4 movwf PORTB swapf Rbuf5,F ; movf Rbuf6,W ; iorwf Rbuf5,W ;WREG = RXBUF5 || RXBUF6 movwf PORTC swapf Rbuf7,F ; movf Rbuf8,W ; iorwf Rbuf7,W ;WREG = RXBUF7 || RXBUF8 movwf PORTD goto Wait ChkNext3 movf Rbuf0,W xorlw 0X04 ; btfss STATUS,Z ; s goto Wait rlf rlf rlf Rbuf1,F Rbuf1,F Rbuf1,F ;

movf Rbuf1,W andlw B'00111000' iorlw 0x81

movwf call

ADCON0

Delay ; Acq Time Delay ;START CONVERSION ;DONE ; ; ; ; H_BYTE:L_BYTE =

bsf ADCON0,GO WfEoc btfsc ADCON0,GO goto WfEoc movf ADRESH,W movwf H_Byte bsf STATUS,RP0 movf ADRESL,W bcf STATUS,RP0 movwf L_Byte ADRESH:ADRESL AWt0 btfss PIR1,TXIF ;s goto AWt0 movlw '{' movwf TXREG call call Delay Delay

AWt1 btfss PIR1,TXIF ;s goto AWt1 swapf H_Byte,W andlw 0x0f bsf PCLATH,1 bsf PCLATH,2 call HexTable bcf PCLATH,1 bcf PCLATH,2 movwf TXREG call Delay

call

Delay

AWt2 btfss PIR1,TXIF;s goto AWt2 movf H_Byte,W andlw 0x0f bsf PCLATH,1 bsf PCLATH,2 call HexTable bcf PCLATH,1 bcf PCLATH,2 movwf TXREG call call Delay Delay

AWt3 btfss PIR1,TXIF ;s goto AWt3 swapf L_Byte,W andlw 0x0f bsf PCLATH,1 bsf PCLATH,2 call HexTable bcf PCLATH,1 bcf PCLATH,2 movwf TXREG call call Delay Delay

AWt4 btfss PIR1,TXIF;s goto AWt4 movf L_Byte,W andlw 0x0f bsf PCLATH,1 bsf PCLATH,2

call HexTable bcf PCLATH,1 bcf PCLATH,2 movwf TXREG call call Delay Delay

AWt5 btfss PIR1,TXIF goto AWt5 movlw '}' movwf TXREG call call Delay Delay

goto Wait Send_Mess MWt0 btfss PIR1,TXIF goto MWt0 movlw 'P' movwf TXREG call Delay

MWt1 btfss PIR1,TXIF goto MWt1 movlw 'i' movwf TXREG call Delay

MWt2 btfss PIR1,TXIF

goto MWt2 movlw 'c' movwf TXREG call Delay

MWt3 btfss PIR1,TXIF goto MWt3 movlw '1' movwf TXREG call Delay

MWt4 btfss PIR1,TXIF goto MWt4 movlw '6' movwf TXREG call Delay

MWt5 btfss PIR1,TXIF goto MWt5 movlw 'F' movwf TXREG call Delay

MWt6 btfss PIR1,TXIF goto MWt6 movlw '8' movwf TXREG call Delay

MWt7 btfss PIR1,TXIF goto MWt7 movlw '7'

movwf call Delay

TXREG

MWt8 btfss PIR1,TXIF goto MWt8 movlw '7' movwf TXREG call Delay

return Delay movlw movwf 0xff Count

Dwait decfsz Count,F goto Dwait return org 0x600

HexTable addwf PCL,1 retlw 0x30 retlw 0x31 retlw 0x32 retlw 0x33 retlw 0x34 retlw 0x35 retlw 0x36 retlw 0x37 retlw 0x38 retlw 0x39 retlw 0x41 retlw 0x42 retlw 0x43

retlw 0x44 retlw 0x45 retlw 0x46 end

C Codings
#include <stdio.h> #include <dos.h> #include <graphics.h> #include <conio.h> #include "com.c"

float M1pulse,M2pulse,M1ang,M2ang,M1dir,M2dir,Xinc; int Resdir[4],Res,P,cnt; int CheckSensors(); void GetInputs(); void InitializePort(); void StopMotors(); void Roboback(); unsigned int StrHextoNumb(char St[10]); char Buf[20],Dstr[20]; int Flame; int Intdelay = 2000;

int Pcount = 0; PORT *P1; void main() { int gd = VGA, gm = VGAHI; initgraph(&gd,&gm," "); InitializePort(); setcolor(11); rectangle(0,0,639,479); line(0,50,639,50); setcolor(14); settextstyle(1,0,5); outtextxy(130,5,"Two Axis Robot"); GetInputs(); cleardevice(); setcolor(11); rectangle(0,0,639,479); line(0,50,639,50); settextstyle(1,0,5); setcolor(14); outtextxy(130,5,"Two Axis Robot"); setcolor(9); settextstyle(1,0,4); outtextxy(220,100," First Axis ");

outtextxy(220,200," Second Axis ");

/* motor 1 */

switch(M1dir) { case 1: Resdir[0] = 0x1a; Resdir[1] = 0x16; Resdir[2] = 0x15; Resdir[3] = 0x19; break; case 0: Resdir[0] = 0x19; Resdir[1] = 0x15; Resdir[2] = 0x16; Resdir[3] = 0x1a; break; } cnt = 0; rectangle(118,148,522,182); setfillstyle(1,2); Intdelay = 2000;

for(P = 1; P <= M1pulse; P++) { Res = CheckSensors(); if (Res < 0) Roboback(); Xinc = (P/(M1pulse/400.0)); bar(120,150,120+Xinc,180); sprintf(Buf,"[3ff%02x8000]",Resdir[cnt++]); Send(Buf); Pcount++; delay(Intdelay); Intdelay = Intdelay - 1; if(Intdelay <= 100) Intdelay = 100; if (cnt > 3 ) { cnt = 0; } if (kbhit()) goto Next; } setfillstyle(1,2); bar(120,150,520,180); Next: StopMotors(); getch(); /* motor 2 */ delay(1000); switch(M2dir) { case 1:

Resdir[0] = 0x1a; Resdir[1] = 0x16; Resdir[2] = 0x15; Resdir[3] = 0x19; break; case 0: Resdir[0] = 0x19; Resdir[1] = 0x15; Resdir[2] = 0x16; Resdir[3] = 0x1a; break; } cnt = 0;

rectangle(118,248,522,282); setfillstyle(1,2); for(P = 1; P <= M2pulse; P++) { Xinc = (P/(M2pulse/400.0)); bar(120,250,120+Xinc,280); sprintf(Buf,"[3ff0080%02x]",Resdir[cnt++]); Send(Buf); delay(1000);

if (cnt > 3 ) { cnt = 0; } if (kbhit()) goto Next1; } setfillstyle(1,2); bar(120,250,520,280); Next1: StopMotors(); getch(); setcolor(12); settextstyle(1,0,5); outtextxy(220,410,"Completed"); port_close(P1); getch(); delay(1000); closegraph(); }

void GetInputs() { gotoxy(15,8); printf("Enter the Pulses for Motor 1 => ");

gotoxy(55,8); scanf("%f",&M1ang); M1pulse = M1ang; do { gotoxy(15,10); printf("Direction (0 for Forward/1 for Reverse) => gotoxy(70,10); scanf("%f",&M1dir); }while(M1dir < 0 || M1dir > 1); gotoxy(15,14); printf("Enter the Pulses for Motor 2 => "); gotoxy(55,14); scanf("%f",&M2ang); M2pulse = M2ang; do { gotoxy(15,16); printf("Direction (0 for CW / 1 for ACW ) gotoxy(60,16); scanf("%f",&M2dir); }while(M2dir < 0 || M2dir > 1); } => "); ");

void InitializePort()

{ P1=port_open(COM1_UART,COM1_INTERRUPT); if(P1==NULL) { printf("You cann't run without com port."); getch(); exit(0); } port_set( P1, 9600L, 'N', 8, 1 ); Send("[1ff00bf00]"); Send("[3ff00bf00]"); }

void StopMotors() { Send("[3ff00bf00]"); }

int CheckSensors() { int Sen; Send("[2]");

delay(100); strcpy(Buf,Receive()); Buf[0] = Buf[5]; Buf[1] = Buf[6]; Buf[2] = '\0'; Sen = StrHextoNumb(Buf); Send("[40]"); delay(20); strcpy(Dstr,Receive()); Dstr[0] = Dstr[1]; Dstr[1] = Dstr[2]; Dstr[2] = Dstr[3]; Dstr[3] = Dstr[4]; Dstr[4] = '\0'; Flame = (StrHextoNumb(Dstr)); if( Flame > 50 ) { cleardevice(); settextstyle(1,0,4); outtextxy(200,175,"Flame Sensed."); StopMotors(); delay(1000);

port_close(P1); getch(); exit(0); return(-1); } if( (Sen & 0x01) == 0x00) { cleardevice(); settextstyle(1,0,4); outtextxy(200,175,"Metal Sensed"); StopMotors(); delay(1000); port_close(P1); getch(); exit(0); return(-1); } if( (Sen & 0x02) == 0x00) { cleardevice(); settextstyle(1,0,4); outtextxy(100,175,"Intruder Sensed. Returning..."); return(-1); }

return(1); } void Roboback() { StopMotors(); sleep(1); switch(M1dir) { case 0: Resdir[0] = 0x1a; Resdir[1] = 0x16; Resdir[2] = 0x15; Resdir[3] = 0x19; break; case 1: Resdir[0] = 0x19; Resdir[1] = 0x15; Resdir[2] = 0x16; Resdir[3] = 0x1a; break; }

for(P = 1; P <= Pcount; P++) { sprintf(Buf,"[3ff%02x8000]",Resdir[cnt++]); Send(Buf); delay(4000); if (cnt > 3 ) { cnt = 0; } if (kbhit()) goto End; } End: StopMotors(); delay(1000); port_close(P1); delay(1000); exit(0); }

unsigned int StrHextoNumb(char St[10]) { unsigned int Val = 0x0000; short int i = 0; while(St[i]) { Val <<= 4;

switch(St[i]) { case '0': Val = Val | 0x00; break; case '1': Val = Val | 0x01; break; case '2': Val = Val | 0x02; break; case '3': Val = Val | 0x03; break; case '4': Val = Val | 0x04; break; case '5': Val = Val | 0x05; break; case '6': Val = Val | 0x06; break; case '7': Val = Val | 0x07; break; case '8':

Val = Val | 0x08; break; case '9': Val = Val | 0x09; break; case 'A': Val = Val | 0x0a; break; case 'B': Val = Val | 0x0b; break; case 'C': Val = Val | 0x0c; break; case 'D': Val = Val | 0x0d; break; case 'E': Val = Val | 0x0e; break; case 'F': Val = Val | 0x0f; break; default: Val = Val | 0x00; } i++;

} return(Val); }