<?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=58&amp;t=22211&amp;mode" />

<title>ATNEL tech-forum</title>
<link href="https://forum.atnel.pl/index.php" />
<updated>2019-04-30T19:15:15+01:00</updated>

<author><name><![CDATA[ATNEL tech-forum]]></name></author>
<id>https://forum.atnel.pl/feed.php?f=58&amp;t=22211&amp;mode</id>
<entry>
<author><name><![CDATA[jez2000]]></name></author>
<updated>2019-04-30T19:15:15+01:00</updated>
<published>2019-04-30T19:15:15+01:00</published>
<id>https://forum.atnel.pl/viewtopic.php?t=22211&amp;p=218612#p218612</id>
<link href="https://forum.atnel.pl/viewtopic.php?t=22211&amp;p=218612#p218612"/>
<title type="html"><![CDATA[Re: Problem z SPI]]></title>

<content type="html" xml:base="https://forum.atnel.pl/viewtopic.php?t=22211&amp;p=218612#p218612"><![CDATA[
Może<br />[syntax=c]#define MOSI PB3[/syntax]<br />itd.<p>Statystyki: Napisane przez <a href="https://forum.atnel.pl/memberlist.php?mode=viewprofile&amp;u=11828">jez2000</a> — 30 kwi 2019, o 19:15</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[Bystrzacha]]></name></author>
<updated>2019-04-30T19:04:29+01:00</updated>
<published>2019-04-30T19:04:29+01:00</published>
<id>https://forum.atnel.pl/viewtopic.php?t=22211&amp;p=218611#p218611</id>
<link href="https://forum.atnel.pl/viewtopic.php?t=22211&amp;p=218611#p218611"/>
<title type="html"><![CDATA[Problem z SPI]]></title>

<content type="html" xml:base="https://forum.atnel.pl/viewtopic.php?t=22211&amp;p=218611#p218611"><![CDATA[
Witam,<br />próbuję napisać program wysyłająca dane po SPI, jednak w konsoli wyskakują mi błędy. Starałem się wszystko robić zgodnie z notą katalogową do ATmega328P, bo do tego procesora pisze program.<br /><br />Oto cały kod:<br />[syntax=c]#include &lt;avr/io.h&gt;<br />#include &lt;util/delay.h&gt;<br /><br />void SMI( void ) ;       // inicjalizacja SPI<br />void SMT( char cData ) ;   //wysyłanie danych z mastera<br /><br /><br />void main( void ) {<br />    while ( 1 ) {<br />        SMI();<br />        SMT( 1 );<br /><br /><br />    }<br />}<br /><br />void SMI( void ) {<br />    /* Set MOSI and SCK output, all others input */<br />    DDR_SPI = ( 1 &lt;&lt; MOSI ) | ( 1 &lt;&lt; SCK );<br />    /* Enable SPI, Master, set clock rate fck/16 */<br />    SPCR = ( 1 &lt;&lt; SPE ) | ( 1 &lt;&lt; MSTR ) | ( 1 &lt;&lt; SPR0 );<br />}<br />void SMT( char cData ) {<br />    /* Start transmission */<br />    SPDR = cData;<br />    /* Wait for transmission complete */<br />    while ( !( SPSR &amp; ( 1 &lt;&lt; SPIF ) ) )<br />        ;<br />}[/syntax]<br /><br />A to informacja z konsoli:<br />[syntax=c]main.c:14:6: warning: return type of 'main' is not 'int' &#91;-Wmain&#93;<br /> void main( void ) {<br />      ^<br />main.c: In function 'SMI':<br />main.c:25:5: error: 'DDR_SPI' undeclared (first use in this function)<br />     DDR_SPI = ( 1 &lt;&lt; MOSI ) | ( 1 &lt;&lt; SCK );<br />     ^<br />main.c:25:5: note: each undeclared identifier is reported only once for each function it appears in<br />main.c:25:22: error: 'MOSI' undeclared (first use in this function)<br />     DDR_SPI = ( 1 &lt;&lt; MOSI ) | ( 1 &lt;&lt; SCK );<br />                      ^<br />main.c:25:38: error: 'SCK' undeclared (first use in this function)<br />     DDR_SPI = ( 1 &lt;&lt; MOSI ) | ( 1 &lt;&lt; SCK );<br />                                      ^<br /><br />----------------<br />WARNING --&gt; main.c  --&gt; Line:  14[/syntax]<br /><br />Jeżeli ktoś wie o co chodzi, to proszę o pomoc.<p>Statystyki: Napisane przez <a href="https://forum.atnel.pl/memberlist.php?mode=viewprofile&amp;u=17681">Bystrzacha</a> — 30 kwi 2019, o 19:04</p><hr />
]]></content>
</entry>
</feed>