CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

How to use CCS PIC16f628 with Xbee.

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
mmc01



Joined: 16 Jun 2010
Posts: 31

View user's profile Send private message

How to use CCS PIC16f628 with Xbee.
PostPosted: Wed Jun 16, 2010 10:36 pm     Reply with quote

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);
}
asmallri



Joined: 12 Aug 2004
Posts: 1635
Location: Perth, Australia

View user's profile Send private message Send e-mail Visit poster's website

PostPosted: Sat Jun 19, 2010 9:49 pm     Reply with quote

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!!
mmc01



Joined: 16 Jun 2010
Posts: 31

View user's profile Send private message

PostPosted: Wed Jun 23, 2010 10:05 pm     Reply with quote

Thaks Very Happy
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
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