Component: Zigbee (EB051, XBEE) (Wireless)

From Flowcode Help
Jump to navigationJump to search


Author Matrix Ltd.
Version 1.5 (Release)
Category Wireless


Image 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. Can also be used with Zigbee MIAC Addon module

Examples

Communications Demo

Here is an example file for a Zigbee Coordinator to set up a Zigbee network.

FC6 Icon.png Zigbee Coordinator


Here is an example file for a Zigbee router / end device to connect to the Zigbee network and transfer data.

FC6 Icon.png Zigbee Router / End device


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.

FC6 Icon.png Zigbee Coordinator


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.

FC6 Icon.png Zigbee Router / End device


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) ,

Parameters

BYTE Mode
1=Hibernate, 2=Doze, 4=Cyclic Sleep, 5=Cyclic Doze
UINT Timeout
Time to sleep in milli seconds (ms)


Return value

This call does not return a value


ReadNameFromBuffer

Returns a byte from the 8-Byte name

Parameters

BYTE Device
The Device name to collect. Range: 0-7
BYTE Idx
The index position of the name. Range: 0-7


Return value

BYTE


NodeWake

Wakes up the local Zigbee module from sleep mode.

Parameters

This macro has no parameters


Return value

This call does not return a value


ReadATResponse

Reads a single byte from the received AT command response.

Parameters

BYTE idx
Specified the byte index in the buffer. Range 0-15


Return value

BYTE


ScanBuffer

Returns a binary list of matched identifier names

Parameters

STRING Compare_Str
BYTE Length


Return value

BYTE


SendChar

Transmits a byte value to the Zigbee module.

Parameters

BYTE Byte
Data byte to transmit. Range 0-255


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

BYTE


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

BYTE


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

BYTE


ConnectFromLibrary

Attempts to connect the data channel to a known device on the network.

Parameters

BYTE Mode
BYTE Device


Return value

BYTE


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

BYTE


GetSignalLevel

Returns the signal strength of the last signal received

Parameters

This macro has no parameters


Return value

BYTE


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

BYTE


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

BYTE


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

BYTE


ReceiveChar

Attempt to receive a byte from the Zigbee module.

Parameters

BYTE nTimeout


Return value

BYTE


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.

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.

The total amount of time that it will take to perform a complete RF channel scan based on the selected scan channels and duration.

Label

This property is of type Line of text and can be referenced with the variable name label.

No additional information