<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>8051 Microcontroller | Student Projects</title>
	<atom:link href="https://studentprojects.in/tag/8051-microcontroller/feed/" rel="self" type="application/rss+xml" />
	<link>https://studentprojects.in</link>
	<description>Microcontroller projects, Circuit Diagrams, Project Ideas</description>
	<lastBuildDate>Mon, 14 Mar 2022 16:46:31 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.1.7</generator>
	<item>
		<title>Interfacing 7-segment display using 8051 Microcontroller</title>
		<link>https://studentprojects.in/electronics/microcontroller/8051-8951/interfacing-7-segment-display-using-8051-microcontroller/</link>
					<comments>https://studentprojects.in/electronics/microcontroller/8051-8951/interfacing-7-segment-display-using-8051-microcontroller/#comments</comments>
		
		<dc:creator><![CDATA[Editorial Team]]></dc:creator>
		<pubDate>Mon, 17 Aug 2009 13:32:44 +0000</pubDate>
				<category><![CDATA[8051/8951]]></category>
		<category><![CDATA[program to interface]]></category>
		<category><![CDATA[pin configuration]]></category>
		<category><![CDATA[Interfacing using microcontroller]]></category>
		<category><![CDATA[7447 decoder]]></category>
		<category><![CDATA[Seven Segment]]></category>
		<category><![CDATA[lookup table]]></category>
		<category><![CDATA[8951 Microcontroller]]></category>
		<category><![CDATA[8051 Microcontroller]]></category>
		<category><![CDATA[7-segment]]></category>
		<guid isPermaLink="false">http://studentprojects.in/?p=673</guid>

					<description><![CDATA[<p>The Light Emitting Diode (LED), finds its place in many applications in this modern electronic fields. One of them is the Seven Segment Display. Seven-segment displays contains the arrangement of the LEDs in “Eight” (8) passion, and a Dot (.) with a common electrode, lead (Anode or Cathode). The purpose of arranging it in that</p>
<p>The post <a href="https://studentprojects.in/electronics/microcontroller/8051-8951/interfacing-7-segment-display-using-8051-microcontroller/">Interfacing 7-segment display using 8051 Microcontroller</a> first appeared on <a href="https://studentprojects.in">Student Projects</a>.</p>]]></description>
										<content:encoded><![CDATA[<p>The Light Emitting Diode (LED), finds its place in many applications in this modern electronic fields. One of them is the Seven Segment Display. Seven-segment displays contains the arrangement of the LEDs in “Eight” (8) passion, and a Dot (.) with a common electrode, lead (Anode or Cathode). The purpose of arranging it in that passion is that we can make any number out of that by switching ON and OFF the particular LED&#8217;s. Here is the block diagram of the Seven Segment LED arrangement.<span id="more-673"></span></p>
<p style="text-align: center;"><strong>Pin configuration of a seven segment display:</strong><br /><img decoding="async" loading="lazy" class="size-medium wp-image-475 aligncenter" title="7 segment pin configuration" src="https://studentprojects.in/wp-content/uploads/2009/04/7_seg_pin_config-300x266.gif" alt="7 segment pin configuration" width="300" height="266" /></p>
<p><strong>LED’s are basically of two types:</strong></p>
<ol>
<li>Common Cathode (CC)<br />All the 8 anode legs uses only one cathode, which is common.</li>
<li>Common Anode (CA)<br />The common leg for all the cathode is of Anode type.</li>
</ol>
<p>For the discussion purpose, we use CC LED, where by just reversing the logical voltages we can implement the same for CA LED also.</p>
<p>In a CC LED, all the 8 legs (&#8216;a&#8217; through &#8216;h&#8217;) are of anode type and the common cathode will be connected to the GND of the supply. By energizing any of the legs with +5 Volts will lead to switch the correspondent segment ON. In the microprocessor binary system, 0Volts will be considered as Binary 0, and 5Volts will be considered as Binary1. Considering these two condition, we can make an arrangement as the microcontroller gives OUT the 0s and 1s through its ports, which is connected to the 8 legs of the LED. Of course, we can control the Port Output; implicitly we can Switch-ON required legs of the display.</p>
<p>There 2 methods of interfacing LED with the Microcontroller Intel 8051/8951.</p>
<ol>
<li><a href="https://studentprojects.in/articles/electronics/microcontroller-electronics-articles/8051-8951/interfacing-7-segment-display-with-microcontroller-using-lookup-table/">Using lookup table. This uses 7 output pins of microcontroller</a></li>
<li>Using 7447 decoder. This method uses 4 output pins of microcontroller</li>
</ol>
<p>The difference between the two main methods is simple and clear. In both the cases, microcontroller communicates with external world through its ports. But, in the 1st case, we connect all the 8 pins of the port directly to the LED and control the voltage through the ports manually to display the desired number. But, in the second case, we send the BCD of the number that we wanted to display to a middleware IC 7447, the BCD to LED code converter, which by itself gives out the correspondent 7 segment codes to the LED.</p>
<p>Here we explain using lookup table. Click here for the method &#8220;using 7447 decoder&#8221;</p>
<p><strong>Using 7447 decoder:</strong></p>
<p>The IC7447 is a BCD to 7-segment pattern converter. This setup is the advanced form of the &lt;previous&gt; setup where we entered the patterns manually to display the desired character. Here in this case, the IC7447 takes the Binary Coded Decimal (BCD) as the input and outputs the relevant 7 segment code. We connect first four pins of the microcontroller Port 2  to the 7447 and the Output 8 pins of 7447 to the 8 legs of the LED as shown in the figure. Te circuit diagrams are shown below, the first figure is interfacing the CA LED where as the second is of CC LED. The number required to display is sent as the lower nibble of the Port 2 of the Microcontroller. The 7447 converts the four input bits (BCD) to their corresponding 7-segment codes. The outputs of the 7447 are connected to the 7-segment display.</p>
<figure id="attachment_674" aria-describedby="caption-attachment-674" style="width: 507px" class="wp-caption aligncenter"><img decoding="async" loading="lazy" class="size-full wp-image-674" title="Circuit diagram for interfacing Common Anode 7-Segment Display " src="https://studentprojects.in/wp-content/uploads/2009/08/7_seg_circuit_ca_7447.gif" alt="Circuit diagram for interfacing Common Anode 7-Segment Display" width="507" height="326" /><figcaption id="caption-attachment-674" class="wp-caption-text">Circuit diagram for interfacing Common Anode 7-Segment Display</figcaption></figure>
<figure id="attachment_675" aria-describedby="caption-attachment-675" style="width: 507px" class="wp-caption aligncenter"><img decoding="async" loading="lazy" class="size-full wp-image-675" title="Circuit diagram for Common Cathode 7-Segment Display" src="https://studentprojects.in/wp-content/uploads/2009/08/7_seg_circuit_cc_7447.gif" alt="Circuit diagram for Common Cathode 7-Segment Display" width="507" height="326" /><figcaption id="caption-attachment-675" class="wp-caption-text">Circuit diagram for Common Cathode 7-Segment Display</figcaption></figure>
<p><strong>Program:</strong></p>
<p lang="asm">This program displays characters 0 through 9 on seven-segment display using IC 7447 as the middle wear.</p>


<pre class="wp-block-code"><code lang="wasm" class="language-wasm">again: mov a,#00h ; Start form zero
       up: mov p2, a ; Move to Port 2 
       mov r3,#255 ; Delay 
D1:    mov r1,#255 
D:     djnz r1,D 
       djnz r3,D1 
       inc a 
       cjne a,#0ah,up 
       sjmp again</code></pre><p>The post <a href="https://studentprojects.in/electronics/microcontroller/8051-8951/interfacing-7-segment-display-using-8051-microcontroller/">Interfacing 7-segment display using 8051 Microcontroller</a> first appeared on <a href="https://studentprojects.in">Student Projects</a>.</p>]]></content:encoded>
					
					<wfw:commentRss>https://studentprojects.in/electronics/microcontroller/8051-8951/interfacing-7-segment-display-using-8051-microcontroller/feed/</wfw:commentRss>
			<slash:comments>51</slash:comments>
		
		
			</item>
		<item>
		<title>Automated multistoried car parking system</title>
		<link>https://studentprojects.in/electronics/microcontrollers/automated-multistoried-car-parking-system/</link>
					<comments>https://studentprojects.in/electronics/microcontrollers/automated-multistoried-car-parking-system/#comments</comments>
		
		<dc:creator><![CDATA[Editorial Team]]></dc:creator>
		<pubDate>Fri, 21 Nov 2008 13:39:00 +0000</pubDate>
				<category><![CDATA[Microcontroller Based Mini Projects]]></category>
		<category><![CDATA[8255 posrts]]></category>
		<category><![CDATA[Microcontroller programs]]></category>
		<category><![CDATA[Interfacing LCD]]></category>
		<category><![CDATA[Microcontroller project]]></category>
		<category><![CDATA[Interfacing LDR]]></category>
		<category><![CDATA[8951]]></category>
		<category><![CDATA[Keyboard Interface]]></category>
		<category><![CDATA[8051 Microcontroller]]></category>
		<category><![CDATA[Car parking system]]></category>
		<category><![CDATA[Lift programming]]></category>
		<category><![CDATA[Interfacing Stepper motor]]></category>
		<guid isPermaLink="false">http://studentprojects.in/?p=115</guid>

					<description><![CDATA[<p>Introduction Basic idea Hardware description Display section Keyboard, Indicator &#38; Beeper section Lift &#38; motor section Sensor section LCD section Software program 1.Introduction: Automatic multistoried car parking system helps to minimize the car parking area. In the modern world, where parking-space has become a very big problem and in the era of miniaturization, it is</p>
<p>The post <a href="https://studentprojects.in/electronics/microcontrollers/automated-multistoried-car-parking-system/">Automated multistoried car parking system</a> first appeared on <a href="https://studentprojects.in">Student Projects</a>.</p>]]></description>
										<content:encoded><![CDATA[<ol>
<li>Introduction</li>
<li>Basic idea</li>
<li>Hardware description
<ol>
<li>Display section</li>
<li>Keyboard, Indicator &amp; Beeper section</li>
<li>Lift &amp; motor section</li>
<li>Sensor section</li>
<li>LCD section</li>
</ol>
</li>
<li>Software program</li>
</ol>
<p><strong>1.Introduction:</strong></p>
<p>Automatic multistoried car parking system helps to minimize the car parking area. In the modern world, where parking-space has become a very big problem and in the era of miniaturization, it is become a very crucial necessity to avoid the wastage of space in modern, big companies and apartments etc. In places where more than 100 cars need to be parked, this system proves to be useful in reducing wastage of space. This Automatic Car Parking System enables the parking of vehicles, floor after floor and thus reducing the space used. Here any number of cars can be parked according to the requirement. This makes the system modernized and even a space-saving one. This idea is developed using 8051 Microcontroller. Here program is written according to this idea using 8051.</p>
<p><figure id="attachment_116" aria-describedby="caption-attachment-116" style="width: 298px" class="wp-caption aligncenter"><img decoding="async" loading="lazy" class="size-full wp-image-116" title="Photograph of the model" src="https://studentprojects.in/wp-content/uploads/2008/11/lift_photo.jpg" alt="Photograph of the model" width="298" height="342"><figcaption id="caption-attachment-116" class="wp-caption-text">Photograph of the model</figcaption></figure></p>
<p><strong>2. Basic idea:</strong></p>
<p>A display is provided at the ground floor which is basically a counter that displays number of cars in each floor. It informs whether the floors are fully filled with the cars or is it having place in a particular floor or not. There is facility of lift to carry the car to up and down. Movement of Lift is controlled by stepper motor. An indicator with a green and red LED is kept in all the floors to indicate whether the lift is busy or is it ready to take the car up or down. If the red LED glows that means the lift is already engaged and the person has to wait for the green LED to glow. In this project we have provided three floors of a building for car parking. Maximum storage capacity of each floor is given as ten. Storage capacity can be changed according to the requirement.</p>
<p>Any one can enter to first or second floor. The third floor in this model is for VIP’s only. Therefore when VIP’s are to be entering they are expected to enter their password and they will be taken to the third reserved floor. The password will be of 4 digits. The processor checks for the password entered and if it is found to be wrong, a siren is heard. In this particular model 10 passwords are stored. So when a password is entered, the processor checks for it and it is compared with 10 passwords. It indicates whether it is the correct one or not.</p>
<p>When the car enters the lift, the LDR detects its presence and sends a signal to glow RED LED indicating that the lift is busy. It also sends a signal to motor which makes the motor to rotate. After RED LED glows the lift will take the person and the car up to the floor where the space for parking is available. (For VIP it will be the third floor). When the lift reaches the first floor, the processor compares&nbsp; the filled amount to that of the already fed capacity of that floor, and if it finds that the first floor is fully filled , it goes to the second floor and thus the procedure stops here. As soon as a car is placed in a particular floor, the display counter at the ground floor increments as to indicate the floor capacity has decreased by one. After the lift places the car in a particular floor, it comes back to its normal position and that time, the motor that drives it , also stops. Now processor sends signal to glow GREEN LED indicating that lift is free.</p>
<p>When a person needs to come down from a particular floor to ground floor, he is expected to focus the headlight onto the LDR placed in that floor. Now sensor section sends signal to motor that the lift has to be send back to that particular floor and sends a signal to glow RED LED indicating that the lift is busy. As soon as the lift reaches that particular floor car should come inside the lift, the display counter at the ground floor decrements by one as to indicate the floor capacity has increased by one. Lift comes back to its normal position and that time, the motor that drives it, also stops. Now processor sends signal to glow GREEN LED indicating that lift is free.</p>
<p>If there no parking taking place, the processor carries out the job according to the following priority:-</p>
<ol>
<li>It checks whether any password is entered.</li>
<li>It checks whether any car is entered to lift.</li>
<li>It checks whether any car headlight is pressed in front of&nbsp; LDR placed in each floor.</li>
</ol>
<p>It is like a round robin system.</p>
<p><strong>3. Hardware description:</strong></p>
<p><strong>Introduction to 8051 Microcontroller:</strong></p>
<p>The first task faced when learning to use a new computer is to become familiar with the capability of the machine. The features of the computer best learned by studying the internal hardware design, also called the architecture of the device, to determine the type, number, and size of the registers and other circuitry.</p>
<p>The hardware is manipulated by an accompanying set of program instructions, or software. One familiar with hardware and software, the system designer can then apply the microcontroller to the problems at hand. In this project we make use of microcontroller.</p>
<p>The 8051 microcontroller generic part number actually includes a whole family of microcontrollers that have numbers ranging from 8031 to 8751.The block diagram of the 8051 shows all of the features unique to microcontrollers:</p>
<ol>
<li>Internal ROM and RAM</li>
<li>I/O ports with programmable pins</li>
<li>Timers and counters</li>
<li>Serial data communication</li>
</ol>
<p>The block diagram also shows the usual CPU components program counter, ALU, working registers, and the clock circuits.</p>
<p>The 8051 architecture consists of these specific features:</p>
<ol>
<li>8 bit CPU with registers A and B</li>
<li>16 bit PC &amp;data pointer (DPTR)</li>
<li>8 bit program status word (PSW)</li>
<li>8 bit stack pointer(SP)</li>
<li>Internal ROM or EPROM (8751)of 0(8031)to 4k(8051)</li>
<li>Internal RAM of 128 bytes.</li>
<li>4 register banks , each containing 8 registers</li>
<li>80 bits of general purpose data memory</li>
<li>32 input/output pins arranged as four 8 bit ports:P0-P3</li>
<li>Two 16 bit timer/counters:T0-T1</li>
<li>Two external and three internal interrupt sources</li>
<li>Oscillator and clock circuits</li>
</ol>
<p>A pin out of the 8051 packaged in a 40 pin DIP is shown below.</p>
<p><figure id="attachment_117" aria-describedby="caption-attachment-117" style="width: 650px" class="wp-caption aligncenter"><img decoding="async" loading="lazy" class="size-full wp-image-117" title="Internal block diagram of IC 8051" src="https://studentprojects.in/wp-content/uploads/2008/11/image001.gif" alt="Internal block diagram of IC 8051" width="650" height="725"><figcaption id="caption-attachment-117" class="wp-caption-text">Internal block diagram of IC 8051</figcaption></figure></p>
<p><figure id="attachment_118" aria-describedby="caption-attachment-118" style="width: 298px" class="wp-caption aligncenter"><img decoding="async" loading="lazy" class="size-full wp-image-118" title="A pin out of the 8051 packaged in a 40 pin DIP." src="https://studentprojects.in/wp-content/uploads/2008/11/image003.gif" alt="A pin out of the 8051 packaged in a 40 pin DIP." width="298" height="652"><figcaption id="caption-attachment-118" class="wp-caption-text">A pin out of the 8051 packaged in a 40 pin DIP.</figcaption></figure></p><p>The post <a href="https://studentprojects.in/electronics/microcontrollers/automated-multistoried-car-parking-system/">Automated multistoried car parking system</a> first appeared on <a href="https://studentprojects.in">Student Projects</a>.</p>]]></content:encoded>
					
					<wfw:commentRss>https://studentprojects.in/electronics/microcontrollers/automated-multistoried-car-parking-system/feed/</wfw:commentRss>
			<slash:comments>403</slash:comments>
		
		
			</item>
		<item>
		<title>8051 Microcontroller port programming</title>
		<link>https://studentprojects.in/electronics/microcontroller/8051-8951/8051-microcontroller-port-programming/</link>
					<comments>https://studentprojects.in/electronics/microcontroller/8051-8951/8051-microcontroller-port-programming/#comments</comments>
		
		<dc:creator><![CDATA[Editorial Team]]></dc:creator>
		<pubDate>Wed, 19 Nov 2008 09:24:58 +0000</pubDate>
				<category><![CDATA[8051/8951]]></category>
		<category><![CDATA[8051 I/O Ports]]></category>
		<category><![CDATA[port programming]]></category>
		<category><![CDATA[8051 Microcontroller]]></category>
		<guid isPermaLink="false">http://studentprojects.in/?p=160</guid>

					<description><![CDATA[<p>There are four ports P0, P1, P2  and  P3 each  use  8 pins,  making  them 8-bit  ports. All the ports upon  RESET are configured as output, ready to be used as output ports. To use any of these ports as an input port, it must be programmed. Pin configuration of 8051/8031 microcontroller. Port 0: Port</p>
<p>The post <a href="https://studentprojects.in/electronics/microcontroller/8051-8951/8051-microcontroller-port-programming/">8051 Microcontroller port programming</a> first appeared on <a href="https://studentprojects.in">Student Projects</a>.</p>]]></description>
										<content:encoded><![CDATA[<p>There are four ports P0, P1, P2  and  P3 each  use  8 pins,  making  them 8-bit  ports. All the ports upon  RESET are configured as output, ready to be used as output ports. To use any of these ports as an input port, it must be programmed.</p>
<p>Pin configuration of 8051/8031 microcontroller.</p>
<p><figure id="attachment_161" aria-describedby="caption-attachment-161" style="width: 260px" class="wp-caption aligncenter"><img decoding="async" loading="lazy" class="size-full wp-image-161" title="Pin configuration of 8951" src="https://studentprojects.in/wp-content/uploads/2008/11/pin-8051.gif" alt="Pin configuration of 8951" width="260" height="550" /><figcaption id="caption-attachment-161" class="wp-caption-text">Pin configuration of 8951</figcaption></figure></p>
<p><strong>Port 0:</strong> Port 0 occupies a total of 8 pins (pins 32-39) .It can be used for input or output. To use the pins of port 0 as both input and output ports, each pin must be connected externally to a 10K ohm pull-up resistor. This is due to the fact that P0 is an open drain, unlike P1, P2, and P3.Open drain  is a term used for MOS chips in the same way that open collector is used for TTL chips. With external pull-up resistors connected upon reset, port 0 is configured as an output port. For example, the following code will continuously send out to port 0 the alternating values 55H and AAH</p>
<p>MOV A,#55H<br />
BACK:  MOV P0,A<br />
ACALL DELAY<br />
CPL A<br />
SJMP BACK</p>
<p><strong>Port 0 as Input :</strong> With resistors connected to port 0, in order to make it an input, the port must be programmed by writing 1 to all the bits. In the following code, port 0 is configured first as an input port by writing 1&#8217;s to it, and then data is received from the port and sent to P1.</p>
<p><figure id="attachment_162" aria-describedby="caption-attachment-162" style="width: 400px" class="wp-caption aligncenter"><img decoding="async" loading="lazy" class="size-full wp-image-162" title="8051 I/O Ports" src="https://studentprojects.in/wp-content/uploads/2008/11/8051.gif" alt="8051 I/O Ports" width="400" height="266" /><figcaption id="caption-attachment-162" class="wp-caption-text">8051 I/O Ports</figcaption></figure></p>
<p>MOV A,#0FFH         ; A = FF hex<br />
MOV P0,A                ; make P0 an input port<br />
BACK: MOV A,P0               ;get data from P0<br />
MOV P1,A                ;send it to port 1<br />
SJMP BACK</p>
<p><strong>Dual role of port 0:</strong> Port 0 is also designated as AD0-AD7, allowing it to be used for both address and data. When connecting an 8051/31 to an external memory, port 0 provides both address and data. The 8051 multiplexes address and data through port 0 to save pins. ALE indicates if P0 has address or data. When ALE = 0, it provides data D0-D7, but when ALE =1 it has address and data with the help of a 74LS373 latch.</p>
<p><strong>Port 1: </strong>Port 1 occupies a total of 8 pins (pins 1 through 8). It can be used as input or output. In contrast to port 0, this port does not need any pull-up resistors since it already has pull-up resistors internally. Upon reset, Port 1 is configured as an output port. For example, the following code will continuously send out to port1 the alternating values 55h  &amp; AAh</p>
<p>MOV A,#55H                    ; A = 55 hex<br />
BACK: MOV P1,A                        ;send it to Port 1<br />
ACALL DELAY                  ;call delay routine<br />
CPL A                               ;make A=0<br />
SJMP BACK</p>
<p><strong> Port 1 as input: </strong>To make port1 an input port, it must programmed as such by writing 1 to all its bits. In the following code port1 is configured first as an input port by writing 1’s to it, then data is received from the port and saved in R7 ,R6 &amp; R5.</p>
<p>MOV A,#0FFH   ;A=FF HEX<br />
MOV P1,A         ;make P1 an input port by writing all 1’s to it<br />
MOV A,P1         ;get data from P1<br />
MOV R7,A         ;save it in register R7<br />
ACALL DELAY   ;wait<br />
MOV  A,P1        ;get another data from P1<br />
MOV R6,A         ;save it in register R6<br />
ACALL DELAY   ;wait<br />
MOV  A,P1        ;get another data from P1<br />
MOV R5,A         ;save it in register R5</p>
<p><strong>Port 2 : </strong>Port 2 occupies a total of 8 pins (pins 21- 28). It can be used as input or output. Just like P1, P2 does not need any pull-up resistors since it already has pull-up resistors internally. Upon reset,Port 2 is configured as an output port. For example, the following code will send out continuously to port 2 the alternating values 55h and AAH. That is all the bits of port 2 toggle continuously.</p>
<p>MOV A,#55H                    ; A = 55 hex<br />
BACK:  MOV P2,A                        ;send it to Port 2<br />
ACALL DELAY                  ;call delay routine<br />
CPL A                               ;make A=0<br />
SJMP BACK</p>
<p><strong>Port 2 as input :</strong> To make port 2 an input, it must programmed as such by writing 1 to all its bits. In the following code, port 2 is configured first as an input port by writing 1’s to it. Then data is received from that port and is sent to P1 continuously.</p>
<p>MOV A,#0FFH         ;A=FF hex<br />
MOV P2,A                ;make P2 an input port by writing all 1’s to it<br />
BACK: MOV A,P2     ;get data from P2<br />
MOV P1,A                ;send it to Port1<br />
SJMP BACK             ;keep doing that</p>
<p><strong> Dual role of port 2 :</strong> In systems based on the 8751, 8951, and DS5000, P2 is used as simple I/O. However, in 8031-based systems, port 2 must be used along with P0 to provide the 16-bit address for the external memory. As shown in pin configuration 8051, port 2 is also designed as A8-A15, indicating the dual function. Since an 8031 is capable of accessing 64K bytes of external memory, it needs a path for the 16 bits of the address. While P0 provides the lower 8 bits via A0-A7, it is the job of P2 to provide bits A8-A15 of the address. In other words, when 8031 is connected to external memory, P2 is used for the upper 8 bits of the 16 bit address, and it cannot be used for I/O.</p>
<p><strong>Port 3 :</strong> Port 3 occupies a total of 8 pins, pins 10 through 17. It can be used as input or output. P3 does not need any pull-up resistors, the same as P1 and P2 did not. Although port 3 is configured as an output port upon reset. Port 3 has the additional function of providing some extremely important signals such as interrupts. This information applies both 8051 and 8031 chips.</p>
<p><figure id="attachment_163" aria-describedby="caption-attachment-163" style="width: 448px" class="wp-caption aligncenter"><img decoding="async" loading="lazy" class="size-full wp-image-163" title="Functions of port 3" src="https://studentprojects.in/wp-content/uploads/2008/11/table.gif" alt="Functions of port 3" width="448" height="299" /><figcaption id="caption-attachment-163" class="wp-caption-text">Functions of port 3</figcaption></figure></p>
<p>P3.0 and P3.1 are used for the RxD and TxD serial communications signals. Bits P3.2 and P3.3 are set aside for external interrupts. Bits P3.4 and P3.5 are used for timers 0 and 1. Finally P3.6 and P3.7 are used to provide the WR and RD signals of external memories connected in 8031 based systems.</p>
<p><strong> Read-modify-write feature :</strong> The ports in the 8051 can be accessed by the read-modify-write technique. This feature saves many lines of code by combining in a single instruction all three action of (1) reading the port, (2) modifying it, and (3) writing to the port. The following code first places 01010101 (binary) into port 1. Next, the instruction “XLR P1,#0FFH” performs an XOR logic operation on P1 with 1111 1111 (binary), and then writes the result back into P1.</p>
<p>MOV P1,#55H      ;P1=01010101<br />
AGAIN: XLR P1,#0FFH     ;EX-OR P1 with 1111 1111<br />
ACALL DELAY<br />
SJMP AGAIN</p>
<p>Notice that XOR of 55H and FFH gives AAH. Likewise, the XOR of AAH and FFH gives 55H.</p>
<p>Single bit  addressability of ports:  There are times that we need to access only 1 or 2 bits of the port instead of the entire 8 bits. A powerful feature of 8051 I/O ports is their capability to access individual bits of the port without altering the rest of the bits in that port.</p>
<p>For example, the following code toggles the bit p1.2 continuously.</p>
<p>BACK:  CPL P1.2                   ;complement p1.2 only<br />
ACALL DELAY<br />
SJMP BACK</p>
<p>Notice that P1.2 is the third bit of P1, since the first bit is P1.0, the second bit is P1.1, and so on. Notices in example of those unused portions of port1 are undisturbed. Table bellow shows the bits of 8051 I/O ports. This single bit addressability of I/O ports is one of the features of the 8051 microcontroller.</p>
<p><figure id="attachment_164" aria-describedby="caption-attachment-164" style="width: 500px" class="wp-caption aligncenter"><img decoding="async" loading="lazy" class="size-full wp-image-164" title="Addressing bits" src="https://studentprojects.in/wp-content/uploads/2008/11/address.gif" alt="Addressing bits" width="500" height="272" /><figcaption id="caption-attachment-164" class="wp-caption-text"> </figcaption></figure></p><p>The post <a href="https://studentprojects.in/electronics/microcontroller/8051-8951/8051-microcontroller-port-programming/">8051 Microcontroller port programming</a> first appeared on <a href="https://studentprojects.in">Student Projects</a>.</p>]]></content:encoded>
					
					<wfw:commentRss>https://studentprojects.in/electronics/microcontroller/8051-8951/8051-microcontroller-port-programming/feed/</wfw:commentRss>
			<slash:comments>54</slash:comments>
		
		
			</item>
		<item>
		<title>Automatic Railway Gate Control &#038; Track Switching</title>
		<link>https://studentprojects.in/electronics/microcontrollers/automatic-railway-gate-control-track-switching/</link>
					<comments>https://studentprojects.in/electronics/microcontrollers/automatic-railway-gate-control-track-switching/#comments</comments>
		
		<dc:creator><![CDATA[Editorial Team]]></dc:creator>
		<pubDate>Thu, 06 Nov 2008 11:58:25 +0000</pubDate>
				<category><![CDATA[Microcontroller Based Mini Projects]]></category>
		<category><![CDATA[Stepper motor]]></category>
		<category><![CDATA[IR Receiver]]></category>
		<category><![CDATA[IR Transitter]]></category>
		<category><![CDATA[8051 Microcontroller]]></category>
		<category><![CDATA[Railway Gate Control]]></category>
		<category><![CDATA[Railway Track Switching]]></category>
		<guid isPermaLink="false">http://studentprojects.in/?p=105</guid>

					<description><![CDATA[<p>Present project is designed using 8051 microcontroller to avoid railway accidents happening at unattended railway gates, if implemented in spirit. This project utilizes two powerful IR transmitters and two receivers; one pair of transmitter and receiver is fixed at up side (from where the train comes) at a level higher than a human being in</p>
<p>The post <a href="https://studentprojects.in/electronics/microcontrollers/automatic-railway-gate-control-track-switching/">Automatic Railway Gate Control & Track Switching</a> first appeared on <a href="https://studentprojects.in">Student Projects</a>.</p>]]></description>
										<content:encoded><![CDATA[<p>Present project is designed using 8051 microcontroller to avoid railway accidents happening at unattended railway gates, if implemented in spirit. This project utilizes two powerful IR transmitters and two receivers; one pair of transmitter and receiver is fixed at up side (from where the train comes) at a level higher than a human being in exact alignment and similarly the other pair is fixed at down side of the train direction. Sensor activation time is so adjusted by calculating the time taken at a certain speed to cross at least one compartment of standard minimum size of the Indian railway. We have considered 5 seconds for this project. Sensors are fixed at 1km on both sides of the gate. We call the sensor along the train direction as ‘foreside sensor’ and the other as ‘aft side sensor’. When foreside receiver gets activated, the gate motor is turned on in one direction and the gate is closed and stays closed until the train crosses the gate and reaches aft side sensors. When aft side receiver gets activated motor turns in opposite direction and gate opens and motor stops. Buzzer will immediately sound at the fore side receiver activation and gate will close after 5 seconds, so giving time to drivers to clear gate area in order to avoid trapping between the gates and stop sound after the train has crossed.</p>
<p>The same principle is applied for track switching. Considering a situation wherein an express train and a local train are traveling in opposite directions on the same track; the express train is allowed to travel on the same track and the local train has to switch on to the other track. Two sensors are placed at the either sides of the junction where the track switches. If there’s a train approaching from the other side, then another sensor placed along that direction gets activated and will send an interrupt to the controller. The interrupt service routine switches the track.  Indicator lights have been provided to avoid collisions. Here the switching operation is performed using a stepper motor. Assuming that within a certain delay, the train has passed the track is switched back to its original position, allowing the first train to pass without any interruption. This concept of track switching can be applied at 1km distance from the stations.</p>
<p>The project is simple to implement and subject to further improvement.</p>
<p><figure id="attachment_106" aria-describedby="caption-attachment-106" style="width: 500px" class="wp-caption aligncenter"><img decoding="async" loading="lazy" class="size-full wp-image-106" title="Model of Automatic Railway Gate Control &amp; Track Switching" src="https://studentprojects.in/wp-content/uploads/2008/11/train_photo.gif" alt="Model of Automatic Railway Gate Control &amp; Track Switching" width="500" height="228" /><figcaption id="caption-attachment-106" class="wp-caption-text">Model of Automatic Railway Gate Control &amp; Track Switching</figcaption></figure></p>
<p><strong><br />
Gate Control</strong>:</p>
<p>Railways being the cheapest mode of transportation are preferred over all the other means .When we go through the daily newspapers we come across many railway accidents occurring at unmanned railway crossings. This is mainly due to the carelessness in manual operations or lack of workers. We, in this project has come up with a solution for the same. Using simple electronic components we have tried to automate the control of railway gates. As a train approaches the railway crossing from either side, the sensors placed at a certain distance from the gate detects the approaching train and accordingly controls the operation of the gate. Also an indicator light has been provided to alert the motorists about the approaching train.</p>
<p><figure id="attachment_108" aria-describedby="caption-attachment-108" style="width: 500px" class="wp-caption aligncenter"><img decoding="async" loading="lazy" class="size-full wp-image-108" title="Railway crossing" src="https://studentprojects.in/wp-content/uploads/2008/11/crossing.jpg" alt="Railway crossing" width="500" height="235" /><figcaption id="caption-attachment-108" class="wp-caption-text">Gate control </figcaption></figure></p>
<p><strong>Track Switching</strong></p>
<p>Using the same principle as that for gate control, we have developed a concept of automatic track switching. Considering a situation wherein an express train and a local train are travelling in opposite directions on the same track; the express train is allowed to travel on the same track and the local train has to switch on to the other track. Indicator lights have been provided to avoid collisions .Here the switching operation is performed using a stepper motor. In practical purposes this can be achieved using electromagnets.</p>
<p><figure id="attachment_109" aria-describedby="caption-attachment-109" style="width: 500px" class="wp-caption aligncenter"><img decoding="async" loading="lazy" class="size-full wp-image-109" title="Track Switching" src="https://studentprojects.in/wp-content/uploads/2008/11/switching.jpg" alt="Track Switching" width="500" height="262" /><figcaption id="caption-attachment-109" class="wp-caption-text">Track Switching</figcaption></figure></p><p>The post <a href="https://studentprojects.in/electronics/microcontrollers/automatic-railway-gate-control-track-switching/">Automatic Railway Gate Control & Track Switching</a> first appeared on <a href="https://studentprojects.in">Student Projects</a>.</p>]]></content:encoded>
					
					<wfw:commentRss>https://studentprojects.in/electronics/microcontrollers/automatic-railway-gate-control-track-switching/feed/</wfw:commentRss>
			<slash:comments>827</slash:comments>
		
		
			</item>
	</channel>
</rss>
