<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-gb">
<link rel="self" type="application/atom+xml" href="http://forum.robosavvy.com/feed.php?f=5&amp;t=9035" />

<title>RoboSavvy Forum</title>
<subtitle>Robosavvy Forum: The largest online community of Humanoid Robot Builders</subtitle>
<link href="http://forum.robosavvy.com/index.php" />
<updated>2013-01-13T19:55:43+01:00</updated>

<author><name><![CDATA[RoboSavvy Forum]]></name></author>
<id>http://forum.robosavvy.com/feed.php?f=5&amp;t=9035</id>
<entry>
<author><name><![CDATA[atomowka]]></name></author>
<updated>2013-01-13T19:55:43+01:00</updated>
<published>2013-01-13T19:55:43+01:00</published>
<id>http://forum.robosavvy.com/viewtopic.php?t=9035&amp;p=36975#p36975</id>
<link href="http://forum.robosavvy.com/viewtopic.php?t=9035&amp;p=36975#p36975"/>
<title type="html"><![CDATA[ZigBee CM-5 Connection Problem AVR]]></title>

<content type="html" xml:base="http://forum.robosavvy.com/viewtopic.php?t=9035&amp;p=36975#p36975"><![CDATA[
Hi!<br />I have wrote some simple code in Studio AVR to connect ZIG-100 and CM-5. Unfortunately it is not working correctly. The robot recieves my message from PC and it sends back something else like when I sends 1 I got back 241.<br />I am checking the transmission by using Docklight.<br /><br />Thanks in advance!<br /><br />My code underneath:<br />#include &lt;avr&gt;<br />#include &lt;avr&gt;<br />#include &lt;stdio&gt;<br />#include &lt;util&gt;<br /><br /><br />//#define F_CPU 8000000UL  // zegar w Hz<br />#define F_CPU 16000000UL // 16MHz<br /><br />//#define FOSC 1843200 <br />#define RS_BAUD 38400<br />#define RS_UBRR F_CPU / 16 / RS_BAUD - 1<br /><br /><br />void uart_init(uint16_t ubrr)<br />{<br />PORTD &amp;= ~0x80;//PORT_LINK_PLUGIN = 0;   // no pull up<br />PORTD &amp;= ~0x20;//PORT_ENABLE_RXD_LINK_PC = 0;<br />PORTD |= 0x40;//PORT_ENABLE_RXD_LINK_ZIGBEE = 1;<br /><br />UCSR1A = 0b01000010;// <br />UCSR1B = 0b10011000;// <br />UCSR1C = 0b00000110;// <br /><br />UBRR1H = (unsigned char)((RS_UBRR &amp; 0xFF00) &gt;&gt; 8);<br />UBRR1L = (unsigned char)(RS_UBRR &amp; 0x00FF);<br /><br />// initialize<br />UDR1 = 0xFF;<br />}<br /><br />void uart_putc(uint8_t data)<br />{<br />// Oczekiwanie na zako&#324;czenie nadawania<br />while (!(UCSR1A &amp; (1 &lt;&lt; UDRE1)));<br />// Wys&#322;anie danych<br />UDR1 = data;<br />}<br /> <br />uint8_t uart_ischar()<br />{<br />// Czy w buforze s&#261; dane?<br />return (UCSR1A &amp; (1 &lt;&lt; RXC1));<br />}<br /> <br />uint8_t uart_getc()<br />{<br />// Czy w buforze s&#261; dane?<br />while(!uart_ischar());<br /><br />// Dane z bufora<br />return UDR1;<br />}<br /> <br />int main(void)<br />{<br />uint8_t c;<br /> <br />uart_init(RS_UBRR);<br /> <br />while(1)<br />{<br />c = uart_getc();<br />_delay_ms(500);<br />uart_putc(c);<br /><br />}<br />}<p>Statistics: Posted by <a href="http://forum.robosavvy.com/memberlist.php?mode=viewprofile&amp;u=4044">atomowka</a> — Sun Jan 13, 2013 7:55 pm</p><hr />
]]></content>
</entry>
</feed>