razavi
Joined: 19 Jul 2010 Posts: 10
|
Xigbee network problem |
Posted: Wed Sep 15, 2010 1:52 am |
|
|
Hi there, sorry for my newbie question.
I have 3 wireless ember zigbee development kit package.
From the book examples I can have unicast data transmission between pic16 small devices and 18f board as coordinator but when I try to join a network from pic18 board as sleepy device to another pic18 board as coordinator nothing happens.
//////////////////////////////////////////////////
Coordinator code :
Code: |
#include <18F4620.h>
#fuses HS, NOWDT, NOLVP, PUT, NOBROWNOUT
#use delay(clock =10000000)
#use rs232(xmit=PIN_C7,rcv = PIN_C7,baud = 9600,)
#define COORDINATOR 1
#include "em260.h"
#include "ember_utilities.c"
#include<digit.h>
void main(void)
{
EmberEUI64 emLocalEui64;
EmberStatus Status;
EmberApsFrame apsframe;
int8 messagetag = 0x01;
int8 messagedata[1];
int messageLength;
int16 indexOrDestination;
printf("\n\r RESET ....");
lcd_clear();
if(EmberInitialization())
{
EmberConfig();
EmberInitializeBinding();
ezspGetEUI64(&emLocalEui64[0]);
EmberAddEndPoint();
EmberFormNetwork();
Status=ezspPermitJoining(0xFF);
while(TRUE)
{
sinkApplicationTick();
EM260Tick();
lcd_putd(unicast_data);
}
}
}
|
Sleepy device code
Code: |
#include <18F4620.h>
#fuses HS,NOWDT,NOLVP,PUT,NOBROWNOUT,NOPROTECT
#DEVICE ADC=8
#use delay(clock=10M)
#define SLEEPY_SENSOR 1
#include "em260.h"
#include "ember_utilities.c"
#include "digit.h"
void main()
{
//int8 i;
EmberStatus status;
EmberEUI64 emLocalEui64;
EmberApsFrame apsframe;
int8 messagetag = 0x01;
int8 messagedata[10];
int messageLength;
int16 indexOrDestination;
if(EmberInitialization())
{
EmberConfig();
EmberInitializeBinding();
ezspGetEUI64(&emLocalEui64[0]);
EmberAddEndPoint();
EmberJoinNetwork(EMBER_SLEEPY_END_DEVICE);
indexOrDestination = 0x0000;
apsframe.profileID=0xC00F;
apsframe.clusterID=0x0001;
apsframe.sourceEndpoint=0x01;
apsframe.destinationEndpoint=0x01;
apsframe.options=0x0000;
apsframe.groupID=0x0000;
apsframe.sequence=0x00;
messageLength=10;
messagedata[0]=0;
messagedata[1]=1;
messagedata[2]=1;
messagedata[3]=2;
messagedata[4]=5;
messagedata[5]=5;
messagedata[6]=5;
messagedata[7]=5;
messagedata[8]=5;
messagedata[9]=255;
int i;
while(TRUE)
{
EM260Tick();
sensorApplicationTick();
ezspSendUnicast(EMBER_OUTGOING_DIRECT,indexorDestination,&apsframe,messagetag,messageLength,&messagedata[0]);
lcd_putd(i++);
}
}
}
|
Can anyone help about it ?
Regards |
|