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

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
Finally, all source files can be found on the DVD at location:
Of course, you should have already copied this to your hard drive into your project’s working directory. To save space, we
are not going to list the contents of each source file since that would take hundreds of pages; however, key elements will
be listed for reference. Nonetheless, you should have your editor pointed to the source directory, so you can review the
complete contents of each file as we discuss them.
17.1 System Library Module
The “System” library module consists of a single C source file and its header. The “System” modules must be included in
every Chameleon PIC program since its contains some top level #defines, types, and other pertinent elements that other
API modules depend on. In addition to the important #defines it also includes the function that configures the onboard PLL
allowing us to switch from an internal ~7MHz RC clock to a full 40 MHz clock rate. Additionally, the C source file contains
a few utility functions that will continue to grow in the future.
The “System” source files are named below:
You should include the .h file will all your applications and add the .C file to your source tree for all applications as well.
Next, we will take a look at some excerpts from the header file, review key elements, and any data structures that are of
interest.
17.1.1 Header File Contents Overview
The header files for many of the API modules are rather large and we won’t have time to list their contents out in their
entirety; however, the “System” header is quite manageable, so we are going to take a look inside. To begin with, the
header contains some useful macros:
// A couple simple delay routines
#define CYCLES_PER_SEC ((unsigned long)g_FCY)
// Instruction cycles per millisecond
#define CYCLES_PER_MS ((unsigned long)(g_FCY * 0.001))
// Instruction cycles per microsecond
#define CYCLES_PER_US ((unsigned long)(g_FCY * 0.000001))
//__delay32 is provided by the compiler, delay some # seconds
#define DELAY_SEC(sec)
//__delay32 is provided by the compiler, delay some # of milliseconds
#define DELAY_MS(ms)
// Delay some number of microseconds
#define DELAY_US(us)
// Delay some clocks, minimum is 12 clocks
#define DELAY_CLOCKS(clocks) __delay32(clocks)
// Cause a one cycle stall
#define NOP {__asm__ volatile ("nop");}
// Used to unlock the IO remapable pin ability
#define UNLOCK_IO_REMAP {__asm__ volatile ( "MOV #OSCCON, w1 \n" \
// Used to lock the IO remapable pin ability
#define LOCK_IO_REMAP {__asm__ volatile (
These macros are primarily used to delay the processor by either seconds, milliseconds, microseconds, or clock cycles.
Also there is a macro that is used to lock and unlock the IO remappable tables so that a user can configure which pins are
connected to what peripherals.
Next, are the #defines and one very important definition is the processor speed:
DVD-ROM:\ CHAM_PIC \ SOURCE \ *.*
CHAM_PIC_SYSTEM_V010.c -
CHAM_PIC_SYSTEM_V010.h -
__delay32(CYCLES_PER_MS * ((unsigned long) ms))
__delay32(CYCLES_PER_US * ((unsigned long) us))
__delay32(CYCLES_PER_SEC * ((unsigned long) sec))
"MOV #OSCCON, w1 \n" \
"MOV #0x46, w2 \n" \
"MOV #0x57, w3 \n" \
"MOV.b w2, [w1] \n" \
"MOV.b w3, [w1] \n" \
"BSET OSCCON, #6" ); }
"MOV #0x46, w2 \n" \
"MOV #0x57, w3 \n" \
"MOV.b w2, [w1] \n" \
"MOV.b w3, [w1] \n" \
"BCLR OSCCON,#6"); }
Main C file source for “System” module.
Header file for “System” module.
© 2009 NURVE NETWORKS LLC “Exploring the Chameleon PIC 16-Bit”
141

Related parts for Chameleon-PIC