ANT

What is BCA_Lib?

“BCA_Lib” is a library, which uses with BC-ANT-USB. This library makes the configuration of ANT communication simple. For more information of ANT protocol, please look at ANT's community page, “thisisant.com.” The details of BC-ANT-USB is listed on ANT/BC-ANT-USB of BC::labs.

The class reference of BCA_lib is published on this page.

Features of BCA_Lib

The major features of this library are listed below.

The features of API are

Files

[Caution]
To use this library, 5 files listed below and the driver for BC-ANT-USB are required.

Definitions

About Communication

Example of Configuration

[Transmitting side]
Channel Number: 0
Channel Type: 0 (MASTER)
Shared Channel: 0
Device Number: 33
Device Type: 1
Transmission Type: 1
Frequency: 66 (2466MHz: Since 2466-2400 =66)
Channel Period; 4Hz

Example code (transmitting data): this uses the callback interface.

[Receiving side]
Channel Number: 0
Channel Type: 0 (MASTER)
Shared Channel: 0
Device Number: 33
Device Type: 1
Transmission Type: 0 (Wildcard)
Frequency: 66 (2466MHz: Since 2466-2400 =66)
Channel Period: 4Hz

Example code (receiving data)

About Pairing

[Transmitting#1]
Channel Number: 0
Channel Type: 0 (MASTER)
Device Number: 1234
Frequency: 66 (2466MHz: Since 2466-2400 =66)
Channel Period: 4Hz

[Transmitting#2]
Channel Number: 0
Channel Type: 0 (MASTER)
Device Number: 5678
Frequency: 66 (2466MHz: Since 2466-2400 =66)
Channel Period: 4Hz

[Receiving]
Channel Number: 0
Channel Type: 1 (SLAVE)
Device Number: 0
Frequency: 66 (2466MHz: Since 2466-2400 =66)
Channel Period: 4Hz

Example Code

The registered (BCA_RegisterPairingFunc()) callback function is executed after the pairing process (BCA_STARTPairing()) has been executed and the selected duration of time has passed. The channel information, such as Device ID, of a newly found device is handed over to the function.
As the device, which you like to connect, is selected from the application of UI, the channel is opened (BCA_OpenChannel()).

The device search is performed by all 8 channels, so 8 devices would be found at most.

Reference

Shared Channel

About Shared Channel

The common connection types of ANT network are 1-to-1 or broadcast connection.
Excluding broadcast, as a master connects to multiple slaves, the master needs to connect to each slave, independently. 図1 Shard Channel is a way that a single master connects to multiple slaves in one channel. In Shared Channel, specific shared addresses are configured to all slaves. To add a shared address to a slave, the address consumes 2 bytes, and the total amount of data, which can be sent in one transmission, is reduced to 6 bytes. 図2 An example of transmitting data 図3 To send data, which includes a specific shared address from a mater, a node, which corresponds to a specific shared address that each slave has sent to the master, receives the data.

As the nodes start receiving the data, the nodes send back data, whose first 2bytes include own shared addresses, in broadcast.

Notify shared addresses on a shared channel

Example of Configuration

Configuration of Node A
Channel Number: 0
Channel Type: BCA_CHANNEL_TYPE_MASTER
Shared Channel: BCA_CHANNEL_SHARED Device Number: 33 (the serial number of node A) Device Type: 3 (the device type of node A) Transmission Type: 3 (2bytes of shared channel address)
Frequency: 66 (2466MHz: Since 2466-2400 =66)
Channel Period: 4Hz~

Configuration of Node B, C, and D
Channel Number: 0
Channel Type: BCA_CHANNEL_TYPE_SLAVE
Shared Channel: BCA_CHANNEL_SHARED Device Number: 33 (the serial number of node A) Device Type: 3 (the device type of node A) Transmission Type: 3 (2bytes of shared channel address)
Frequency: 66 (2466MHz: Since 2466-2400 =66)
Channel Period: 4Hz~

As the slaves (node B, C, and D) has completed opening own channels, they add own shared addresses to the first 2bytes of the data and send back the data in broadcast. Since now on, slaves reply as sending back the data which includes shared addresses at its first 2 bytes. Otherwise, the information of the configured shared address is void.

Sample Code

There are sets of sample code for transmitting, receiving, and pairing (receiving only). One is for C++, and the other is for Python.

C++ Samples

Python Examples

Whole files, BCA_lib, and HTML document


Front page   New List of pages Search Recent changes   RSS of recent changes