Forum Menu




 


Log in Problems?
New User? Sign Up!
AVR Freaks Forum Index

Post new topic   Reply to topic
View previous topic Printable version Log in to check your private messages View next topic
Author Message
djoshi
PostPosted: Feb 18, 2012 - 10:13 PM
Raving lunatic


Joined: Dec 04, 2007
Posts: 2382
Location: UK London

Hi All

I am trying to send two bytes of data from cord to the routers.

What must I set APS_ASDU_OFFSET and APS_AFFIX_LENGTH to?

Where can I find more information on this?


I think I need to set a structure correctly
when I call APS_DataReq?

DJ

_________________
Thanks

Regads

DJ
 
 View user's profile Send private message  
Reply with quote Back to top
xtal_88
PostPosted: Feb 20, 2012 - 12:23 PM
Wannabe


Joined: May 25, 2011
Posts: 85


Hi!

It goes something like this (in *.h file):

Code:

BEGIN_PACK
typedef union
{
   uint8_t    message[65];      
} PACK AppMessage_t;

typedef struct
{
   uint8_t        header[APS_ASDU_OFFSET];
   AppMessage_t   data;
   uint8_t        footer[APS_AFFIX_LENGTH - APS_ASDU_OFFSET];
} PACK AppMessageRequest_t;
END_PACK



And in *.c file where you send message :

Code:

// global variables
AppMessageRequest_t   outgoingMessage;            


// data you send
outgoingMessage.data.message[0] = 0xXX;       // 1st byte
outgoingMessage.data.message[1] = 0xXX;       // 2nd byte



When you receive data:
Code:

// global variables
uint8_t received_data[65];

void APS_DataInd(APS_DataInd_t *indData)      
{         
   AppMessage_t *data = (AppMessage_t *) indData->asdu;
   
   
        received_data[0] = data->messsage[0];    // 1st byte
        received_data[1] = data->messsage[1];    // 2nd byte
}


Have look at the WSNDemo\include\WSNDemoApp.h file in WSNDemo application.
 
 View user's profile Send private message  
Reply with quote Back to top
Display posts from previous:     
Jump to:  
All times are GMT + 1 Hour
Post new topic   Reply to topic
View previous topic Printable version Log in to check your private messages View next topic
Powered by PNphpBB2 © 2003-2006 The PNphpBB Group
Credits