Survey
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
EMBEDDED SYSTEM BASED DISASTER MANAGEMENT PROJECT REPORT ON EMBEDDED SYSTEM BASED DISASTER MANAGEMENT BY Name 1) Punit Thakkar 2) Darshini Desai 3) Mitesh Dave Roll No. 69 71 72 Seat No. DEPARTMENT OF ELECTRONICS AND TELECOMMUNICATION ENGINEERING Shri Vile Parle Kalvani Mandal’s Dwarkadas J. Sanghvi College of Engineering Plot no. U-15, JVPD Scheme, Bhaktivedanta Swami Marg, Vile Parle (W), Mumbai – 400 056 2 Shri Vile Parle Kelvani Mandal’s Dwarkadas J Sanghvi College of Engineering Plot. No. U – 15, JVPD Scheme, Bhaktivedanta Swami Marg, Vile Parle (W), Mumbai – 400 056 Department of Electronics and Telecommunication Engineering This is to certify that the Project report entitled “EMBEDDED SYSTEM BASED DISASTER MANAGEMENT” Submitted by: 1. Punit Thakkar 2. Darshini Desai 3. Mitesh Dave Students of Electronics and Telecommunication Engineering have successfully completed their Project required for the fulfillment of B. E. Degree as per the norms prescribed by the University of Mumbai during the first half of the year 2007. The project report has been assessed and found to be satisfactory. _______________ Under EGURU, Ekalavya Programme, KReSIT, IIT Bombay. Group ID : EGURU10202 Internal Guide (http://ekalavya.it.iitb.ac.in) External Guide _______________ Head of Department _______________ Principal _______________ ______________ Internal Examiner External Examiner 3 Preface N o w a da y’ s Em b e d de d s yst em h a s c a p t ur ed t h e fi e ld o f i n du st r y a s w e l l a s do m e st i c o r p r a c t i c a l li fe o f h um a n b ei n g s . G la n c i n g a t r ec en t de v e lo p m en t i n t h e f i el d o r el ec t r o n i c s a n d c o m p ut er s, we c a n j us t s a y t h a t t h ey h a v e c a p t u r e d p r a c t i c a l ly e v e r y m o d e o f h um a n ’ s l i fe a n d h a v e g i v en a n ew w a y t o i t . Ta k i n g i n t o c o n si der a t i o n , t h e n e ed t o s a v e li v i n g b ei n g s h a s i n sp i r e d u s t o d ev e lo p a D i sa s t e r M a n a g em en t S y st em t h a t r em o t e l y c o n t r o l s w i d e r a n g e o f a p p li a n c e, i n a n d a r o u n d t h e a f fe c t ed a r ea , wi t h t h e h elp o f a Em b e dd ed S y st em . F i n a l l y we f ee l v er y m u c h sa t i s fi ed i n p r e sen t i n g t h i s p r o j ec t , wh i c h wo u ld b e o f g r ea t u s e t o o ur so c i et y. 4 Acknowledgment W e t a k e g r e a t p l e a s ur e t o p r e s en t t h i s p r o j e c t r ep o r t o n “Em b e dd ed S y st em b a s ed D i sa st er M a n a g em en t ”. W e h a v e t a k e n g r e a t c a r e t h a t t h e i n fo r m a t i o n p r o v i de d b y u s i s i n c o r r ec t , b ut ev en t h en w e w e lc o m e a n y s ug g es t i o n s o r c o r r e c t i o n s. Wh en w e l o o k up t h i s t a sk i t wa s r ea l ly di ff i c u lt t o w o r k o ut b ut t h e v a r i a b l e g ui da n c e g i v e n b y o ur p r o j e c t g u i d e Pr o f. Mr . S a n j a y . B. D e sh m uk h h a s m a de t h i s p r o j e c t s uc c e s sf u l. W e a r e v e r y g r a t e fu l t o o u r H. O . D Pr o f. Mr . Ki s h o r e S . K i n a g e, wh o s e c o n st a n t en c o ur a g em en t , p r ec i o u s g ui da n c e a n d fu l l - f le dg e d c o - o p e r a t i o n h a s l ed t o t h e s u c c e ss o f t h i s p r o j e c t . W e wo ul d li k e t o ex p r e s s o u r t h a n k s t o eG URU p r o g r a m m e ( Pr o j e c t ek a l a v ya T ea m a t I I T BO M B AY ) f o r a l l t h e si g n i f i c a n t c o - o p er a t i o n a n d fr i en d ly t r ea t m en t g i v en t o u s d ur i n g p r ep a r a t i o n fo r t h e project. O u r sp ec i a l t h a n k s fo r la b o r a t o r y a s si st a n c e t o Mr . A s h o k T a n n a a n d C o m p a n y ( Ta n n a El ec t r o n i c s ) f o r t h ei r c o - o p er a t i o n fo r v a r i o u s i n st r um en t s a n d s o m e h e lp f u l t i p s. 5 Table of Contents Sr.No Title Page No. 1. INTRODUCTION 7 2. BLOCK DIAGRAM 10 3. CIRCUIT DIAGRAM & CIRCUIT WORKING 14 4. SOFTWARE DEVELOPMENT 25 5. FEATURES 49 6. APPLICATIONS 50 7. MERITS & DEMERITS 52 8. FUTURE EXPANSION 54 9. TESTING & MEASUREMENTS 55 10. BIBLIOGRAPHY 57 11. IC SPECIFICATIONS(DATA SH EETS) 59 6 INTRODUCTION 7 Intro duction : Year after years devastating disasters ravage the land mass and leave behind countless victims. Pre -disaster planning can have a significant impact on minimizing the effect of tragedy and sufferings, coordinated and may result (non-panicked) in response a more in efficient saving lives and and properties. With seismic studies revealing sizable portions of the Indian Sub-continent prone to earthquake(s), it is desirable for India to be equipped with disa ster management equipment at all times. The country is also prone to other calamities like cyclones, droughts, floods, fires etc. In a report by UN Office for the Coordination of Humanitarian Affairs (OCHA) on Gujarat earthquake, it is mentioned that in su ch situations for saving of lives and rehabilitation to be taken on a war footing, it is imperative to develop disaster management equipments on priority such communication as detecting equipment cutting etc. which concrete can be slabs, mobile deployed fo r clearing debris. 8 General Working of System Here the system continuously obeys the commands given by the PC and moves the vehicle in desired direction. The control to mov e the vehicle can be given using a program written in C / C++. This takes place wirelessly using a transmitting and a receiving antenna. The transmitting antenna is interfaced to PC using embedded hardware. The embedded system placed on the vehicle is interfaced to PC via RS232 serial port. It uses microcontroller to handle the command issued by the operator to find out the temp of the living element. Here a temperature sensor mounted on the motor is used for this purpose. After it senses the desired temperature , p rogram can move the vehicle in desired direction. Graphically element is temperature shown on and hence the the the monitor vehicle direction screen can be of the along moved living with to the that position. Here a camera may be mounted and hence controlled to provide visual display of the surrounding which may be included as an additional application. 9 Block Diagram : Figure A : 10 Figure B: PC 11 General Descri ptio n: RF Chipset: This chipset has the capability of communicating over radio frequencies ( TX / RX vehicle). Micro controller based circuit: This module communicating triggering will perform with RF various various chipset, outputs like functions processing hooter or the such as inputs and transmitting RF signal. Power supply: This module will provide power supply to all the modules as mentioned : RF chipset : 9v . Microcontroller : 5v, 150mA. It will draw the necessary supply from the connected battery, which can fulfill the power requirement for 24 hours. DESCRIPTION OF BLOCK DIAGRA M: The Unit Consists Of Following Blocks: Power Supply: It provides regulated power supply to micro controller,ADC, reset circuits, and the sensors. Analog To Digital Converte r: 12 It accepts temperature inputs and inputs from sensors and generates the digital code. Micro controller: It accepts digital code from ADC i. e temperature value and transmits it to the host. Signal conditioner: Analog signals are amplified to get 0 to 5 volts swing and to make it compatible with ADC. Relay driver or stepper motor driver is used to move stepper motor. At receiving end a computer is used to give the desired commands. SYSTEM OPERATING ENVIRONMENT: The project is 89c51 micro controller based and implemented using assembly language at the transmitter side. At t he receiver side a PC is interfaced to detect various faults in different mini pillars. The operating platform is windows and the language used is C/C++ (Graphics). 1) C LANGUAGE: a. Graphics is easier to implement with aid of c language. b. Data input is possible from the COM ports. c. File handling is easy. 2) ASM code optimization a. Micro controller executes only machine language. b. Machine code takes less space as compared to language. c. Easy to debug. d. Close to hardware hence fault finding is e asy. 13 CIRCUIT DIAGRAM AND CIRCUIT WORKING 14 CIRCUIT DIAGRAM 15 Ci rcu it Working : Temperature Sensor : The LM35 series are precision integrated circuit temperature sensors, whose output voltage is linear ly proportional to Celsius temperature. The LM35 thus has an advantage over linear temperature sensors calibrated in degree Kelvin as the user is not required to subtract a large constant voltage from its output to obtain convenient centigrade scaling.The LM35’s low output impedance, linear output, and precise inherent calibration make interfacing to read out all control circuitry especially easy. The LM35 is rated to operate over -55 to +150 degree C temperature range. The LM35 is mounted on the motor and used to sense the temperature of the alive bodies. The embedded system placed on the vehicle is interfaced to PC via RS232 serial port. It uses microcontroller to handle the command issued by the operator. The vehicle is moved to the desired location via the PC command and the motor is used to rotate the temperature sensor in steps of 1.8 degrees. Since dead bodies do not produce heat, the LM35 senses the temperature of the alive bodies and conveys the information to the PC where graphically the precise lo cation of the living body is shown on the monitor screen along with the temperature and hence the vehicle can be moved to the desired position to retrieve the located alive bodies. Analog to Digital Convertor: IC 809 is an 8-channel analog to digital con vertor.It is designed to give fast,accurate and repeatable conversions over 16 a wide range of temperatures.it accepts temperature inputs and inputs from sensors and generates corresponding digital code. The temperature sensor LM35, used to detect the temper ature of alive bodies, is connected to ADC 0809 and inputs the temperature reading to the analog to digital convertor. The output of ADC 0809 is connected to the microcontroller 89C51.Thus, the ADC 0809 will take the temperature inputs from the LM35 and convert analog data to digital form and provide digital output to the microcontroller. RS232C : RS232C is a telecommunication standard for binary serial communication between devices. It supplies the roadmap for the way devices speak to each other using s erial ports. The devices are commonly referred to as DTE (data terminal equipment) and DCE (data communication equipment); for example, a computer and modem, respectively. It sets acceptable voltage and signal levels, along with common pin designations or configurations, for wiring serial connector ports. It also specifies protocol for the control information passed between devices which include events such as indicating the beginning or end of a data stream. Without standards like this, manufacturers woul d have no roadmap to build compatible product lines for technology. The RS232C serial port is used to interface PC to the embedded system placed on the vehicle which uses the microcontroller 89C51 to handle the command issued by the operator. The TXD and RXD pins of Port 3 of 89C51 are connected to the serial port. The future scope of the system says that the serial port 17 can be replaced with Wireless or Bluetooth Technology to eliminate the use of hardwired connections. RS232 Pinout The RS232 specification only defines the pin -out for a 25 pin D connector; how ever, the 9 pin is used more often (defined by EIA-574). The serial port found on Personal Computers uses a 9-pin connector. Normally the RS232 serial port is used for external modems, and in older systems for the mouse and printer interfaces. Most computer systems have only one serial port. The RS232 pinout is provided below. DB-9 Connector Pin Out Pin # Signal Name Signal Description CD Carrier Detect 1 2 RXD Receive Data 3 TXD Transmit Data 4 DTR Data Terminal Ready 5 GND Signal Ground / Common 6 DSR Data Set Ready 7 RTS Request To Send 8 CTS Clear To Send 9 RI Ring Indicator RS232 Serial Port Signal Description TXD: Transmit Data; The data sent from the Data Terminal and received by the Data Set. RXD: Receive Data; The data sent from the Data Set and received by the Data 18 Terminal. DTR: Data Terminal Ready; Used by the Data Terminal to signal to the Data Set that it is ready for operation, active high. DSR: Data Set Ready; Used by the Data Set to signal to the Data Terminal that it is ready for operation and ready to receive data, active high. RTS: Request To Send; Used by the Data Terminal to signal the Data Set that it may begin sending data. The Data Set will not send out data with out this signal, active high. CTS: Clear To Send; Used by the Data Set to signal the Data Terminal that it may begin sending data. The Data Terminal will not send out data with out this signal, active high. CD: Carrier Detect; Used by the Data Set to indicate to the Data Terminal that the Data set has detected a carrier (of another device). RI: Ring Indicator; Used by the Data Set to indicate to the Data Terminal that a ringing condition has been detected. GND: Ground; The common return for all signals on the interface. When using Software Flow Control(XON, XOFF); you only need 3 lines, TX (data), 19 RX (data), and GND. XON being equal to ready, XOFF equal to not ready. Parallel Port : LPT (Parallel) port Pins layout Connector : female DB25 20 D Description Name Pin - I/O Strobe STROBE 1 I/O Data Bit 0 D0 2 I/O Data Bit 1 D1 3 I/O Data Bit 2 D2 4 I/O Data Bit 3 D3 5 I/O Data Bit 4 D4 6 I/O Data Bit 5 D5 7 I/O Data Bit 6 D6 8 I/O Data Bit 7 D7 9 - I Acknoledge ACK 10 I Busy BUSY 11 I Paper End PE 12 I Select Out SLCT 13 Pin Name Description D 14 AUTO FEED Auto-Feed -O 15 ERROR Error -I 16 INIT Init (Reset) -O 17 SLCT IN Select In -O 18 GND Ground / 19 GND Ground / 20 GND Ground / 21 GND Ground / 22 GND Ground / 23 GND Ground / 24 GND Ground / 25 GND Ground / S GND Chasis Ground / Signals STROBE (Strobe) active low output Notify the printer that data available on D0 o D7 are valid. D0 - D7 (Data Bus) outputs Data byte send to the printer, output only in "compatible" mode and bi -directionnal in newer modes. ACK (Acknoledge) active low input Notify the computer that the printer is ready to receive the next data. BUSY (Busy) active low input Printer buffer full or printer busy, the computer must wait for this signal to get high again to continue sending data. 21 PE (Paper End) active high input Printer out of paper. SLCT (Select Out) active high input Printer ready (On-line). AUTO-FEED (Auto-Feed) active high output Printer Line feed. ERROR (Error) active low input Error detected by the printer. INIT (Reset) active low output Initialize the printer (reset). SLCT IN (Select In) active low output Send a on-line request to the printer. Programming Standard Resources : LPT1 I/O 0378-037A/037F IRQ 7 DMA 3 LPT2 I/O 0278-027A/027F IRQ 5 DMA 3 IRQ 7 / LPT3 I/O 03BC-03BE LPT ports can use only I/O (3 adresses) in standard mode ; both I/O (3 adresses) and an IRQ, dunno what's that mode ; or I/O (8 adresses), IRQ and DMA in ECP mode. 22 I/O Resources : Bits positions Description 7 6 5 4 3 2 1 0 Base+0 D7 D6 D5 D4 D3 D2 D1 D0 <- Data output Base+1 BUSY ACK PE SLCT ERROR / / Time-out <- Status register SLCT AUTO <- Control Base+2 / / / IRQ* INIT STROBE IN FEED register IRQ enable the IRQ for ACK, 1=enabled, 0=disabled. Address Note: dunno yet what are the 5 other addresses used on ECP for. "Base" is the first I/O Address used by the parallel port, 0378 for LPT1 for exemple. "?" are signals, but I have to check witch ones. "/" are undefined bits, they must be ignored. Voltage Regulator : The +5 volts supply is useful for both analog and digital circuits.DTL,TTL and CMOS IC’s will all operate nicely from a +5 volts supply.The +5 volts power supply is b ased on the commercial 7805 voltage regulator IC.This IC contains all the circuitry needed to accept any input voltage from 8 to 18 volts and produce a steady +5 volt output,accurate to within 5%(0.25 V).It also contains current limiting circuitry and ther mal overload protection,so that the IC wont be damaged in case of excessive load current;it will reduce its output voltage instead. The two 100 micro Farad capacitors serves as a ‘reservoir’ which maintains a reasonable input voltage to the 7805 throughout the entire cycle of the ac line voltage.it helps to keep the the power supply output voltage constant when load conditiond change. 23 Microcontroller 89C51 : The AT89c51 is a low power, high performance CMOS 8bit microcomputer erasable with read 4K only bytes of memory Flash pro grammable (PEROM). The and device is manufactured using ATMEL's high -density nonvolatile memory technology and is compatible with industry standard MCS -51 instruction program set and memory pinout. to be The on -chip reprogrammed Flash allows in-system or the by a conventional nonvolatile memory programmer. By combining a versatile 8-bit cpu with Flash on a monolithic chip; microcomputer the which ATMEL provides AT89C51 a highly is a flexible powerful and cost effective solution to many embedded control applications. The AT89CS1 provides the following standard features: 4Kbytes of flash 128 bytes of RAM 32 10 lines 32 10 lines 2-16 bit timer/counter a 5vector 21evel interrupt architecture a full duplex serial port chip oscillator and clock circuit In addition the AT89C51 is designed operation with static logic for down to zero frequency and supports two software selectable power saving modes. The ideal mode stops the cpu while allowing the RAM, timer/counters,. serial port and interrupt systems to continue functioning. The power down mode saves the RAM content but freezes the oscillator disabling all other chip functions until the next hardware resets. 24 SOFTWARE DEVELOPMENT 25 Assembly language programming: mov 141,#253 clr p1.0 mov 139,#253 lcall delay mov a,135 clr P1.1 anl lcall delay a,#127 mov 135,a clr p1.2 mov 152,#80 setb P1.3 mov 137,#32 lcall delay mov 136,#64 clr mov 128,#0 mov a,p2 mov 144,#0 lcall sendbyte mov 160,#0 sjmp back p1.3 BACK: lcall getchar ;move steppermotor setb p0.0 delay: mov r4,#0ffh b3: djnz r4,b3 ret lcall delay setb P0.1 getchar: lcall delay nop clr P0.1 b5: lcall delay mov a,sbuf ; cho clr ri jnb ri ,b5 ret 26 sendbyte: nop b5: jnb ti ,b5 mov sbuf,a clr ti ret 8051 Tutorial: Addressing Modes An "addressing mode" refers to how you are addressing a given memory location. In summary, the addressing modes are as follows, with an example of each: Immediate Addressing MOV A,#20h Direct Addressing MOV A,30h Indirect Addressing MOV A,@R0 External Direct MOVX A,@DPTR Code Indirect MOVC A,@A+DPTR Each of these addressing modes provides important flexibility. Immediate Addressing Immediate addressing is so -named because the value to be stored in memory immediately follows the operation code in memory. That is to say, the instruction itself dictates what value will be stored in memory. For example, the instruction: MOV A,#20h 27 This instruction uses Immediate Addressing because the Accumulator will be loaded with the value that immediately follows; in this case 20 (hexidecimal). Immediate addressing is very fast since the value to be loaded is included in the instruction. However, since the value to be loaded is fixed at compile -time it is not very flexible. Direct Addressing Direct addressing is so -named because the value to be stored in memory is obtained by directly retrieving it from another memory location. For example: MOV A,30h This instruction will read the data out of Internal R AM address 30 (hexidecimal) and store it in the Accumulator. Direct addressing is generally fast since, although the value to be loaded isnt included in the instruction, it is quickly accessable since it is stored in the 8051s Internal RAM. It is also much more flexible than Immediate Addressing since the value to be loaded is whatever is found at the given address -which may be variable. Also, it is important to note that when using direct addressing any instruction which refers to an address between 00h a nd 7Fh is referring to Internal Memory. Any instruction which refers to an address between 80h and FFh is referring to the SFR control registers that control the 8051 microcontroller itself. The obvious question that may arise is, "If direct addressing an address from 80h through FFh refers to SFRs, how can I access the upper 128 bytes of Internal RAM that are available on the 28 8052?" The answer is: You cant access them using direct addressing. As stated, if you directly refer to an address of 80h through FFh you will be referring to an SFR. However, you may access the 8052s upper 128 bytes of RAM by using the next addressing mode, "indirect addressing." Indirect Addressing Indirect addressing is a very powerful addressing mode which in many cases provides an exceptional level of flexibility. Indirect addressing is also the only way to access the extra 128 bytes of Internal RAM found on an 8052. Indirect addressing appears as follows: MOV A,@R0 This instruction causes the 8051 to analyze the value of the R0 register. The 8051 will then load the accumulator with the value from Internal RAM which is found at the address indicated by R0. For example, lets say R0 holds the value 40h and Internal RAM address 40h holds the value 67h. When the above instruction is executed the 8051 will check the value of R0. Since R0 holds 40h the 8051 will get the value out of Internal RAM address 40h (which holds 67h) and store it in the Accumulator. Thus, the Accumulator ends up holding 67h. Indirect addressing always refers to I nternal RAM; it never refers to an SFR. Thus, in a prior example we mentioned that SFR 99h can be used to write a value to the serial port. Thus one may think that the following would be a valid solution to write the value 1 to the serial port: 29 MOV R0,#99h ; Load the address of the serial port MOV @R0,#01h ; Send 01 to the serial port -- WRONG!! This is not valid. Since indirect addressing always refers to Internal RAM these two instructions would write the value 01h to Internal RAM address 99h on an 8052. On an 8051 these two instructions would produce an undefined result since the 8051 only has 128 bytes of Internal RAM. External Direct External Memory is accessed using a suite of instructions which use what I call "External Direct" addressing. I call it this because it appears to be direct addressing, but it is used to access external memory rather than internal memory. There are only two commands that use External Direct addressing mode: MOVX A,@DPTR MOVX @DPTR,A As you can see, both commands utilize DPTR. In these instructions, DPTR must first be loaded with the address of external memory that you wish to read or write. Once DPTR holds the correct external memory address, the first command will move the contents of that external memory address into th e Accumulator. The second command will do the opposite: it will allow you to write the value of the Accumulator to the external memory address pointed to by DPTR. External Indirect External memory can also be accessed using a form of indirect addressing which I call External Indirect addressing. This form 30 of addressing is usually only used in relatively small projects that have a very small amount of external RAM. An example of this addressing mode is: MOVX @R0,A Once again, the value of R0 is first read and the value of the Accumulator is written to that address in External RAM. Since the value of @R0 can only be 00h through FFh the project would effectively be limited to 256 bytes of External RAM. There are relatively simple hardware/software tricks tha t can be implemented to access more than 256 bytes of memory using External Indirect addressing; however, it is usually easier to use External Direct addressing if your project has more than 256 bytes of External RAM. 31 C Program : #include <stdlib.h> #include <conio.h> #include <time.h> #include <stdio.h> #include <dos.h> #include <bios.h> #define COM1 0 #define COM_INIT 0 #define COM_SEND 1 #define COM_RECEIVE 2 #define COM_STATUS 3 #include <graphics.h> int gdriver = DETECT, gmode, errorcode; int status,c; int midx, midy; int stangle , endangle ; int radius = 180; int b,w,i,*ptr,maxx,x,maxy,*ptr1,j,x1,cnt,y1,x2,y2; 32 /* initialize graphics and local variables */ char m,n; int main(void) { /* request auto detection */ initgraph(&gdriver, &gmode, "c: \\tc\\bgi "); /* read result of initialization */ errorcode = graphresult(); /* an error occurred */ if (errorcode != grOk) { printf("Graphics error: grapherrormsg(errorcode)); %s\n", printf("Press any key to halt:"); getch(); exit(1); /* terminate with an error code */ } setcolor(10); settextstyle(4 , HORIZ_DIR, 0); outtextxy(100,10," D.M. ") ; setcolor(11); clearviewport(); outtextxy(100,60," Project By") ; outtextxy(100,90," Mr. Punit Thakkar") ; outtextxy(100,120,"Mr. Mitesh Dave") ; 33 outtextxy(100,90," Ms. Darshini Desai") ; getch(); clearviewport(); midx = getmaxx() / 2; midy = getmaxy() / 2; setcolor(14); /* data1 = 0xe3; */ bioscom(COM_INIT,0xe3,COM1); outportb(0x3fc,0x3); line(0,midy,2*midx,midy); line(midx,0,midx,2*midy); setcolor(10); settextstyle(4 , HORIZ_DIR, 3); outtextxy(0,0," D.M. ") ; settextstyle(0 , HORIZ_DIR, 0); setcolor(11); outtextxy(0,60," Start Position Angle -") ; outtextxy(0,90," End Position Angle -") ; outtextxy(0,120," Te mp-") ; outtextxy(0,150,"Press m to s/w menu"); for(stangle=0,endangle=0;endangle<361;endangle= endangle+1.8) //9 34 { /* draw arc */ arc(midx, midy, stangle, endangle, radius); setcolor(12); setfillstyle(EMPTY_FILL,9);/* getma xcolor()); */ pieslice(midx, midy, stangle, endangle, radius); itoa(stangle,ptr,10); outtextxy(180,60,ptr); itoa(endangle,ptr1,10); outtextxy(180,90,ptr1); getch(); // transmit trigger pulse */ do { status=inportb(0x3fd); status=status&0x20; } while(!status); c=0x54; outportb(0x3f8,c); /* receive temp value */ do { status=inportb(0x3fd); status=status&0x1; } while(!status); c=inportb(0x3f8); 35 /* /c=45; */ itoa(c,ptr,10); outtextxy(90,120,ptr); delay(1000); b= getbkcolor(); w= getcolor(); setcolor(b); outtextxy(90,120,ptr); setcolor(w); m= getch(); if(m!='m') goto bb1; irobo: settextstyle(1 , HORIZ_DIR, 3); outtextxy(0,240,"Menu: ") ; settextstyle(0 , HORIZ_DIR, 0); setcolor(11); outtextxy(0,330," 4: Left") ; outtextxy(0,340," 6: Right") ; outtextxy(0,350," 8: Forward") ; outtextxy(0,360," 2: Backward") ; outtextxy(0,370," b: Back") ; outtextxy(0,380," q: quit") ; outtextxy(0,390," 9: F - R") ; outtextxy(0,400," 3: B - R") ; outtextxy(0,410," 1: B - L") ; 36 outtextxy(0,420," 7: F - L") ; bb2: m=getch(); if(m=='b') goto bb1; if(m=='q') exit(0); if(m=='2') { outportb(0x378,0x1); delay(1000); outportb(0x378,0x0); } if(m=='1') { outportb(0x378,0x9); delay(1000); outportb(0x378,0x0); } if(m=='3') { outportb(0x378,0x3); delay(1000); outportb(0x378,0x0); } 37 if(m=='7') { outportb(0x378,0xc); delay(1000); outportb(0x378,0x0); } if(m=='9') { outportb(0x378,0x6); delay(1000); outportb(0x378,0x0); } if(m=='8') { outportb(0x378,0x4); delay(1000); outportb(0x378,0x0); } if(m=='4') { outportb(0x378,0x8); delay(1000); outportb(0x378,0x0); } 38 if(m=='6') { outportb(0x378,0x2); delay(1000); outportb(0x378,0x0); } delay(1000); goto bb2; bb1: j=getcolor(); i=getbkcolor(); setcolor(i); itoa(endangle,ptr1,10); outtextxy(180,90,ptr1); setcolor(j); j=getcolor(); i=getbkcolor(); setcolor(i); itoa(c,ptr1,10); outtextxy(90,120,ptr1); setcolor(j); getch(); } } 39 FLOWCHART ON TRANSMITTER SIDE : START INITIALIZE TIMER INITIALIZE COM PORT INITIALIZE STACK CONFIGURE PORTS READ ONE CHANNEL (TEMP) GOTO TO NEXT Y IS DATA = SET VAL GET TEMP VALUE POSITION N TRANSMIT DATA ON RS232 REPEAT PROCESS 40 FLOWCHART ON RECEIVER SIDE: START INITIALIZE GRAPHIC CONTROLLER DISPLAY THE CHANNELS INITIALIZE COM PORTS READ DATA FROM RECEIVER STORE INTO ARRAY DISPLAY POSITION STATUS STORE INFORMATION 41 G RA P H I C M O D E O F C LA N GU A G E For representing the data in graphical form through C language, we use the ' graphic.h' header fiIe of c library. To use the 'graphic.h' file, we use the command as "# include<graphics.h>".In the graph ics mode to initialize the modes, we can use the function "initgraph ( )".Also to check the mode is available or not in the graphics, we can use the function "detectgraph ( )".The mode is established by "initgraph ( )"function can be terminated by the func tion "closegraph( )". Many functions are available in 'graphics.h' file of C such as circle ( ), rectangle ( ), getmaxx ( ), getmaxy ( ), etc to use the graphics mode efficiently. C FUNCTIONS I) #define (directive) -- Defines a macro # d e f i n e < i d l > [ « i d 2 > , . . . )] < t o k e n - s t r i n g > The #define directive defines a macro. Macros provide a mechanism for token replacement with or without a set of formal, function-line parameters. All subsequent instances of the identifier <idl> in the source text will be replaced by the text defined by <token -string>. static (keyword)--Preserves variable value static <data-definition>; OR static <function -definition>; A function or data element is only known within the scope of the current compile. 42 If you use the register keyw ord with a variable that is local to a function, it allows the last value of the variable to be preserved between successive calls to that function. 2) initgraph-- Initializes the graphics system. Syntax: void far initgraph (int far *graphdriver, intfar *graphmode, char far *pathtodriyer); Prototype in: graphics.h Initgraph initializes the graphics system by loading a graphics driver from the disk ( or validating a registered driver) and putting the system into graphics mode. *graphdriver - is an integer that specifics the graphics driver to be used. you can give it a value using a constant of the graphics_drivers enumeration type *graphmode- the (integer value) that specifies the initial graphics mode (unless *graphdriver=DETECT) if graphdriver =DETEC T, initgraph sets *graphmode to the highest resolution available for detected driver. 3) cIearviewport -- Clears the current viewport. Syntax: void far clearviewport(void); Prototype in: graphics.h 43 4) setcolor -- Sets the current drawing color. Syntax: void farsetcolor (int color); Prototype in: graphics.h 5) settextstyle--Sets the current text characteristics. Syntax: void far settextstyle (int font, int direction, int charsize); Prototype in: graphics.h q) outtextxy--Displays a string at the specified location (graphics mode). Syntax: void far outtextxy (int x, int y, char far *textstring); Prototype in: graphics.h 7) geteh and getche--Gets character from console, with echoing to screen(getche), or without echoing to screen (getch). Syntax: int getch(void); int getche(void); 8) bioscom RS-232 communications I/O. Syntax: int bioscom(int cmd, char abyte, int port); Prototype in: bios.h 44 FOLLOWING ARE SOME OF THE ARGUMENTS USED: abyte- combination of bits that specifies COM port settings (ign ored id cmd= 2 or 3) cmd- Specifies the I/O operation to perform port- Identifies the I/O operation to perform 9) inportb --Reads a byte from hardware port. Syntax: unsigned char inportb(int portid); Prototype in: dos.h p o r t i d - i n p o r t p o r t t h a t i n p o r t s &i n p o r t b r e a d s f r o m 10) outportb -- Outputs a byte to a hardware port. Syntax: void outportb (int portid, unsigned char value); Prototype in: dos.h portid- outport port that outports & outportb reads from 11) closegraph - Shuts down the graphics system. Syntax: void far closegraph (void); Prototype in: graphics.h 12) cprintf- Writes formatted output to the tcxt window on the screen. Syntax : i n t c p r i n t f ( c o n s t c h a r * f o r m a t [ , a r g u m e n t , … …] ) ; prototype in : conio.h 45 FUNCTIONS USED IN C PROGRAM: 1. "initgraph": It is placed under library GRAPHICS.h. It is used to initialize the graphics system by loading the graphics driver from the disk (or validating a registered driver), the putting the system into graphics mode. It also resets all graphics settings. De claration: initgraph (graphics driver) 2. "closegraph": It shuts down the graphics mode and restore the scree"n in to the mode it was before" initgraph". The "closegraph" deallocates all the memory allocated by the graph system. Declaration: closegraph() 3. "setviewport": it sets the curr-ent view port of the current graphics output. The viewport corners all absolute screen co - ordinates by (left/top) and (right, bottom). In addition to a clip parameter is also provided to determine whether the drawings ar e clipped at the current viewpoint boundcrries. If clip is non -zero, all drawings will be clipped to the current viewport. Declaration: setviewport (left, top) and (right, bottom). 4. "clearviewport": it clears the current view port. It erases the viewport and moves the current position (CP)to home(O,O) relative to the cu rrent viewport() 5. "arc", "circle": thi,s function facilitates the drawing of circle arc and circle in the current drawing colour. The arc function requires the parameters such as cent er poent of the are, x,y; co -ordinates of the position of the arc, start angle of the arc(stangle) and end 46 angle (endangle) of the arc. A function is specified in terms of three paramaters namely X- co-ordinates Y - co-ordinates that speCifies its position and the radius of circle. Declaration: circle(x,y,radius) 6. "delay": it suspects the execution for an interval specified in milliseconds. With a call to "delay" , the current program is suspended from the execution for the time specified by the argument in milliseconds. It is not necessary to make a calibration call to a delay before using it. The delay is accurate 0.1 millisecond. Declaration: delay(time in milliseconds) 7. "line": it allows us to draw a line between two points. Such a function has x, y co-ordinates of the two points as its parameters .an extension of line function is :Iineto" function that enables us to draw a line from the current position to the x, y, co -ordinates specified. Declaration: Ii ne(xl, yl, x2,y2), lineto(x, y). 8. "'rectangle": it enables us to draw rectangle in current line style, thickness and drawing colour. Such a function has four parameters as its argument namely left, top, right, bottom. The (left, top) co ordinates from the upper left corner of rectangle while the (right, bottom) co-ordinates form the lower corner of the rectangle. Declaration: rectangle(left, top, right, bottom). 9. "outtext": it will output characters that are enclosed within thequotation marks. Declaration: outtext(" text”). 10."getbkcolor & setbkcolor" : "getcolor" returns the current background color while "setbkcolor" sets the current background color or by giving the number associated with the color. decleration: setbkcolor(BLUE). 47 11."inport", "inportb", "outport", "outportb": "inport" reads a word from a hardware port. "outport" outputs a word to the hardware port. "outportb" outputs a byte to the har,dware port. The "inport" and "outportb" have a ."portid" as their argument where "portid" is the destination from where "inport", "inportb" wi ll read. Similarly "outport", "outportb" write a word or a byte to the specified port. "outport" writes the lower byte of te value to the lower byte of the value to the lower portion of portid while it writ~s the higher byte of value to the higher portion of the portid. 12. "setcolor" & "getcolor" : "setcolor" sets the current drawing color while "getcolor" returns the current drawing color. To select a drawing color one can 'pass either the color number or the equivalent color name.Declaration: setcolor( color name) color name) getcolor(color name). 13." settextstyle" :. it sets the characteristics of the current text such as text font, direction in which the text is to be displayed i.e. horizontal or vertical and the size of the characters. Such a functi on has three parameters namely font, direction, character size as its argument. A call to "settextstyle" affects all the text output by "outtext" and "outtexty". The font name and their settings are defined in GRAPHICS.h library. Declaration: settextstyle(font,direction,size). 48 Features The unit developed by us has various features: 1) Compactness: The unit is much more compact as the PCB is reduced to almost one fourth of the original PCB. Thus it occupies less desktop area. 2) Versatileness: The switching unit developed by us is very versatile as you can access any kind of load through it . You can even connect desired no. of loads to it. 3) Flexibility: Since it uses a micro -controller it offers lot of flexi bility to the programmer for the programming purpose, as well as for the user since it is user friendly. 4) Longer period of service: Since the components used in the circuit are not susceptible to rough handling, it offers a longer period of service. 5) Less experience: The PCB uses circuits that are very cheap. They are easily accessible as their voltage & power requirement is less. These circuits are easy to troubleshoot, and so their voltage and so their maintenance cost is also low. So it is affordable by a common man also. 6) Easy availability : The components is used in the circuit are easily available in the market. The components are also replaceable since IC pads are used. 49 APPLICATIONS 50 A p p l i c at i on s : The “ Embedded System Based Disaster M anagement” has a wide range of applications . The main objective of this unit is to detect the live human body via a sensor that detects the temperature of the living being. Here a has bein g used. The key aspect beyond using a wireless vehicle is that one access the damaged site from a remote area. It is applicable in the following areas: 1.Disaster Management : In the current project it is used to detect living beings by detecting th e temperature of the living being ( around 37o C ). It is mainly used when natural disasters like earthquake strikes. 2.Space applications : It can be used for space exploration to determine various properties of heavenly bodies , as in, the MARS ROVER. 51 MERITS & DEMERITS 52 Merits: 1. It uses very less components and power consumption is low its cost is very less. 2. Feedback is received in form system this helps in carrying out rescue operation quickly. 3. Instant switching is done without any delay. 4. It has no distance limitation if wireless data transmission is used. Demerits : 1. The unit cannot be accessed when the vehicle is dead. 2. T h e p r o j e c t u s e s s e r i a l p o r t f o r t r a n s m i s s i o n o f d a t a w h i c h is a wired link hence there is distance limitation . 53 Future Expansion: Although our circuit is very sophisticated, complete and precise but still to provide more flexibility to the user some provision should be included in our unit which includes: Wireless Link for transmission and reception: Wireless link can used for transmission and reception of data which can indeed be multiplexed and transmitted while controlling the vehicle wirelessly, thus elimi nating the use of serial transmission and hence the system can become distance independent. Additional Application : The system may also include a camera along with the sensor module which can be controlled to provide visual display. This may be included as an additional application. 54 TESTING AND MEASURING 55 T e st i n g an d T r oub l e - s h o ot i n g Before checking whether the circuit is working or not we tested it part by part. First of all we tested the components individually using digital meter, LCR -Q meter and IC tester. After testing the components we tested : Relay circuit: The relays were checked by giving each an external 12V DC supply . Further its outputs i.e. NO & NC conditions were checked using a multi-meter. Trouble-shooting : Trouble-shooting began at very first stage after designing the PCB, which contained many open and short paths, which were checked with the help of a multi -meter and were then rectified as required. After soldering, the soldering was not found up to the mark and we found number of short paths, which were then corrected one by one. As expected the circuit did not function in the intended manner, which actually began the real trouble -shooting. It was found that some components were damaged due to over heating and improper soldering. 56 Bibliography 57 SR.NO AUTHOR TITLE OF EDITION PUBLISHER BOOK 1. 2. Bossard PCB Layout & 3rd Tata Mc Graw Designing Hill Let us C 4th Bpb Kenneth 8051 3rd Tata Mc Graw Ayala Architecture Yashwant Kanetkar 3. 4. Stephen Kochan G. Programming Hill 2nd in C CBS Publishers & Distributors Along with the above reference books the following sites were also referred: Rs232c - website www.maxsion.com Batteries - website www.exide.com 89c51_MicrocontroJler - website www.atmel.com Some forums: www.edaboard.com www.electronics-lab.com/forum/index.html my.integritynet.com.au/purdic/ 58 59 60