Xbee basics - FRAMESĀ
Just like every sentence has a structure, The way Xbeeās communicate also has a structure. This structure is called a FRAME. It looks typically like this :
7E 00 14 92 00 13 A2 00 40 CC 86 29 02 A4 01 01 00 10 00 00 10 F5
A sentence is usually identified by a capital letter in the beginning, ending with a full stop. For Xbee, the sentence structure is first consisting of a number of bytes. The start byte, is 0x7E (also referred commonly as 7E, iāll use the ā0xā prefix generously as most tutorials you see will do that too).Ā
The next 2 bytes indicate the length of the whole frame. So you can say that 7E is the capital letter of a sentence, while 00 14 indicates how long this sentence is. For the example above 00 14 adds up in Hex as 14, which is 18 in decimal ( the usual number system we use ).Ā
We can now start counting the number of bytes after 14. Youāll realize that there are actually 19 bytes!! Why this is because the last byte, F5 is actually called a CHECKSUM. Turns out , most electronic hardware are really smart, when they send data to each other, they try to make sure that the data is correct. Thereās a way this checksum is calculated, but lets keep that at the back of our minds right now.
The next byte after the length, is 92. This is the the FRAME TYPE, it explains what the rest of the frame might be. For example, if your 4th byte is 92, it means it is getting IO input from one of the pins that is connected to the Xbee. There is a list of different Frame type numbers, each frame type has a different meaning. Ā For the full list of meanings, check it out here : https://docs.digi.com/display/XBeeZigBeeMeshKit/Frame+structureĀ So you can say that the Frame type is like telling us the type of sentence this is. Ā After frame type comes the 64bit address of the Xbee. Its like a serial number of sorts. It usually starts with 00 13 A2 00 (As most Xbees will have the same first 4 bytes) then for the above example, the next 4 bytes are 40 CC 86 29. These 8 bytes (64 bits) make up the serial number of the Xbee!Ā
The next 2 bytes are an internal IP of sorts. 02 A4 is what the coordinator Xbee issued to this Xbee. So if you think of the Coordinator Xbee as your home WIFI router, it issues any device connected to it an IP address. Your phone/ computer for example, will have an internal IP of 192.168.1.12. This is an internal IP within your home LAN which is different from how you look like to the rest of the internet. The same is happening to Xbee. 02 A4 is a randomĀ āIP of sortsā that has been issued to it.Ā
The rest of the bytes 01 01 00 10 00 00 10. Is telling you what pins youāve configured to receive data or transmit data. Xbee has about 10pins depending on which model you get, and these pins can capture either a HIGH LOW , digital in/out put, as well as ANALOG, maybe temperature or humidity in/output. These bytes are an indication if out of those pins, which ones are turned on and which ones are turned off, you can set it all in XCTU, you probably just need to know the last byte. Which is typically the data that youāre trying to capture. For our case, its 10! which means Iāve received a HIGH on one of my digital pins.Ā
the last byte F5 is the checksum. Remember when I told you to keep checksum at the back of your mind. Well, right now, weāve almost reached the end of this frame. The checksum adds up all the bytes from the 4th byte to the 2nd last byte. Weāll tentatively call this amount CKS. The equation is so :
0xFF - 0xCKS = <checksum value>
For our case all the bytes from byte 4 to 2nd last byte , taken away from FF is actually F5. So our sentence has officially ended.
Well hope my primer to the Xbee communication is beneficial for the noobies like me. Cheers
















