Syntax and Functions

CCS C Compilers include Standard C Constructs, numerous Pre-Processor Functions, and hundreds of Built-In Functions. All practical ANSI C standard requirements are implemented. C syntax and special functions have a uniform syntax across all chip families, allowing for migration to a new chip trivial.

Data Types

  • int1
  • int8
  • int16
  • int32
  • int48*
  • int64*
  • float
  • float48*
  • float64*
  • short
  • char
  • int
  • long
  • double*
  • _fixed(n)
  • unsigned
  • signed
  • void
Items marked with * are for 24-bit parts only.

Standard C Syntax

  • if, else, while, do, switch, case, for, return, goto, break, continue
  • ! ~ ++ -- * = = , & |
  • * / % << >> ^ && || ?:
  • <= < > >= == !=
  • = += -= *= /= %= >>= <<= &= ^=m |=
  • typedef, static, auto, const, enum, struct, union
  • Arrays up to 5 subscripts
  • Structures and Unions may be nested
  • Custom bit fields (1-8 bits) within structures
  • Enumurated types
  • Constant variables, arrays, structures and strings
  • Full function parameter support (any number and kind)
  • C++ reference parameters and comments allowed

Pre-Processors

Built-In Libraries (+show)

#ocs
#use capture
#use delay
#use dynamic_memory
#use fast_io
#use fixed_io
#use i2c
#use profile
#use pwm
#use rs232
#use spi
#use standard_io
#use timer
#use touchpad

Compiler Control (+show)

#case
#ignore_warnings
#line
#module
#opt
#priority
#profile

Device Specification (+show)

#device
#fuses
#hexcomment
#id
#pin_select
#serialize
#todo

Linker (+show)

#build
#export
#import

Memory Control (+show)

#asm
#asm asis
#bank_dma
#bank1
#bankx
#banky
#bit
#byte
#endasm
#fill_rom
#locate
#org
#reserve
#rom
#type
#word
#zero_local_ram
#zero_ram

Pre-Defined Identifiers (+show)

_ _address_ _
_ _buildcount_ _
_ _date_ _
_ _device_ _
_ _file_ _
_ _filename_ _
_ _line_ _
_ _pcb_ _
_ _pcd_ _
_ _pch_ _
_ _pcm_ _
_ _time_ _

Function Qualifiers (+show)

_ _attribute_ _
#inline
#int_xxxx
#int_default
#int_global
#recursive
#separate
_ _unicode_ _

RTOS (+show)

#task
#use rtos

Standard C (+show)

#define
defined()
definedinc()
#elif
#else
#endif
#error
#if
#ifdef
#ifndef
#include
#list
#nolist
#pragma
#undef
#warning

Built-In Functions

Operation Amplifier

setup_opamp1( )
setup_opamp2( )
setup_opamp3( )
setup_opamp4( )

Programmable Gain Amplifier (PGA)

setup_pga( )

A/D Conversion (ADC)

adc_done( )
adc_done2( )
adc_read( )
adc_status( )
adc_write( )
get_adc_ports( )
high_speed_adc_done( )
read_adc( )
read_adc2( )
read_high_speed_adc( )
read_sd_adc( )
set_adc_channel( )
set_adc_channel2( )
set_adc_trigger( )
set_analog_pins( )
set_sd_adc_channel( )
set_dedicated_adc_channel( )
setup_adc( )
setup_adc2( )
setup_adc_ports( )
setup_adc_ports2( )
setup_adc_reference( )
setup_adc_reference2( )
setup_dedicated_adc( )
setup_high_speed_adc( )
setup_high_speed_adc_pair( )
setup_sd_adc( )
setup_sd_adc_calibration( )

Analog Comparator

setup_comparator( )
setup_comparator_dac( )
setup_comparator_filter( )
setup_comparator_mask( )
setup_comparator_slope( )
setup_comparator_x( )

D/A Conversion (DAC)

dac_write( )
setup_dac( )

Proportional Integral Derivative (PID)

pid_busy( )
pid_get_result( )
pid_read( )
pid_write( )
setup_pid( )

Quadrature Encoder Interface (QEI)

qei_get_capture( )
qei_get_count( )
qei_get_index_count( )
qei_get_interval_count( )
qei_get_velocity_count( )
qei_set_count( )
qei_set_index_count( )
qei_status( )
setup_qei( )

CAN Bus

can_abort( )
can_associate_filter_to_buffer( )
can_associate_filter_to_mask( )
can_config_DMA( )
can_disable_filter( )
can_disable_interrupts( )
can_disable_rtr( )
can_enable_b_receiver( )
can_enable_b_transfer( )
can_enable_filter( )
can_enable_interrupts( )
can_enable_rtr( )
can_fifo_getd( )
can_get_id( )
can_getd( )
can_init( )
can_kbhit( )
can_load_rtr( )
can_putd( )
can_set_baud( )
can_set_buffer_id( )
can_set_buffer_size( )
can_set_functional_mode( )
can_set_id( )
can_set_mode( )
can_tbe( )
can_trb0_putd( )

Single-Edge Nibble Transmission (SENT)

sent_getd( )
sent_putd( )
sent_status( )
setup_sent( )

Bit/Byte Manipulation

_mul( )
bit_clear( )
bit_first( )
bit_last( )
bit_set( )
bit_test( )
make16( )
make32( )
make8( )
rotate_left( )
rotate_right( )
shift_left( )
shift_right( )
swap( )

Cyclic Redundancy Check (CRC)

crc_calc( )
crc_calc8( )
crc_calc16( )
crc_calc32( )
crc_init( )
crc_read( )
crc_write( )
setup_crc( )

Data Converter Interface (DCI)

dci_data_received( )
dci_read( )
dci_start( )
dci_transmit_ready( )
dci_write( )
setup_dci( )

Data Signal Modulator (DSM)

setup_dsm( )

Environment

getenv( )

Input Capture / Output Capture

get_capture( )
setup_capture( )
setup_compare( )

General Purpose I/O

get_tris_x( )
input( )
input_change_x( )
input_state( )
input_x( )
output_bit( )
output_drive( )
output_float( )
output_high( )
output_low( )
output_toggle( )
output_x( )
port_a_current_source( )
port_x_pullups( )
set_input_level_x( )
set_open_drain_x( )
set_pulldown( )
set_pullup( )
set_slow_slew_x( )
set_tris_x( )

I2C I/O

i2c_init( )
i2c_isr_state( )
i2c_poll( )
i2c_read( )
i2c_slaveaddr( )
i2c_speed( )
i2c_start( )
i2c_stop( )
i2c_transfer( )
i2c_transfer_in( )
i2c_transfer_out( )
i2c_write( )

Peripheral Pin Select (PPS)

pin_select( )

RS232 I/O

assert( )
fgetc( )
fgets( )
fprintf( )
fputc( )
fputc_send( )
fputs( )
fscanf( )
getc( )
getch( )
getchar( )
gets( )
kbhit( )
perror( )
printf( )
putc( )
putc_send( )
putchar( )
puts( )
rcv_buffer_bytes( )
rcv_buffer_full( )
scanf( )
set_uart_speed( )
setup_uart( )
tx_buffer_available( )
tx_buffer_bytes( )
tx_buffer_full( )

SPI Two Wire I/O

setup_spi( )
setup_spi2( )
setup_spi3( )
setup_spi4( )
spi_data_is_in( )
spi_data_is_in2( )
spi_data_is_in3( )
spi_data_is_in4( )
spi_init( )
spi_prewrite( )
spi_read( )
spi_read_16( )
spi_read_32( )
spi_read2( )
spi_read2_16( )
spi_read2_32( )
spi_read3( )
spi_read3_16( )
spi_read3_32( )
spi_read4( )
spi_read4_16( )
spi_read4_32( )
spi_set_txcnt( )
spi_speed( )
spi_transfer_write( )
spi_write( )
spi_write2( )
spi_write3( )
spi_write4( )
spi_xfer( )
spi_xfer_in( )

Master Program Memory

load_slave_program( )
verify_slave_program( )

Master Slave Interface (MSI)

msi_fifo_status( )
msi_mailbox_status( )
msi_read_fifo( )
msi_read_mailbox( )
msi_status( )
msi_write_fifo( )
msi_write_mailbox( )
setup_msi( )

Parallel Ports (PMP, PSP)

pmp_address( )
pmp_error
psp_error( )
pmp_input_full( )
psp_input_full( )
pmp_output_full( )
psp_output_full( )
pmp_overflow( )
psp_overflow( )
pmp_read( )
psp_read( )
pmp_timeout( )
psp_timeout( )
pmp_write( )
psp_write( )
setup_pmp( )
setup_psp( )

Configuration Memory

read_config_info( )
read_configuration_memory( )
read_device_info( )
write_configuration_memory( )

Direct Memory Access (DMA)

dma_start( )
dma_status( )
setup_dma( )

External Memory

read_external_memory( )
setup_external_memory( )
write_external_memory( )

RAM / Extended RAM

read_bank( )
read_extended_ram( )
write_extended_ram( )
write_bank( )

ROM / Data EEPROM / Program EEPROM

erase_eeprom( )
erase_program_eeprom( )
erase_program_memory( )
goto_address( )
label_address( )
read_calibration( )
read_calibration_memory( )
read_eeprom( )
read_program_eeprom( )
read_program_memory( )
read_program_memory8( )
read_rom_memory( )
write_eeprom( )
write_program_eeprom( )
write_program_memory( )
write_program_memory8( )

Real Time Operating System (RTOS)

rtos_await( )
rtos_disable( )
rtos_enable( )
rtos_msg_poll( )
rtos_msg_read( )
rtos_msg_send( )
rtos_overrun( )
rtos_run( )
rtos_signal( )
rtos_stats( )
rtos_terminate( )
rtos_wait( )
rtos_yield( )

Code Profile

profileout( )

Internal Oscillator

setup_oscillator( )

Numerically Controlled Oscillator (NCO)

get_nco_accumulator( )
get_nco_inc_value( )
set_nco_accumulator( )
set_nco_inc_value( )
setup_nco( )

Configurable Logic Cell (CLC)

clc1_setup_gate( )
clc2_setup_gate( )
clc3_setup_gate( )
clc4_setup_gate( )
clc1_setup_input( )
clc2_setup_input( )
clc3_setup_input( )
clc4_setup_input( )
setup_clc1( )
setup_clc2( )
setup_clc3( )
setup_clc4( )

Programmable Ramp Generator (PRG)

prgx_status( )
setup_prgx( )

Reset

reset_cpu( )
restart_cause( )

Capture / Compare / PWM (CCP)

clear_pwm1_interrupt( )
clear_pwm2_interrupt( )
clear_pwm3_interrupt( )
clear_pwm4_interrupt( )
clear_pwm5_interrupt( )
clear_pwm6_interrupt( )
disable_pwm1_interrupt( )
disable_pwm2_interrupt( )
disable_pwm3_interrupt( )
disable_pwm4_interrupt( )
disable_pwm5_interrupt( )
disable_pwm6_interrupt( )
enable_pwm1_interrupt( )
enable_pwm2_interrupt( )
enable_pwm3_interrupt( )
enable_pwm4_interrupt( )
enable_pwm5_interrupt( )
enable_pwm6_interrupt( )
get_capture_ccp1( )
get_capture_ccp2( )
get_capture_ccp3( )
get_capture_ccp4( )
get_capture_ccp5( )
get_capture32( )
get_capture32_ccp1( )
get_capture32_ccp2( )
get_capture32_ccp3( )
get_capture32_ccp4( )
get_capture32_ccp5( )
get_capture_event( )
get_capture_time( )
get_timer_ccp1( )
get_timer_ccp2( )
get_timer_ccp3( )
get_timer_ccp4( )
get_timer_ccp5( )
pwm_off( )
pwm_set_duty( )
pwm_set_duty_percent( )
pwm_set_frequency( )
pwm1_interrupt_active( )
pwm2_interrupt_active( )
pwm3_interrupt_active( )
pwm4_interrupt_active( )
pwm5_interrupt_active( )
pwm6_interrupt_active( )
set_ccp1_compare_time( )
set_ccp2_compare_time( )
set_ccp3_compare_time( )
set_ccp4_compare_time( )
set_ccp5_compare_time( )
set_compare_time( )
set_pwm1_duty( )
set_pwm2_duty( )
set_pwm3_duty( )
set_pwm4_duty( )
set_pwm5_duty( )
set_pwm_duty( )
set_pwm1_offset( )
set_pwm2_offset( )
set_pwm3_offset( )
set_pwm4_offset( )
set_pwm5_offset( )
set_pwm6_offset( )
set_pwm1_period( )
set_pwm2_period( )
set_pwm3_period( )
set_pwm4_period( )
set_pwm5_period( )
set_pwm6_period( )
set_pwmx_phase( )
set_timer_ccp1( )
set_timer_ccp2( )
set_timer_ccp3( )
set_timer_ccp4( )
set_timer_ccp5( )
set_timer_ccp6( )
set_timer_period_ccp1( )
set_timer_period_ccp2( )
set_timer_period_ccp3( )
set_timer_period_ccp4( )
set_timer_period_ccp5( )
set_timer_period_ccp6( )
setup_compare( )
setup_pwm1( )
setup_pwm2( )
setup_pwm3( )
setup_pwm4( )
setup_ccp1( )
setup_ccp2( )
setup_ccp3( )
setup_ccp4( )
setup_ccp5( )
setup_ccp6( )

Complementary Output Generator (COG)

cog_restart( )
cog2_restart( )
cog3_restart( )
cog4_restart( )
cog_status( )
cog2_status( )
cog3_status( )
cog4_status( )
set_cog_blanking( )
set_cog2_blanking( )
set_cog3_blanking( )
set_cog4_blanking( )
set_cog_dead_band( )
set_cog2_dead_band( )
set_cog3_dead_band( )
set_cog4_dead_band( )
set_cog_phase( )
set_cog2_phase( )
set_cog3_phase( )
set_cog4_phase( )
setup_cog( )
setup_cog2( )

Complementary Waveform Generator (CWG)

cwg_restart( )
cwg2_restart( )
cwg3_restart( )
cwg_status( )
cwg2_status( )
cwg3_status( )
setup_cwg( )
setup_cwg2( )
setup_cwg3( )

High Speed PWM

get_hspwm_capture( )
get_hspwm_feedback( )
get_hspwm_status( )
hspwm_do_capture( )
hspwm_stop_pwm( )
hspwm_trigger_pwm( )
hspwm_update( )
set_hspwm_duty( )
set_hspwm_duty_adjustment( )
set_hspwm_event( )
set_hspwm_override( )
set_hspwm_period( )
set_hspwm_phase( )
set_hspwm_scaling( )
set_hspwm_secondary_event( )
set_hspwm_trigger_x( )
setup_hspwm( )
setup_hspwm_blanking( )
setup_hspwm_chop_clock( )
setup_hspwm_current_limit( )
setup_hspwm_event( )
setup_hspwm_fault( )
setup_hspwm_feed_forward( )
setup_hspwm_logic_x( )
setup_hspwm_secondary( )
setup_hspwm_sync( )
setup_hspwm_trigger( )
setup_hspwm_unit( )
setup_hspwm_unit_chop_clock( )

Motor PWM

get_motor_pwm_count( )
get_motor_pwm_event( )
set_motor_pwm_duty( )
set_motor_pwm_event( )
set_motor_unit( )
setup_motor_pwm( )

Power PWM

set_power_pwm_override( )
set_power_pwmx_duty( )
setup_power_pwm( )
setup_power_pwm_faults( )
setup_power_pwm_pins( )

Programmable Switch Mode Controller (PSMC)

psmc_blanking( )
psmc_deadband( )
psmc_duty( )
psmc_freq_adjust( )
psmc_modulation( )
psmc_pins( )
psmc_shutdown( )
psmc_sync( )
setup_psmc( )

Standard C Char / String

atof( )
atoi( )
atol( )
atol32( )
isalnum( )
isalpha( )
isamong( )
iscntrl( )
isdigit( )
isgraph( )
islower( )
isprint( )
ispunct( )
isspace( )
isupper( )
isxdigit( )
itoa( )
sprintf( )
strcat( )
strchr( )
strcmp( )
strcoll( )
strcopy( )
strcpy( )
strcspn( )
strerror( )
stricmp( )
strlen( )
strlwr( )
strncat( )
strncmp( )
strncpy( )
strpbrk( )
strrchr( )
strspn( )
strstr( )
strtod( )
strtof( )
strtof48( )
strtok( )
strtol( )
strtoul( )
strxfrm( )
tolower( )
toupper( )

Standard C Math

abs( )
acos( )
asin( )
atan( )
atan2( )
atoe( )
atof( )
atof48( )
atof64( )
atoi( )
atoi32( )
atoi48( )
atoi64( )
atol( )
atol32( )
ceil( )
cos( )
cosh( )
div( )
exp( )
fabs( )
floor( )
fmod( )
frexp( )
labs( )
ldexp( )
ldiv( )
log( )
log10( )
modf( )
pow( )
pwr( )
sin( )
sinh( )
sqrt( )
tan( )
tanh( )

Standard C Memory

calloc( )
free( )
longjmp( )
malloc( )
memchr( )
memcmp( )
memcpy( )
memmove( )
memset( )
offsetof( )
offsetofbit( )
realloc( )
setjmp( )

Standard C Special

bsearch( )
mblen( )
mbstowcs( )
mbtowc( )
nargs( )
qsort( )
rand( )
srand( )
va_arg( )
va_end( )
va_start( )
wcstombs( )
wctomb( )

Active Clock Tuning (ACT)

act_status( )
setup_act( )

Angular Timer (AT)

at_clear_interrupts( )
at_disable_interrupts( )
at_enable_interrupts( )
at_get_capture( )
at_get_missing_pulse_delay( )
at_get_period( )
at_get_phase_counter( )
at_get_resolution( )
at_get_set_point( )
at_get_set_point_error( )
at_get_status( )
at_interrupt_active( )
at_set_compare_time( )
at_set_missing_pulse_delay( )
at_set_resolution( )
at_set_set_point( )
at_setup_cc( )
setup_at( )

Deadman Timer (DMT)

clear_dmt( )
disable_dmt( )
dmt_status( )
enable_dmt( )
read_dmt( )
setup_dmt( )

Delays

delay_cycles( )
delay_ms( )
delay_us( )
pll_locked( )

Interrupts

clear_interrupt( )
disable_interrupts( )
enable_interrupts( )
ext_int_edge( )
interrupt_active( )
interrupt_enabled( )
jump_to_isr( )

Real Time Clock and Calendar (RTC, RTCC)

get_rtcc( )
rtc_alarm_read( )
rtc_alarm_write( )
rtc_read( )
rtc_status( )
rtc_tsx_read( )
rtc_write( )
set_rtcc( )
setup_counters( )
setup_rtc( )
setup_rtc_alarm( )

Signal Measurement Timer (SMT)

setup_smtx( )
smtx_read( )
smtx_reset_timer( )
smtx_start( )
smtx_status( )
smtx_stop( )
smtx_write( )
smtx_update( )

Sleep

sleep( )
sleep_ulpwu( )

Timers

get_rtcc( )
get_ticks( )
get_timerA( )
get_timerB( )
get_timerx( )
get_timerxy( )
set_rtcc( )
set_ticks( )
set_timerA( )
set_timerB( )
set_timerx( )
set_timerxy( )
setup_counters( )
setup_timer_0( )
setup_timer_1( )
setup_timer_2( )
setup_timer_3( )
setup_timer_4( )
setup_timer_5( )
setup_timer_A( )
setup_timer_B( )
setup_timerx( )

Watch Dog Timer (WDT)

get_wdt( )
release_io( )
restart_wdt( )
setup_counters( )
setup_wdt( )

Capacitive Touch Pad

touchpad_getc( )
touchpad_hit( )
touchpad_state( )

Internal LCD

lcd_contrast( )
lcd_load( )
lcd_symbol( )
setup_lcd( )

USB

usb_attach( )
usb_attached( )
usb_cdc_getc( )
usb_cdc_kbhit( )
usb_cdc_putc( )
usb_cdc_putc_fast( )
usb_cdc_putready( )
usb_cdc_puts( )
usb_detach( )
usb_enumerated( )
usb_get_packet( )
usb_gets( )
usb_init( )
usb_init_cs( )
usb_kbhit( )
usb_put_packet( )
usb_puts( )
usb_task( )

Brownout

brownout_enable( )
restart_cause( )

Constant Current Source

setup_current_source( )

Voltage Reference / Comparator

setup_comparator( )
setup_low_volt_detect( )
setup_vref( )
setup_vref2( )

Zero-Cross Detection (ZCD)

setup_zcd( )
zcd_status( )


C-Aware IDE Demo
Embedded C Learners Kit
EZ App Lynx