With nothing to lose, I performed this little code mod
in the Mi WiDefs.h file:
// MAC Address
//#define EUI_7 0x00
//#define EUI_6 0x04
//#define EUI_5 0xA3
//#define EUI_4 0x11
//#define EUI_3 0x22
//#define EUI_2 0x33
//#define EUI_1 0x44
//#define EUI_0 0x55
#define EUI_7 0x55
#define EUI_6 0x01
#define EUI_5 0x02
#define EUI_4 0x03
#define EUI_3 0x04
#define EUI_2 0x05
#define EUI_1 0x06
#define EUI_0 0x07
SCREENSHOT 4. The presence of the received report message
and the LED illumination confirms that the Coordinator LED code
was actually executed.
break;
}
break;
AHA! Take a look at Screenshot 3. The association of
the coordinator and End Device went as planned with the
new address information. So, I pressed the RB4 button on
the End Device and the Trainer’s LED 2 illuminated. The LED
code is only interested in the Report and Data fields of the
DATA frame in Screenshot 3. Here’s the LED blinker code
that we were failing to execute in main.c:
switch(*pRxData++) //report type
{
case USER_REPORT_TYPE:
switch(*pRxData++) //report id
{
case LIGHT_REPORT:
switch(*pRxData++) //first byte of
//payload
{
}
break;
The LED code is a simple parser that switches on the
Report Type (0x12) and falls through to switch on the
Report ID (0x34) which falls through to the LED LIGHT
TOGGLE function (0x55).
The confusion was centered on not reprogramming the
PICDEMZ microcontroller. The PICDEMZ is programmed to
send to the 0x55, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, and
0x07 address. So, when we changed our ZENA-assigned
address on the coordinator, things worked as the
coordinator’s new address was what the End Device was
aiming for. So, guess what? The PIC24FJ/PIC32MX Trainer/
MRF24J40MB combination works! SV
case LIGHT_ON:
LED_2 = 1;
break;
case LIGHT_OFF:
LED_2 = 0;
break;
case
LIGHT_TOGGLE:
LED_2 ^= 1;
ConsolePutROMString((ROM
char*)”Receive Report to
Toggle
Light\r\n”);
Sources
EDTP Electronics, Inc.
PIC24FJ/PIC32MX Trainer Kit
ZeroG - PIC24FJ128GA006
Trainer Kit
www.edtp.com
Fred Eady can be reached via email:
fred@edtp.com.
Microchip
MRF24J40MB
MRF24J40MA
MiWi
www.microchip.com
PHOTO 5. Although the XBee-Pro and MRF24J40MB are mutually exclusive
due to the interleaved socket arrangement, we’re quickly running out of
peripheral space on the perfboard.
SERVO 06.2010 73