Zigbee address and data

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 6.

Moderator: Benj

Post Reply
Walbeek
Flowcode v5 User
Posts: 68
Joined: Thu Mar 01, 2007 10:48 am
Location: Netherlands
Been thanked: 3 times
Contact:

Zigbee address and data

Post by Walbeek »

Hi there,

I'm testing with several Zigbee Eblocks.
I would like to give the modules a address (byte) and let them receive data (byte)
The Zigbee command is "SendChar" to send a byte on the Zigbee network.
How can I send more than one byte (from coordinator) and let the zigbee routers know that the first one is a address?
Do we need a checksum here and how does the router answers?
Can anyone point me in the right direction?
Please let me know.
Greetings, Rinie
Flowcode V7 user

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: Zigbee address and data

Post by Benj »

Hello Rinie,

I would create a protocol to allow you to do what you need.

A simple protocol might look like this.

Start Byte
Address
Data0
Data1
...
End Byte / Checksum

When sending out a packet you simply send out the bytes in order e.g.

start byte = 0x5A
Address = 0x01
...
end byte = 0xA5

At the receiving end you wait for the value 0x5A to be received, you then know that the next byte will be the address and bytes after that will be data. If one of the data bytes is 0xA5 then it could be the end of packet or it could be a data value.

Fixing the number of data bytes would help to get around this potential issue but there are other workarounds if you need variable data lengths. One is to send the number of data bytes before or after the address.

Implementing a checksum instead of the fixed end byte would allow for error checking so the receiver knows the data it receives is correct.

To do a simple checksum you can simply do something like this.

Checksum = 0
Send Start Byte
Checksum = Checksum ^ Start Byte
Send Address
Checksum = Checksum ^ Address
Send Data0
Checksum = Checksum ^ Data0
Send Data1
Checksum = Checksum ^ Data1
...
Send Checksum

At the receiver end you do the same calculations on the incoming data and if the checksum byte matches your calculation you know the data is valid and can be actioned.

Post Reply