<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://community.arm.com/utility/feedstylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>8051 with zigbee</title><link>https://community.arm.com/developer/tools-software/tools/f/keil-forum/31461/8051-with-zigbee</link><description> 
any ideas on how i can write a code to transmit an AT command from
8051 to zigbee serially? thanks in advance 
 </description><dc:language>en-US</dc:language><generator>Telligent Community 10</generator><item><title>RE: 8051 with zigbee</title><link>https://community.arm.com/thread/143517?ContentTypeID=1</link><pubDate>Mon, 26 May 2014 23:08:43 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:8d622feb-ab96-4ea2-87c7-7ed0214e727c</guid><dc:creator>Andy Neil</dc:creator><description>&lt;p&gt;&lt;p&gt;
Have you not heard of &lt;b&gt;loops&lt;/b&gt; ??&lt;/p&gt;

&lt;p&gt;
If not, then you &lt;i&gt;really&lt;/i&gt; need to get (back) to that basic
textbook!&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: 8051 with zigbee</title><link>https://community.arm.com/thread/143520?ContentTypeID=1</link><pubDate>Mon, 26 May 2014 22:25:36 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:e423216c-1cfb-46d6-88dd-e431e6a5e012</guid><dc:creator>ImPer Westermark</dc:creator><description>&lt;p&gt;&lt;p&gt;
If you want to walk 10 kilometers do you then take one step at a
time, or do you suddenly take 100 steps at the same time?&lt;/p&gt;

&lt;p&gt;
You always have to send one character at a time.&lt;/p&gt;

&lt;p&gt;
Program becomes very long? Why? Haven&amp;#39;t you actually tried to
search for the keywords &amp;quot;string&amp;quot; and &amp;quot;array&amp;quot; on Google? A loop that
sends all characters in a string/array doesn&amp;#39;t take more space
because the string/array contains 50 characters instead of 1
character. It&amp;#39;s only the assign of the string/array that will be come
a longer line until the string is so long that you need to split it
over multiple source code lines.&lt;/p&gt;

&lt;pre&gt;
const char string[] = &amp;quot;This is a long string of many characters to send.&amp;quot;
&lt;/pre&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: 8051 with zigbee</title><link>https://community.arm.com/thread/140742?ContentTypeID=1</link><pubDate>Mon, 26 May 2014 18:29:47 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:3dcd6f0a-99de-4617-a577-78347f72e3f9</guid><dc:creator>Ben Tan</dc:creator><description>&lt;p&gt;&lt;p&gt;
What if i want to transmit a long string? Maybe around 40 to 50
characters. Do i still send a character one at a time? No right? If
not the code will be very very long.&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: 8051 with zigbee</title><link>https://community.arm.com/thread/137133?ContentTypeID=1</link><pubDate>Mon, 26 May 2014 11:00:55 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:cbfdea28-b409-4c66-bef5-9e4bbf7402db</guid><dc:creator>Andy Neil</dc:creator><description>&lt;p&gt;&lt;p&gt;
You do know how &amp;#39;C&amp;#39; marks the end of a string - don&amp;#39;t you?&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: 8051 with zigbee</title><link>https://community.arm.com/thread/128594?ContentTypeID=1</link><pubDate>Mon, 26 May 2014 09:52:20 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:24e08480-f53f-4129-b2b5-f527dc358ba6</guid><dc:creator>Andy Neil</dc:creator><description>&lt;p&gt;&lt;p&gt;
&lt;i&gt;&amp;quot;But i&amp;#39;m not clear as to how to send a string of data&amp;quot;&lt;/i&gt;&lt;/p&gt;

&lt;p&gt;
Well, a string is just a sequence of characters, isn&amp;#39;t it?&lt;/p&gt;

&lt;p&gt;
So you send the first, then the second, then the third, etc -
until you reach the end.&lt;/p&gt;

&lt;p&gt;
This is just basic indexing through an array. If you&amp;#39;re not clear
on that, then it&amp;#39;s time to get back to the basic &amp;#39;C&amp;#39; textbook&lt;/p&gt;

&lt;p&gt;

&lt;a href="http://blog.antronics.co.uk/2011/08/08/so-youre-thinking-of-starting-with-c/"&gt;blog.antronics.co.uk/.../&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;
Remember that the serial transmission is slow compared to the
instruction execution - so you need to &lt;b&gt;wait&lt;/b&gt; for the
transmission of one character to finish before starting the next.&lt;/p&gt;

&lt;p&gt;
Also, you need to &lt;b&gt;wait&lt;/b&gt; for and correctly handle the
response to each AT command before starting the next...&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: 8051 with zigbee</title><link>https://community.arm.com/thread/117564?ContentTypeID=1</link><pubDate>Mon, 26 May 2014 07:33:02 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:618d1625-3082-42f8-a149-70d91240f203</guid><dc:creator>Ben Tan</dc:creator><description>&lt;p&gt;&lt;p&gt;
OK, thanks. but now i want to transmit a string of AT command
using array from the 8051 micro controller to the computer and see
through hyperterminal. i am able to transmit just a character like
&amp;#39;A&amp;#39;. But i&amp;#39;m not clear as to how to send a string of data using
arrays. thank you in advance.&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: 8051 with zigbee</title><link>https://community.arm.com/thread/120332?ContentTypeID=1</link><pubDate>Thu, 22 May 2014 23:46:15 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:b469cf74-65b2-45b9-a606-880cd55e8334</guid><dc:creator>Andy Neil</dc:creator><description>&lt;p&gt;&lt;p&gt;
&lt;i&gt;&amp;quot;you have a busy-loop delay() that you most probably can&amp;#39;t tell
how long delays it actually gives. Or what happens if you maybe
change some compiler options or changes to a different version of the
compiler.&amp;quot;&lt;/i&gt;&lt;/p&gt;

&lt;p&gt;
&lt;b&gt;&lt;br /&gt;
See: &lt;a href="http://www.8052.com/forum/read/162556"&gt;www.8052.com/.../162556&lt;/a&gt;&lt;br /&gt;
&lt;/b&gt;&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: 8051 with zigbee</title><link>https://community.arm.com/thread/107697?ContentTypeID=1</link><pubDate>Thu, 22 May 2014 23:16:31 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:48ced5d8-e0a0-4119-bd91-108bf883905e</guid><dc:creator>ImPer Westermark</dc:creator><description>&lt;p&gt;&lt;pre&gt;
sbit mybit=P1^5;
&lt;/pre&gt;

&lt;p&gt;
&lt;br /&gt;
&amp;quot;mybit&amp;quot; - that really isn&amp;#39;t a variable name that tells any story
about what it does.&lt;br /&gt;
Later in the program you have:&lt;/p&gt;

&lt;pre&gt;
 mybit=1; //toggle LED
&lt;/pre&gt;

&lt;p&gt;
&lt;br /&gt;
So why must a reader scan through all your code just to figure out
that &amp;quot;mybit&amp;quot; is actually controlling a LED? And &amp;quot;toggle LED&amp;quot; still
doesn&amp;#39;t tell a reader if writing a &amp;#39;1&amp;#39; will turn on or turn off that
LED.&lt;/p&gt;

&lt;pre&gt;
unsigned char code start_header=&amp;#39;!&amp;#39;;
&lt;/pre&gt;

&lt;p&gt;
&lt;br /&gt;
You used a #define for CR, but then you decided to use normal
variables for some of your &amp;quot;constants&amp;quot; - are you saying that your
program supports reprogrammable tokens for the framing of your
messages?&lt;/p&gt;

&lt;pre&gt;
unsigned char x,i,j,k,z,u,h; //declare variables for checking use
&lt;/pre&gt;

&lt;p&gt;
&lt;br /&gt;
Is it easy to read code when you need to all the time figure out
what&amp;#39;s the difference between &amp;#39;i&amp;#39;, &amp;#39;j&amp;#39; or maybe &amp;#39;k&amp;#39;? Or what is
currently stored in &amp;#39;u&amp;#39;? Your comments seems to indicate that &amp;#39;k&amp;#39; is
&amp;quot;the values&amp;quot;. Easy to see from the name?&lt;/p&gt;

&lt;p&gt;
Every second you save with a short variable name like this you
normally lose quite a number of minutes from being confused about the
meaning of the variable.&lt;/p&gt;

&lt;pre&gt;
read[read_count]=zigbeerxd[read_count]; //read the data
&lt;/pre&gt;

&lt;p&gt;
&lt;br /&gt;
Seems strange that you have two different arrays but use the same
index. So the raw data received from the UART is identically aligned
with your currently processed command?&lt;/p&gt;

&lt;pre&gt;
if(read[read_count]==end_header) //check if data is &amp;#39;@&amp;#39;(end header)
&lt;/pre&gt;

&lt;p&gt;
&lt;br /&gt;
Why have a constant downgraded into a variable &amp;quot;end_header&amp;quot; if you
still need to write a comment telling us that the variable is &amp;#39;@&amp;#39; and
that &amp;#39;@&amp;#39; means &amp;quot;end header&amp;quot;? Does it make sense to try to write the
same program twice - once as C code and once as C comments? Isn&amp;#39;t it
better to have C symbol names that tells the story and instead
reserve the C comments for telling the reader why you need to do
different things?&lt;/p&gt;

&lt;p&gt;
Because of your formatting issues (while ignoring the &amp;#39;well-named&amp;#39;
variables, it&amp;#39;s almost impossible to actually read the code. But you
have a busy-loop delay() that you most probably can&amp;#39;t tell how long
delays it actually gives. Or what happens if you maybe change some
compiler options or changes to a different version of the compiler.
Busy-loops aren&amp;#39;t a good way to implement delays. Wouldn&amp;#39;t it be
better with a delay_100us(2000) that could have a user know that each
tick of the input parameter represented 0.1ms of delay so the reader
could figure out that delay_100us(2000) would be a 200ms delay?&lt;/p&gt;

&lt;p&gt;
By the way - you posted code without specifically telling what
issues you have with the code and what you have done to try to
overcome these issues.&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: 8051 with zigbee</title><link>https://community.arm.com/thread/107699?ContentTypeID=1</link><pubDate>Thu, 22 May 2014 22:34:15 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:69692a9e-1542-42ec-8308-d11dabff98e9</guid><dc:creator>Andy Neil</dc:creator><description>&lt;p&gt;&lt;p&gt;
Your source code is illegible because you didn&amp;#39;t follow the
instructions on how to post source code - they are quite clearly
stated, as this picture shows:&lt;br /&gt;
&lt;b&gt;&lt;br /&gt;
&lt;a href="http://www.danlhenry.com/caps/keil_code.png"&gt;www.danlhenry.com/.../keil_code.png&lt;/a&gt;&lt;br /&gt;
&lt;/b&gt;&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: 8051 with zigbee</title><link>https://community.arm.com/thread/81913?ContentTypeID=1</link><pubDate>Thu, 22 May 2014 18:14:43 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:6bfeebf5-4107-4944-8169-cc2d1ecfbe21</guid><dc:creator>Ben Tan</dc:creator><description>&lt;p&gt;&lt;p&gt;
Thanks for the reply. this is the code that i currently got, it is
to turn on a port which i connected to an LED, when i receive a raw
data !A@ from the zigbee. they are connected serially. next i want to
do is when i receive a raw data from the zigbee serially, i want to
send out an AT command instead to the zigbee for it to send out.&lt;/p&gt;

&lt;p&gt;
#include &amp;lt;DS89C4xx.h&amp;gt; //8051 header file&lt;/p&gt;

&lt;p&gt;
#define CR 0x0D&lt;/p&gt;

&lt;p&gt;
sbit mybit=P1^5;&lt;/p&gt;

&lt;p&gt;
unsigned char code start_header=&amp;#39;!&amp;#39;; //to check where is the start
of the data&lt;br /&gt;
unsigned char code end_header=&amp;#39;@&amp;#39;; //to check where is the end of the
data&lt;br /&gt;
unsigned char idata zigbeerxd[50]; //to store data from SBUF0 in
serial interrupt&lt;br /&gt;
unsigned char idata read[50]; //to read data from zigbeerxd[] in the
main&lt;br /&gt;
unsigned char idata rawdata[14]; //to store the data transmitted from
zigbee&lt;br /&gt;
unsigned char idata mynodeID[3]; //to check received data whether it
is my ID&lt;br /&gt;
unsigned char x,i,j,k,z,u,h; //declare variables for checking use&lt;br /&gt;
unsigned char count; //to read serial data in the serial
interrupt&lt;br /&gt;
unsigned char read_count; //to read data from serial buffer&lt;br /&gt;
unsigned char get_raw;&lt;/p&gt;

&lt;p&gt;
void delay (unsigned int value)&lt;br /&gt;
{ unsigned int x, y; for (x=0;x&amp;lt;value;x++) for (y=0;y&amp;lt;500;y++);
}&lt;br /&gt;
void serial_int (void) interrupt 4&lt;br /&gt;
{ if (RI_0==1) { if(count==50) //check if array is full count=0;
//restart from 0 zigbeerxd[count]=SBUF0; //storing the data from
serial buffer into array count++; //increase the count RI_0=0; }&lt;br /&gt;
}&lt;/p&gt;

&lt;p&gt;
void Read_Zigbee (void)&lt;br /&gt;
{ if(read_count!=count) //check for any unread data? {
if(read_count==50) //go back to start position of array read_count=0;
read[read_count]=zigbeerxd[read_count]; //read the data&lt;br /&gt;
if (i==1) { if(read[read_count]==end_header) //check if data is
&amp;#39;@&amp;#39;(end header) { k=0; //reset the values&lt;/p&gt;

&lt;p&gt;
i=0; get_raw=1; //raise the get_raw flag } else if (k&amp;lt;=13) //to
prevent the array from overflow { rawdata[k]=read[read_count];
//store the data in rawdata[] array k++; } } else
if(read[read_count]==start_header) //check the data is &amp;#39;!&amp;#39;(start
header) i++; read_count++; } }&lt;/p&gt;

&lt;p&gt;
void check_data (void)&lt;br /&gt;
{ z=0;&lt;br /&gt;
if(x==1); { if(rawdata[x]==mynodeID[1]) //check data if it&amp;#39;s &amp;#39;A&amp;#39; z++;
}&lt;/p&gt;

&lt;p&gt;
if(z==1) { mybit=1; //toggle LED delay(2000); mybit=0;&lt;br /&gt;
} }&lt;/p&gt;

&lt;p&gt;
void main (void)&lt;br /&gt;
{ delay(500); //delay to wait for zigbee to warm up&lt;br /&gt;
count=0; //make count zero at first&lt;/p&gt;

&lt;p&gt;
read_count=0; get_raw=0; mynodeID[1]=&amp;#39;A&amp;#39;;&lt;br /&gt;
mybit=0;&lt;br /&gt;
TMOD=0x20; //Use Timer1&lt;br /&gt;
TH1=0xfd; //9600 BAUD RATE, 8 BIT DATA, NO PARITY&lt;br /&gt;
TR1=1; //Start Timer1&lt;br /&gt;
SCON0=0x50; //SERIAL MODE1, 8 BIT DATA, 1 STOP BIT, 1 START BIT, NO
PARITY&lt;br /&gt;
ES0=1; //enable serial interrupt for port 0&lt;br /&gt;
EA=1; //enable global interrupt&lt;br /&gt;
RI_0=0; //reset receive interrupt flag&lt;br /&gt;
delay(500); //wait for PPI to reset&lt;/p&gt;

&lt;p&gt;
while(1)&lt;br /&gt;
{ Read_Zigbee(); //function to read the new data from serial
interrupt array&lt;/p&gt;

&lt;p&gt;
if(get_raw==1) //check if there is new data to check? {
check_data(); //check the data get_raw=0; }&lt;br /&gt;
} }&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: 8051 with zigbee</title><link>https://community.arm.com/thread/93194?ContentTypeID=1</link><pubDate>Thu, 22 May 2014 15:16:46 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:15820ccc-7a97-4d89-afa0-b6ca634cf066</guid><dc:creator>&amp;#178;erik malund</dc:creator><description>&lt;p&gt;&lt;p&gt;
SILabs have &amp;#39;51s with Zigbee functionality&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: 8051 with zigbee</title><link>https://community.arm.com/thread/68692?ContentTypeID=1</link><pubDate>Thu, 22 May 2014 08:21:31 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:a77367cf-7061-45ab-ad61-b5bca3b43b0b</guid><dc:creator>ImPer Westermark</dc:creator><description>&lt;p&gt;&lt;p&gt;
What problems do you see?&lt;/p&gt;

&lt;p&gt;
Does the 8051 need to know what device is connected to the serial
port when it&amp;#39;s about to send serial data? Isn&amp;#39;t it enough that the
8051 and the external device have electrically compatible signals and
that you know what baud rate, number of data bits and stop bits and
parity settings to use?&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>