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

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
33.1.1 Adding SPIN Driver Support for the Status LED
As we designed the Chameleon we added a status LED to it. The idea of this LED was for the Propeller to use it to
indicate status, state, etc. For example, when the Propeller boots our driver it blinks 3 times to indicate that everything is
good to go, and then the driver is ready to receive messages from the client/master. However, after that we were all done
designing everything and the drivers were written. We left out messages to control the LED from the client/master, but I
thought, hmmm, I will hold off on this and later us it as the perfect example of adding some messages to do something
useful.
Thus, this example was born of that motivation. With that in mind, this is a good exercise since at first you will want to
make small changes to the master driver, but not re-write it. Anyway, so the first thing you need to do is decide what new
functionality you need. In this case, all I needed was to control the LED, turn it on and off. So, the first thing you need to
do is copy the Propeller driver and re-name it something else. In this case, I made a copy of:
and renamed it to:
This way if I mess something up, I can go back to my original. Then I reviewed the messages at the top of the code and
found where new messages can go and added two new commands 100 and 101, here’s a snippet of what the constants
looked like before and after:
Before
.
.
.
.
.
.
REG_CMD_WRITE
REG_CMD_READ
REG_CMD_WRITE_BYTE
REG_CMD_READ_BYTE
' system commands
SYS_RESET
' ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
' this range of commands for future expansion...
' ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
' advanced GFX commands for GFX tile engine
GPU_GFX_BASE_ID
GPU_GFX_NUM_COMMANDS
GPU_GFX_SUBFUNC_STATUS_R = (0+GPU_GFX_BASE_ID) ' Reads the status of the GPU, Writes the GPU Sub-Function register and issues
GPU_GFX_SUBFUNC_STATUS_W = (1+GPU_GFX_BASE_ID) ' Writes status of the GPU, Writes the GPU Sub-Function register and issues
the messages to the .H file as well as the SPIN file. In addition to this you need to add more cases to process and
dispatch the messages in the SPIN driver and then on the PIC C side you might want to add more API functions.
Class 2: (New object new functionality). The second case is when you want to add a completely new driver object
and run it on another processor on the Propeller. In this case, you will load the object in at the top of the main
driver, start it up, and then add messages along with message handlers to the main message dispatcher loop.
This is the most complex case.
Class 3: (Simple messages that can be processed in place). Finally, the last case is the easiest and the one we
will illustrate. This is the case, where we want to add some functionality to the main Propeller driver, but we can
run that functionality right on the main processor that is running the message loop. Examples of this are the
Propeller local port driver. For messages run right on the main SPIN interpreter, there is no need to add another
processor.
cham_default2_drv_112.spin
cham_default2_drv_112_modified.spin
= 56 ' performs a 32-bit write to the addressed register [0..F] from the output register buffer
= 57 ' performs a 32-bit read from the addressed register [0..F] and stores in the input register buffer
= 58 ' write byte 0..3 of output register g_reg_out_buffer.byte[
= 59 ' read byte 0..3 of input register g_reg_in_buffer.byte[
= 64 ' resets the prop
= 192
= 37
' starting id for GFX commands to keep them away from normal command set
' number of GFX commands
'
' a high level command like copy, fill, etc.
a high level command like copy, fill, etc.
© 2009 NURVE NETWORKS LLC “Exploring the Chameleon PIC 16-Bit”
0..3 ]
0..3
]
244

Related parts for Chameleon-PIC