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

Xbee API Method

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



Joined: 16 Sep 2008
Posts: 4

View user's profile Send private message Visit poster's website

Xbee API Method
PostPosted: Wed Sep 17, 2008 2:08 am     Reply with quote

Dear all

I wrote a source code for Xbee transceiver. I'm using API methods. Luckily, it is working. But, may be my code is look funny. Here i show my source code:

Transmit Request 16-bit:

Code:

void GXBeeTR()
{
unsigned int8 sd,lmsb,llsb,id,fid,damsb,dalsb,op,gid,data,csm;

sd = 0x7E;                          // (Byte 1)Start Delimiter
lmsb = 0x00;                        // (Byte 2)Length MSB
llsb  = 0x07;                       // (Byte 3)Length LSB
id = 0x01;                          // (Byte 4)API Identifier
fid = 0x00;                         // (Byte 5)Frame ID
damsb = 0x71;                       // (Byte 6)Destination Address MSB
dalsb = 0x76;                       // (Byte 7)Destination Address LSB
op = 0x00;                          // (Byte 8)Options (Please Refer Datasheet)
gid = 0x02;                         // (Byte 9)G-Xbee ID
data = value00;                     // (Byte 10)Gas Sensor Value

// (Byte 11)Checksum
csm = 0xFF - (id + fid + damsb + dalsb + op + gid + data);

putc(sd);putc(lmsb);putc(llsb);putc(id);putc(fid);putc(damsb);
putc(dalsb);putc(op);putc(gid);putc(data);putc(csm);
}



Receive Packet 16-Bit:

Code:


void GXBeeRP()
{
unsigned int8 x;

chksumRP = 0;

for (x=1;x<=11;x++)
{
   byteRP[x]=getc();
}
chksumRP = chksumRP + byteRP[4] + byteRP[5] + byteRP[6] + byteRP[7] + byteRP[8] + byteRP[9] + byteRP[10];
chksumRP = 0xFF - chksumRP;
CheckRP();
}



Can anyone help me to minimize the source code for both Transmit and Request? Very Happy Laughing

Thank You
tottidatunisia



Joined: 12 May 2012
Posts: 1

View user's profile Send private message

Re: Xbee API Method
PostPosted: Sat May 12, 2012 11:09 am     Reply with quote

the gas sensor that you use have a profile home automation or not?
ezflyr



Joined: 25 Oct 2010
Posts: 1019
Location: Tewksbury, MA

View user's profile Send private message

PostPosted: Sat May 12, 2012 2:58 pm     Reply with quote

Hi,

Do you realize that this thread is almost 4 years old???

John
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