ANT

Library for LPC1114

This is a sample code of the library for LPC1114, a 32bit microcontroller (IC) produced by NXP Semiconductors. (The product page at NXP Semiconductors is available here.)

This library is still alpha version, and there is possibly a lot bug in the code. (Please handle it carefully)

ant.c calls functions listed at uart.c. The functions are used for exchnaging commands and results with the ANT chip. In this sample, therefore, uart.c as well as uart.h are required.

For uart.c and uart.h, their licenses are checking right now.

Example

#include <ant.h>
#include <uart.h>

#define   DEVICE_NUMBER   31
#define   MAX_BUFSIZE     32

#define   ANT_CH          0

unsigned  char buffer[MAX_BUFSIZE];

void OpenANT() {
//  This function sets the communication parameter 0 and opens the communication channel. 

	ANT_ResetSystem();                                         // Resetting ANT device

	ANT_AssignChannel( ANT_CH, ANT_Bidirectional_Slave, 0) ;   // Assigning a channel to a receiving channel
	ANT_SetChannelId( ANT_CH,  DEVICE_NUMBER, 1, 1 );          //   Setting Device Number and other Device ID 

	ANT_SetChannelPeriod_Hz( ANT_CH, 4 );                      // Setting Channel Period as 4Hz (This is the default setting. )
	ANT_SetChannelRFFreq( ANT_CH, 4 );                         // Frequency is at 2404MHz  
	ANT_OpenChannel( ANT_CH );                                 // Opening a channel and starting communication

      return;
}
 
void main () {

   int s;
   OpenANT();

   while(1) {
       if ( s = BC_ANT_RecvPacket( buffer, MAX_BUFSIZE )) {
           // Receiving data from the ANT chip, and processing....
           // Receiving packets, and processing events, which the ANT chip has sent .
       }
   }

}

Revision History

  • 2013/02/01 This article is initially uploaded

Attach file: fileant.h 652 download [Information] fileant.c 688 download [Information]

Front page   Edit Freeze Diff Backup Upload Copy Rename Reload   New List of pages Search Recent changes   RSS of recent changes
Last-modified: 2013-02-01 (Fri) 10:09:43 (1750d)