Professional Documents
Culture Documents
DE CCS
PRINCIPALES
FUNCIONES Y
DIRECTIVAS
DIRECTIVAS DE
PREPROCESADO
#DEVICE
Syntax:
#include <filename>
#include "filename
Ejemplos:
#include <16f877.h>
#include lcd.h
#DEFINE
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 portb=5
#INT_xxx
delay_ms(tiempo)
delay_us(tiempo)
delay_cycles(ciclos) (0-255)
1 ciclo= 4 ciclos de reloj
INPUT( )
Syntax:
value = input_a()
value = input_b()
value = input_c()
...
Returns: An 8 bit int representing the
port input data.
OUTPUT_X()
Syntax:
output_a (value)
output_b (value)
...
Parameters: value is an 8 bit int
Function: Output an entire byte to a
port.
OUTPUT_BIT( )
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.
SET_TRIS_X()
Ejemplos:
enable_interrupts(GLOBAL);
disable_interrupts(INT_TIMER0);
enable_interrupts(INT_TIMER1);
OTRAS FUNCIONES
setup_adc_ports()
setup_adc()
set_adc_channel() swap()
read_adc()
setup_timer_X() setup_ccpX()
set_timer_X() set_pwmX_duty()
get_timer_X()