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 support@ccsinfo.com

Zigbee Network
Goto page 1, 2  Next
 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
hayee



Joined: 05 Sep 2007
Posts: 252

View user's profile Send private message

Zigbee Network
PostPosted: Tue Jul 28, 2009 4:28 am     Reply with quote

Hi,
I want to make a network having one coordinator and two sensors board. Coordinator sends data to both sensors. Have anyone any example how to make a network and sends data?
I am using CCS Ember Zigbee and CCS compiler.
adesport



Joined: 03 Apr 2008
Posts: 18
Location: France

View user's profile Send private message

PostPosted: Tue Jul 28, 2009 10:03 am     Reply with quote

For my Zigbee apps I'm using a module with its own Ember stack and drive the network from my PIC through AT command.
hayee



Joined: 05 Sep 2007
Posts: 252

View user's profile Send private message

PostPosted: Tue Jul 28, 2009 11:19 pm     Reply with quote

Thanks adesport.
Can you send me some example files.
adesport



Joined: 03 Apr 2008
Posts: 18
Location: France

View user's profile Send private message

PostPosted: Wed Jul 29, 2009 1:42 am     Reply with quote

Code:

ATSend("AT+DASSL"); //Disconnect ZigBee Network
ATSend("AT+JN"); // Join any ZigBee PAN
//...


ATSend uses PIC UART to send command to a ZigBee module.
AT command answers are catch by an ISR with the UART as well.
hayee



Joined: 05 Sep 2007
Posts: 252

View user's profile Send private message

PostPosted: Wed Jul 29, 2009 3:08 am     Reply with quote

I am using "CCS ember zigbee". I brought development kit from CCS. It interfaces with pic controller through SPI. There is no option for UART.
adesport



Joined: 03 Apr 2008
Posts: 18
Location: France

View user's profile Send private message

PostPosted: Wed Jul 29, 2009 3:11 am     Reply with quote

So I guess CCS provides example files as usual...
hayee



Joined: 05 Sep 2007
Posts: 252

View user's profile Send private message

PostPosted: Wed Jul 29, 2009 6:34 am     Reply with quote

I have made a network but it is not working properly. Coordinator sends data to both sensors one by one and both sensors receive data.

Problem starts here:
When I switch off sensor 1, sensor 2 stops receiving data
but
When I switch off sensor 2, sensor 1 receives data.

I want that both sensors do work independently. Whenever I switch off any of the sensors the other sensor receives data.
adesport



Joined: 03 Apr 2008
Posts: 18
Location: France

View user's profile Send private message

PostPosted: Wed Jul 29, 2009 9:17 am     Reply with quote

Which kind of ZB devices are your sensor ? SED or FFD ?
hayee



Joined: 05 Sep 2007
Posts: 252

View user's profile Send private message

PostPosted: Wed Jul 29, 2009 11:01 pm     Reply with quote

If "SED means Sleepy End Device" then I have two sleepy end devices,
and the Coordinator is acting as a FFD.
adesport



Joined: 03 Apr 2008
Posts: 18
Location: France

View user's profile Send private message

PostPosted: Thu Jul 30, 2009 1:08 am     Reply with quote

If both your sensors are SED, their parent is your FFD. In this case, if one of your sensor goes off the other one will still be able to communicate.

Post your code to see if something is missing.
hayee



Joined: 05 Sep 2007
Posts: 252

View user's profile Send private message

PostPosted: Thu Jul 30, 2009 1:22 am     Reply with quote

the codes are as follows

COORDINATOR SIDE:
Code:

#include <18f452.h>
#fuses HS,NOWDT,NOLVP,PUT,NOBROWNOUT
#use delay(clock=20000000)
#use rs232(xmit=PIN_C6, rcv=PIN_C7, baud=9600)

#define COORDINATOR 1
#define APP_CHANNEL 0x0B
#define APP_PANID 0x1111
#define APP_POWER 0xFF

#include <E:\abdul hayee\pic controller\my examples\ember_zigbee\sending 1byte\sender\em260.h>
#include <E:\abdul hayee\pic controller\my examples\ember_zigbee\sending 1byte\sender\ember_utilities.c>

int a,b;

void main ()
{
 EmberEUI64 emLocalEui64;
 EmberStatus Status;
 
 int16 childID;
 EmberEUI64 childEui64;
 EmberNodeType childType;
 
 EmberApsFrame apsframe;
 int8 messagetag=0x01;
 int8 messagedata1;
 int8 messageLength;
 int16 indexOrDestination;
 
 if (EmberInitialization())
 {
  EmberConfig();
  EmberInitializeBinding();
  ezspGetEUI64(&emLocalEui64[0]);
  EmberAddEndPoint();
  EmberFormNetwork();
  Status=ezspPermitJoining(0xFF);
  apsframe.profileID=0xC00F;
  apsframe.clusterID=0x0001;
  apsframe.sourceEndPoint=0x01;
  apsframe.destinationEndPoint=0x01;
  apsframe.options=0x0000;
  apsframe.groupID=0x0000;
  apsframe.sequence=0x00;
  messageLength=1;
  while (1)
  {
   EM260Tick();
   sinkApplicationTick();
   if(!input(PIN_A2))
   {
    ezspLeaveNetwork();
    while(1)
    {
     delay_ms(10);
    }
   }
   a=1;
   status=ezspGetChildData(0,&childID,childEui64,&childtype);
   if(status==0)
   {
    indexOrDestination=childID;
    messagedata1=a;
    status=ezspSendUnicast(EMBER_OUTGOING_DIRECT,indexOrDestination,
    &apsframe,messagetag,messageLength,&messagedata1);
   }
   b=1;
   status=ezspGetChildData(1,&childID,childEui64,&childtype);
   if(status==0)
   {
    indexOrDestination=childID;
    messagedata1=b;
    status=ezspSendUnicast(EMBER_OUTGOING_DIRECT,indexOrDestination,
    &apsframe,messagetag,messageLength,&messagedata1);
   }
  }
 }
}


SLEEPY_SENSOR_1:
Code:

#include <18f452.h>
#fuses HS,NOWDT,NOLVP,PUT,NOBROWNOUT
#use delay(clock=20000000)
#use rs232(xmit=PIN_C6, rcv=PIN_C7, baud=9600)

#define SLEEPY_SENSOR 1

#define APP_CHANNEL 0x0B
#define APP_PANID 0x1111
#define APP_POWER 0xFF

#include <E:\abdul hayee\pic controller\my examples\ember_zigbee\sending 1byte\reciver_1\em260.h>
#include <E:\abdul hayee\pic controller\my examples\ember_zigbee\sending 1byte\reciver_1\ember_utilities.c>

int8 value1,value2,x;

void main()
{
 EmberEUI64 emLocalEui64;
 if(EmberInitialization())
 {
  EmberConfig();
  EmberInitializeBinding();
  ezspGetEUI64(&emLocalEUI64[0]);
  EmberAddEndPoint();
  EmberJoinNetwork(EMBER_SLEEPY_END_DEVICE);
  while(1)
  {
   sensorApplicationTick();
   EM260Tick();
   if(!input(PIN_A4))
   {
    ezspLeaveNetwork();
    while(1)
    {
     delay_ms(10);
    }
   }
   value1=(rcvdata[x]);
   value2=value1;
   if(value2==1)
   {
    output_high(PIN_D0);
    delay_ms(10);
    output_low(PIN_D0);
    delay_ms(10);
   }
   value2=0;
  }
 }
}


SLEEPY_SENSOR_2:
Code:

#include <18f452.h>
#fuses HS,NOWDT,NOLVP,PUT,NOBROWNOUT
#use delay(clock=20000000)
#use rs232(xmit=PIN_C6, rcv=PIN_C7, baud=9600)

#define SLEEPY_SENSOR 2

#define APP_CHANNEL 0x0B
#define APP_PANID 0x1111
#define APP_POWER 0xFF

#include <E:\abdul hayee\pic controller\my examples\ember_zigbee\sending 1byte\reciver_2\em260.h>
#include <E:\abdul hayee\pic controller\my examples\ember_zigbee\sending 1byte\reciver_2\ember_utilities.c>

int8 value1,value2,x;

void main()
{
 EmberEUI64 emLocalEui64;
 if(EmberInitialization())
 {
  EmberConfig();
  EmberInitializeBinding();
  ezspGetEUI64(&emLocalEUI64[0]);
  EmberAddEndPoint();
  EmberJoinNetwork(EMBER_SLEEPY_END_DEVICE);
  while(1)
  {
   sensorApplicationTick();
   EM260Tick();
   if(!input(PIN_A4))
   {
    ezspLeaveNetwork();
    while(1)
    {
     delay_ms(10);
    }
   }
   value1=(rcvdata[x]);
   value2=value1;
   if(value2==1)
   {
    output_high(PIN_D0);
    delay_ms(10);
    output_low(PIN_D0);
    delay_ms(10);
   }
   value2=0;
  }
 }
}
adesport



Joined: 03 Apr 2008
Posts: 18
Location: France

View user's profile Send private message

PostPosted: Thu Jul 30, 2009 1:49 am     Reply with quote

Your code doesn't have any comment at all Smile nice
Did you read "Wireless-Ember ZigBee™ Exercise Book Table Of Contents" provided by CCS? There may be some example.

Quote:
value1=(rcvdata[x]);


Normally, a Sleepy End Device has to poll its parent in order to get messages from the network. I can't see this in your code, but again I'm not familiar with CCS Wireless - Ember ZigBee.
hayee



Joined: 05 Sep 2007
Posts: 252

View user's profile Send private message

PostPosted: Thu Jul 30, 2009 7:24 am     Reply with quote

Ya I have read "Wireless-Ember ZigBee™ Exercise Book Table Of Contents". In the example SLEEPY SENSOR is sending data to the COORDINATOR, and in this example there is only one Coordinator and one Sleepy Sensor. No such example which have two sleepy sensors. I want to send data from Coordinator to Sleepy Sensors. I am only confused why one sensor is not responding when other is off. I referred to the CCS Team but they said that your code have no error.
Can you help me out or have you any examples which can solve my problem?
adesport



Joined: 03 Apr 2008
Posts: 18
Location: France

View user's profile Send private message

PostPosted: Thu Jul 30, 2009 7:34 am     Reply with quote

Give me a link to all the CCS Zigbee documentation. I'll check it out.
hayee



Joined: 05 Sep 2007
Posts: 252

View user's profile Send private message

PostPosted: Mon Aug 03, 2009 2:50 am     Reply with quote

I have only "CCS wireless-Ember Zigbee Exercise Book".
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Goto page 1, 2  Next
Page 1 of 2

 
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