<?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>trigger &#8211; Dr. Jian Chen</title>
	<atom:link href="http://localhost/jianchen/tag/trigger/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.jianchen.info</link>
	<description>陈建博士</description>
	<lastBuildDate>Tue, 28 Jun 2022 23:41:19 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.1.1</generator>

<image>
	<url>https://www.jianchen.info/wp-content/uploads/2022/06/cropped-Frued_Cartoon-32x32.png</url>
	<title>trigger &#8211; Dr. Jian Chen</title>
	<link>https://www.jianchen.info</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>Send Triggers via Parallel Port in Linux – using pp &#038; ppMEX.c</title>
		<link>https://www.jianchen.info/2015/12/30/send-triggers-via-parallel-port-in-linux-using-pp-ppmex-c/</link>
		
		<dc:creator><![CDATA[saturn]]></dc:creator>
		<pubDate>Wed, 30 Dec 2015 23:40:33 +0000</pubDate>
				<category><![CDATA[research]]></category>
		<category><![CDATA[matlab]]></category>
		<category><![CDATA[trigger]]></category>
		<guid isPermaLink="false">https://www.jianchen.info/?p=97</guid>

					<description><![CDATA[This method is developed by&#160;Erik Flister. It is designed to read/write TTL levels on parallel port pins under Linux, win32 (using porttalk), or matlab32 on win64 (using io32). This method includes two code files:&#160;pp.m&#160;and&#160;ppMex.c. The way to implement this method is easy, just to insert a line of code in your matlab script. To even ... <a title="Send Triggers via Parallel Port in Linux – using pp &#038; ppMEX.c" class="read-more" href="https://www.jianchen.info/2015/12/30/send-triggers-via-parallel-port-in-linux-using-pp-ppmex-c/" aria-label="More on Send Triggers via Parallel Port in Linux – using pp &#038; ppMEX.c">Read more</a>]]></description>
										<content:encoded><![CDATA[
<p>This method is developed by&nbsp;<a href="https://groups.yahoo.com/neo/groups/psychtoolbox/conversations/messages/13972" target="_blank" rel="noreferrer noopener">Erik Flister</a>. It is designed to read/write TTL levels on parallel port pins under Linux, win32 (using porttalk), or matlab32 on win64 (using io32). This method includes two code files:&nbsp;<em><strong>pp.m</strong></em>&nbsp;and&nbsp;<em><strong>ppMex.c</strong></em>.</p>



<p>The way to implement this method is easy, just to insert a line of code in your matlab script. To even simplify the triggering job, I wrote a function here to share. So you basically only need to input the triggers you want to send into the trigger.m function. For example, trigger(1); trigger(2).</p>



<p>Download all three files at here:</p>



<p><a href="https://jianch.github.io/wp-content/uploads/2021/02/pp_ppMex.zip">pp_ppMex</a><a href="https://jianch.github.io/wp-content/uploads/2021/02/pp_ppMex.zip">Download</a></p>



<p><em><strong>trigger.m</strong></em></p>



<pre class="wp-block-code"><code>function trigger(sti_trigger)

% &#91;input] = pp(pins,&#91;output],&#91;slowChecks],&#91;port],&#91;address])
% pp(uint8(&#91;2 3 4 5 6 7 8 9]), &#91;0 0 0 0 0 0 0 0], 0, uint8(0), uint64(53248));

if sti_trigger == 0
    bin_value = &#91;0 0 0 0 0 0 0 0];
    pp(uint8(&#91;2 3 4 5 6 7 8 9]), bin_value, 0, uint8(0), uint64(53248));
end

if sti_trigger == 1
    bin_value = &#91;1 0 0 0 0 0 0 0];
    pp(uint8(&#91;2 3 4 5 6 7 8 9]), bin_value, 0, uint8(0), uint64(53248));
end

if (1 &lt; sti_trigger)&amp;&amp;(sti_trigger &lt; 4)
    bin_value = strcat('000000',dec2bin(sti_trigger));
    bin_value = fliplr(bin_value);
    bin_value = bin_value - '0' ;
    pp(uint8(&#91;2 3 4 5 6 7 8 9]), bin_value, 0, uint8(0), uint64(53248));
end

if (3 &lt; sti_trigger)&amp;&amp;(sti_trigger &lt; 8)
    bin_value = strcat('00000',dec2bin(sti_trigger));
    bin_value = fliplr(bin_value);
    bin_value = bin_value - '0' ;
    pp(uint8(&#91;2 3 4 5 6 7 8 9]), bin_value, 0, uint8(0), uint64(53248));
end

if (7 &lt; sti_trigger)&amp;&amp;(sti_trigger &lt; 16)
    bin_value = strcat('0000',dec2bin(sti_trigger));
    bin_value = fliplr(bin_value);
    bin_value = bin_value - '0' ;
    pp(uint8(&#91;2 3 4 5 6 7 8 9]), bin_value, 0, uint8(0), uint64(53248));
end

if (15 &lt; sti_trigger)&amp;&amp;(sti_trigger &lt; 32)
    bin_value = strcat('000',dec2bin(sti_trigger));
    bin_value = fliplr(bin_value);
    bin_value = bin_value - '0' ;
    pp(uint8(&#91;2 3 4 5 6 7 8 9]), bin_value, 0, uint8(0), uint64(53248));
end

if (31 &lt; sti_trigger)&amp;&amp;(sti_trigger &lt; 64)
    bin_value = strcat('00',dec2bin(sti_trigger));
    bin_value = fliplr(bin_value);
    bin_value = bin_value - '0' ;
    pp(uint8(&#91;2 3 4 5 6 7 8 9]), bin_value, 0, uint8(0), uint64(53248));
end

if (63 &lt; sti_trigger)&amp;&amp;(sti_trigger &lt; 128)
    bin_value = strcat('0',dec2bin(sti_trigger));
    bin_value = fliplr(bin_value);
    bin_value = bin_value - '0' ;
    pp(uint8(&#91;2 3 4 5 6 7 8 9]), bin_value, 0, uint8(0), uint64(53248));
end

if sti_trigger &gt; 127
    bin_value = dec2bin(sti_trigger);
    bin_value = fliplr(bin_value);
    bin_value = bin_value - '0' ;
    pp(uint8(&#91;2 3 4 5 6 7 8 9]), bin_value, 0, uint8(0), uint64(53248));
end</code></pre>



<p><em>[update 2/12/2016]</em></p>



<p><em>An minor error was found in trigger.m and has been fixed.</em></p>
]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
