User manual

LPCXpresso Experiment Kit - User’s Guide
Page 113
Copyright 2013 © Embedded Artists AB
A shorting jumper in position 1-2 of J12 means that the RF module is powered from the 3.3V supply
from the LPCXpresso or mbed board. This supply is somewhat current limited (about 100-150mA) but
will be sufficient for most RF modules. However, some modules have higher current requirements and
then the shorting jumper should be placed in 2-3 position of J12. This is the left position for the jumper,
when viewed like in Figure 64. In this case, an external power supply can power the RF module (via
U1 voltage regulator).
The RF-module experiments are based on the interrupt-driven UART code from Lab14c. The
UARTSendString() and UARTSendBuffer()functions are needed.
7.16.1 Lab 15a: XBee™ RF-Module
This exercise requires at least two XBee modules and the same number of experiment boards to be
able to test XBee communication. One of the boards will be setup as a controller and the other as
node(s).
There are many different XBee modules with different functionality and programming interfaces. The
XBee module used in this experiment is: XB24-AWI-001. It can be bought from for example Digikey:
XB24-AWI-001-ND or Mouser: 888-XB24-AWI-001.
Prepare the boards by plugging in the XBee module in the J15 socket and inserting a jumper in J12 at
position 1-2 to get power from the LPCXpresso board.
The XBee driver is quite large and is found in the xbee.c and xbee.h files in the code framework
that is provided. Copy all drivers created so far into the project, including the interrupt driven UART
code from Lab 14c.
Below is the template for the main() program.
#include "stdio.h"
#include "LPC11xx.h"
#include "type.h"
#include "board.h"
#include "gpio.h"
#include "delay.h"
#include "xbee.h"
/*
* Application configuration
*
* CFG_ACT_AS_COORDINATOR - (1) - Configure the XBee module to act as a coordinator.
* (0) - Configure the XBee module to act as an end-device
*/
#define CFG_ACT_AS_COORDINATOR (0)
/*
* RF message IDs, add your own here but make sure that the coordinator
* and the nodes have the same numbering.
*/
#define RFPT_SET_LED (1)
// Forward declarations
static void xbeeUp(uint8_t up);
static void xbeeNode(uint32_t addrHi, uint32_t addrLo, uint8_t rssi);
static void xbeeTxStatus(uint8_t frameId, xbeeTxStatus_t error);
static void xbeeData(uint32_t addrHi, uint32_t addrLo, uint8_t rssi,
uint8_t* buf, uint8_t len);
static xbee_callb_t callbacks = {
xbeeUp,
xbeeNode,
xbeeTxStatus,
xbeeData
};
static uint8_t devIsReady = 0;