Component: Zigbee (EB051, XBEE) (Wireless)
Author | Matrix Ltd. |
Version | 1.3 (Release) |
Category | Wireless |
Contents
- 1 Zigbee (EB051, XBEE) component
- 2 Examples
- 3 Downloadable macro reference
- 3.1 NodeConfigureSleep
- 3.2 ReadNameFromBuffer
- 3.3 NodeWake
- 3.4 ReadATResponse
- 3.5 ScanBuffer
- 3.6 SendChar
- 3.7 InitNetwork
- 3.8 ConnectToCoordinator
- 3.9 ConnectToName
- 3.10 StoreParams
- 3.11 EnterCommandMode
- 3.12 RestartNetwork
- 3.13 ConnectToAll
- 3.14 ConnectFromLibrary
- 3.15 ConnectToAddress
- 3.16 GetSignalLevel
- 3.17 ExitCommandMode
- 3.18 ReadAddressFromBuffer
- 3.19 SendATCommand
- 3.20 ScanNetwork
- 3.21 GetATResponse
- 3.22 ReceiveChar
- 4 Simulation macro reference
- 5 Property reference
Zigbee (EB051, XBEE) component
Zigbee component designed to work with the XBEE range of modules from Digi. Provides a very simple interface to allow Zigbee mesh networks and communications. Also available in the form of the EB051 Zigbee E-block.
Examples
Communications Demo
Here is an example file for a Zigbee Coordinator to set up a Zigbee network.
Here is an example file for a Zigbee router / end device to connect to the Zigbee network and transfer data.
The coordinator example sets up the network and periodically sends out an incrementing byte value. The router / end device example receives the byte sent from the coordinator and outputs this to the PORTB pins before replying back to the coordinator with the incoming value plus 128.
Read & Display ADC
Here is an example file for a Zigbee Coordinator to set up a Zigbee network, request sensor readings and display them on a graphical LCD.
Here is an example file for a Zigbee router / end device to connect to the Zigbee network, wait for commands from the coordinator and then sample the ADC and transmit the value.
The coordinator example sets up the network and periodically sends out a byte to inform node 2 to take an ADC sample. The router / end device example receives the byte sent from the coordinator and collects the reading from the ADC before transmitting the value back to the coordinator.
Downloadable macro reference
NodeConfigureSleep
Sets the Zigbee device sleep mode (only applicable for end node type devices) 1=Hibernate, 2=Doze, 4=Cyclic Sleep, 5=Cyclic Doze, Timeout in ms
Parameters
- BYTE Mode
- UINT Timeout
Return value
- This call does not return a value
ReadNameFromBuffer
Returns a byte from the 8-Byte name
Parameters
- BYTE Device
- BYTE Idx
Return value
NodeWake
Wakes up the local Zigbee module from sleep mode.
Parameters
- This macro has no parameters
Return value
ReadATResponse
Reads a single byte from the received AT command response.
Parameters
- BYTE idx
Return value
ScanBuffer
Returns a binary list of matched identifier names
Parameters
- STRING Compare_Str
- BYTE Length
Return value
SendChar
Transmits a byte value to the Zigbee module.
Parameters
- BYTE Byte
Return value
- This call does not return a value
InitNetwork
Initialises the Zigbee module and attempts to setup or join the network
Parameters
- This macro has no parameters
Return value
- This call does not return a value
ConnectToCoordinator
Attempts to connect the data channel to the network coordinator node.
Parameters
- This macro has no parameters
Return value
ConnectToName
Attempts to connect the data channel to a named device on the network.
Parameters
- <- STRING Name
- This parameter may be returned back to the caller
Return value
StoreParams
Stores the current register set into the Zigbee module's non volatile memory
Parameters
- This macro has no parameters
Return value
- This call does not return a value
EnterCommandMode
Moves from data mode into command mode by sending the special characters
Parameters
- This macro has no parameters
Return value
- This call does not return a value
RestartNetwork
Attempts to restart the network
Parameters
- This macro has no parameters
Return value
- This call does not return a value
ConnectToAll
Attempts to connect the data channel to all devices on the network.
Parameters
- This macro has no parameters
Return value
ConnectFromLibrary
Attempts to connect the data channel to a known device on the network.
Parameters
- BYTE Mode
- BYTE Device
Return value
ConnectToAddress
Attempts to connect the data channel to a specific device address on the network.
Parameters
- <- STRING Address
- This parameter may be returned back to the caller
Return value
GetSignalLevel
Returns the signal strength of the last signal received
Parameters
- This macro has no parameters
Return value
ExitCommandMode
Returns from command mode to allow data to be sent and received
Parameters
- This macro has no parameters
Return value
- This call does not return a value
ReadAddressFromBuffer
Reads a byte from a 16-bit Zigbee device address
Parameters
- BYTE Device
- BYTE Idx
Return value
SendATCommand
Transmits a string of values to the Zigbee module.
Parameters
- <- STRING Command
- Transmits a command to the Zigbee module followed by a carriage return
- This parameter may be returned back to the caller
Return value
- This call does not return a value
ScanNetwork
Scans the local network for devices and stores into a local device array. Mode = 0 store device names, mode = 1 store device addresses. Returns the number of devices found.
Parameters
- BYTE Mode
Return value
GetATResponse
Waits for a response from the Zigbee module. If the Logging parameter is set then the response is stored in memory allowing the software to read the reply.
Parameters
- BYTE Logging
Return value
ReceiveChar
Attempt to receive a byte from the Zigbee module.
Parameters
- BYTE nTimeout
Return value
Simulation macro reference
This component does not contain any simulation macros
Property reference
Device Name
This property is of type Line of text and can be referenced with the variable name dev_name.
String of characters used to allow the Zigbee node to use the name addressing mode of operation.
Can be left blank if name addressing is not being used.
Zigbee Mode
This property is of type Fixed list of ints and can be referenced with the variable name zig_mode.
Specifies the functionality of the Zigbee node.
Coordinator - Must be used with a Coordinator Zigbee E-Block EB051C, Responsible for starting the network and assigning addresses.
Router - Must be used with a Router / End Node E-Block EB051R, Responsible for forwarding / repeating packets on the network.
End Device - Must be used with a Router / End Node E-Block EB051R, Capable of low power operation.
Auto ID
This property is of type True or false and can be referenced with the variable name auto_id.
Automatically generate a PAN ID
PAN ID
This property is of type Line of text and can be referenced with the variable name pan_id.
Assigns a Personal Area Network Identifier code to the Zigbee node.
Random / Search - Scans the local area for Zigbee PAN networks and joins the existing network, otherwise a random value is chosen.
Preset - Assigns a preset PAN ID to the Zigbee node, Must be between 0x0 and 0x3FFF.
Node Join Time
This property is of type Fixed list of ints and can be referenced with the variable name join_time.
Length of time in seconds where nodes are allowed to join the network.
Infinte - Nodes are always allowed to join the network.
Preset - Nodes are only allowed to join the network for a specific amount of time.
Note: Join time not available for End Device nodes.
Verbose Mode
This property is of type True or false and can be referenced with the variable name verbose.
Forwards the Incoming and Outgoing AT command structure to a Graphical or standard LCD display.
Note: LCD component must be added to the Flowcode program before the Zigbee component is added for this functionality to compile correctly.
Max Hops
This property is of type Signed integer and can be referenced with the variable name max_hops.
Specifies the maximum number of retransmits for a Broadcast transmission.
Sleep Buffer Time
This property is of type Fixed list of ints and can be referenced with the variable name sleep_buffer.
Length of time to buffer packets for sleeping or powered down nodes. This value must be consistent throughout the Zigbee network.
Default - Assigns the maximum buffer time of 28 seconds.
Preset - Allows for a custom sleep time of 0.32 - 28 seconds.
UART Channel
This property is of type Fixed list of ints and can be referenced with the variable name Channel.
UART peripheral used to communicate with the Zigbee module
RX Pin
This property is of type Single digital pin and can be referenced with the variable name rx_pin.
UART Receive Pin
TX Pin
This property is of type Single digital pin and can be referenced with the variable name tx_pin.
UART Transmit Pin
Sleep Pin
This property is of type Single digital pin and can be referenced with the variable name pin_sleep.
Zigbee Sleep Control Pin
Flow Control
This property is of type True or false and can be referenced with the variable name flow_control.
Determines if the UART communications has additional flow control enabled.
RTS Pin
This property is of type Single digital pin and can be referenced with the variable name pin_rts.
Request to send flow control pin
CTS Pin
This property is of type Single digital pin and can be referenced with the variable name pin_cts.
Clear to send flow control pin
0x0B
This property is of type True or false and can be referenced with the variable name chan_0.
Determines if channel will be scanned
0x0C
This property is of type True or false and can be referenced with the variable name chan_1.
Determines if channel will be scanned
0x0D
This property is of type True or false and can be referenced with the variable name chan_2.
Determines if channel will be scanned
0x0E
This property is of type True or false and can be referenced with the variable name chan_3.
Determines if channel will be scanned
0x0F
This property is of type True or false and can be referenced with the variable name chan_4.
Determines if channel will be scanned
0x10
This property is of type True or false and can be referenced with the variable name chan_5.
Determines if channel will be scanned
0x11
This property is of type True or false and can be referenced with the variable name chan_6.
Determines if channel will be scanned
0x12
This property is of type True or false and can be referenced with the variable name chan_7.
Determines if channel will be scanned
0x13
This property is of type True or false and can be referenced with the variable name chan_8.
Determines if channel will be scanned
0x14
This property is of type True or false and can be referenced with the variable name chan_9.
Determines if channel will be scanned
0x15
This property is of type True or false and can be referenced with the variable name chan_10.
Determines if channel will be scanned
0x16
This property is of type True or false and can be referenced with the variable name chan_11.
Determines if channel will be scanned
0x17
This property is of type True or false and can be referenced with the variable name chan_12.
Determines if channel will be scanned
0x18
This property is of type True or false and can be referenced with the variable name chan_13.
Determines if channel will be scanned
0x19
This property is of type True or false and can be referenced with the variable name chan_14.
Determines if channel will be scanned
0x1A
This property is of type True or false and can be referenced with the variable name chan_15.
Determines if channel will be scanned
Scan Duration
This property is of type Signed integer and can be referenced with the variable name scan_duration.
Configures the length of time to scan each channel for network activity. The overall time for the entire channel scan is shown as channel scan time.
Total Scan Time (ms)
This property is of type Signed integer and can be referenced with the variable name scan_total.
No additional information
Label
This property is of type Line of text and can be referenced with the variable name label.
No additional information