mayais Guest
|
sending data with the ccs wireless zigbee development kit |
Posted: Tue Apr 14, 2009 9:27 pm |
|
|
Hi in the example code:
#include <16F886.h>
#DEVICE ADC=10
#fuses INTRC,NOWDT,NOLVP,BORV21
#device *=16
#use delay(clock=4000000)
#define SLEEPY_SENSOR 1
#include "em260.h"
#include "ember_utilities.c"
//long value=0;
long i,j=0;
void main(void){
EmberEUI64 emLocalEui64;
EmberStatus status;
EmberApsFrame apsframe;
int8 messagetag=0x01;
long messagedata[2];
int16 messageLength;
int16 indexOrDestination;
output_high(pin_A2);
output_high(POWER_UP_PIN);
setup_adc_ports(sAN0|sAN1);
setup_adc(ADC_CLOCK_DIV_32);
set_adc_channel(1);
enable_interrupts(GLOBAL);
enable_interrupts(INT_AD);
enable_interrupts(INT_EXT);
read_adc(ADC_START_ONLY);
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=2;
while(true)
{
sensorApplicationTick();
EM260Tick();
if(!input(PUSH_BUTTON1))
{ //value=read_adc();
//i=value;
i++;
// messagedata[0]=i*0x00FF;
messagedata[0]=i;
[color=red]ezspSendUnicast(Ember_OUTGOING_Direct,indexOrDestination,0x0000,messagetag,messageLength,&messagedata[0]);//Change
delay_ms(100);
}
if(!input(PUSH_BUTTON2))
{
j=j+2;
messagedata[1]=j;
ezspSendUnicast(EMBER_OUTGOING_DIRECT,indexOrDestination,0x0001,messagetag,messageLength,&messagedata[1]);//change
delay_ms(200);
}
}
}
}[/color]
Then the function in red (ezspSendUnicast()) is the one who send the data, but it is sending an int8 and i need to send a float what i have to change to do that, or at least that i can send a long, what i have to modify in the libraries to do this.
I understand that unicast_data in the coordinator must be a float or a long but i think that the problem is that even if the variable i or j are long or float i only send and int8 value.
Help please |
|