
PIC C Compiler
This C compiler, is fully optimised
for use with PIC microcontrollers.
Built in functions make coding the
software very easy. Based on
original K&R, the integrated C
development environment gives
developers a fast method to
produce efficient code from an
easily maintainable high level
language.
CAPABILITIES
• Arrays up to 5 subscripts
• Structures and Unions may be nested.
• Custom bit fields (1-8 bits) within structures.
• ENUMurated types,
• CONSTant variables, arrays and strings.
• Full function parameter support (any number).
• Some support for C++ reference parameters.
• Built in Libraries for RS232 serial I/O library, I/O, I2C, discrete I/Oand precision delays.
• Integrates with MPLAB and other simulators/emulators for source level debugging.
• Standard Hex file and debug files ensure compatibility with all programmers.
• Formatted Printf allows easy formatting and display in Hex or decimal.
• Efficient function implementation allows call trees deeper than the hardware stack.
• Access to hardware from easy to use C functions, Timers, A/D, E2, SSP, PSP, I2C & more.
• 1,8, and 16 bit types.
• Assembly code may be inserted anywhere in source and may reference C variables.
• Automatic linking handles multiple code pages.
• Inline procedures supported; Linker automatically determines optimum architecture or it can be
manually specified.
• Compiler directives determine if tri-state registers are refreshed on every I/O
• Constants (including strings and arrays) are saved in program memory.
• Standard one bit type (Short Int) permits the compiler to generate efficient Bit oriented code.
• #BIT and #BYTE allow C variables to be placed at absolute addresses to map register to C
variables.
• Reference parameters may be used to improve code readability and inline procedure efficiency.
• Both an Integrated editor/compiler and a cmd line compiler.
• Special windows show the RAM memory map, C/Assembly listing and the calling tree.
• Interrupt procedures supported on PCM. The compiler generates all startup and cleanup code as
well as identifying the correct interrupt procedure to be called.
• Updates via modem for 30 days included.
STANDARD C FUNCTIONS:
• IF, ELSE, WHILE, DO, SWITCH, CASE, FOR,
RETURN, GOTO, BREAK, CONTINUE
• !, ~, ++, --, *, /, %, +, -, <<, >>, <. <=, >, >=,
==, !=, &, ^, |, &&, ||, ?:, =, +=, -=, *=, /=, %=,
>>=, <<=, &=, ^=, |=
• TYPEDEF, STATIC, AUTO, CONST, ENUM,
STRUCT, UNION
©1999 RF Solutions Ltd, ENGLAND. Tel +44 (0) 1273 898 000. Fax +44 (0) 1273 480661.
DS000049 V2.0 All Trademarks acknowledged and remain the property of the respective owners. Page 1

PIC C Compiler
Description
This integrated C development environment gives developers the capability to quickly produce very efficient
code from an easily maintainable high level language. The compiler includes built in functions to access the
PIC hardware such as READ_ADC to read a value from the A/D converter. Discrete I/O is handled by
describing the port characteristics in a PRAGMA. Functions such as INPUT and OUTPUT_HIGH will properly
maintain the tri-state registers. Variables including structures may be directly mapped to memory such as
I/O ports to best represent the hardware structure in C. The microcontroller clock speed may be specified in
a PRAGMA to permit built in functions to delay for a given number of microseconds or milliseconds.
Serial I/O functions allow standard functions such as GETC and PRINTF to be used for RS-232 like I/O. The
hardware serial transceiver is used for applicable parts when possible. For all other cases a software serial
transceiver is generated by the compiler. The standard C operators and the special built in functions are
optimised to produce very efficient code for the bit and I/O functions. Functions may be implemented inline or
separate. Function parameters are passed in reusable registers.
Inline functions with reference parameters are implemented efficiently with no memory overhead. During the
linking process the program structure including the call tree is analysed. Functions that call one another
frequently are grouped together in the same page. Calls across pages are handled automatically by the tool
transparent to the user. Functions may be implemented inline or separate. RAM is allocated efficiently by
using the call tree to determine how locations can be re-used. Constant strings and tables are saved in the
device ROM. The output hex and debug files are selectable and compatible with popular emulators &
programmers including MPLAB for source level debugging. The Professional Package (PCW) provides both
compilers in a powerful Windows environment.
Feature CCS-PCB CCS-PCM CCS-PCW
12 bit PICs (PIC12C50X & 16C5X) X X
14 bit PICs (PIC16c61 - 84) X X
Built in Functions X X X
Example Programs X X X
Device Drivers X X X
Extra Optimization X
MPLAB Interface X X X
Professional Editor X
Device Editor X
Hex Dissassembler X
New Project Starter X
Call Tree Window X X X
Statistics Window X
Part Numbering and Pricing
Description Part No Price
PCB Compiler for PIC16C52-58 CCS-PCB £99.00
PCM Compiler for PIC16C61-84 CCS-PCM £99.00
PCW Professional Package (Windows IDE with PCB & PCM) CCS-PCW £299.00
Maintenance 30 day update rights Included
PCB or PCM Maintenance £66.00
PCW Maintenance £135.00
Monthly Email updates £15.00
©1999 RF Solutions Ltd, ENGLAND. Tel +44 (0) 1273 898 000. Fax +44 (0) 1273 480661.
DS000049 V2.0 All Trademarks acknowledged and remain the property of the respective owners. Page 2

PIC C Compiler
Built In Functions
DELAYS STR COMPILER CONTROL
DELAY_US CHAR STRCAT #CASE
DELAY_MS CHAR STRCHR #PRIORITY
DELAY_CYCLES CHAR STRRCHR #OPT
RS232 I/O INT STRCMP PRE_DEFINED IDENTIFIER
GETCH INT STRNCMP __PCB__
PUTCHAR INT STRICMP __PCM__
KBHIT CHAR * STRNCPY __DEVICE__
ETS INT STRCSPN __DATE__
PUTS INT STRSPN
PRINTF INT STRLEN TIMERS /COUNTERS
GETCHAR CHAR *STRLWR SETUP_COUNTERS GET_RTCC
PUTC CHAR * STRPBRK GET_TIMER0
I2C I/O CHAR *STRSTR GET_TIMER1
I2C_START CHAR STRTOK GET_TIMER2
I2C_STOP STANDARD C SET_RTCC
I2C_WRITE #PRAGMA SET_TIMER0
I2C_READ #DEFINE SET_TIMER1
I2C_POLL #UNDEF SET_TIMER2
DISCRETE I/O #INCLUDE SETUP_TIMER1
OUTPUT_HIGH #IF SETUP_TIMER2
OUTPUT_FLOAT #IFDEF RESTART_WDT
OUTPUT_BIT #IFNDEF CCP
INPUT #ELSE SETUP_CCP1
SET_UART_SPEED #ENDIF SETUP_CCP2
SET_TRIS_x #ERROR SETUP_PWM_DUTY
OUTPUT_LOW #NOLIST SETUP_COMPARATOR
PORT_B_PULLUPS #LIST VREF
BIT MANIPULATIONS DEVICE SPECIFICATION SETUP_VREF
SHIFT_LEFT #DEVICE INTERNAL EEPROM
SHIFT_RIGHT #FUSES READ_EEPROM
ROTATE_LEFT #ID WRITE_EEPROM
ROTATE_RIGHT FUNCTION QUALIFIER A/D INPUT
BIT_SET #INLINE SETUP_PORT_A
BIT_CLEAR BIT_TEST #SEPARATE SETUP_ADC
SWAP #INT_xxxx SET_ADC_CHANNEL
STANDARD C INT_GLOBAL READ_ADC
MEMCPY INT_DEFAULT PROCESSOR CONTROL
MEMSET BUILT-IN LIBRARIES ENABLE_INTERRUPTS
STRCPY #USE DISABLE_INTERRUPS
ISALNUM #USE STANDARD_IO EXT_INT_EDGE
ISALPHA #USE FAST_IO PSP PARALLEL I/O
ISDIGIT #USE FIXED_IO PSP_OUTPUT_FULL
ISLOWER #USE DELAY PSP_INPUT_FULL
ISUPPER #USE RS232 PSP_OVERFLOW
ISSPACE #USE I2C SETUP_PSP
ISXDIGIT MEMORY CONTROL SPI 2 WIRE I/O
TOUPPER #BIT SETUP_SPI
TOLOWER #BYTE SPI_DATA_IS_IN
READ_BANK #ASM SPI_WRITE
WRITE_BANK #ENDASM SPI_READ
92xx LCD #ROM PROCESSOR CONTROL
SETUP_LCD #ZERO_RAM SLEEP
LCD_LOAD #RESERVE RESTART_CAUSE
©1999 RF Solutions Ltd, ENGLAND. Tel +44 (0) 1273 898 000. Fax +44 (0) 1273 480661.
DS000049 V2.0 All Trademarks acknowledged and remain the property of the respective owners. Page 3

Example Program
PIC C Compiler
//////////////////////////////////////////////////////////////////////////////////
/
//// EX_STEP.C ////
////
////
//// This program interfaces to a stepper motor. ////
//// The program will use the RS-232 interface to ////
//// either control the motor with an analog ////
//// input, a switch input or by RS-232 command. ////
//////////////////////////////////////////////////////////////////////////////////
/
#include <16C71.H>
#use Delay(Clock=20000000)
#use RS232(Baud=9600,Xmit=PIN_A3,Rcv=PIN_A2)
#byte port_b = 6
#define FOUR_PHASE TRUE
#ifdef FOUR_PHASE
byte const POSITIONS[4] = {0b0101,
0b1001,
0b1010,
0b0110};
#else
byte const POSITIONS[8] = {0b0101,
0b0001,
0b1001,
0b1000,
0b1010,
0b0010,
0b0110,
0b0100};
#endif
drive_stepper(byte speed, char dir, byte steps) {
static byte stepper_state = 0;
byte i;
delay_ms(100);
use_switch(byte speed, char dir) {
byte steps;
printf("\n\rSteps per press: ");
steps = gethex();
while(true) {
while(input(pin_13)) ;
drive_stepper(speed,dir,steps);
while(!input(pin_13)) ;main() {
byte speed,steps;
char dir;
setup_port_a(RA0_RA1_ANALOG);
while (TRUE) {
printf("\n\rSpeed (hex): ");
speed = gethex();
if(speed==0)
use_pot();
printf("\n\rDirection (F,R): ");
dir=getc()|0x20;
printf("\n\rSteps (hex): ");
steps = gethex();
if(steps==0)
use_switch(speed,dir);
drive_stepper(speed,dir,steps);
}
for(i=0;i0x80)
drive_stepper(128-(value-128),'F',8);
RF Solutions Ltd,
Unit 21, Cliffe Industrial Estate,
Lewes,
E. Sussex. BN8 6JL, England
Email : sales@rfsolutions.co.uk
Web Page : http://www.rfsolutions.co.uk
Tel: +44 (0)1273 898 000 Fax: +44 (0)1273 480 661
Information contained in this document is believed to be accurate , however no representation or warranty is given and no liability is assumed by R.F. Solutions Ltd. with respect to the accuracy of
such information. Use of R.F.Solutions as critical components in life support systems is not authorised except with express written approval from R.F.Solutions Ltd.
©1999 RF Solutions Ltd, ENGLAND. Tel +44 (0) 1273 898 000. Fax +44 (0) 1273 480661.
DS000049 V2.0 All Trademarks acknowledged and remain the property of the respective owners. Page 4
}