<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="pl-pl">
<link rel="self" type="application/atom+xml" href="https://forum.atnel.pl/feed.php?f=4&amp;t=15261&amp;mode" />

<title>ATNEL tech-forum</title>
<link href="https://forum.atnel.pl/index.php" />
<updated>2016-04-30T13:48:33+01:00</updated>

<author><name><![CDATA[ATNEL tech-forum]]></name></author>
<id>https://forum.atnel.pl/feed.php?f=4&amp;t=15261&amp;mode</id>
<entry>
<author><name><![CDATA[anshar]]></name></author>
<updated>2016-04-30T13:48:33+01:00</updated>
<published>2016-04-30T13:48:33+01:00</published>
<id>https://forum.atnel.pl/viewtopic.php?t=15261&amp;p=159617#p159617</id>
<link href="https://forum.atnel.pl/viewtopic.php?t=15261&amp;p=159617#p159617"/>
<title type="html"><![CDATA[Re: Zapis pewnej makrodefinicja]]></title>

<content type="html" xml:base="https://forum.atnel.pl/viewtopic.php?t=15261&amp;p=159617#p159617"><![CDATA[
Zrobiłbym to tak:<br />[syntax=c]#define PROG_HIGH_IMPEDPORRx &amp;= ~(1&lt;&lt;Pxx) // Pushpull disabled, Hi-Z<br />#define PROG_LOW_IMPEDPORTx |= (1&lt;&lt;Pxx)// Pushpull enabled<br />#define CLEAR_PROGPROG = 0<br />#define SET_PROGPPROG = 1[/syntax]<br />albo tak:<br /><br />[syntax=c]#define PROG_HIGH_IMPED() do { PORTx &amp;= ~(1&lt;&lt;Pxx); PROG = 1;} while(0) // Pushpull disabled, Hi-Z<br />#define PROG_LOW_IMPED() do { PORTx |= (1&lt;&lt;Pxx); } while(0) // Pushpull enabled<br />#define CLEAR_PROG() do { PROG = 0; } while(0)<br />#define SET_PROG() do { PROG = 1; } while(0)[/syntax]<p>Statystyki: Napisane przez <a href="https://forum.atnel.pl/memberlist.php?mode=viewprofile&amp;u=7157">anshar</a> — 30 kwi 2016, o 13:48</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[drewpol]]></name></author>
<updated>2016-04-30T12:48:03+01:00</updated>
<published>2016-04-30T12:48:03+01:00</published>
<id>https://forum.atnel.pl/viewtopic.php?t=15261&amp;p=159616#p159616</id>
<link href="https://forum.atnel.pl/viewtopic.php?t=15261&amp;p=159616#p159616"/>
<title type="html"><![CDATA[Zapis pewnej makrodefinicja]]></title>

<content type="html" xml:base="https://forum.atnel.pl/viewtopic.php?t=15261&amp;p=159616#p159616"><![CDATA[
Witam. Znalazłem fragment programu na jakiś inny procesor zawierający pewną makrodefinicję:<br />[syntax=c]#define PROG_HIGH_IMPED() do { P0MDOUT = 0x5F; PROG = 1;} while(0) // Pushpull disabled, Hi-Z<br />#define PROG_LOW_IMPED() do { P0MDOUT = 0xDF; } while(0) // Pushpull enabled[/syntax]<br />Jeżeli chciałbym to przenieść na AVR to czy taki zapis jest poprawny ? :<br />[syntax=c]#define PROG_HIGH_IMPED() do { DDRx &amp;= ~(1&lt;&lt;Pxx); } while(0) // Pushpull disabled, Hi-Z<br />#define PROG_LOW_IMPED() do { DDRx |= (1&lt;&lt;Pxx; } while(0) // Pushpull enabled[/syntax] <br />I analogicznie inna makrodefinicja :<br />[syntax=c]#define CLEAR_PROG() do { PROG = 0; } while(0)<br />#define SET_PROG() do { PROG = 1; } while(0)[/syntax]<br />Na AVR :<br />[syntax=c]#define CLEAR_PROG() do { PORTx &amp;= ~(1&lt;&lt;Pxx); } while(0)<br />#define SET_PROG() do { PORTx |= (1&lt;&lt;Pxx); } while(0)[/syntax]<br />Oczywiście za symbole &quot;x&quot; wstawiam odpowiednie porty i piny.<br />Czy taki sposób jaki przedstawiłem jest OK ? Jeżeli nie to proszę poprawcie mnie <img src="https://forum.atnel.pl/images/smilies/icon_e_smile.gif" alt=":)" title="Szczęśliwy" /><br /><br />Pozdrawiam,<br />drewpol<p>Statystyki: Napisane przez <a href="https://forum.atnel.pl/memberlist.php?mode=viewprofile&amp;u=8379">drewpol</a> — 30 kwi 2016, o 12:48</p><hr />
]]></content>
</entry>
</feed>