<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	>
<channel>
	<title>Comments on: Building OnChange event to listen the parallel port</title>
	<atom:link href="http://moebiusit.com/blog/pabloromano/2009/04/03/building-onchange-event-to-listen-the-parallel-port/feed/" rel="self" type="application/rss+xml" />
	<link>http://moebiusit.com/blog/pabloromano/2009/04/03/building-onchange-event-to-listen-the-parallel-port/</link>
	<description>A bunch of techy stuff we want to talk about</description>
	<pubDate>Sun, 01 Aug 2010 04:38:03 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.6.3</generator>
		<item>
		<title>By: robert hacault</title>
		<link>http://moebiusit.com/blog/pabloromano/2009/04/03/building-onchange-event-to-listen-the-parallel-port/#comment-49</link>
		<dc:creator>robert hacault</dc:creator>
		<pubDate>Tue, 12 Jan 2010 18:12:47 +0000</pubDate>
		<guid isPermaLink="false">http://moebiusit.com/blog/?p=45#comment-49</guid>
		<description>got it to work</description>
		<content:encoded><![CDATA[<p>got it to work</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: robert hacault</title>
		<link>http://moebiusit.com/blog/pabloromano/2009/04/03/building-onchange-event-to-listen-the-parallel-port/#comment-47</link>
		<dc:creator>robert hacault</dc:creator>
		<pubDate>Fri, 08 Jan 2010 18:23:01 +0000</pubDate>
		<guid isPermaLink="false">http://moebiusit.com/blog/?p=45#comment-47</guid>
		<description>I have my code working but I have a question on the pins

I am trying to receive some inputs from the port.

I know the 8 data pins are used for output
I can receive the input of the 5 status pins but for some reason I cant find a way to receive input data from the 4 control pins. I though they were I/O. if so , what am I doing wrong?</description>
		<content:encoded><![CDATA[<p>I have my code working but I have a question on the pins</p>
<p>I am trying to receive some inputs from the port.</p>
<p>I know the 8 data pins are used for output<br />
I can receive the input of the 5 status pins but for some reason I cant find a way to receive input data from the 4 control pins. I though they were I/O. if so , what am I doing wrong?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Pablo Romano</title>
		<link>http://moebiusit.com/blog/pabloromano/2009/04/03/building-onchange-event-to-listen-the-parallel-port/#comment-45</link>
		<dc:creator>Pablo Romano</dc:creator>
		<pubDate>Mon, 14 Dec 2009 18:26:03 +0000</pubDate>
		<guid isPermaLink="false">http://moebiusit.com/blog/?p=45#comment-45</guid>
		<description>Hi Bennyben,
I guess you want to send a 0 to a particular pin, but when you write to the port you must send 1s or 0s to all the others too.

Reading and writing can be done through PortAccess.Input and PortAccess.Output. The latter receives the address and a decimal value that is converted to it's binary form, where each bit correlates to a pin. Here is a link explaining what you can do with each pin.
http://www.beyondlogic.org/spp/parallel.htm#5

If you want to change the value of one pin first of all you need the value of the others, the ones that don't change. If you are working with the bi-directional pins you can read the value, if you are using the write-only ones you must keep the value in your application.

Let's suppose the value is 11011011 = 219 dec and you want to send a 0 to the 4th pin (bit 3), then you should make a mask that has a 0 in that position, 1s in all the others and make a bitwise and (&#38;) with the current value. Here is an example:

int currentValue = 91; //01011011

int mask = 255 - (int)Math.Pow(2, 3); //11111111 - 1000 = 11110111

int newValue = currentValue &#38; mask; //01110111 &#38; 11011011 = 01010011

If you want to send a 1 to a pin you should make a mask with 1 in that pin, 0s in all the others and make a bitwise or (&#124;) with the current value.

Please tell me if this helps or you need more assistance.</description>
		<content:encoded><![CDATA[<p>Hi Bennyben,<br />
I guess you want to send a 0 to a particular pin, but when you write to the port you must send 1s or 0s to all the others too.</p>
<p>Reading and writing can be done through PortAccess.Input and PortAccess.Output. The latter receives the address and a decimal value that is converted to it&#8217;s binary form, where each bit correlates to a pin. Here is a link explaining what you can do with each pin.<br />
<a href="http://www.beyondlogic.org/spp/parallel.htm#5" rel="nofollow">http://www.beyondlogic.org/spp/parallel.htm#5</a></p>
<p>If you want to change the value of one pin first of all you need the value of the others, the ones that don&#8217;t change. If you are working with the bi-directional pins you can read the value, if you are using the write-only ones you must keep the value in your application.</p>
<p>Let&#8217;s suppose the value is 11011011 = 219 dec and you want to send a 0 to the 4th pin (bit 3), then you should make a mask that has a 0 in that position, 1s in all the others and make a bitwise and (&amp;) with the current value. Here is an example:</p>
<p>int currentValue = 91; //01011011</p>
<p>int mask = 255 - (int)Math.Pow(2, 3); //11111111 - 1000 = 11110111</p>
<p>int newValue = currentValue &amp; mask; //01110111 &amp; 11011011 = 01010011</p>
<p>If you want to send a 1 to a pin you should make a mask with 1 in that pin, 0s in all the others and make a bitwise or (|) with the current value.</p>
<p>Please tell me if this helps or you need more assistance.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: bennyben</title>
		<link>http://moebiusit.com/blog/pabloromano/2009/04/03/building-onchange-event-to-listen-the-parallel-port/#comment-43</link>
		<dc:creator>bennyben</dc:creator>
		<pubDate>Mon, 14 Dec 2009 03:17:06 +0000</pubDate>
		<guid isPermaLink="false">http://moebiusit.com/blog/?p=45#comment-43</guid>
		<description>how to deactivate a certain pin? 
i know that 'PortAccess.Output(address, 0)' is to deactivate all the pins.</description>
		<content:encoded><![CDATA[<p>how to deactivate a certain pin?<br />
i know that &#8216;PortAccess.Output(address, 0)&#8217; is to deactivate all the pins.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Pablo Romano</title>
		<link>http://moebiusit.com/blog/pabloromano/2009/04/03/building-onchange-event-to-listen-the-parallel-port/#comment-40</link>
		<dc:creator>Pablo Romano</dc:creator>
		<pubDate>Sun, 18 Oct 2009 15:55:36 +0000</pubDate>
		<guid isPermaLink="false">http://moebiusit.com/blog/?p=45#comment-40</guid>
		<description>Hi Miguel,
I haven't tried the code with a usb to parallel, I think in the worst case only a change in the PORT_ADDRESS constant will be needed.

Try it and let me know</description>
		<content:encoded><![CDATA[<p>Hi Miguel,<br />
I haven&#8217;t tried the code with a usb to parallel, I think in the worst case only a change in the PORT_ADDRESS constant will be needed.</p>
<p>Try it and let me know</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Miguel Hidalgo</title>
		<link>http://moebiusit.com/blog/pabloromano/2009/04/03/building-onchange-event-to-listen-the-parallel-port/#comment-39</link>
		<dc:creator>Miguel Hidalgo</dc:creator>
		<pubDate>Sat, 17 Oct 2009 14:57:53 +0000</pubDate>
		<guid isPermaLink="false">http://moebiusit.com/blog/?p=45#comment-39</guid>
		<description>Excelent article, but I have a question: Does it works with a USB to parallel cable (1284)? I am looking to access the pins of the this port with the cable.

Thank you</description>
		<content:encoded><![CDATA[<p>Excelent article, but I have a question: Does it works with a USB to parallel cable (1284)? I am looking to access the pins of the this port with the cable.</p>
<p>Thank you</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Pablo Romano</title>
		<link>http://moebiusit.com/blog/pabloromano/2009/04/03/building-onchange-event-to-listen-the-parallel-port/#comment-33</link>
		<dc:creator>Pablo Romano</dc:creator>
		<pubDate>Mon, 21 Sep 2009 14:31:57 +0000</pubDate>
		<guid isPermaLink="false">http://moebiusit.com/blog/?p=45#comment-33</guid>
		<description>Hi Niraj,
The code listens all the pins, it translates the binary number to it's decimal form.
If you only need the 10th pin you can mask the others by doing "bool pinState = (readedNumber &#38; (int)Math.Pow(2, 6)) != 0;" (http://www.ctv.es/pckits/tutorial.html#padr)

Please tell me if this helps or you need more assistance.</description>
		<content:encoded><![CDATA[<p>Hi Niraj,<br />
The code listens all the pins, it translates the binary number to it&#8217;s decimal form.<br />
If you only need the 10th pin you can mask the others by doing &#8220;bool pinState = (readedNumber &amp; (int)Math.Pow(2, 6)) != 0;&#8221; (http://www.ctv.es/pckits/tutorial.html#padr)</p>
<p>Please tell me if this helps or you need more assistance.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: niraj</title>
		<link>http://moebiusit.com/blog/pabloromano/2009/04/03/building-onchange-event-to-listen-the-parallel-port/#comment-32</link>
		<dc:creator>niraj</dc:creator>
		<pubDate>Mon, 21 Sep 2009 05:44:17 +0000</pubDate>
		<guid isPermaLink="false">http://moebiusit.com/blog/?p=45#comment-32</guid>
		<description>hello is it listen to lpt pin no 10????????? plz replay soon</description>
		<content:encoded><![CDATA[<p>hello is it listen to lpt pin no 10????????? plz replay soon</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: wilman</title>
		<link>http://moebiusit.com/blog/pabloromano/2009/04/03/building-onchange-event-to-listen-the-parallel-port/#comment-9</link>
		<dc:creator>wilman</dc:creator>
		<pubDate>Mon, 20 Apr 2009 17:30:15 +0000</pubDate>
		<guid isPermaLink="false">http://moebiusit.com/blog/?p=45#comment-9</guid>
		<description>Pablo,

I have already figured it out myself after trying but thanks a lot for typing it since it will be useful for others I think. The project worked great with this. Go ahead, really nice blog!</description>
		<content:encoded><![CDATA[<p>Pablo,</p>
<p>I have already figured it out myself after trying but thanks a lot for typing it since it will be useful for others I think. The project worked great with this. Go ahead, really nice blog!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Pablo Romano</title>
		<link>http://moebiusit.com/blog/pabloromano/2009/04/03/building-onchange-event-to-listen-the-parallel-port/#comment-8</link>
		<dc:creator>Pablo Romano</dc:creator>
		<pubDate>Fri, 17 Apr 2009 13:54:07 +0000</pubDate>
		<guid isPermaLink="false">http://moebiusit.com/blog/?p=45#comment-8</guid>
		<description>Hi Wilman,
Thanks, I'm glad you liked it!

Here is an example, if you have any doubts tell me.

Greetings from the other side of the Rio de la Plata,
Pablo

Example:

    class DemoClass
    {
        public DemoClass()
        {
            PortListener.ParallelPortListener.Instance.OnPortChanged += OnPortChanged;
        }

        void OnPortChanged(int portValue)
        {
            //Do something with portValue
        }
    }</description>
		<content:encoded><![CDATA[<p>Hi Wilman,<br />
Thanks, I&#8217;m glad you liked it!</p>
<p>Here is an example, if you have any doubts tell me.</p>
<p>Greetings from the other side of the Rio de la Plata,<br />
Pablo</p>
<p>Example:</p>
<p>    class DemoClass<br />
    {<br />
        public DemoClass()<br />
        {<br />
            PortListener.ParallelPortListener.Instance.OnPortChanged += OnPortChanged;<br />
        }</p>
<p>        void OnPortChanged(int portValue)<br />
        {<br />
            //Do something with portValue<br />
        }<br />
    }</p>
]]></content:encoded>
	</item>
</channel>
</rss>
