# API communication bytecount question

**URL:** <https://forums.digi.com/t/api-communication-bytecount-question/2269>\
**Category:** XBee - Zigbee\
**Created:** [July 9, 2008, 2:00pm UTC](https://forums.digi.com/t/api-communication-bytecount-question/2269 "2008-07-09T14:00:41Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![nikosf](https://avatars.discourse-cdn.com/v4/letter/n/3da27b/32.png) [@nikosf](https://forums.digi.com/u/nikosf)\
**Post date:** [July 9, 2008, 2:00pm UTC](https://forums.digi.com/t/api-communication-bytecount-question/2269/1 "2008-07-09T14:00:41Z")

</div>

Hello everyone.  
I am currently making some libraries to communicate to an Xbee S2 (using zigbee API function set) by a microcontroller (Atmel AVR 8 bit to be specific).  
The length of any API frame is the second and third bytes in the frame.  
I am trying to calculate the maximum length for any given frame send or received but this seems rather difficult.  
Also from everything I understand rom the manuals, there is no way I can exceed 256 bytes in a frame so I will never have a length more than one byte (I can understand why there are two bytes in the API e.g. compatibility, future version etc)  
In my code I define character arrays for the packet to be sent to the xbee and another one for the reply. Since memory in a microcontroller is something limited and ussually small I cannot declare something many times bigger that what I will need.  
I have concluded that an array of 100 elements will always be enough for transmission or reception of any API frame.  
Does this stand true??

Thanx
