<?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>MachineGrid &#187; parallel port</title>
	<atom:link href="http://www.machinegrid.com/tag/parallel-port/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.machinegrid.com</link>
	<description>robots at work</description>
	<lastBuildDate>Mon, 19 Jul 2010 01:59:06 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Parallel Port Tutorial &#8211; Part 2 (Handling Inputs)</title>
		<link>http://www.machinegrid.com/2008/12/parallel-port-tutorial-part-2-handling-inputs/</link>
		<comments>http://www.machinegrid.com/2008/12/parallel-port-tutorial-part-2-handling-inputs/#comments</comments>
		<pubDate>Wed, 31 Dec 2008 20:12:24 +0000</pubDate>
		<dc:creator>bluehash</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[parallel port]]></category>
		<category><![CDATA[sensors]]></category>

		<guid isPermaLink="false">http://www.blog.machinegrid.com/?p=298</guid>
		<description><![CDATA[Disclaimer : The information provided here is correct to my best knowledge.You may use it at your own risk. This is a followup of the first tutorial which described using the port as an output. This tutorial demonstrates how to use the parallel port as an input. This feature is a great help in robotics [...]


No related posts.]]></description>
			<content:encoded><![CDATA[<p><U>Disclaimer </U>:   The information provided here is correct to my best knowledge.You may use it at your own risk.<br />
This  is a followup of the first tutorial which described using the port as an output. This tutorial  demonstrates how to use the parallel port as an input. This feature is a great help in robotics as it is used to collect data of what the robot really is encountering.<BR><br />
<FONT SIZE="" COLOR=""><B>The INPUT PINS</B></FONT><br />
 <IMG SRC="http://www.machinegrid.com/machinepress/wp-content/uploads/media/images/parallelin_files/pinout.gif" WIDTH="459" HEIGHT="225" BORDER="0" ALT=""><br />
<I>Picture Courtesy :: <A Target="_blank" HREF="http://www.doc.ic.ac.uk/~ih/doc/par/">Ian Harries</a><br /></I><BR></p>
<p>The 10,11,12,13,15 pins of the STATUS PORT are the basic input pins.<BR><br />
Though the CONTROL PORT pins can also be used as inputs,only accessing the status pins are described here.<U><B>Follow these steps to read an input</B></U><br />
<BR><br />
<U>Step1</U><br />
Construct the following TEST circuit.<br />
In this example I have taken pin 13 of the STATUS port as an input.<br />
<FONT SIZE="" COLOR="#CC0000"><B>WARNING</B></FONT> &nbsp;&nbsp;<FONT SIZE="" COLOR="#CC0000">Please do not feed your port more than 5V.You&#8217;ll blow it up.<br />
Check all the voltages with a Multimeter before proceeding</FONT><BR><br />
<IMG SRC="http://www.machinegrid.com/machinepress/wp-content/uploads/media/images/parallelin_files/iport.jpg" WIDTH="457" HEIGHT="288" BORDER="0" ALT=""><BR><br />
<U>Step2</U><br />
Fire up your C compiler and typre the following program:<br />
<IMG SRC="http://www.machinegrid.com/machinepress/wp-content/uploads/media/images/parallelin_files/prog.jpg" WIDTH="620" HEIGHT="194" BORDER="0" ALT=""><BR><br />
The program scans the STATUS[0x379] port and give an appropriate integer number,depending on what combinations of pins have gone high or low.<br />
In this example ,since I have used pin 13 and connected to a high value i.e  a binary &#8220;1&#8243;, I get a value of &#8220;127&#8243; on my PC. Please note that this number will differ from PC to PC. Now we test for a Low value i.e a binary &#8220;0&#8243;. Modify the above circuit as shown below:<br />
<IMG SRC="http://www.machinegrid.com/machinepress/wp-content/uploads/media/images/parallelin_files/iport2.jpg" WIDTH="457" HEIGHT="288" BORDER="0" ALT=""><br />
Short pin13 to GND.<br />
When you do this and run the above program ,you get a different number.<br />
On my PC ,i get a &#8220;230&#8243;<BR><br />
<U>Step3</U><br />
Now using a simple switch case statement you can monitor the input at pin13.<br />
<IMG SRC="http://www.machinegrid.com/machinepress/wp-content/uploads/media/images/parallelin_files/switch.jpg" WIDTH="620" HEIGHT="305" BORDER="0" ALT=""><br />
<U>When pin13 is set HIGH:</U><br />
<IMG SRC="http://www.machinegrid.com/machinepress/wp-content/uploads/media/images/parallelin_files/high.jpg" WIDTH="525" HEIGHT="250" BORDER="0" ALT=""><br />
<U>When pin13is set LOW:</U><br />
<IMG SRC="http://www.machinegrid.com/machinepress/wp-content/uploads/media/images/parallelin_files/low.jpg" WIDTH="525" HEIGHT="250" BORDER="0" ALT=""><br />
This is for monitoring a particular pin.<br />
You can use all the status pins as inputs ,note down the numbers for different combinations and then write your program.<FONT SIZE="" COLOR="#CC0000">Please note that the 11th pin is inverted i.e If u give a HIGH to it ,the port reads it as LOW.</FONT><br />
That&#8217;s it for the parallel port inputs.</p>


<p>No related posts.</p>]]></content:encoded>
			<wfw:commentRss>http://www.machinegrid.com/2008/12/parallel-port-tutorial-part-2-handling-inputs/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Parallel Port Tutorial &#8211; Part 1</title>
		<link>http://www.machinegrid.com/2008/12/parallel-port-tutorial-part-1/</link>
		<comments>http://www.machinegrid.com/2008/12/parallel-port-tutorial-part-1/#comments</comments>
		<pubDate>Wed, 31 Dec 2008 20:10:56 +0000</pubDate>
		<dc:creator>bluehash</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[parallel port]]></category>

		<guid isPermaLink="false">http://www.blog.machinegrid.com/?p=296</guid>
		<description><![CDATA[Disclaimer: The information provided here is correct to my best knowledge.You may use it at your own risk . This tutorial will help you get a taste of controlling your machine using the printer port. Though the parallel port isn&#8217;t being used for many applications ,it is a boon for us hobbyists. This tutorial&#8217;s main [...]


No related posts.]]></description>
			<content:encoded><![CDATA[<p><script type="text/javascript"><!--
google_ad_client = "pub-1367209070807564";
/* 468x60, created 2/5/09 */
google_ad_slot = "5600105339";
google_ad_width = 468;
google_ad_height = 60;
//-->
</script><br />
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script><span style="text-decoration: underline;"><strong>Disclaimer:</strong></span> The information provided here is correct to my best knowledge.You may use it at your own risk .</p>
<p>This tutorial will help you get a taste of controlling your machine using the printer port. Though the parallel port isn&#8217;t being used for many applications ,it is a boon for us hobbyists. This tutorial&#8217;s main aim is to get you working , so that you can send signals from the port like control a motor. Taking inputs<br />
from the port will be covered in a subsequent tutorial.</p>
<p><span style="text-decoration: underline;"><strong>Parallel Port Anatomy:</strong></span><br />
Following are the pinouts:<br />
<img src="http://www.machinegrid.com/machinepress/wp-content/uploads/media/images/parallel_files/pinout.gif" alt="" width="459" height="225" /><br />
<em>Picture Courtesy :: <a href="http://www.doc.ic.ac.uk/~ih/doc/par/" target="_blank">Ian Harries</a><br />
</em></p>
<ul>
<li>8 Output pins [<strong><span style="color: #0000ff;">D0 to D7</span></strong>]</li>
<li>5 Status pins [<strong><span style="color: #ff0000;">S4 to S7 and S3</span></strong>]</li>
<li>4 Control pins [<strong><span style="color: #0000ff;">C0 to C3</span></strong>]</li>
<li>8 ground pins [<strong><span style="color: #00ff00;">18 to 25</span></strong>]</li>
</ul>
<p>The Pins having a bar over them ,means that the signal is inverted by the parallel port&#8217;s hardware.If a 1 were to appear on the 11 pin [S7], the PC would see a 0. The Status pins are mainly used by the PC to know the status of the printer, like if there is paper in the printer, end of paper etc. Only the Data Port will be covered in this segment.</p>
<p align="center"><img src="http://www.machinegrid.com/machinepress/wp-content/uploads/media/images/parallel_files/image002.jpg" alt="" width="250" height="72" /></p>
<p align="center">Parallel Port Female Connector</p>
<p><span style="text-decoration: underline;"><strong>The Data Port</strong></span><br />
Sending commands involves only the data pins [<span style="color: #0000ff;"><strong>D0 to D7</strong></span>].Though it is possible to use the some other pins as input, we&#8217;ll stick to the basics.</p>
<p><span style="color: #ff0000;"><strong>Please remember that the Data pins are from pin 2 to pin 9 and not from pin 1.</strong></span><br />
If you have a good eyesight, check your parallel port connectors. Both the connectors [male/female], have numbers etched next to their pins, so people like us don&#8217;t screw up our ports, connecting them the wrong way.The word &#8220;Parallel&#8221; means sending an entire set of 8 bits at once to the PC [That's why term Parallel Port].However we can use the individual pins of the port; sending either a 1 or a 0 to a peripheral like a motor or LED.</p>
<p><strong><span style="text-decoration: underline;">Sending Commands to the Port:</span></strong><br />
This part is easy.Just a single line of code does the trick.</p>
<li>C program for the motor<br />
<blockquote><p>#include{stdio.h} //replace {} with &lt;&gt;<br />
#include{dos.h}   //replace {} with &lt;&gt;<br />
void main(void){<br />
outportb(0&#215;378,0xFF);<br />
}</p></blockquote>
</li>
<p>That&#8217;s it ,you just set all your data pins to 1.<br />
<img src="http://www.machinegrid.com/machinepress/wp-content/uploads/media/images/parallel_files/ledtest.jpg" alt="" width="550" height="350" /><br />
If you take an LED and put one terminal at pin2 and the other to pin 18,it would glow.[Use a 2K resistor in series with the LED, otherwise you will end up ruining your LED, or source too much current from the port pin].<br />
If you wish to switch it off. Type this:<br />
<span style="color: #666666;"><strong>outportb(0&#215;378,0&#215;00);</strong></span> instead of the above line.</p>
<p><span style="text-decoration: underline;"><strong> What did you do?:</strong></span><br />
<img src="http://www.machinegrid.com/machinepress/wp-content/uploads/media/images/parallel_files/pinaccess.jpg" alt="" width="444" height="195" /></p>
<p><strong><span style="color: #009900;">0&#215;378</span></strong> is the parallel port address. Usually this is the default address.Sometimes it is <strong><span style="color: #33cc00;">0&#215;278</span></strong> too</p>
<p><strong><span style="color: #ff0000;">0&#215;00</span></strong> is the command appearing at the output pins. The Format is in Hexadecimal. So if u want to make pin no2 high, that&#8217;s the first pin you type.<br />
<span style="color: #ff0000;"><strong>0&#215;01</strong></span> which would mean 0000 0001 for the data port.</p>
<p>0x<span style="color: #0000ff;">0</span><span style="color: #00cc00;">4</span> would mean <span style="color: #0000ff;">0000</span><span style="color: #00cc00;">0100</span></p>
<p>0x<span style="color: #0000ff;">5</span><span style="color: #009900;">5</span> would mean <span style="color: #0000ff;">0101</span><span style="color: #00cc00;">0101</span></p>
<p>0x<span style="color: #0000ff;">0</span><span style="color: #33cc00;">A</span> would mean <span style="color: #0000ff;">0000</span><span style="color: #33cc00;">1010</span></p>
<p>see the table below for reference</p>
<blockquote><p><strong>0000-0</p>
<p>0001-1</p>
<p>0010-2</p>
<p>0011-3</p>
<p>0100-4</p>
<p>0101-5</p>
<p>0110-6</p>
<p>0111-7</p>
<p>1000-8</p>
<p>1001-9</p>
<p>1010-A</p>
<p>1011-B</p>
<p>1100-C</p>
<p>1101-D</p>
<p>1110-E</p>
<p>1111-F </strong></p></blockquote>
<p>That finishes your basics so that you can run your motor.<br />
<strong><span style="text-decoration: underline;">Material to control a Motor via a parallel port:</span></strong></p>
<ul>
<li>1 parallel port Male connector</li>
<li>1 DC Motor</li>
<li>1 Motor Driver [L293D]</li>
<li>1 5V regulator [7805]</li>
</ul>
<p><strong><span style="color: #ff0000;">Before trying out anything ,please remember that your parallel port is not meant or designed to handle more than 5Volts.If possible, trying accessing your parallel port using Windows 98.Windows XP does not allow access to the parallel port. You&#8217;ll need special drivers for that.</span></strong></p>
<p><strong><span style="text-decoration: underline;">Steps to Control a Motor:</span></strong></p>
<ul>
<li>Use the Voltage regulator 7805,to get a constant DC 5V voltage from your<br />
DC power supply.</li>
<li>
<div>Connect your motor to your Motor Driver L293D.<img src="http://www.machinegrid.com/machinepress/wp-content/uploads/media/images/parallel_files/motordriver.jpg" alt="" width="524" height="295" /></div>
</li>
<li>Connect your parallel port pins to your Female connector [on your PC],through the male connector as  follows.<br />
<img src="http://www.machinegrid.com/machinepress/wp-content/uploads/media/images/parallel_files/connect.jpg" alt="" width="354" height="196" /></li>
<li>Short all Ground pins i.e from 18 to 25.</li>
<li>Commands for the motor <img src="http://www.machinegrid.com/machinepress/wp-content/uploads/media/images/parallel_files/circles.jpg" alt="" width="596" height="315" /></li>
</ul>
<ul>
<li>
<ul>
<li><strong><span style="color: #ff0000;">outportb(0&#215;378,0&#215;00);</span></strong> &#8212;&#8212;&#8212;<strong>STOP<br />
MOTOR </strong></li>
<li><strong><span style="color: #ff0000;">outportb(0&#215;378,0&#215;03);</span></strong>&#8212;&#8212;&#8212;<strong>MOVE<br />
MOTOR(Break!))</strong></li>
<li><strong><span style="color: #ff0000;">outportb(0&#215;378,0&#215;01);</span></strong>&#8212;&#8212;&#8212;<strong>MOVE<br />
MOTOR(CCW) </strong></li>
<li><strong><span style="color: #ff0000;">outportb(0&#215;378,0&#215;02);</span></strong>&#8212;&#8212;&#8212;<strong>MOVE<br />
MOTOR(CW)</strong> .</li>
</ul>
</li>
<li>C program for the motor<br />
<blockquote><p>#include{stdio.h}<br />
#include{conio.h}<br />
#include{dos.h}<br />
[Please replace the {} bracket to &lt;&gt;]</p>
<p>main()<br />
{<br />
<strong>outportb(0&#215;378,0&#215;00); &#8212;&#8212;&#8212;STOP MOTOR </strong><br />
sleep(2);<br />
<strong>outportb(0&#215;378,0&#215;01);&#8212;&#8212;&#8212;MOVE MOTOR(CCW) </strong><br />
sleep(2);<br />
<strong>outportb(0&#215;378,0&#215;02);&#8212;&#8212;&#8212;MOVE MOTOR(CW) </strong><br />
sleep(2);<br />
<strong>outportb(0&#215;378,0&#215;03);&#8212;&#8212;&#8212;MOVE MOTOR(Break!) </strong><br />
sleep(2);<br />
return 0;<br />
}</p></blockquote>
</li>
<p>The Sleep(n) function tells the port to hold [Latch] the command for (n) seconds.<br />
eg: sleep(2)&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;delay or sleep for 2 seconds</p>
<p>If you want to work in milliseconds ,use the delay(n) command<br />
eg: delay(500) &#8212;&#8212;&#8212;&#8212;&#8211;delay for 500 milliseconds</p>
<p>That&#8217;s it, you can now control a motor using the parallel port. Use 2 motors and you have a moving machine. You can actually control the motors using the arrow keys using the Bioskey() function. Check &#8220;C&#8221; help for this. Hope you found this tutorial useful.<br />
Helpful links:<br />
<a href="http://doc.ic.ac.uk/~ih/doc/par/" target="_blank">Interfacing the printer port</a><br />
<a href="http://www.beyondlogic.org" target="_blank">Introduction to Parallel Ports</a><br />
Books I used:<br />
<a href="http://www.lvr.com" target="_blank">Parallel Port Complete</a> By Jan Axelson [Rs 350]</ul>
<p><script type="text/javascript"><!--
google_ad_client = "pub-1367209070807564";
/* 468x15, created 2/5/09 */
google_ad_slot = "3359662072";
google_ad_width = 468;
google_ad_height = 15;
//-->
</script><br />
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></p>


<p>No related posts.</p>]]></content:encoded>
			<wfw:commentRss>http://www.machinegrid.com/2008/12/parallel-port-tutorial-part-1/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>
