Académique Documents
Professionnel Documents
Culture Documents
SRTIST/ECE
IR SECTION 1
LCD
IR SECTION 2
A T 8 9 S 5 2
RED LED 1
GREEN LED 1
GREEN LED 2
RESET CIRCUIT
L293D
STEPPER MOTOR
SRTIST/ECE
CIRCUIT DIAGRAM:
SRTIST/ECE
Power supply
A variable regulated power supply, also called a variable bench power supply, is One where you can continuously adjust the output voltage to your requirements.
Stepper motor
This is used to open and close the gates automatically when it is rotated clock wise or anticlockwise direction.
Proximity Sensor
Two IR sensor pairs (IC 555) are used for transmitting and receiving signals.
Buzzer Alarm
When the security system detects an intruder, the microcontroller activates the Buzzer alarm and the telephone auto dialer.
SRTIST/ECE
SRTIST/ECE
Port 0 Port 0 is an 8-bit open drain bi-directional I/O port. As an output port, each pin can sink eight TTL inputs. When 1s are written to port 0 pins, the pins can be used as high-impedance inputs. Port 0 can also be configured to be the multiplexed low-order, address/data bus during accesses to external program and data memory. In this mode, P0 has internal pullups. Port 0 also receives the code bytes during Flash programming and outputs the code bytes during program verification. External pull-ups are required during program verification. Port 1 Port 1 is an 8-bit bi-directional I/O port with internal pull-ups. The Port 1 output buffers can sink/source four TTL inputs. When 1s are written to Port 1 pins, they are pulled high by the internal pull-ups and can be used as inputs. As inputs, Port 1 pins that are externally being pulled low will source current (IIL) because of the internal pull-ups. In addition, P1.0 and P1.1 can be configured to be the timer/counter 2 external count input (P1.0/T2) and the timer/counter 2 trigger input (P1.1/T2EX), respectively.
SRTIST/ECE
Port Pin Alternate Functions P1.0 T2 (external count input to Timer/Counter 2), clock-out P1.1 T2EX (Timer/Counter 2 capture/reload trigger and direction control) Port 1 also receives the low-order address bytes during Flash programming and program verification. Port 2 Port 2 is an 8-bit bi-directional I/O port with internal pull-ups. The Port 2 output buffers can sink/source four TTL inputs. When 1s are written to Port 2 pins, they are pulled high by the internal pull-ups and can be used as inputs. As inputs, Port 2 pins that are externally being pulled low will source current (IIL) because of the internal pull-ups. Port 2 emits the high-order address byte during fetches from external program memory and during accesses to external data memory that uses 16-bit addresses (MOVX @ DPTR). In this application, Port 2 uses strong internal pull-ups when emitting 1s. During accesses to external data memory that uses 8-bit addresses (MOVX @ RI), Port 2 emits the contents of the P2 Special Function Register. Port 2 also receives the high-order address bits and some control signals during Flash programming and verification. Port 3 Port 3 is an 8-bit bi-directional I/O port with internal pull-ups. The Port 3 output buffers can sink/source four TTL inputs. When 1s are written to Port 3 pins, they are pulled high by the internal pull-ups and can be used as inputs. As inputs, Port 3 pins that are externally being pulled low will source current (IIL) because of the pull-ups. Port 3 also serves the functions of various special features of the AT89S51, as shown in the following table.
SRTIST/ECE
Port Pin Alternate Function Port Pin P3.0 P3.1 P3.2 P3.3 P3.4 P3.5 P3.6 P3.7 Alternate Functions RXD (serial input port) TXD (serial output port) INT0 (external interrupt 0) INT1 (external interrupt 1) T0 (timer 0 external input) T1 (timer 1 external input) WR (external data memory Write strobe) RD (external data memory read strobe)
Table 2.1: Port pins & their alternate functions Port 3 also receives some control signals for Flash programming and programming verification. RST Reset input. A high on this pin for two machine cycles while the oscillator is running resets the device. ALE/PROG Address Latch Enable is an output pulse for latching the low byte of the address during accesses to external memory. This pin is also the program pulse input (PROG) during Flash programming. In normal operation, ALE is emitted at a constant rate of 1/6 the oscillator frequency and may be used for external timing or clocking purposes. Note, however, that one ALE pulse is skipped during each access to external data memory. If desired, ALE operation can be disabled by setting bit 0 of SFR location 8EH.
PSEN
10
SRTIST/ECE
Program Store Enable is the read strobe to external program memory. When the AT89S52 is executing code from external program memory, PSEN is activated twice each machine cycle, except that two PSEN activations are skipped during each access to external data memory. EA/VPP External Access Enable EA must be strapped to GND in order to enable the device to fetch code from external program memory locations starting at 0000H up to FFFFH. Note, however, that if lock bit 1 is programmed, EA will be internally latched on reset. EA should be strapped to VCC for internal program executions. This pin also receives the 12-volt programming enable voltage (VPP) during Flash programming when 12-volt programming is selected. XTAL1 Input to the inverting oscillator amplifier and input to the internal clock operating circuit. XTAL2 Output from the inverting oscillator amplifier
Oscillator Characteristics XTAL1 and XTAL2 are the input and output, respectively, of an inverting amplifier which can be configured for use as an on-chip oscillator, Either a quartz crystal or ceramic resonator may be used.
11
SRTIST/ECE
12
SRTIST/ECE
mode used in the instruction specifies whether the CPU accesses the upper 128 bytes of RAM or the SFR space. Instructions that use direct addressing access SFR space. For example, the following direct addressing instruction accesses the SFR at location 0A0H (which is P2). MOV 0A0H, #data Instructions that use indirect addressing access the upper 128 bytes of RAM. For example, the following indirect addressing instruction, where R0 contains 0A0H, accesses the data byte at address 0A0H, rather than P2 (whose address is 0A0H). MOV @R0, #data Note that stack operations are examples of indirect addressing, so the upper 128 bytes of data RAM are available as stack space.
Timer 0 and 1
Timer 0 and Timer 1 in the AT89S52 operate the same way as Timer 0 and Timer 1 in the AT89S51.
Timer 2
Timer 2 is a 16-bit Timer/Counter that can operate as either a timer or an event counter. The type of operation is selected by bit C/T2 in the SFR T2CON (shown in Table 2). Timer 2 has three operating modes: capture, auto-reload (up or down counting), and baud rate generator. The modes are selected by bits in T2CON, as shown in Table 3. Timer 2 consists of two 8-bit registers, TH2 and TL2. In the Timer function, the TL2 register is incremented every machine cycle. Since a machine cycle consists of 12 oscillator periods, the count rate is 1/12 of the oscillator frequency. In the Counter function, the register is incremented in response to a 1-to-0 transition at its corresponding external input pin, T2. In this function, the external input is sampled during S5P2 of every machine cycle. When the samples show a high in one cycle and a low in the next cycle, the count 15
SRTIST/ECE
is incremented. The new count value appears in the register during S3P1 of the cycle following the one in which the transition was detected. Since two machine cycles (24 oscillator periods) are required to recognize a 1-to-0 transition, the maximum count rate is 1/24 of the oscillator frequency. To ensure that a given level is sampled at least once before it changes, the level should be held for at least one full machine cycle
2.4 REGISTERS
Registers: In the CPU, registers are used to store information temporarily. That information could be a byte of data to be processed, or an address pointing to the data to be fetched. The vast majority of 8052 registers are 8bit registers. In the 8052 there is only one data type: 8bits. The 8bits of a register are shown in the diagram from the MSB (most significant bit) D7 to the LSB (least significant bit) D0. The most widely used registers of the 8051 are A (accumulator), B, R0, R1, R2, R3, R4, R5, R6, R7, DPTR (data pointer), and PC (program counter). All of the above registers are 8-bits, except DPTR and the program counter.
16
SRTIST/ECE
Brief description of operation: Gives out well regulated +5V output, output current capability of 100 mA
Circuit protection: Built-in overheating protection shuts down output when regulator IC gets too hot
Circuit complexity: Very simple and easy to build Circuit performance: Very stable +5V output voltage, reliable operation Availability of components: Easy to get, uses only very common basic components
Design testing: Based on datasheet example circuit, I have used this circuit successfully as part of many electronics projects
17
SRTIST/ECE
Applications: Part of electronics devices, small laboratory power supply Power supply voltage: Un regulated DC 8-18V power supply Power supply current: Needed output current + 5 mA
18
SRTIST/ECE
TRANSFORMER:
Usually, DC voltages are required to operate various electronic equipment and these voltages are 5V, 9V or 12V. But these voltages cannot be obtained directly. Thus the AC input available at the mains supply i.e., 230V is to be brought down to the required voltage level. This is done by a transformer. Thus, a step down transformer is employed to decrease the voltage to a required level.
RECTIFIER:
19
SRTIST/ECE
A rectifier converts AC to DC, but the DC output is varying. The rectifier may be a half wave or a full wave rectifier. In this project, a bridge rectifier is used because of its merits like good stability and full wave rectification. The Bridge rectifier is a circuit, which converts an AC voltage to dc voltage using both half cycles of the input ac voltage.
FILTER:
Capacitive filter is used in this project. It removes the ripples from the output of rectifier and smoothens the D.C. Output received from this filter is constant until the mains voltage and load is maintained constant. However, if either of the two is varied, D.C. voltage received at this point changes. Therefore a regulator is applied at the output stage.
Eliminates ripple by setting DC output to a fixed voltage. In order to obtain these voltage levels, 7805 and 7812 voltage regulators are to be used. The first number 78 represents positive supply and the numbers 05, 12 represent the required output voltage levels. PIN DESCRIPTION: Pin No 1 2 3 Function Input voltage (5V-18V) Ground (0V) Regulated output; 5V (4.8V-5.2V) Name Input Ground Output
21
SRTIST/ECE
In gallium arsenide diode, recombination is predominantly a radiation recombination and the probability of this radioactive recombination far exceeds that in either germanium or silicon. Hence Ga As LED has much higher efficiency in terms of Photons emitted per carrier. The internal efficiency of Ga As LED may be very close to 100% but because of high index of refraction, only a small fraction of the internal radiation can usually come out of the device surface. In spite of this low efficiency of actually radiated light , these LEDs are efficiency used as light emitters in visual display units and in optically coupled circuits, The efficiency of light generation increases with the increase of injected current and with decreases in temperature. The light so generated is concentrated near the junction since most of the charge carriers are obtained within one diffusion length of the diode junction. The following are the merits of LEDs over conventional incandescent and other types of lamps 1. Low working voltages and currents 2. Less power consumption 3. Very fast action 4. Emission of monochromatic light 5. small size and weight 6. No effect of mechanical vibrations 7. Extremely long life Typical LED uses a forward voltage of about 2V and current of 5 to 10mA. Ga As LED produces infra-red light while red, green and orange lights are produced by gallium arsenide phosphide (Ga As) and gallium phosphide (Gap).
Example:
Circuit symbol:
Fig. 4 LED
Function:
22
SRTIST/ECE
Testing an LED:
Never connect an LED directly to a battery or power supply! It will be destroyed almost instantly because too much current will pass through and burn it out. LEDs must have a resistor in series to limit the current to a safe value, for quick testing purposes a 1k resistor is suitable for most LEDs if your supply voltage is 12V or less. Remember to connect the LED the correct way round!
Tri-color LEDs:
The most popular type of tri-color LED has a red and a green LED combined in one package with three leads. They are called tri-color because mixed red and green light appears to be yellow and this is produced when both the red and green LEDs are on. The diagram shows the construction of a tri-color LED. Note the different lengths of the three leads. The centre lead (k) is the common cathode for both LEDs; the outer leads (a1 and a2) are the anodes to the LEDs allowing each one to be lit separately, or both together to give the third color. Tri-color LEDs are can designed for any application where wash lights are needed. Smooth and output even makes these lights perfect for front light applications.it eliminates multi colored shadows.
Bi-color LEDs:
A bi- color LED has two LEDs wired in 'inverse parallel' (one forwards, one backwards) combined in one package with two leads. Only one of the LEDs can be lit at one time and they are less useful than the tri-color LEDs described above.
24
SRTIST/ECE
R = (VS - VL) / I
VL=LED voltage.
voltage
(usually
2V,
but
4V
for
blue
and
white
LEDs)
I = LED current (e.g. 20mA), this must be less than the maximum permitted, VS =supply
Working out the LED resistor formula using Ohm's law: Ohm's law says that the resistance of the resistor, R = V/I, Where: V=voltage across resistor I=current through resistor.
5.1: DESCRIPTION
The Device is a monolithic integrated high voltage, high current four channel driver designed to accept standard DTL or TTL logic levels and drive inductive loads (such as relays solenoids, DC and stepping motors) and switching power transistors. 26
SRTIST/ECE
To simplify use as two bridges each pair of channels is equipped with an enable input. A separate supply input is provided for the logic, allowing operation at a lower voltage and internal clamp diodes are included. This device is suitable for use in switching applications at frequencies up to 5 kHz. The L293D is assembled in a 16 lead plastic package which has 4 center pins connected together and used for heat sinking. The L293DD is assembled in a 20 lead surface mount which has 8 center pins connected together and used for heat sinking. The ULN2001A, ULN2002A, ULN2003 and ULN2004Aare high Voltage, high current Darlington arrays each containing seven open collector Darlington pairs with common emitters. Darlington pairs are back to back connection of two transistors with some source resistors.
BLOCK DIAGRAM:
PIN CONNECTIONS:
27
SRTIST/ECE
28
SRTIST/ECE
5.3 ADVANTAGES:
Efficient way of speed control of DC motor. Produces more torque.
29
SRTIST/ECE
5.4 APPLICATIONS:
Industries. Home appliance.
6. STEPPER MOTOR
6.1 DESCRIPTION:
A stepper motor (or step motor) is a brushless, synchronous electric motor that can divide a full rotation into a large number of steps. The motor's position can be controlled precisely, without any feedback mechanism (see open loop control). Stepper motors are similar to switched reluctance motors (which are very large stepping motors with a reduced pole count, and generally are closed-loop commutated).
make the motor shaft turn, first one electromagnet is given power, which makes the gear's teeth magnetically attracted to the electromagnet's teeth. When the gear's teeth are thus aligned to the first electromagnet, they are slightly offset from the next electromagnet. So when the next electromagnet is turned on and the first is turned off, the gear rotates slightly to align with the next one, and from there the process is repeated. Each of those slight rotations is called a "step," with an integral number of steps making a full rotation. In that way, the motor can be turned by a precise angle.
closed loop mode if the rotor position error becomes too large -- this will allow the system to avoid hunting or oscillating, a common servo problem. There are three main types of stepper motors: 1. Permanent stepper 2. Hybrid synchronous stepper 3. Variable reluctance stepper.
32
SRTIST/ECE
7. LCD
7.1 DESCRIPTION:
Liquid crystal display (LCD) has material which combines the properties of both liquid and crystals. They have a temperature range within which the molecules are almost as mobile as they would be in a liquid, but are grouped together in an order form similar to a crystal. A model described here is for its low price and great possibilities most frequently used in practice. It is based on the HD44780 microcontroller ( Hitachi) and can display messages in two lines with 16 characters each. It displays all the alphabets, Greek letters, punctuation marks, mathematical symbols etc. In addition, it is possible to display symbols that user makes up on its own. Automatic shifting message on display (shift left and right), appearance of the pointer, backlight etc. are considered as useful characteristics. These components are specialized for being used with the microcontrollers, which means that they cannot be activated by standard IC circuits. They are used for writing different messages on a miniature LCD.
33
SRTIST/ECE
Control Signals It's function = 0 Writes character in display R/W = 1 Reads from display = 0 Selects command register = 1 Selects Data register to display RS/DI character = 0 Disables the display = 1 Enables the display
En
Table 7.1: LCD control signals description LCD displays designed around Hitachi's LCD HD44780 module, are inexpensive, easy to use, and it is even possible to produce a readout using the 8 x 80 pixels of the display. Hitachi LCD displays have a standard ASCII set of characters plus Japanese, Greek and mathematical symbols. This display contains two internal byte-wide registers, one for command and second for characters to be displayed. There are three control signals called R/W, DI/RS and En. The table given below will tell you what the use of these three signals is. By making RS/DI signal 0 you can send different commands to display. These commands are used to initialize LCD, to select display pattern, to shift cursor or screen etc. The different commands and their functions are as given below
34
SRTIST/ECE
For an 8-bit data bus, the display requires a +5V supply plus 11 I/O lines. For a 4-bit data bus it only requires the supply lines plus seven extra lines. When the LCD display is not enabled, data lines are tri-state which means they are in a state of high impedance (as though they are disconnected) and this means they do not interfere with the operation of the microcontroller when the display is not being addressed. The LCD also requires 3 "control" lines from the microcontroller. Enable (E) When (E) line is high, the LCD checks the state of the two control lines and
responds accordingly. When E is low, the LCD is disabled. Read/Write (R/W) When it is low, data is written to the LCD. When it is high, data is read from the LCD. Register select (RS) When it is low, an instruction is being written to the LCD. When it is high, a character is being written to the LCD. Bits Function RS/DIR/W D7 D6 D5 D4 D3 D2 D1 D0 0 0 0 0 0 0 0 0 0 1 Clear LCD memory, Home cursor 0 0 0 0 0 0 0 0 1 0 Clear and Home cursor only s = 1/0 : Shift screen/cursor, I/O = 1/0 0 0 0 0 0 0 0 1 I/O s : shift R/L D = 1/0 : Screen On/Off. C = 1/0 : 0 0 0 0 0 0 1 D C B cursor On/Off. B = 1/0 : Cursor blink/no blink S/C = 1/0 : Screen / Cursor. R/L = 1/0 : Shift one space right / left D/L = 1/0 : 8/4 bits per character. N = 1/0 : 2/1 rows of char. F = 1/0 : 510/57 dots/char. Write to char. RAM address after this Writes to display RAM address after this BF = 1/0 : display is busy/not busy Write byte to last RAM chosen
SRTIST/ECE
S/C R/L 0
0 0 0
0 0 0 1 0
0 0 1
0 1
DL N
Char address
Character type
reduce the total number of communication lines to seven. The wiring for connection via a 4-bit data bus is shown in the diagram below. In this example we use an LCD display with 2x16 characters.
LCD SCREEN:
LCD screen consists of two lines with 16 characters each. Each character consists of 5x7 dot matrix. Contrast on display depends on the power supply voltage and whether messages are displayed in one or two lines. For that reason, variable voltage 0-Vdd is applied on pin marked as Vee. Trimmer potentiometer is usually used for that purpose. Some versions of displays have built in backlight (blue or green diodes). When used during operating, a resistor for current limitation should be used (like with any LE diode).
7.3 FEATURES:
16 Characters x 2 Lines 5x7 Dot Matrix Character + Cursor HD44780 Equivalent LCD Controller/driver Built-In 4-bit or 8-bit MPU Interface Standard Type Works with almost any Microcontroller Maximum input voltage: 5.3VDC 37
SRTIST/ECE
Operating input voltage: 5VDC 8-bit interface data bus Controller: HD47780 equivalent 14 pin/terminals
8. IR SENSORS
8.1 INTRODUCTION:
This infrared sensor also called as IR sensors, consists of two parts: 1. IR transmitter circuit 2. IR receiver unit
Fig. 8.1 IR Transmitter unit The transmitter circuit consists of the following components: 1. IC 555 2. Resistors 38
SRTIST/ECE
3. Capacitors and IR LED. The IR LED emitting infrared light is put on in the transmitting unit. To generate IR signal, 555 IC based Astable Multivibrator is used. Infrared LED is driven through transistor BC 548. IC 555 is used to construct an astable multivibrator which has two quasi-stable states. It generates a square wave of frequency 38 kHz and amplitude 5Volts. It is required to switch ON the IR LED.
Fig. 8.2 IR Receiver unit The receiver circuit consists of the following components: 1. TSOP1738 (sensor) 2. IC 555 3. Resistors 4. Capacitors
39
SRTIST/ECE
The receiver unit consists of a sensor and its associated circuitry. In receiver section, the first part is a sensor, which detects IR pulses transmitted by IR-LED. Whenever a train crosses the sensor, the output of IR sensor momentarily transits through a low state. As a result the monostable is triggered and a short pulse is applied to the port pin of the 8051 microcontroller. On receiving a pulse from the sensor circuit, the controller activates the circuitry required for closing and opening of the gates and for track switching.
9. SOFTWARE DESCRIPTION
ABOUT SOFTWARE
Software used: *Keil software for c programming 9.1 ABOUT KEIL SOFTWARE: Keil compiler is software used where the machine language code is written and compiled. After compilation, the machine source code is converted into hex code which is to be dumped into the microcontroller for further processing. Keil compiler also supports C language code. 9.2 STEPS TO WRITE AN ASSEMBLY LANGUAGE PROGRAM IN KEIL AND HOW TO COMPILE IT: Install the Keil Software in the PC in any of the drives. After installation, an icon will be created with the name Keil uVision3. Just drag this icon onto the desktop so that it becomes easy whenever you try to write programs in keil. Double click on this icon to start the keil compiler.
40
SRTIST/ECE
A page opens with different options in it showing the project workspace at the leftmost corner side, output window in the bottom and an ash coloured space for the program to be written.
Now to start using the keil, click on the option project. A small window opens showing the options like new project, import project, open project etc. Click on New project. A small window with the title bar Create new project opens. The window asks the user to give the project name with which it should be created and the destination location. The project can be created in any of the drives available. You can create a new folder and then a new file or can create directly a new file.
After the file is saved in the given destination location, a window opens where a list of vendors will be displayed and you have to select the device for the target you have created.
The most widely used vendor is Atmel. So click on Atmel and now the family of microcontrollers manufactured by Atmel opens. You can select any one of the microcontrollers according to the requirement.
When you click on any one of the microcontrollers, the features of that particular microcontroller will be displayed on the right side of the page. The most appropriate microcontroller with which most of the projects can be implemented is the AT89C51. Click on this microcontroller and have a look at its features. Now click on OK to select this microcontroller.
A small window opens asking whether to copy the startup code into the file you have created just now. Just click on No to proceed further. Now you can see the TARGET and SOURCE GROUP created in the project workspace. Now click on File and in that New. A new page opens and you can start writing program in it. After the program is completed, save it with any name but with the .asm extension. Save the program in the file you have created earlier.
41
SRTIST/ECE
You can notice that after you save the program, the predefined keywords will be highlighted in bold letters. Now add this file to the target by giving a right click on the source group. A list of options open and in that select Add files to the source group. Check for this file where you have saved and add it.
Right click on the target and select the first option Options for target. A window opens with different options like device, target, output etc. First click on target. Since the set frequency of the microcontroller is 11.0592 MHz to interface with the PC, just enter this frequency value in the Xtal (MHz) text area and put a tick on the Use on-chip ROM. This is because the program what we write here in the keil will later be dumped into the microcontroller and will be stored in the inbuilt ROM in the microcontroller.
Now click the option Output and give any name to the hex file to be created in the Name of executable text area and put a tick to the Create HEX file option present in the same window. The hex file can be created in any of the drives. You can change the folder by clicking on Select folder for Objects.
Now to check whether the program you have written is errorless or not, click on the icon exactly below the Open file icon which is nothing but Build Target icon. You can even use the shortcut key F7 to compile the program written.
To check for the output, there are several windows like serial window, memory window, project window etc. Depending on the program you have written, select the appropriate window to see the output by entering into debug mode.
The icon with the letter d indicates the debug mode. Click on this icon and now click on the option View and select the appropriate window to check for the output. After this is done, click the icon debug again to come out of the debug mode. The hex file created as shown earlier will be dumped into the microcontroller with the help of software called PROLOAD.
9.3 PROLOAD: 42
SRTIST/ECE
Proload is software which accepts only hex files. Once the machine code is converted into hex code, that hex code has to be dumped into the microcontroller placed in the programmer kit and this is done by the Proload. Programmer kit contains a microcontroller on it other than the one which is to be programmed. This microcontroller has a program in it written in such a way that it accepts the hex file from the keil compiler and dumps this hex file into the microcontroller which is to be programmed. As this programmer kit requires power supply to be operated, this power supply is given from the power supply circuit designed above. It should be noted that this programmer kit contains a power supply section in the board itself but in order to switch on that power supply, a source is required. Thus this is accomplished from the power supply board with an output of 12volts or from an adapter connected to 230 V AC.
Install the Proload Software in the PC. Now connect the Programmer kit to the PC (CPU) through serial cable. Power up the programmer kit from the ac supply through adapter. Now place the microcontroller in the GIF socket provided in the programmer kit. Click on the Proload icon in the PC. A window appears providing the information like Hardware model, com port, device type, Flash size etc. Click on browse option to select the hex file to be dumped into the microcontroller and then click on Auto program to program the microcontroller with that particular hex file.
The status of the microcontroller can be seen in the small status window in the bottom of the page. After this process is completed, remove the microcontroller from the programmer kit and place it in your system board. Now the system board behaves according to the program written in the microcontroller.
43
SRTIST/ECE
The following sections list the Vision3 commands that can be reached by menu commands, toolbar buttons, and keyboard shortcuts. The Vision3 commands are grouped mainly based on the appearance in the menu bar:
File Menu and File Commands Edit Menu and Editor Commands o Outlining Menu o Advanced Menu o Selecting Text Commands View Menu Project Menu and Project Commands Debug Menu and Debug Commands Flash Menu Peripherals Menu Tools Menu SVCS Menu Window Menu Help menu
10. CODING
Program written in C language:
#include<at89x52.h> /********************* Port Initialization ***************************************/ #define motor P2 #define ir1 P1_1 #define ir2 P1_0 #define red P3_4 #define yellow P3_5 #define green P3_6 /******************** generating a delay of 1 sec ********************************/ Delay () { int i; for (i=0;i<=2500;i++); 44
SRTIST/ECE
} /******************** generating a delay of 10 sec ********************************/ delay1() { int i; for (i=0;i<=25000;i++); } /******************** Rotating motor in clockwise direction ***********************/ motor_cw () { int j; for (j=0;j<4;j++) { P2=0x66; Delay (); P2=0x33; delay(); P2=0x99; delay(); P2=0xcc; delay(); } } /******************* Rotating motor in anti clockwise direction *******************/ motor_acw() { int j; for(j=0;j<4;j++) { P2=0x66; delay(); P2=0xcc; delay(); P2=0x99; delay(); P2=0x33; delay(); 45
SRTIST/ECE
} } /******************* Beginning of the main program ********************************/ main() { unsigned int a=0, b=1; /* Initialising temporary variables */ while(1) { red=1; yellow=1; green=0;
if((ir1==0 || ir2==0) && a==0) /* Condition to check the arrival of the train */ { motor_cw(); /* Closing the gate */ red=0; yellow=1; green=1; for(;((ir1==1 && ir2==0) || (ir1==0 && ir2==1));) /* Condition for the gate to be closed while the train is present at the two sensors */ { if((ir1==1 && ir2==1) || (ir1==1 || ir2==1) || (ir1==0&ir2==0)) { a=1; b=0; } } if((ir1==0 && ir2==1 ) || (ir2==0 && ir1==1)||(ir1==1 && ir2==1)) /* Condition for the gate to be closed while the train is in between the two sensors */ { for(;(ir1==1 && ir2==1);) ; a=1; b=0; } }
46
SRTIST/ECE
if((ir2==1 && ir1==1) && b==0) /* Condition to check the departure of train from the railway crossing */ { red=1; yellow=0; motor_acw(); /* Opening the gate */ delay(); delay1(); yellow=1; green=0; delay(); delay1(); delay(); green=1; b=1; a=0; } }
47
SRTIST/ECE
11. APPLICATIONS&ADVANTAGES
APPLICATIONS:
Real time transport systems. Same principle can be used for automatic track switching. Garage door opening.
ADVANTAGES:
Accident avoidance. Human Resource. Safety and quality of services.
48
SRTIST/ECE
12. CONCLUSION
The accidents are avoided at places where there is no person manning the railway crossing gates. Here we use the stepper motor to open and close the gates automatically when it is rotated clockwise or anticlockwise direction. When the train arrives in a particular direction the transmitter IR senses and generates appropriate signal, then at the same time the receiver IR receives the signal and generates an interrupt. When the interrupt is generated the stepper motor rotates in clockwise direction. When the interrupt ends the stepper motor rotates in anti clock wise direction.
SCOPE OF PROJECT
This project is developed in order to help the INDIAN RAILWAYS in making its Based on the responses and reports obtained as a result of the significant
present working system a better one, by eliminating some of the loopholes existing in it. development in the working system of INDIAN RAILWAYS, this project can be further extended to meet the demands according to situation. This can be further implemented to have control room to regulate the working of
the system. Thus becomes the user friendliness. This circuit can be expanded and used in a station with any number of platforms
as per the usage. Additional modules can be added with out affecting the remaining modules. This
allows the flexibility and easy maintenance of the developed system. This system consists of following features over manual system: 49 There is no time lag to operate the device. Accuracy.
SRTIST/ECE
Simulation is provided to reflect the present status of the system. End user can operate this without knowing about electronics.
13. BIBLIOGRAPHY
BOOKS REFERRED
Kenneth .J. Ayala The 89C51 Microcontroller Architecture programming and Applications, Pen ram International. D.RoyChoudary and Sail Jain L.I.C, New Age International. Principles of Electronics by V.K.MEHTA. Communication Systems by Simon Hawkins.
WEB REFERENCES
50
SRTIST/ECE
51
SRTIST/ECE