<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>http://fpcamigawiki.alb42.de/index.php?action=history&amp;feed=atom&amp;title=Tutorial%3ASerielle_Kommunikation</id>
	<title>Tutorial:Serielle Kommunikation - Revision history</title>
	<link rel="self" type="application/atom+xml" href="http://fpcamigawiki.alb42.de/index.php?action=history&amp;feed=atom&amp;title=Tutorial%3ASerielle_Kommunikation"/>
	<link rel="alternate" type="text/html" href="http://fpcamigawiki.alb42.de/index.php?title=Tutorial:Serielle_Kommunikation&amp;action=history"/>
	<updated>2026-04-18T02:31:30Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.35.1</generator>
	<entry>
		<id>http://fpcamigawiki.alb42.de/index.php?title=Tutorial:Serielle_Kommunikation&amp;diff=899&amp;oldid=prev</id>
		<title>Alb42: /* Vorbereiten des seriellen Gerätes */ image of the RS232 to TTL adapter</title>
		<link rel="alternate" type="text/html" href="http://fpcamigawiki.alb42.de/index.php?title=Tutorial:Serielle_Kommunikation&amp;diff=899&amp;oldid=prev"/>
		<updated>2018-12-20T17:42:52Z</updated>

		<summary type="html">&lt;p&gt;&lt;span dir=&quot;auto&quot;&gt;&lt;span class=&quot;autocomment&quot;&gt;Vorbereiten des seriellen Gerätes: &lt;/span&gt; image of the RS232 to TTL adapter&lt;/span&gt;&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left diff-editfont-monospace&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 17:42, 20 December 2018&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l4&quot; &gt;Line 4:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 4:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;== Vorbereiten des seriellen Gerätes ==&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;== Vorbereiten des seriellen Gerätes ==&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;[[File:RS232TTL.jpg|200x200px|thumbnail|right]]&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Als Modelgerät benutzen wir ein Arduino UNO welches per RS232 am Amiga angeschlossen wird bzw. via USB am MorphOS Computer und dabei einen virtuellen seriellen Port zur Verfügung stellt. Achtung man kann nicht einfach die Leitungen des Arduino an den Amiga RS232 anschliessen, da braucht man ein wenig Elektronik um die Pegel zu regeln. Bei Interesse nach &amp;quot;RS232 Shield Arduino&amp;quot; oder &amp;quot;RS232 zu TTL-Konverter&amp;quot; googlen, da gibt es viel Auswahl.&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Als Modelgerät benutzen wir ein Arduino UNO welches per RS232 am Amiga angeschlossen wird bzw. via USB am MorphOS Computer und dabei einen virtuellen seriellen Port zur Verfügung stellt. Achtung man kann nicht einfach die Leitungen des Arduino an den Amiga RS232 anschliessen, da braucht man ein wenig Elektronik um die Pegel zu regeln. Bei Interesse nach &amp;quot;RS232 Shield Arduino&amp;quot; oder &amp;quot;RS232 zu TTL-Konverter&amp;quot; googlen, da gibt es viel Auswahl.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Zuerst muss der Arduino programiert werden. Als sehr einfacher Anfang wir schreiben ein kurzes Program welches nur &amp;quot;Hello World&amp;quot; und eine laufende Nummer ausgibt. (damit man besser sieht das etwas passiert.)&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Zuerst muss der Arduino programiert werden. Als sehr einfacher Anfang wir schreiben ein kurzes Program welches nur &amp;quot;Hello World&amp;quot; und eine laufende Nummer ausgibt. (damit man besser sieht das etwas passiert.)&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;source lang=&amp;quot;C&amp;quot;&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;source lang=&amp;quot;C&amp;quot;&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;const unsigned long BAUD_RATE = 9600;&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;const unsigned long BAUD_RATE = 9600;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;

&lt;!-- diff cache key db624220369-ntdbjym2gu:diff::1.12:old-896:rev-899 --&gt;
&lt;/table&gt;</summary>
		<author><name>Alb42</name></author>
	</entry>
	<entry>
		<id>http://fpcamigawiki.alb42.de/index.php?title=Tutorial:Serielle_Kommunikation&amp;diff=896&amp;oldid=prev</id>
		<title>Alb42: Temperature control added german</title>
		<link rel="alternate" type="text/html" href="http://fpcamigawiki.alb42.de/index.php?title=Tutorial:Serielle_Kommunikation&amp;diff=896&amp;oldid=prev"/>
		<updated>2018-12-20T17:31:10Z</updated>

		<summary type="html">&lt;p&gt;Temperature control added german&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left diff-editfont-monospace&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 17:31, 20 December 2018&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l384&quot; &gt;Line 384:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 384:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;/source&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;/source&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Von hier an gibt es nur noch Teile des Sopurce, da es sonst zu lang wird, allerdings kannst du den kompletten Source hier runterladen: Source1.pas[http://www.alb42.de/serial/Source1.pas]&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Von hier an gibt es nur noch Teile des Sopurce, da es sonst zu lang wird, allerdings kannst du den kompletten Source hier runterladen: Source1.pas[http://www.alb42.de/serial/Source1.pas]&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;== Temperatursensor ==&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;Da die serielle Übertragung jetzt funktioniert, können wir etwas mehr sinnvolles mit dem Arduino machen. Zum Beispiel Sendoren and den Arduino anschliessen, die Werte auslesen und an den Amiga schicken.&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;Fangen wir mit einem Temperatursensor an, dies is relativ einfach weil es nicht viel Programmierung benötigt und die Werte siuch nicht sehr schnell ändern. Ich habe dafür einen DS18B20 Temperatursensor welches mittels 1-Wite Protokoll kommuniziert. Es gibt dafür schon fertig Libraries in der Arduino Library Kollektion. Die Library, die man hier benötigt heisst &amp;quot;MAX31850 DallasTemp&amp;quot; (diese braucht auch eine weitere Library zum 1-Wire zugriff, diese wird aber normalerweise automatisch mitinstalliert). Nachdem die Library installiert ist muss man den Sensor noch an den Arduino anschliessen. Ich benutze den GPIO Pin 10 dafür (weil bei meinem Arduino andere Pins schon für andere Sachen belegt sind) man kann auch einen anderen Pin benutzen.&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;[[File:TemperatureArduino.png]]&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;Schliesse die Kabel wie im Bild gezeigt an, wie im Bild zu sehen benötigt man nur den Temperatursensor, einen 4.7 kOhm Widerstand und einige Kabel (und vielleicht ein Breadboard um alles draufzustecken).&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;Um die Temperatur vom Sensor auszulesen schreiben wir ein neues kleines Arduinoprogram welches die Temperatur an den seriellen Port sendet.&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;lt;source lang=&amp;quot;C&amp;quot;&amp;gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;#include &amp;lt;OneWire.h&amp;gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;#include &amp;lt;DallasTemperature.h&amp;gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;const unsigned long BAUD_RATE = 9600;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;const unsigned char ONE_WIRE_BUS = 10; // Pin des Temperatur sensors&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;OneWire oneWire(ONE_WIRE_BUS);&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;DallasTemperature sensoren(&amp;amp;oneWire);&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;void setup() {&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;  sensoren.begin();&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;  Serial.begin(BAUD_RATE);&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;}&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;void loop() {&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;  sensoren.requestTemperatures();&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;  if (sensoren.getDeviceCount() &amp;gt; 0)&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;  {&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;    float temperatur = sensoren.getTempCByIndex(0);&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;    Serial.println(temperatur);&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;  }&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;  else&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;  {&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;    Serial.println(&amp;quot;N&amp;quot;);&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;  }&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;  delay(200);&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;}&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;lt;/source&amp;gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;Wenn wir jetzt unser FreePascal-Programm starten zeigt es die Temperatur welcher der Sensor misst, ohne das wir das Programm ändern müssten.&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;== Graphische Benutzeroberfläche ==&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;== Mehrere Sensoren ==&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Alb42</name></author>
	</entry>
	<entry>
		<id>http://fpcamigawiki.alb42.de/index.php?title=Tutorial:Serielle_Kommunikation&amp;diff=895&amp;oldid=prev</id>
		<title>Alb42: stuff for serial device in german</title>
		<link rel="alternate" type="text/html" href="http://fpcamigawiki.alb42.de/index.php?title=Tutorial:Serielle_Kommunikation&amp;diff=895&amp;oldid=prev"/>
		<updated>2018-12-20T17:18:22Z</updated>

		<summary type="html">&lt;p&gt;stuff for serial device in german&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left diff-editfont-monospace&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 17:18, 20 December 2018&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l5&quot; &gt;Line 5:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 5:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;== Vorbereiten des seriellen Gerätes ==&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;== Vorbereiten des seriellen Gerätes ==&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt;−&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Als &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;Modelgeräte &lt;/del&gt;wir &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;benutzen &lt;/del&gt;ein Arduino UNO welches per &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;USB &lt;/del&gt;am Amiga angeschlossen wird und dabei einen virtuellen seriellen Port zur &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;verfügung &lt;/del&gt;stellt. &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;Man könnte den Arduino auch and die RS232 Schnittstelle des Amigas anschliessen (falls man z.B. kein USB für Amiga hat) aber &lt;/del&gt;Achtung man kann nicht einfach die Leitungen des Arduino an den Amiga RS232 anschliessen, da braucht man ein wenig Elektronik um die Pegel zu regeln. Bei Interesse nach &amp;quot;RS232 Shield Arduino&amp;quot; googlen, da gibt es viel Auswahl.&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Als &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;Modelgerät benutzen &lt;/ins&gt;wir ein Arduino UNO welches per &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;RS232 &lt;/ins&gt;am Amiga angeschlossen wird &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;bzw. via USB am MorphOS Computer &lt;/ins&gt;und dabei einen virtuellen seriellen Port zur &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;Verfügung &lt;/ins&gt;stellt. Achtung man kann nicht einfach die Leitungen des Arduino an den Amiga RS232 anschliessen, da braucht man ein wenig Elektronik um die Pegel zu regeln. Bei Interesse nach &amp;quot;RS232 Shield Arduino&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;&amp;quot; oder &amp;quot;RS232 zu TTL-Konverter&lt;/ins&gt;&amp;quot; googlen, da gibt es viel Auswahl.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Zuerst muss der Arduino programiert werden. Als sehr einfacher Anfang wir schreiben ein kurzes Program welches nur &amp;quot;Hello World&amp;quot; und eine laufende Nummer ausgibt. (damit man besser sieht das etwas passiert.)&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Zuerst muss der Arduino programiert werden. Als sehr einfacher Anfang wir schreiben ein kurzes Program welches nur &amp;quot;Hello World&amp;quot; und eine laufende Nummer ausgibt. (damit man besser sieht das etwas passiert.)&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l183&quot; &gt;Line 183:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 183:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;   Res: LongInt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;   Res: LongInt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;   DevOpen: Boolean = False;&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;   DevOpen: Boolean = False;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt;−&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;   DeviceName: AnsiString = &amp;#039;&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;usbmode&lt;/del&gt;.device&amp;#039;; // or &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;serial &lt;/del&gt;device&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;   DeviceName: AnsiString = &amp;#039;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;serial&lt;/ins&gt;.device&amp;#039;; // or &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;usbmodem.&lt;/ins&gt;device&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;   UnitNumber: Integer = 0;&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;   UnitNumber: Integer = 0;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l205&quot; &gt;Line 205:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 205:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Zuerst wir konfigurieren den IORequest:&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Zuerst wir konfigurieren den IORequest:&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;source lang=&amp;quot;pascal&amp;quot;&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;source lang=&amp;quot;pascal&amp;quot;&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt;−&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;     io^.io_SerFlags := (io^.io_SerFlags or SERF_XDISABLED) and (not SERF_PARTY_ON); &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;// Parity und XON/XOFF ausschalten&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;    // Parity und XON/XOFF ausschalten &lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt;−&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;     io^.io_Baud := Baud; &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;                                                           &lt;/del&gt;// Baud rate setzen&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;     io^.io_SerFlags := (io^.io_SerFlags or SERF_XDISABLED) and (not SERF_PARTY_ON);  &lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt;−&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;     io^.IOSer.io_Command := SDCMD_SETPARAMS; &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;                                       &lt;/del&gt;// Message Kommando = Setze Parameter&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;     io^.io_Baud := Baud; &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;                    &lt;/ins&gt;// Baud rate setzen&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;    io^.io_ReadLen := 8;                     // 8 Bits pro Character&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;    io^.io_WriteLen := 8;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;    io^.io_StopBits := 1;                    // 1 Stopbit &lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;     io^.IOSer.io_Command := SDCMD_SETPARAMS; // Message Kommando = Setze Parameter&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;/source&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;/source&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Um die Nachricht zu versenden wir können &amp;lt;code&amp;gt;DoIO()&amp;lt;/code&amp;gt; oder &amp;lt;code&amp;gt;SendIO()&amp;lt;/code&amp;gt; neutzen. DoIO() blockiert bis die Nachricht abgearbeitet ist. SendIO() kehrt sofort zurück, läuft im Hintergrund weiter und wir müssen testen ob die Nachricht beendet ist. I prefer SendIO() because you have more control about what happens and you can break the request if it needs too long time. With &amp;lt;code&amp;gt;CheckIO()&amp;lt;/code&amp;gt; you can test if the request is already finished or use WaitIO() for the end of operation. All together it looks like that:&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Um die Nachricht zu versenden wir können &amp;lt;code&amp;gt;DoIO()&amp;lt;/code&amp;gt; oder &amp;lt;code&amp;gt;SendIO()&amp;lt;/code&amp;gt; neutzen. DoIO() blockiert bis die Nachricht abgearbeitet ist. SendIO() kehrt sofort zurück, läuft im Hintergrund weiter und wir müssen testen ob die Nachricht beendet ist. I prefer SendIO() because you have more control about what happens and you can break the request if it needs too long time. With &amp;lt;code&amp;gt;CheckIO()&amp;lt;/code&amp;gt; you can test if the request is already finished or use WaitIO() for the end of operation. All together it looks like that:&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;source lang=&amp;quot;pascal&amp;quot;&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;source lang=&amp;quot;pascal&amp;quot;&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt;−&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;     io^.io_SerFlags := (io^.io_SerFlags or SERF_XDISABLED) and (not SERF_PARTY_ON); &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;// Parity und XON/XOFF ausschalten&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;    // Parity und XON/XOFF ausschalten&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt;−&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;     io^.io_Baud := Baud; &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;                                                           &lt;/del&gt;// Baud rate setzen&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;     io^.io_SerFlags := (io^.io_SerFlags or SERF_XDISABLED) and (not SERF_PARTY_ON);  &lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt;−&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;     io^.IOSer.io_Command := SDCMD_SETPARAMS; &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;                                       &lt;/del&gt;// Message Kommando = Setze Parameter&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;     io^.io_Baud := Baud; &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;                    &lt;/ins&gt;// Baud rate setzen&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;    io^.io_ReadLen := 8;                     // 8 Bits pro Character&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;    io^.io_WriteLen := 8;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;    io^.io_StopBits := 1;                    // 1 Stopbit &lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;     io^.IOSer.io_Command := SDCMD_SETPARAMS; // Message Kommando = Setze Parameter&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;     SendIO(PIORequest(io));  // sende die Nachricht&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;     SendIO(PIORequest(io));  // sende die Nachricht&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;     WaitIO(PIORequest(io));  // Warte auf die Antwort&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;     WaitIO(PIORequest(io));  // Warte auf die Antwort&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l241&quot; &gt;Line 241:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 249:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;   exec, serial;&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;   exec, serial;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;const&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;const&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt;−&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;   DefDevice = &amp;#039;&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;usbmodem&lt;/del&gt;.device&amp;#039;;&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;   DefDevice = &amp;#039;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;serial&lt;/ins&gt;.device&amp;#039;; &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;// or usbmodem.device&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;   DefUnit = 0;&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;   DefUnit = 0;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;   DefBaud = 9600;&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;   DefBaud = 9600;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l280&quot; &gt;Line 280:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 288:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;     io^.io_SerFlags := (io^.io_SerFlags or SERF_XDISABLED) and (not SERF_PARTY_ON);&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;     io^.io_SerFlags := (io^.io_SerFlags or SERF_XDISABLED) and (not SERF_PARTY_ON);&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;     io^.io_Baud := Baud;&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;     io^.io_Baud := Baud;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;    io^.io_ReadLen := 8;                     // 8 Bits pro Character&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;    io^.io_WriteLen := 8;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;    io^.io_StopBits := 1;                    // 1 Stopbit &lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;     io^.IOSer.io_Command := SDCMD_SETPARAMS;&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;     io^.IOSer.io_Command := SDCMD_SETPARAMS;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;     SendIO(PIORequest(io));&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;     SendIO(PIORequest(io));&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l324&quot; &gt;Line 324:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 335:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;source lang=&amp;quot;pascal&amp;quot;&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;source lang=&amp;quot;pascal&amp;quot;&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt;−&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;     io^.io_SerFlags := (io^.io_SerFlags or SERF_EOFMODE or SERF_XDISABLED) and (not SERF_PARTY_ON); &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;// Parity und XON/XOFF ausschalten, EOF anschalten&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;    // Parity und XON/XOFF ausschalten, EOF anschalten&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt;−&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;     io^.io_Baud := Baud; &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;                                                                           &lt;/del&gt;// Baudrate setzen&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;     io^.io_SerFlags := (io^.io_SerFlags or SERF_EOFMODE or SERF_XDISABLED) and (not SERF_PARTY_ON);  &lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt;−&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;     io^.io_TermArray.TermArray0 := $0a030303; &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;                                                      &lt;/del&gt;// Ende des Files Zeichen #10 Rest gefüllt mit $03 = End of Text&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;     io^.io_Baud := Baud; &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;                     &lt;/ins&gt;// Baudrate setzen&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;    io^.io_ReadLen := 8;                      // 8 Bits pro Character&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;    io^.io_WriteLen := 8;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;    io^.io_StopBits := 1;                     // 1 Stopbit &lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;     io^.io_TermArray.TermArray0 := $0a030303; // Ende des Files Zeichen #10 Rest gefüllt mit $03 = End of Text&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;     io^.io_TermArray.TermArray1 := $03030303;&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;     io^.io_TermArray.TermArray1 := $03030303;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt;−&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;     io^.IOSer.io_Command := SDCMD_SETPARAMS; &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;                                                       &lt;/del&gt;// Nachtichten Kommando type = Setze Parameter&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;     io^.IOSer.io_Command := SDCMD_SETPARAMS; &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt; &lt;/ins&gt;// Nachtichten Kommando type = Setze Parameter&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;     SendIO(PIORequest(io));  // Sende Nachricht&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;     SendIO(PIORequest(io));  // Sende Nachricht&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;     WaitIO(PIORequest(io));  // Warte auf Antwort&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;     WaitIO(PIORequest(io));  // Warte auf Antwort&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;

&lt;!-- diff cache key db624220369-ntdbjym2gu:diff::1.12:old-888:rev-895 --&gt;
&lt;/table&gt;</summary>
		<author><name>Alb42</name></author>
	</entry>
	<entry>
		<id>http://fpcamigawiki.alb42.de/index.php?title=Tutorial:Serielle_Kommunikation&amp;diff=888&amp;oldid=prev</id>
		<title>Alb42: german translation</title>
		<link rel="alternate" type="text/html" href="http://fpcamigawiki.alb42.de/index.php?title=Tutorial:Serielle_Kommunikation&amp;diff=888&amp;oldid=prev"/>
		<updated>2018-12-08T22:25:13Z</updated>

		<summary type="html">&lt;p&gt;german translation&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;&amp;lt;big&amp;gt;[[Tutorial:Start|Start]] Nächste&amp;lt;/big&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Dieses Tutorial zeigt wie man Geräte mit serieller Kommunikation (RS232 oder USB) am Amiga benutzt. Als Besipiel wird hier ein Arduino UNO board benutzt. Alles was hier gezeigt wird wurde auf einem Amiga 1200 (68030/50 Mhz, OS 3.9) und einer MorphOS machine getestet, aber sollte auch genauso auf einem AmigaOS4 oder nativen AROS (i386/x86_64/ARM)  so funktionieren.&lt;br /&gt;
&lt;br /&gt;
== Vorbereiten des seriellen Gerätes ==&lt;br /&gt;
&lt;br /&gt;
Als Modelgeräte wir benutzen ein Arduino UNO welches per USB am Amiga angeschlossen wird und dabei einen virtuellen seriellen Port zur verfügung stellt. Man könnte den Arduino auch and die RS232 Schnittstelle des Amigas anschliessen (falls man z.B. kein USB für Amiga hat) aber Achtung man kann nicht einfach die Leitungen des Arduino an den Amiga RS232 anschliessen, da braucht man ein wenig Elektronik um die Pegel zu regeln. Bei Interesse nach &amp;quot;RS232 Shield Arduino&amp;quot; googlen, da gibt es viel Auswahl.&lt;br /&gt;
&lt;br /&gt;
Zuerst muss der Arduino programiert werden. Als sehr einfacher Anfang wir schreiben ein kurzes Program welches nur &amp;quot;Hello World&amp;quot; und eine laufende Nummer ausgibt. (damit man besser sieht das etwas passiert.)&lt;br /&gt;
&amp;lt;source lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
const unsigned long BAUD_RATE = 9600;&lt;br /&gt;
int count;&lt;br /&gt;
&lt;br /&gt;
void setup() {&lt;br /&gt;
  Serial.begin(BAUD_RATE);&lt;br /&gt;
  count = 1;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void loop() {&lt;br /&gt;
  Serial.print(&amp;quot;Hello Amiga (Msg: &amp;quot;);&lt;br /&gt;
  Serial.print(count++);&lt;br /&gt;
  Serial.println(&amp;quot;)&amp;quot;);&lt;br /&gt;
  delay(500);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
Dieses Programm sendet jede halbe Sekunde ein &amp;quot;Hello World (Msg: count)&amp;quot; and den serielle port. Dies kann man ganz gut mit dem &amp;quot;Serial Monitor&amp;quot; der Arduino IDE überprüfen&lt;br /&gt;
&lt;br /&gt;
== Serielle Ausgabe am Amiga ==&lt;br /&gt;
&lt;br /&gt;
Nun wollen wir diesen Text auch am Amiga sehen, wenn der Arduino am RS232 angeschlossen ist muss man nur ein Terminalprogramm starten wie z.B. NComm[http://aminet.net/package/comm/term/ncomm306]. Dort setzt man das Device zu serial.device, die Unitnummer zu 0 und Baudrate zu 9600 und schon sollte man den Output des obigen Programms sehen.&lt;br /&gt;
&lt;br /&gt;
Wenn man den Arduino per USB anschließt sollte der installierte USB Stack (z.B. Poseidon) automatisch den richtigen Treiber (cdcacm.class) benutzen und damit den Virtuellen seriellen Port verfügbar machen. Das sollte ungefähr so aus sehen:&lt;br /&gt;
&lt;br /&gt;
[[File:ArduinoUSB.png]]&lt;br /&gt;
&lt;br /&gt;
Falls er nicht automatisch den richtigen Treiber benutzt (z.B. auf MorphOS) muss man diesen erzwingen für den 0. Endpunkt. (USB Prefs/Trident öffnen, Devices, Doppelklick auf&amp;quot;Arduino UNO&amp;quot;, &amp;quot;CDC control interface (0)&amp;quot; auswählen, rechte Maustaste &amp;quot;forced binding&amp;quot; &amp;quot;cdcacm.class&amp;quot;, Warnung abnicken, Usb rausziehen und wieder anschliessen). &lt;br /&gt;
Dieser virtuelle serielle port soltle jetzt verfügbar sein über das usbmodem.device. Der Rest ist gleich wie beim RS232 Anschluss nur das das device usbmodem.device heisst.&lt;br /&gt;
&lt;br /&gt;
== Serielles Gerät mit FreePascal ==&lt;br /&gt;
=== Message port ===&lt;br /&gt;
&lt;br /&gt;
Als erstes brauchen wir einen Messageport für die Kommunikation mit dem Triber, dafür gibt es &amp;lt;code&amp;gt;CreateMsgPort()&amp;lt;/code&amp;gt; und &amp;lt;code&amp;gt;DeleteMsgPort()&amp;lt;/code&amp;gt; in der Unit Exec.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;pascal&amp;quot;&amp;gt;&lt;br /&gt;
program test;&lt;br /&gt;
uses&lt;br /&gt;
  Exec;&lt;br /&gt;
var&lt;br /&gt;
  Mp: PMsgPort;&lt;br /&gt;
begin&lt;br /&gt;
  Mp := CreateMsgPort;&lt;br /&gt;
  // do something&lt;br /&gt;
  DeleteMsgPort(Mp);&lt;br /&gt;
end.&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
Falls es nicht genug Speicher gibt um den Messageport anzulegen der Aufruf wird fehlschlagen und ein nil (=0) zurückgeben. Natürlich sollten wir das Ergebnis testen und das Program verlassen falls es ein Problem gibt. Man kann entweder den Messageport mit nil vergleichen oder die spezielle Funktion &amp;lt;code&amp;gt;Assigned()&amp;lt;/code&amp;gt; benutzen.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;pascal&amp;quot;&amp;gt;&lt;br /&gt;
program test;&lt;br /&gt;
uses&lt;br /&gt;
  Exec;&lt;br /&gt;
var&lt;br /&gt;
  Mp: PMsgPort;&lt;br /&gt;
begin&lt;br /&gt;
  Mp := CreateMsgPort;&lt;br /&gt;
  if not Assigned(Mp) then&lt;br /&gt;
  begin&lt;br /&gt;
    writeln(&amp;#039;Failed to create MsgPort&amp;#039;);&lt;br /&gt;
    Exit;&lt;br /&gt;
  end;&lt;br /&gt;
  // do something&lt;br /&gt;
  DeleteMsgPort(Mp);&lt;br /&gt;
end.&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
Dieses Programm testet ob die Erzeugung des Messageports funktioniert hat und wenn nicht gibt es eine Nachricht aus und verlässt das Programm.&lt;br /&gt;
&lt;br /&gt;
=== IO Request ===&lt;br /&gt;
Für den nächsten Schritt brauchen wir einen &amp;lt;code&amp;gt;IORequest&amp;lt;/code&amp;gt;, praktisch ein Befehl an den Treiber, da wir serielle Kommunikation betreiben wollen benötigen wir eine spezialisierten IORequest namens &amp;lt;code&amp;gt;PIOExtSer&amp;lt;/code&amp;gt; welchen wir in der serial unit finden. (Falls die serial unit nicht gefunden wird, muss das FreePascal aktualisiert werden)&lt;br /&gt;
Um so einen IORequest zu erstellen benötigen wir die beiden Funktionen &amp;lt;code&amp;gt;CreateExtIO()&amp;lt;/code&amp;gt; und &amp;lt;code&amp;gt;DeleteExtIO()&amp;lt;/code&amp;gt; aus der exec unit. Wir erweitern unser Programm und erzeugen so ein &amp;lt;code&amp;gt;PIOExtSer&amp;lt;/code&amp;gt;.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;pascal&amp;quot;&amp;gt;&lt;br /&gt;
program test;&lt;br /&gt;
uses&lt;br /&gt;
  Exec;&lt;br /&gt;
var&lt;br /&gt;
  Mp: PMsgPort;&lt;br /&gt;
  Io: PIOExtSer;&lt;br /&gt;
begin&lt;br /&gt;
  // create Messageport&lt;br /&gt;
  Mp := CreateMsgPort;&lt;br /&gt;
  if not Assigned(Mp) then&lt;br /&gt;
  begin&lt;br /&gt;
    writeln(&amp;#039;Failed to create MsgPort&amp;#039;);&lt;br /&gt;
    Exit;&lt;br /&gt;
  end;&lt;br /&gt;
  // create IO Serial&lt;br /&gt;
  Io := PIOExtSer(CreateExtIO(mp, SizeOf(TIOExtSer)));&lt;br /&gt;
  if not Assigned(Io) then&lt;br /&gt;
  begin&lt;br /&gt;
    Writeln(&amp;#039;Cannot alloc IOExtSer&amp;#039;);&lt;br /&gt;
    Exit;&lt;br /&gt;
  end;&lt;br /&gt;
  // do something&lt;br /&gt;
  DeleteExtIO(PIORequest(Io));&lt;br /&gt;
  DeleteMsgPort(Mp);&lt;br /&gt;
end.&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
An dieser Stelle möchte ich auf ein kleines Problem hinweisen. Falls der Messageport erfolgreich erzeugt wurde aber der IORequest schlägt fehl, das Programm wird einfach beendet und der Messageport wird nicht wieder zerstört. Man kann geschachtelte if Blöcke benutzen:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;pascal&amp;quot;&amp;gt;&lt;br /&gt;
program test;&lt;br /&gt;
uses&lt;br /&gt;
  Exec, Serial;&lt;br /&gt;
var&lt;br /&gt;
  Mp: PMsgPort;&lt;br /&gt;
  Io: PIOExtSer;&lt;br /&gt;
begin&lt;br /&gt;
  // create Messageport&lt;br /&gt;
  Mp := CreateMsgPort;&lt;br /&gt;
  if  Assigned(Mp) then&lt;br /&gt;
  begin&lt;br /&gt;
    // create IO Serial&lt;br /&gt;
    Io := PIOExtSer(CreateExtIO(mp, SizeOf(TIOExtSer)));&lt;br /&gt;
    if Assigned(Io) then&lt;br /&gt;
    begin&lt;br /&gt;
      // do something&lt;br /&gt;
      DeleteExtIO(PIORequest(Io));&lt;br /&gt;
    end&lt;br /&gt;
    else&lt;br /&gt;
    begin&lt;br /&gt;
      Writeln(&amp;#039;Cannot alloc IOExtSer&amp;#039;);&lt;br /&gt;
    end;&lt;br /&gt;
    DeleteMsgPort(Mp);&lt;br /&gt;
  end&lt;br /&gt;
  else&lt;br /&gt;
  begin&lt;br /&gt;
    writeln(&amp;#039;Failed to create MsgPort&amp;#039;);&lt;br /&gt;
  end;&lt;br /&gt;
end.&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
Man kann das so machen, aber wenn es sehr viele Ebenen hat wird es sehr schnell unübersichtlich. I bevorzuge den &amp;lt;code&amp;gt;try...finally..end;&amp;lt;/code&amp;gt; Ansatz oder separate Initialisieren() und Zerstoere() Funktionen, welche bei besonders einfach sind bei Objektorientierter Programmierung da man einen Konstruktor und Destruktor der Klasse hat den man dafür benutzen kann.&lt;br /&gt;
Achtung: Wenn man Klassen oder try finally Blöcke benutzen möchte muss man den Compiler im Delphi oder ObjectFPC Modus benutzen. z.B. &amp;lt;code&amp;gt;{$mode objfpc}&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;pascal&amp;quot;&amp;gt;&lt;br /&gt;
program test;&lt;br /&gt;
{$mode objfpc}&lt;br /&gt;
uses&lt;br /&gt;
  Exec, Serial;&lt;br /&gt;
var&lt;br /&gt;
  Mp: PMsgPort = nil;&lt;br /&gt;
  Io: PIOExtSer = nil;&lt;br /&gt;
begin&lt;br /&gt;
  try&lt;br /&gt;
    // create Messageport&lt;br /&gt;
    Mp := CreateMsgPort;&lt;br /&gt;
    if not Assigned(Mp) then&lt;br /&gt;
    begin&lt;br /&gt;
      writeln(&amp;#039;Failed to create MsgPort&amp;#039;);&lt;br /&gt;
      Exit;&lt;br /&gt;
    end;&lt;br /&gt;
    // create IO Serial&lt;br /&gt;
    Io := PIOExtSer(CreateExtIO(mp, SizeOf(TIOExtSer)));&lt;br /&gt;
    if not Assigned(Io) then&lt;br /&gt;
    begin&lt;br /&gt;
      Writeln(&amp;#039;Cannot alloc IOExtSer&amp;#039;);&lt;br /&gt;
      Exit;&lt;br /&gt;
    end;&lt;br /&gt;
&lt;br /&gt;
    // do something&lt;br /&gt;
 &lt;br /&gt;
  finally&lt;br /&gt;
    if Assigned(Io) then&lt;br /&gt;
      DeleteExtIO(PIORequest(Io));&lt;br /&gt;
    if Assigned(Mp) then&lt;br /&gt;
      DeleteMsgPort(Mp);&lt;br /&gt;
  end;&lt;br /&gt;
end.&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
Man beachte das alle Variablen mit nil initialisiert werden und dann im finally Teil auf nil getestet werden und nur dann zerstört werden. Diese Funktionen benötigen das eigentlich nicht, da sie intern auch auf nil testen. Aber viele andere Amiga API Funktionen testen nicht auf leere Pointer und stürzen einfach ab. Daher sollte man sich angewöhnen alle Pointer zu testen bevor man sie an Amiga API Funktionen übergibt.&lt;br /&gt;
&lt;br /&gt;
=== Öffnen des seriellen Devices ===&lt;br /&gt;
&lt;br /&gt;
Aber zurück zu der seriellen Kommunikation. Es ist alles vorbereitet damit wir das seriellen Sevice öffnen können dafür bietet die exec Unit &amp;lt;code&amp;gt;OpenDevice()&amp;lt;/code&amp;gt; und &amp;lt;code&amp;gt;CloseDevice()&amp;lt;/code&amp;gt;.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;pascal&amp;quot;&amp;gt;&lt;br /&gt;
var&lt;br /&gt;
  Res: LongInt;&lt;br /&gt;
  DevOpen: Boolean = False;&lt;br /&gt;
  DeviceName: AnsiString = &amp;#039;usbmode.device&amp;#039;; // or serial device&lt;br /&gt;
  UnitNumber: Integer = 0;&lt;br /&gt;
&lt;br /&gt;
    // ...&lt;br /&gt;
    Res := OpenDevice(PChar(DeviceName), UnitNumber, PIORequest(io), 0);&lt;br /&gt;
    if Res &amp;lt;&amp;gt; 0 then&lt;br /&gt;
    begin&lt;br /&gt;
      Writeln(&amp;#039;Unable to open device &amp;quot;&amp;#039; + DeviceName + &amp;#039; &amp;#039; + IntToStr(UnitNumber) + &amp;#039;&amp;quot; :&amp;#039; +  IntToStr(Res));&lt;br /&gt;
      Exit;&lt;br /&gt;
    end;&lt;br /&gt;
    DevOpen := True;&lt;br /&gt;
    &lt;br /&gt;
    // ...&lt;br /&gt;
    if DevOpen then&lt;br /&gt;
      CloseDevice(PIORequest(io));&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Serielle Device Parameter setzen ===&lt;br /&gt;
&lt;br /&gt;
Bevor wir das Device wirklich benutzen können müssen wir noch einige Parameter setzen, wie Baudrate und Flow control. Dafür müssen wir das erste mal eine Nachricht and den Serielle Device Treiber schicken mit dem IORequest den vorhin erzeugt haben.&lt;br /&gt;
Zuerst wir konfigurieren den IORequest:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;pascal&amp;quot;&amp;gt;&lt;br /&gt;
    io^.io_SerFlags := (io^.io_SerFlags or SERF_XDISABLED) and (not SERF_PARTY_ON); // Parity und XON/XOFF ausschalten&lt;br /&gt;
    io^.io_Baud := Baud;                                                            // Baud rate setzen&lt;br /&gt;
    io^.IOSer.io_Command := SDCMD_SETPARAMS;                                        // Message Kommando = Setze Parameter&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
Um die Nachricht zu versenden wir können &amp;lt;code&amp;gt;DoIO()&amp;lt;/code&amp;gt; oder &amp;lt;code&amp;gt;SendIO()&amp;lt;/code&amp;gt; neutzen. DoIO() blockiert bis die Nachricht abgearbeitet ist. SendIO() kehrt sofort zurück, läuft im Hintergrund weiter und wir müssen testen ob die Nachricht beendet ist. I prefer SendIO() because you have more control about what happens and you can break the request if it needs too long time. With &amp;lt;code&amp;gt;CheckIO()&amp;lt;/code&amp;gt; you can test if the request is already finished or use WaitIO() for the end of operation. All together it looks like that:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;pascal&amp;quot;&amp;gt;&lt;br /&gt;
    io^.io_SerFlags := (io^.io_SerFlags or SERF_XDISABLED) and (not SERF_PARTY_ON); // Parity und XON/XOFF ausschalten&lt;br /&gt;
    io^.io_Baud := Baud;                                                            // Baud rate setzen&lt;br /&gt;
    io^.IOSer.io_Command := SDCMD_SETPARAMS;                                        // Message Kommando = Setze Parameter&lt;br /&gt;
    SendIO(PIORequest(io));  // sende die Nachricht&lt;br /&gt;
    WaitIO(PIORequest(io));  // Warte auf die Antwort&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Text lesen ===&lt;br /&gt;
Um Text vom seriellen Port zu lesen, welches der Arduino sendet, wir müssen wieder eine Nachricht senden mit dem Kommando CMD_READ und einem Puffer wo der Text abgelegt werden soll.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;pascal&amp;quot;&amp;gt;&lt;br /&gt;
var&lt;br /&gt;
  Buffer: array[0..256] of char;&lt;br /&gt;
    // ...&lt;br /&gt;
    FillChar(Buffer[0], 257, #0);        // Buffer löschen (immer ein  #0 am Ende)&lt;br /&gt;
    io^.IOSer.io_Length := 256;          // einer weniger als die wirkliche Groesse dahaer immer ein #0 am ende&lt;br /&gt;
    io^.IOSer.io_Data := @Buffer[0];     // Zeiger auf den ersten wert als Start &lt;br /&gt;
    io^.IOSer.io_Command := CMD_READ;    // Kommando = Lesen&lt;br /&gt;
    &lt;br /&gt;
    SendIO(PIORequest(io));&lt;br /&gt;
    WaitIO(PIORequest(io));&lt;br /&gt;
    // ...&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
Damit haben wir alles was wir brauchen um den Text vom Arduino zu lesen. Alles zusammen:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;pascal&amp;quot;&amp;gt;&lt;br /&gt;
program test;&lt;br /&gt;
{$mode objfpc}{$H+}&lt;br /&gt;
uses&lt;br /&gt;
  SysUtils,&lt;br /&gt;
  exec, serial;&lt;br /&gt;
const&lt;br /&gt;
  DefDevice = &amp;#039;usbmodem.device&amp;#039;;&lt;br /&gt;
  DefUnit = 0;&lt;br /&gt;
  DefBaud = 9600;&lt;br /&gt;
var&lt;br /&gt;
  Mp: PMsgPort = nil;&lt;br /&gt;
  Io: PIOExtSer = nil;&lt;br /&gt;
  DevOpen: Boolean = False;&lt;br /&gt;
  Res: LongInt;&lt;br /&gt;
  DeviceName: string = DefDevice;&lt;br /&gt;
  UnitNumber: Integer = DefUnit;&lt;br /&gt;
  Baud: Integer = DefBaud;&lt;br /&gt;
  Buffer: array[0..256] of char;&lt;br /&gt;
begin&lt;br /&gt;
  try&lt;br /&gt;
    // create Messageport&lt;br /&gt;
    Mp := CreateMsgPort;&lt;br /&gt;
    if not Assigned(Mp) then&lt;br /&gt;
    begin&lt;br /&gt;
      writeln(&amp;#039;Failed to create MsgPort&amp;#039;);&lt;br /&gt;
      Exit;&lt;br /&gt;
    end;&lt;br /&gt;
    // create IO Serial&lt;br /&gt;
    Io := PIOExtSer(CreateExtIO(mp, SizeOf(TIOExtSer)));&lt;br /&gt;
    if not Assigned(Io) then&lt;br /&gt;
    begin&lt;br /&gt;
      Writeln(&amp;#039;Cannot alloc IOExtSer&amp;#039;);&lt;br /&gt;
      Exit;&lt;br /&gt;
    end;&lt;br /&gt;
    // Open the device&lt;br /&gt;
    Res := OpenDevice(PChar(DeviceName), UnitNumber, PIORequest(io), 0);&lt;br /&gt;
    if Res &amp;lt;&amp;gt; 0 then&lt;br /&gt;
    begin&lt;br /&gt;
      Writeln(&amp;#039;Unable to open device &amp;quot;&amp;#039; + DeviceName + &amp;#039; &amp;#039; + IntToStr(UnitNumber) + &amp;#039;&amp;quot; :&amp;#039; +  IntToStr(Res));&lt;br /&gt;
      Exit;&lt;br /&gt;
    end;&lt;br /&gt;
    DevOpen := True;&lt;br /&gt;
    // configure serial interface&lt;br /&gt;
    io^.io_SerFlags := (io^.io_SerFlags or SERF_XDISABLED) and (not SERF_PARTY_ON);&lt;br /&gt;
    io^.io_Baud := Baud;&lt;br /&gt;
    io^.IOSer.io_Command := SDCMD_SETPARAMS;&lt;br /&gt;
    SendIO(PIORequest(io));&lt;br /&gt;
    WaitIO(PIORequest(io));&lt;br /&gt;
&lt;br /&gt;
    // read 256 chars from the serial port&lt;br /&gt;
    FillChar(Buffer[0], 257, #0); &lt;br /&gt;
    io^.IOSer.io_Length := 256;&lt;br /&gt;
    io^.IOSer.io_Data := @Buffer[0];&lt;br /&gt;
    io^.IOSer.io_Command := CMD_READ;&lt;br /&gt;
    SendIO(PIORequest(io));&lt;br /&gt;
    WaitIO(PIORequest(io));&lt;br /&gt;
&lt;br /&gt;
    // everything ok - print out the Buffer&lt;br /&gt;
    writeln(&amp;#039;Everything ok, Buffer: &amp;#039;, Buffer);&lt;br /&gt;
  finally&lt;br /&gt;
    if DevOpen then&lt;br /&gt;
      CloseDevice(PIORequest(io));&lt;br /&gt;
    if Assigned(Io) then&lt;br /&gt;
      DeleteExtIO(PIORequest(Io));&lt;br /&gt;
    if Assigned(Mp) then&lt;br /&gt;
      DeleteMsgPort(Mp);&lt;br /&gt;
  end;&lt;br /&gt;
end.&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Wenn man das kompiliert und auf dem Amiga starten mit dem Arduino angeschlossen, man sollte folgendes erhalten:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
Work:Sources/Serial&amp;gt; test&lt;br /&gt;
Everything ok, Buffer:&lt;br /&gt;
 Amiga (Msg: 10)&lt;br /&gt;
Hello Amiga (Msg: 11)&lt;br /&gt;
Hello Amiga (Msg: 12)&lt;br /&gt;
Hello Amiga (Msg: 13)&lt;br /&gt;
Hello Amiga (Msg: 14)&lt;br /&gt;
Hello Amiga (Msg: 15&lt;br /&gt;
Work:Sources/Serial&amp;gt; &lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
Wir haben unseren ersten Text vom Arduino. Wie man sehen kann wartet der WaitIO() aufruf bis 256 Zeichen eingetroffen sind. Was aber etwas störend sein kann, wenn man eine direkte Reaktion auf einen Text haben möchte und nicht soviel Text gesendet wird.&lt;br /&gt;
&lt;br /&gt;
=== EOF Modus ===&lt;br /&gt;
&lt;br /&gt;
Dafür können wir den EOF Moudus des seriellen Devicetreibers benutzen. Dieser stoppt die Textaufnahme wenn ein &amp;quot;Ende des Files&amp;quot; erhalten wird im Zeichenstrom. Jede Zeile vom Arduino sollte mit einem Return (#13 #10) enden so wir könnten das #10 =($0a) Zeichen benutzen um die Textaufnahme vorzeitig abzubrechen. Um das zu erreichen ändern wir die Parameter die wir am Anfang mir SETPARAM gesetzt haben zu:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;pascal&amp;quot;&amp;gt;&lt;br /&gt;
    io^.io_SerFlags := (io^.io_SerFlags or SERF_EOFMODE or SERF_XDISABLED) and (not SERF_PARTY_ON); // Parity und XON/XOFF ausschalten, EOF anschalten&lt;br /&gt;
    io^.io_Baud := Baud;                                                                            // Baudrate setzen&lt;br /&gt;
    io^.io_TermArray.TermArray0 := $0a030303;                                                       // Ende des Files Zeichen #10 Rest gefüllt mit $03 = End of Text&lt;br /&gt;
    io^.io_TermArray.TermArray1 := $03030303;&lt;br /&gt;
    io^.IOSer.io_Command := SDCMD_SETPARAMS;                                                        // Nachtichten Kommando type = Setze Parameter&lt;br /&gt;
    SendIO(PIORequest(io));  // Sende Nachricht&lt;br /&gt;
    WaitIO(PIORequest(io));  // Warte auf Antwort&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Wenn man das so ändert erhält man schliesslich: &lt;br /&gt;
&amp;lt;source lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
Work:Sources/Serial&amp;gt; serialtest&lt;br /&gt;
Everything ok, Buffer: Hello Amiga (Msg: 23)&lt;br /&gt;
Work:Sources/Serial&amp;gt; &lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Das ist schon viel besser, wir erhalten nur eine einzige Zeile des Texts und diese daher auch sofort. Falls der Text länger als 256 Zeichen ist bricht er natürlich immer noch dort ab und man muss nochmal nach dem Rest fragen (oder einen grösseren Buffer bereitstellen).&lt;br /&gt;
&lt;br /&gt;
Aber was passiert, wenn kein Text mehr gesendet wird? Der WaitIO() Aufruf blockiert für immer und man kann ihn auch nicht unterbrechen (ausser mit einem Computerneustart). Um das zu umgehen programmieren wir einen Timeout dazu. &lt;br /&gt;
&lt;br /&gt;
=== Timeout ===&lt;br /&gt;
Wir brauchen die vorher erwähnte Funktion &amp;lt;code&amp;gt;CheckIO()&amp;lt;/code&amp;gt; um zu prüfen ob das Kommando abgearbeitet wurd und eine Funktion um einen IORequest abzubrechen wenn ein Timeout eintritt, diese Funktion heisst &amp;lt;code&amp;gt;Abort(IO)&amp;lt;/code&amp;gt;. Um die Zeit zu überprüfen kann man sehr einfach die Funktion &amp;lt;code&amp;gt;GetTickCount()&amp;lt;/code&amp;gt; aus SysUtils benutzen, diese gibt uns die Zeit in Millisekunden, welche wir benutzen können um sehr genau Zeitabstände zu messen. Für den Timeout ersetzen wir &amp;lt;code&amp;gt;SendIO()/WaitIO()&amp;lt;/code&amp;gt; für das Kommando CMD_READ mit:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;pascal&amp;quot;&amp;gt;&lt;br /&gt;
var&lt;br /&gt;
  t: LongWord;&lt;br /&gt;
    // ...&lt;br /&gt;
    t1 := GetTickCount;&lt;br /&gt;
    repeat&lt;br /&gt;
      if CheckIO(PIORequest(io)) &amp;lt;&amp;gt; nil then&lt;br /&gt;
        Break;&lt;br /&gt;
      Sleep(25);&lt;br /&gt;
    until GetTickCount - t1 &amp;gt; 10000;&lt;br /&gt;
    if CheckIO(PIORequest(io)) &amp;lt;&amp;gt; nil then&lt;br /&gt;
    begin&lt;br /&gt;
      WaitIO(PIORequest(io));&lt;br /&gt;
      writeln(&amp;#039;Everything ok, Buffer: &amp;#039;, Buffer);&lt;br /&gt;
    end&lt;br /&gt;
    else&lt;br /&gt;
    begin&lt;br /&gt;
      AbortIO(PIORequest(io));&lt;br /&gt;
      writeln(&amp;#039;Timeout, not enough data: &amp;#039;, Buffer);&lt;br /&gt;
    end;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
Von hier an gibt es nur noch Teile des Sopurce, da es sonst zu lang wird, allerdings kannst du den kompletten Source hier runterladen: Source1.pas[http://www.alb42.de/serial/Source1.pas]&lt;/div&gt;</summary>
		<author><name>Alb42</name></author>
	</entry>
</feed>