Sie sind auf Seite 1von 35

Chapter 1 INTRODUCTION 1.

.1 NEED FOR A HEAVY EXPLOSIVE ROBOT Today, explosive removing robot is an interesting area of robotics mainly because this technology is ripening and the price of the robot has been accepted. Dangerous explosives can be anywhere and can cause serious damage wherever it is present. They can be in the open field or in the closed house. It can explode at anytime and can cause death or serious injury to numerous people depending upon its intensity and the place where it is set up. So to avoid this, we go in for a robot which is programmed to move, search, grasp, lift and put the explosive at a safer point. The earlier methods employed people to move closer to the explosive and diffuse it by hand. This method was quite risky as they werent assured of their life while carrying out this job. And moreover this process usually required people to wear explosion resistant dresses which were quite and hefty. So to overcome all these problems and for the safety of people we go in for a robot which does all the work of people with a precise and reliable manner. 1.2 EXISTING ROBOTS IN THE WORLD 1.2.1 1.2.3 1.2.4 1.2.5 1.2.6 1.2.7 MK8 made by the British AB Electronic products company. Defender made by British ALLEN company. RMI-9WT made by Canada PEDSCO company. TEODOR made by German TELEROB company. Lingxi-B made in China. Versatrax made by Canada INUKTUN company. 1.2.2 There are a host of explosive removing robots across the world. Some of them are listed below: ANDROS F6A made by America REMOTEC company.

Chapter 2 LITERATURE REVIEW 2.1 BACKGROUND The use of remote controlled vehicles in various fields prompted engineers and scientists to discover one such vehicle for bomb disposal purposes. There are various kinds of explosives such as chemical, biological, nuclear etc. The robots developed helped in the disposal of a particular kind of explosive. The Heavy explosive robot research control technique aids in disposing heavy explosives which are quite difficult to lift manually. 2.2 INTERPRETATION The robots were fitted with cameras, microphones, and sensors for chemical, biological, or nuclear agents. Many of these robots even have hand-like manipulators in case a door needs to be opened, or a bomb requires diffusion without moving. Then there are projectile water disrupters which fires an explosively-propelled jet of water to disrupt the circuitry of a bomb and thereby disable it with a low risk of detonation. The robots are generally controlled from a remote location to avoid unpredictable explosion. Certain robots have specialized abilities such as image mapping, accurate vehicle positioning, multi terrain vehicles. The heavy explosive robot research control technique is used to lift particularly heavy explosives. The robot weighs 450kgs and has a lift weight of 50kgs. It has a 7 joint arm for picking explosive. It has 5 cameras for control from remote location. It is powered by means of a battery. Since the majority composition of heavy explosives constitute metals it is also fitted with a metal sensor. The prototype is powered by 230V mains stepped down to 12V DC by means of a step down transformer. Zigbee protocol is used for communication between the transmitter and receiver stations. The robot can be controlled at a distance of 100m from the transmitter station. The position of the robot is adjusted by trial and error. The robot weighs 2kgs and can lift 300gms. The robot has a camera for controlling from a remote location. The movement of the wheels, the spinning of the robotic arm and the picking of mine is controlled individually by respective relay drives.

Chapter - 3 HARDWARE SPECIFICATIONS

An embedded system is a special-purpose computer system designed to perform a dedicated function. Since the system is dedicated to specific tasks, design engineers can optimize it, reducing the size and cost of the product. Embedded system comprises of both hardware and software. Embedded system is fast growing technology in various fields like industrial automation, home appliances, automobiles, aeronautics etc. Embedded technology uses PC or a controller to do the specified task and the programming is done using assembly language programming or embedded C. The various hardware specifications that come in place in this robot are as follows: 3.1 8051 MICROCONTROLLER A microcontroller (also microcontroller unit, MCU or C) is a small computer on a single integrated circuit consisting of a relatively simple CPU combined with support functions such as a crystal oscillator, timers, etc. The reason for choosing a microcontroller over other control units is because they are easily available and widely used. 3.2 KEYPAD Keypads and LCDs are the most widely used input/output devices of the 8051. The keyboard fundamentals, along with key press and key detection mechanisms, and a keyboard interfacing to an 8051 are necessary to understand the keypad working. The advantage of this input device is that it is easy to handle and work upon. 3.3 ZIGBEE ZigBee is a wireless technology developed as an open global standard to address the unique needs of low-cost, low-power, wireless sensor networks. The standard takes full advantage of the IEEE 802.15.4 physical radio specification. 3.4 LCD LIQUID CRYSTAL DISPLAY LCDs are more energy efficient and offer safer disposal than CRTs. Its low electrical power consumption enables it to be used in battery-powered electronic equipment. This is mainly used at the transmitting end to view the commands given to the robot. 3

3.5

RELAY A relay is an electrically operated switch. Electric current through the coil of the relay creates

a magnetic field which attracts a lever and changes the switch contacts. This is the most common method used for driving the robot mechanism. 3.6 DC MOTOR The advantages of a DC motor over other motors and the reason why we are going for this in our heavy explosive removing robot mechanism is its low initial cost, high reliability, and simple control of motor speed.

Chapter - 4 SOFTWARE DESCRIPTION 4.1 COMPILATION Since we are using embedded systems as the backbone for this Heavy explosive removing robot, we tend to use either embedded C or the Keil C compiler. These two compilers will thereby help us in sending instructions to the robot movement and also to the microcontroller as input data. 4.2 8051 C-COMPILER & ASSEMBLER KIT The CA51 Compiler Kit for the 8051 microcontroller family supports all 8051 derivatives including those from companies like Analog Devices, Atmel, Cypress Semiconductor, Dallas Semiconductor, Goal, Hynix, Infineon, Intel, OKI, Philips, Silicon Labs, SMSC, STMicroelectronics, Synopsis, TDK, Temic, Texas Instruments, and Winbond. The following components are included in the CA51 8051 C-compiler & Assembler Kit: 4.2.1 C51 C Compiler The Keil C51 C Compiler for the 8051 microcontroller is the most popular 8051 C compiler in the world. It provides more features than any other 8051 C compiler available today. The C51 Compiler allows you to write 8051 microcontroller applications in C that have the efficiency and speed of assembly language. Language extensions in the C51 Compiler give you full access to all resources of the 8051. C51 translates C source files into a relocatable object module. When the DEBUG control is used, the object file contains full symbolic information for debugging with the Vision3 Debugger or an in-circuit emulator. In addition to the object file, the C51 Compiler generates a listing file which optionally may include symbol table and cross-reference information. 4.2.1.1.Features Nine basic data types, including 32-bit IEEE floating-point Flexible variable allocation with bit, data, bdata, idata, xdata, and pdata memory types Interrupt functions may be written in C Full use of the 8051 register banks Complete symbol and type information for source-level debugging Use of AJMP and ACALL instructions 5

Bit-addressable data objects Built-in interface for the RTX51 real-time operating system Support for dual data pointers on Atmel, AMD, Cypress, Dallas Semiconductor, Infineon, Philips, and Triscend microcontrollers Support for the Philips 8xC750, 8xC751, and 8xC752 limited instruction sets Support for the Infineon 80C517 arithmetic unit

4.2.2

Macro Assembler The A51 Assembler is a macro assembler for the 8051 family of microcontrollers. It

supports all 8051 derivatives. It translates symbolic assembly language mnemonics into relocatable object code where the utmost speed, small code size, and hardware control are critical. The macro facility speeds development and conserves maintenance time since common sequences need only be developed once. The A51 assembler supports symbolic access to all features of the 8051 architecture. The A51 assembler translates assembler source files into a relocatable object modules. The DEBUG control adds full symbolic information to the object module and supports debugging with the Vision3 Debugger or an in-circuit emulator. In addition to object files, the A51 assembler generates list files which optionally may include symbol table and cross reference information. 4.2.3 Vision 3 IDE

The Vision3 IDE from Keil Software combines project management, make facilities, source code editing, program debugging, and complete simulation in one powerful environment. Vision3 helps you get programs working faster than ever while providing an easy-to-use development platform. The editor and debugger are integrated into a single application and provide a seamless embedded project development environment.

Chapter - 5 PROJECT DESCRIPTION 5.1 PROBLEM DEFINITION The main problem that has been arising in the military battlefield in the current year is the correct searching of explosive and either detonating it or placing it in a safer place without any loss of life. This is quite possible with the usage of this robot as it does all the operation of a human. The current robot used for this case can only move a lesser distance that too without any obstacle in front of it. This hinders a great problem to the people as the area should be first free of any obstacle in front of the robot and then the pick and place of the explosive will be carried out. This problem is solved by using zigbee communication protocol as the latter will allow to control the robot with some minimum specification with the obstacle in between the robot and the controller. Zigbee, thereby tends to give you great support where we have an explosive in the middle of heavily populated area. The heavy explosive robot can lift heavier explosives and can dispose it at a safer location.

5.2 OVERVIEW OF THE PROJECT The robot has two units which make the final output. They are the transmitting end and the receiving end. The block diagram of these are as given below: 5.2.1 Pictorial representation

Fig.5.1 General view of the robot

5.2.2 Block diagram

Power Supply

LCD
KEYPAD

8051 Micro Controller

ZIGBEE

Power Supply

Mine Detection Sensor Signal conditioning Circuit Buzzer 8051 Micro Controller

ZIGBEE

O B O T

RELAY Driver RELAY Driver

5.3 5.3.1

INTERFACING DIAGRAM Transmitter station

The transmitter end consists of an microcontroller to get inputs from the keypad and transmit them through the Zigbee transceiver. The power supply converts 230VAC power to 5V DC and gives it to the microcontroller. The LCD is interfaced to the microcontroller to verify the commands given to the robot. We also have a CCTV to monitor the robot from a remote location

Fig 5.2 Interfacing of the transmitter components

10

5.3.1.1 Flow Chart

11

5.3.2

Receiver station

The receiver station receives signals from transmitter through the Zigbee transceiver and the movement of the robot is controlled. The microcontroller identifies the signals received from the Zigbee transceiver and gives the output to the appropriate relay driver. The relay driver controls the motor to propel the robot forward, backward and in either directions. The movement of the robotic arm is also controlled in similar manner.

Fig. 5.3 Interfacing of the receiver components

5.3.2.1 Flow Chart 12

13

14

5.4 MODULES There are a total of six modules that control the whole working of the robot. These modules are given as below: 8051 Microcontroller Keypad LCD Liquid crystal display Zigbee Relay DC Motor 5.5 MODULES DESCRIPTION 5.5.1 8051 Microcontroller A microcontroller (also microcontroller unit, MCU or C) is a small computer on a single integrated circuit consisting of a relatively simple CPU combined with support functions such as a crystal oscillator, timers and etc. 5.5.1.1 Schematic

Fig. 5.4 Pin diagram of 8051 micro-controller 15

5.5.1.2

Power supply unit for the microcontroller The power supply section is the important one. It should deliver constant output

regulated power supply for successful working of the project. A 0-12V/1 mA transformer is used for this purpose. The primary of this transformer is connected in to main supply through on/off switch& fuse for protecting from overload and short circuit protection. The secondary is connected to the diodes to convert 12V AC to 12V DC voltage. And filtered by the capacitors, which is further regulated to +5v, by using IC 7805.

Fig. 5.5 Power supply 5.5.2 Keypad Keyboards and LCDs are the most widely used input/output devices of the 8051, and a basic understanding of them is essential. In this section, we first discuss keyboard fundamentals, along with key press and key detection mechanisms, Then we show how a keyboard is interfaced to an 8051. 5.5.2.1 Interfacing the keyboard to the 8051 At the lowest level, keyboards are organized in a matrix of rows and columns. The CPU accesses both rows and column through ports; therefore, with two 8-bit ports, an 8*8 matrix of keys can be connected to a microprocessor. When a key pressed, a row and column make a connect; otherwise, there is no connection between row and column. In IBM PC keyboards, a single microcontroller (consisting of microprocessor, RAM and EPROM, and several ports all on a single 16

chip) takes care of software and hardware interfacing of keyboard. In such systems it is the function of programs stored in the EPROM of microcontroller to scan the keys continuously, identify which one has been activated, and present it to the motherboard. In this section we look by which the 8051 scans and identifies the key. 5.5.2.2 Scanning and identifying the key The figure shows a 4*4 matrix connected to two ports. The rows are connected to an output port and the columns are connected to an input port. If no key has been pressed, reading the input port will yield 1s for all columns since they are all connected to high (Vcc) If all the rows are grounded and a key is pressed, one of the columns will have 0 since the key pressed provides the path to ground. It is the function of the microcontroller to scan the keyboard continuously to detect and identify the key pressed. How it is done is explained next. at the mechanism

Fig. 5.6 Matrix representation of kerpad 5.5.2.3 Grounding rows and reading columns To detect a pressed key, the microcontroller grounds all rows by providing 0 to the output latch, and then it reads the columns. If the data read from the columns is D3-D0=1111, no key has been pressed and the process continues until a key press is detected. However, if one of the column bits has a zero, this means that a key press has occurred. For example, if D3-D0=1101, this means that a key in the D1 column has been pressed. After a key press is detected, the microcontroller will go through the process of identifying the key. Starting with the top row, the microcontroller grounds it by providing a low to row D0 only; then it reads the columns. If the data read is all1s, no key in that row is activated and the process is moved to the next row. It grounds the next row, reads the columns, 17

and checks for any zero. This process continues until the row is identified. After identification of the row in which the key has been pressed, the next task is to find out which column the pressed key belongs to. This should be easy since the microcontroller knows at any column are being accessed. 5.5.3 LCD Liquid crystal display time which row and

It is an electronically-modulated optical device made up of any number of pixels filled with liquid crystals and arrayed in front of a light source (backlight) or reflector to produce images in color or monochrome. The earliest discovery leading to the development of LCD technology, the discovery of liquid crystals, dates from 1888. By 2008, worldwide sales of televisions with LCD screeEach pixel of an LCD typically consists of a layer of molecules aligned between two transparent electrodes, and two polarizing filters, the axes of transmission of which are (in most of the cases) perpendicular to each other. With no actual liquid crystal between the polarizing filters, light passing through the first filter would be blocked by the second (crossed) polarizer. In most of the cases the liquid crystal has double refraction.The LCD standard requires 3 control lines and 8 I/O lines for the data bus. 8 data pins D7:D0 Bi-directional data/command pins. Alphanumeric characters are sent in ASCII format. RS: Register Select RS = 0 -> Command Register is selected RS = 1 -> Data Register is selected

R/W: Read or Write 0 -> Write, 1 -> Read E: Enable (Latch data) Used to latch the data present on the data pins. A high-to-low edge is needed to latch the data. The 8 data lines are connected to PORT 1 of 8051 microcontroller. The three control lines( RS,RW and EN ) are connected to PORT 3.5,3.6 and 3.7 respectively. 18

5.5.3.1

Interfacing diagram

Fig. 5.7 Interfacing of LCD 5.5.4 Zigbee

ZigBee is a wireless technology developed as an open global standard to address the unique needs of low-cost, low-power, wireless sensor networks. The standard takes full advantage of the IEEE 802.15.4 physical radio specification and operates in unlicensed bands worldwide at the following frequencies: 2.4002.484 GHz, 902-928 MHz and 868.0868.6 MHz. The power levels (down from 5v to 3.3v) to power the zigbee module. The communication lines (TX, RX, DIN and DOUT) to the appropriate voltages.

19

5.5.4.1

Interfacing Diagram

Fig. 5.8 Interfacing of Zigbee

5.5.5

Relay A relay is an electrically operated switch. Electric current through the coil of the

relay creates a magnetic field which attracts a lever and changes the switch contacts. The coil current can be on or off so relays have two switch positions and there are double-throw (changeover) switches. It consists of a coil of wire surrounding a soft iron core, an iron yoke, which provides a low reluctance path for magnetic flux, a movable iron armature, and a set, or sets, of contacts. In this condition, one of the two sets of contacts in the relay pictured is closed, and the other set is open. The P0_0, P0_1, P0_2 and P0_3 pin of controller is assumed as data transmit pins to the relay through relay driver ULN 2003. ULN 2003 is just like a current driver.

20

5.5.5.1

Interfacing Diagram

Fig. 5.9 Interfacing of relay

5.5.5.2

Logic Diagram

Fig. 5.10 Relay logic 21

5.5.6

DC Motor A DC motor is designed to run on DC electric power. Two examples of pure DC

designs are Michael Faraday's homopolar motor (which is uncommon), and the ball bearing motor, which is (so far) a novelty. By far the most common DC motor types are the brushed and brushless types, which use internal and external commutation respectively to create an oscillating AC current from the DC sourceso they are not purely DC machines in a strict sense. We in our project are using brushed DC Motor, which will operate in the ratings of 12v DC 0.6A which will drive the flywheels in order to make the robot move.

5.5.6.1

Schematic

Fig. 5.11 DC Motor connections 22

Chapter - 6 PROTOTYPE ANALYSIS AND TESTING 6.1 Dimensions Length of the robot 36 cm Breadth of the robot 25 cm Height with arm straightened 62 cm Height below the arm 27 cm Diameter of the back wheel 9.25 cm Diameter of the front wheel 4.25 cm 6.2 Movement of the robot Forward movement for one step 11 cm Backward movement for a step 11 cm Angular base wheel rotation for each step 30 Angular arm rotation for each step 51.5 Angular displacement of the vertical arm 3.75 6.3 Keypad details S/w 1 Forward movement of the robot S/w 2 Backward movement of the robot S/w 3 Angular right movement of the robot S/w 4 Angular left movement of the robot S/w 5 Angular right movement of the robotic arm S/w 6 Angular left movement of the robotic arm S/w 7 Angular movement of the arm upwards S/w 8 Angular movement of the arm downwards S/w 9 Closes the width of the robotic finger. S/w 10 Opens up the width of the robotic finger.

23

6.4

Snapshots

Fig. 6.1 Picking of an object by the arm

Fig. 6.2 Transmitting station 24

Fig. 6.3 Robot at work

Fig. 6.4 Robot when powered down 25

Chapter - 7 CONCLUSION & FUTURE ENHANCEMENTS 7.1 CONCLUSION The heavy explosive robot is made for the safety of the people from harmful explosives that tend to end the lives of millions. The robot can thus tend to help in this noble cause. The searching and picking up of the explosive and transporting it to a safer place where the human race is less populated is attained through this project. With the use of zigbee communication protocol we have an added advantage. With obstacle in front of the robot, it can still carry out the whole process of searching, picking and placing without the need of people interfering it. Thus, this robot is of extensive use in the military field where explosive removing is quite often. 7.2 FUTURE ENHANCEMENTS The heavy explosive removing robot finds numerous applications which can be used in the mere future as well. The number of cameras can be increased for improved control from a remote location to get a multi-dimensional view. Using the recent and advantageous Zigbee technology we can use multiple robots which can be controlled from a single transmitter. This can be extremely useful in disposing multiple explosives in a very short period of time. Stepper motors can thereby be used for accurately positioning the arm. The lifting capacity of the robot can be increased. The robotic wheels can be improvised to make the robot mobile on various terrains.

26

REFERENCES [1] Ward, C.C.; Iagnemma, K.; A Dynamic-Model-Based Wheel Slip Detector for Mobile Robots on Outdoor Terrain. Robotics, IEEE Transactions on Volume 24, Issue 4, Aug. 2008 Page(s):821 831 [2] Antonelli, G.; Chiaverini, S. Kinematic Control of Flatoons of Autonomous Vehicles Robotics, IEEE Transactions on , Volume 22, Issue 6, Dec. 2006 Page(s):1285 1292. [3] Mariottini, G. L.; Oriolo, G.; Prattichizzo, D, Image-Based Visual Servoing for Nonholonomic Mobile Robots Using Epipolar Geometry. Robotics, IEEE Transactions on. Volume 23, Issue 1, Feb. 2007 Page(s): 87 100 [4] Pei-chun lin,Haldun Komsuoglu,Daniel E.koditschek. A Leg configuration measurement sys for fuu-body pose estimate in a hexapod robot, IEEE TRAN ON ROBOTICS, 2005, 21(3),pp.411~422. [5] Bhattacharya, S, Murrieta-Cid, R, Hutchinson, S. Optimal Paths for Landmark-Based Navigation by Differential-Drive Vehicles With Fieldof- View Constraints. Robotics, IEEE Transactions on, Volume 23, Issue 1, Feb. 2007 Page(s): 47 59 [6] Daigle M. J.; Koutsoukos, X. D; Biswas, G.;Robotics. Distributed Diagnosis in Formations of Mobile Robots, Robotics, IEEE Transactions on. Volume 23, Issue 2, April 2007 Page(s): 353 369. [7] Wolf, D.F.; Sukhatme, G.S.; Semantic Mapping Using Mobile Robots, Robotics, IEEE Transactions on. Volume 24, Issue 2, April 2008 Page(s):245 258 [8] Danwei Wang; Chang Boon Low; Modeling and Analysis of Skidding and Slipping in Wheeled Mobile Robots: Control Design Perspective. Robotics, IEEE Transactions on. Volume 24, Issue 3, June 2008 Page(s):676 687 [9] Daigle, M.J.; Koutsoukos, X.D.; Biswas, G.; Distributed Diagnosis in Formations of Mobile Robots. Robotics, IEEE Transactions on. Volume 23, Issue 2, April 2007 Page(s):353 369 [10] McCarthy, C.; Barnes, N.; Mahony, R.; A Robust Docking Strategy for a Mobile Robot Using Flow Field Divergence, Robotics, IEEE Transactions on Volume 24, Issue 4, Aug. 2008 Page(s):832 842 [11] Ji, M.; Sarkar, N, Supervisory Fault Adaptive Control of a Mobile Robot and Its Application in Sensor-Fault Accommodation, Robotics, IEEE Transactions on , Volume 23, Issue 1, Feb. 2007 Page(s):174 178 [12] Gabriely, Y.; Rimon , E.; CBUG: A Quadratically Competitive Mobile Robot Navigation Algorithm. Robotics, IEEE Transactions on Volume 24, Issue 6, Dec. 2008 Page(s):1451 1457.

APPENDIX A 27

Transmitting side: #include <REGX51.H> sbit RS = P3^7; //potr 2.0 sbit RW = P3^6; //potr 2.1 sbit EN = P3^5; //potr 2.2 sbit buzzer = P0^0; unsigned int m; void delay(unsigned int value){ unsigned int i, j; for(i=0;i<=value;i++){ for(j=0;j<=1000;j++){ } } } void serial_init(){ TMOD=0x20; TH1=0xFD; SCON=0x50; TR1=1; } void Transmit(unsigned char value){ SBUF=value; while(TI==0); TI=0; } unsigned char Receive(){ unsigned char i; while(RI==0); i = SBUF; RI = 0; return i; } void serial_string(unsigned char *s){ while(*s){ Transmit(*s); s++; } } void lcdcmd(unsigned char value){ P1 = value; RS = 0; RW = 0; 28

EN = 1; delay(1); EN = 0; } void lcddatastr(unsigned char *value){ unsigned int i=0; while(value[i] != '\0'){ P1 = value[i]; i++; RS = 1; RW = 0; EN = 1; delay(1); EN = 0; } } void lcddata(unsigned char value){ P1 = value; RS = 1; RW = 0; EN = 1; delay(1); EN = 0; } void lcd_init(){ lcdcmd(0x38); lcdcmd(0x0C); lcdcmd(0x80); } void llcddata(int m) { lcdcmd(0x01); lcdcmd(0x80); switch(m) { case 6: lcddatastr(" Rot Left"); break; case 1: lcddatastr(" Forward"); break; case 5: lcddatastr(" Rot Right"); break; case 4: lcddatastr(" Move Left"); break; case 9: lcddatastr("Pick Mine "); break; 29

case 3: lcddatastr(" Move Right"); break; case 7: lcddatastr("Move Arm UP"); break; case 2: lcddatastr(" Move Back"); break; case 8: lcddatastr("Move Arm Down "); break; case 10: lcddatastr(" Place Mine "); break; case 11: lcddatastr(" Halt "); break; default: lcddatastr(" Try Next "); } } unsigned char keypad(){ int i,key=0; unsigned char val,row[4]; P2=0x0F;//0000 1111 row[0]=0xEF;//1110 1111 row[1]=0xDF;//1101 1111 row[2]=0xBF;//1011 1111 row[3]=0x70;//1000 1111 P2=0x0F; while((P2&0x0F)==0x0F); while((P2&0x0F)!=0x0F) { key=0; for(i=0;i<3;i++) { P2=row[i]; val=(P2&0x0F); if(val==0x0E) { key+=1; Transmit(0x30+key); while((P2&0x0F)!=0x0F); return key; } if(val==0x0D) { key+=2; Transmit(0x30+key); 30

while((P2&0x0F)!=0x0F); return key; } if(val==0x0B) { key+=3; Transmit(0x30+key); while((P2&0x0F)!=0x0F); return key; } if(val==0x07) { key+=4; Transmit(0x30+key); while((P2&0x0F)!=0x0F); return key; } key=(i+1)*4; } } } void serial_interrupt()interrupt 4{ if(RI==1) { RI=0; buzzer = 0; lcdcmd(0x81); lcddatastr("MINE HAS BEEN "); lcdcmd(0xC4); lcddatastr("DETECTED"); delay(1000); lcdcmd(0x01); buzzer = 1; } } void main(){ unsigned char a; buzzer = 1; lcd_init(); serial_init(); serial_string("WILL OUTPUT COME?\n\r"); IE=0x90; while(1){ // Transmit('s'); a = keypad(); // Transmit('p'); 31

//

Transmit('\n'); //Transmit(a); llcddata(a); delay(100);

} }

APPENDIX B 32

Receiving side #include <REGX51.H> sbit motor1_1 = P0^0; sbit motor1_2 = P0^1; sbit motor2_1 = P0^2; sbit motor2_2 = P0^3; sbit rotateleft = P0^4; sbit rotateright = P0^5; sbit up = P0^6; sbit down = P0^7; sbit pick = P2^0; sbit place = P2^1; sbit ir = P1^0; sbit us = P1^1; void delay(unsigned int value){ unsigned int i, j; for(i=0;i<=value;i++){ for(j=0;j<=1000;j++){ } } } void serial_init(){ TMOD=0x20; TH1=0xFD; SCON=0x50; TR1=1; } void Transmit(unsigned char value){ SBUF=value; while(TI==0); TI=0; } unsigned char Recieve(){ unsigned char a; while(RI==0); a=SBUF; RI=0; return a; } void serial_string(unsigned char *s){ while(*s){ Transmit(*s); 33

s++; } } void External_interrupt() interrupt 0{ Transmit('1'); } void main(){ unsigned char a; serial_init(); IE = 0x81; P0=0x00; P2=0x00; while(1){ a=Recieve(); if(a=='1'){ //forward if(ir==0||us==0){ }else{ motor1_1 = 1; motor2_1 = 1; delay(100); motor1_1 = 0; motor2_1 = 0; } } else if(a=='2'){ //backward motor1_2 = 1; motor2_2 = 1; delay(100); motor1_2 = 0; motor2_2 = 0; } else if(a=='4'){ //left motor2_1 = 1; delay(100); motor2_1 = 0; } else if(a=='3'){ //right motor1_1 = 1; delay(100); motor1_1 = 0; } else if(a=='5'){ //rotate left rotateleft = 1; delay(100); rotateleft = 0; } 34

else if(a=='6'){ //rotate right rotateright = 1; delay(100); rotateright = 0; } else if(a=='8'){ //up up = 1; delay(100); up = 0; } else if(a=='7'){ //down down = 1; delay(100); down = 0; } else if(a=='9'){ //pick pick = 1; delay(100); pick = 0; } else if(a==':'){ //place place = 1; delay(100); place = 0; } else { P0=0x00; } } }

35

Das könnte Ihnen auch gefallen