![](templates/subSilver/images/CCSLogo.jpg) |
![CCS C Software and Maintenance Offers](templates/subSilver/images/forumAd6.jpg) |
View previous topic :: View next topic |
Author |
Message |
mmc01
Joined: 16 Jun 2010 Posts: 31
|
How to use CCS PIC16f628 with Xbee. |
Posted: Wed Jun 16, 2010 10:36 pm |
|
|
I can't connect 16f628 with Xbee. I send AT command from microcontroller but it's not connect. It's connect when I config in X-CTU only. I want to have some code for read OK from Xbee. Do you have some code for check return OK from Xbee? Please help me.
This is my code. It can't show anything. It not connect.
Code: |
#include <16f628A.h>
#include <stdio.h>
#USE delay(clock=4000000)
#fuses XT,NOWDT,PUT,NOPROTECT,BROWNOUT,NOCPD
#use rs232(baud=9600,parity=N,xmit=PIN_B2,rcv=PIN_B1)
void delay(long z)
{
for(z=z;z>0;z--);
}
void main(void)
{
char str[4];
delay(100000);
printf("+++");
putc(0x0d);
delay(100000);
printf("ATGT%u",(50));
putc(0x0d);
delay(100000);
printf("ATCH11");
putc(0x0d);
delay(100000);
printf("ATID100");
putc(0x0d);
delay(100000);
printf("ATCE0");
putc(0x0d);
delay(100000);
printf("ATBD3");
putc(0x0d);
delay(100000);
printf("ATSM%d",0);
putc(0x0d);
delay(100000);
printf("ATRO%d",0x00);
putc(0x0d);
delay(100000);
printf("ATDH0");
putc(0x0d);
delay(100000);
printf("ATDL%d",0);
putc(0x0d);
delay(100000);
printf("ATMY1");
putc(0x0d);
delay(100000);
printf("ATWR");
putc(0x0d);
delay(100000);
printf("ATCN");
putc(0x0d);
delay(100000);
st:
printf("hello world");
putc(0x0d);
putc(0x0a);
delay(30000); delay(30000);
delay(30000); delay(30000);
goto st;
}
|
When I send +++ with this code it return +++ too.
Code: |
#include <16f628A.h>
#include <stdio.h>
#USE delay(clock=4000000)
#fuses XT,NOWDT,PUT,NOPROTECT,BROWNOUT,NOCPD
#use rs232(baud=9600,parity=N,xmit=PIN_B2,rcv=PIN_B1)
void delay(long z)
{
for(z=z;z>0;z--);
}
void main(void)
{
char str[4];
delay(100000);
printf("+++");
putc(0x0d);
delay(100000);
while(TRUE)
{
gets(str);
printf("Connect : %s",str);
}
|
|
|
![](templates/subSilver/images/spacer.gif) |
asmallri
Joined: 12 Aug 2004 Posts: 1634 Location: Perth, Australia
|
|
Posted: Sat Jun 19, 2010 9:49 pm |
|
|
Have you already configured the XBee units to be in transparent mode (their default when shipped)?
Have you selected the same baud rate that the XBee units have been configured with?
If you are running both XBees in transparent mode (point to point) then communication is just standard serial comms. _________________ Regards, Andrew
http://www.brushelectronics.com/software
Home of Ethernet, SD card and Encrypted Serial Bootloaders for PICs!! |
|
![](templates/subSilver/images/spacer.gif) |
mmc01
Joined: 16 Jun 2010 Posts: 31
|
|
Posted: Wed Jun 23, 2010 10:05 pm |
|
|
Thaks ![Very Happy](images/smiles/icon_biggrin.gif) |
|
![](templates/subSilver/images/spacer.gif) |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|