COMPILADOR C DE CCS - PowerPoint PPT Presentation

About This Presentation
Title:

COMPILADOR C DE CCS

Description:

chip is the name of a specific processor (like: PIC16C74) ... Used to provide a simple string replacement of the ID with the given text from ... – PowerPoint PPT presentation

Number of Views:126
Avg rating:3.0/5.0
Slides: 20
Provided by: Iaki
Category:
Tags: ccs | compilador | define

less

Transcript and Presenter's Notes

Title: COMPILADOR C DE CCS


1
COMPILADOR C DE CCS
  • PRINCIPALES FUNCIONES Y DIRECTIVAS

2
DIRECTIVAS DE PREPROCESADO
3
DEVICE
  • Syntax device chip options
  • chip is the name of a specific processor (like
    PIC16C74),
  • Options are qualifiers to the standard operation
    of the device.
  • Example
  • device PIC16F877

4
INCLUDE
  • Syntax
  • include ltfilenamegt
  • include "filename
  • Ejemplos
  • include lt16f877.hgt
  • include lcd.h

5
DEFINE
  • Syntax define id text
  • Used to provide a simple string replacement of
    the ID with the given text from this point of the
    program and on.
  • Examples
  • define verdadero 1
  • define falso 0

6
USE _I/O
  • Afectan a como utilizamos los TRISX
  • Syntax
  • use fast_io (port)
  • use fixed_io (port_outputspin, pin?)
  • USE STANDARD_IO (port)
  • Ejemplo
  • use fast_io (A)

7
USE DELAY
  • Syntax use delay (clockspeed(Hz))
  • Tells the compiler the speed of the processor and
    enables the use of the built-in functions
    delay_ms() and delay_us().
  • Ejemplo
  • use delay (clock20000000)

8
BYTE
  • Syntax byte id x
  • Elements id is a valid C identifier, x is a C
    variable or a constant
  • Coloca la variable id en la posicion de memoria
    x.
  • Ejemplo
  • byte portb5

9
INT_xxx
  • Indica que la funcion a continuacion es la rutina
    de atencion de una determinada interrupción
  • INT_EXT External interrupt
  • INT_RTCC Timer 0 (RTCC) overflow
  • INT_TIMER1 Timer 1 overflow

10
FUNCIONES ESPECIFICAS DEL COMPILADOR
  • RS232 I/O
  • I2C I/O
  • Discrete I/O
  • SPI two wire I/O
  • Parallel Slave I/O
  • Delays
  • Processor Controls
  • Bit/Byte
  • Capt/Comp/PWM
  • Timers
  • A/D Conversion
  • EEPROM
  • C Math
  • Etc.

11
DELAYS
  • delay_ms(tiempo)
  • delay_us(tiempo)
  • delay_cycles(ciclos) (0-255)
  • 1 ciclo 4 ciclos de reloj

12
INPUT( )
  • Syntax value input (pin)
  • Returns
  • 0 (or FALSE) if the pin is low,
  • 1 (or TRUE) if the pin is high
  • Ejemplo
  • Encendidoinput(PIN_A4)

13
INPUT_x()
  • Syntax
  • value input_a()
  • value input_b()
  • value input_c()
  • ...
  • Returns An 8 bit int representing the port input
    data.

14
OUTPUT_X()
  • Syntax
  • output_a (value)
  • output_b (value)
  • ...
  • Parameters value is an 8 bit int
  • Function Output an entire byte to a port.

15
OUTPUT_BIT( )
  • Syntax output_bit (pin, value)
  • Function Outputs the specified value (0 or 1) to
    the specified I/O pin.
  • Ejemplos
  • Output_bit (PIN_D1,0)
  • Output_bit(PIN_A3,1)

16
OUTPUT_xxxx()
  • OUTPUT_HIGH( )
  • Syntax output_high (pin)
  • Function Sets a given pin to the high state.
  • OUTPUT_LOW( )
  • Syntax output_low (pin)
  • Function Sets a given pin to the ground state.

17
SET_TRIS_X()
  • Configura los registros de direccionamiento de
    los puertos (TRIS)
  • 0 significa salida
  • 1 significa entrada
  • Ejemplo
  • Set_tris_a(0b00001011)

18
ENABLE/DISABLE INTERRUPTS
  • Permiten o inhiben las interrupciones.
  • Ejemplos
  • enable_interrupts(GLOBAL)
  • disable_interrupts(INT_TIMER0)
  • enable_interrupts(INT_TIMER1)

19
OTRAS FUNCIONES
  • setup_adc_ports()
  • setup_adc()
  • set_adc_channel()
  • read_adc()
  • setup_timer_X()
  • set_timer_X()
  • get_timer_X()
  • swap()
  • setup_ccpX()
  • set_pwmX_duty()
Write a Comment
User Comments (0)
About PowerShow.com