Chameleon-PIC Nurve Networks, Chameleon-PIC Datasheet - Page 246

MCU, MPU & DSP Development Tools PIC24 & PROPELLER DEV SYSTEM (SBC)

Chameleon-PIC

Manufacturer Part Number
Chameleon-PIC
Description
MCU, MPU & DSP Development Tools PIC24 & PROPELLER DEV SYSTEM (SBC)
Manufacturer
Nurve Networks
Datasheet

Specifications of Chameleon-PIC

Processor To Be Evaluated
PIC24
Data Bus Width
16 bit
Interface Type
USB, VGA, PS/2, I2C, ISP, SPI
Operating Supply Voltage
3.3 V, 5 V
Lead Free Status / RoHS Status
Lead free / RoHS Compliant
After Adding New Message Handlers
.
.
.
.
.
.
That’s it! Save the file as cham_default2_drv_112_modified.spin and we are done with this portion. In fact, you can flash it
down to the Propeller and every single program will still work the same. We have added messages and features, but we
have NOT made anything incompatible or re-used message ids for something else. This is very important to keep in mind,
so you do not damage a driver and make it incompatible with other software.
31.1.2 Adding PIC Support at the Client/Master Side
At this point, we have new messages added to the Propeller driver along with the message handler code. If you haven’t
done so, compile and download the new driver to the Propeller chip on the Chameleon, whatever application you have
running on the Chameleon should work exactly the same.
Now, what we need is to add support on the client/master side or write a program that sends the messages to the
Propeller. Rather than go into the SPI driver code header, I decided to just write a standalone program that blinks the
LED. I started with the port blinking demo and then modified it to directly send the new messages. Here’s the entire
program:
////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//////
// INCLUDES
///////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//////
// include headers required for demo
#include "CHAM_PIC_SYSTEM_V010.h"
#include "CHAM_PIC_I2C_SPI_DRV_V010.h"
#include "CHAM_PIC_NTSC_DRV_V010.h"
////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//////
// DEFINES AND MACROS
/////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//////
// new commands for status LED control
#define STATUS_LED_ON
#define STATUS_LED_OFF 101
////////////////////////////////////////////////////////////////////////////////////////////////////////////////
///////
' set result and set dispatcher to idle
spi.finishcmd(g_spi_result)
' // end main loop
' ////////////////////////////////////////////////////////////////////////
' // Propeller status LED commands book example on how to modify the driver
' // end added code for status LED control
REG_CMD_WRITE_BYTE:
' read command from byte registers of 32-bit buffer register
REG_CMD_READ_BYTE:
SYS_RESET:
STATUS_LED_ON:
STATUS_LED_OFF:
' end case commands
' byte address to write 0..3 is in g_data while data to write is in g_data2
g_reg_out_buffer.byte[ g_data ] := g_data2
' byte address to read 0..3 is in g_data
g_spi_result := g_reg_in_buffer.byte[ g_data ]
reboot
OUTA[25] := 1
OUTA[25] := 0
' resets the prop
100
' write byte 0..3 of output register g_reg_out_buffer.byte[
' read byte 0..3 of input register g_reg_in_buffer.byte[
' this data is then placed into spi buffer for transport back to client
// you need this one always
// you need this always
// needed for NTSC driver
© 2009 NURVE NETWORKS LLC “Exploring the Chameleon PIC 16-Bit”
0..3 ]
0..3
]
246

Related parts for Chameleon-PIC