Professional Documents
Culture Documents
DIRECTIVAS DE PREPROCESADO
#DEVICE
Syntax:
chip is the name of a specific processor (like: PIC16C74), Options are qualifiers to the standard operation of the device.
Example:
#device PIC16F877
#INCLUDE
Syntax:
#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
#USE ****_I/O
Afectan Syntax:
#use fast_io (port) #use fixed_io (port_outputs=pin, pin?) #USE STANDARD_IO (port)
Ejemplo
#USE DELAY
Syntax:
#use delay (clock=speed(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 (clock=20000000)
#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 portb=5
#INT_xxx
Indica
#INT_EXT
I/O
I/O Discrete I/O SPI two wire I/O Parallel Slave I/O Delays Processor Controls
DELAYS
delay_ms(tiempo) delay_us(tiempo) delay_cycles(ciclos)
(0-255)
INPUT( )
Syntax:
Encendido=input(PIN_A4)
INPUT_x()
Syntax:
OUTPUT_X()
Syntax:
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)
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.
SET_TRIS_X()
Configura
los registros de direccionamiento de los puertos (TRIS) 0 significa salida 1 significa entrada Ejemplo:
Set_tris_a(0b00001011)
ENABLE/DISABLE INTERRUPTS
Permiten
Ejemplos:
OTRAS FUNCIONES
swap()
setup_ccpX() set_pwmX_duty()