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

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
26.0 Propeller Local I/O Port Module Primer
The Propeller chip on the Chameleon is more or less “peripherless” if that’s a word? In other words, if you want serial,
SPI, A/D, D/A, etc. you use a core and write one yourself using software. Thus, the philosophy of the Propeller chip is a lot
of I/O pins and a lot of processors, what you do with them is up to you. The Chameleon uses most of the I/O pins for the
video, audio, VGA, and PS/2 port, but we were able to tuck 8 I/O pins away and export them out to what is called the
“Propeller Local Port”. With this you can hook up devices that are designed to interface to the Propeller, us it for switches,
a D/A, A/D, even another video or VGA port! That said, what I decided to do was write a very rudimentary interface to it,
so you can control the direction of each port bit (input or output) and then write/read data to and from the port from the
PIC. So, if you run out of digital I/Os on the PIC headers you can use the Propeller port, or if you just want to connect
something to the Propeller that takes 8 or less I/O pins that someone has developed a Propeller object for. Either way, in
this section, we will see the API for the Propeller Local Port.
One detail before we begin, the Propeller Port does NOT have a driver object running on another core. It’s so simple that
we wrote the code right into the master control dispatch program object. There is a complete listing of the code below
excerpted from CHAM_DEFAULT2_DRV_112.spin.
' // Propeller local port specific commands ///////////////////////////////////////////////////////////////////
' these are handled locally in SPIN on the interface driver's COG
As you can see, there are 3 commands; set direction, read, and write. These are directly interfaced to SPIN native
functions and port I/O control. The PIC side API is nothing more than 3 commands to set the direction, read, and write.
The name of the API file is:
CHAM_PIC_PROP_PORT_DRV_V010.c – Contains the API functions for the Propeller local port functionality.
And once again, this functionality is available in all versions of the main Propeller driver Default1 and 2.
26.1 Header File Contents Overview
The “Propeller Local Port” module header CHAM_PIC_PROP_PORT_DRV_V010.h has nothing in it, but the prototypes
for the API functions, so nothing to show you there.
26.2 API Listing Reference
The API listing for the “Propeller Local Port” module CHAM_PIC_PROP_PORT_DRV_V010.c is listed in Table 26.1
categorized by functionality.
Function Name
int PropPort_SetDir(int dirbits);
int PropPort_Read(void);
int PropPort_Write(int data8);
Note: When reading or writing, I/O pins that aren’t set the proper direction will have invalid data on them, thus if you have
set the lower 4-bits as inputs and read the port, only count on the lower 4-bits having valid data. Similarly when writing
data, only pins that are outputs will drive current. They only will sink it as inputs. Thus, any data written to them is ignored
(as is should be).
PORT_CMD_SETDIR:
PORT_CMD_READ:
PORT_CMD_WRITE:
DIRA[7..0] := g_data
g_spi_result := (INA[7..0] & $FF) ' data is now in g_spi_result,
OUTA[7..0] := g_data
Table 26.1 – “Propeller Local Port” module API functions listing.
' sets the 8-bit I/O pin directions for the port 1=output, 0=input
' reads the 8-bit port pins, outputs are don't cares
' writes the 8-bit port pins, port pins set to input ignore data
‘ client must perform a general READ_CMD to get it back
Description
Sets the port bit direction bits individually.
Read the port input buffer.
Writes to the port output buffer.
© 2009 NURVE NETWORKS LLC “Exploring the Chameleon PIC 16-Bit”
204

Related parts for Chameleon-PIC