C Template

Acciones de Documento
  • Marcadores (bookmarks)
Autores: Guillermo Carpintero, Marta Ruiz

PR-F-002_C_template.c — Plain Text, 3 kB (3730 bytes)

Contenido del Archivo

//;    Filename:                                               
//;    Date:                                                                   
//;    File Version:                                                           
//;                                                                            
//;    Author:                                                                 
//;    Company:                                                                
//;                                                                            
//;	
//;*****************************************************************
//;                                                                            
//;    Files required:                                                         
//;                                                                            
//;********************************************************************
//-----------------------------------------------------------------------------
#include <p18f2525.h>
#include "delays.h"
#include "timers.h"

//----------------------------------------------------------------------------
// Configuracion:
// - Habilitar oscilador HS
// - Deshabilitar watchdog timer
// - Deshabilitar low voltage programming
// - Deshabilitar debuger
//----------------------------------------------------------------------------

#pragma config OSC = HS
#pragma config WDT = OFF
#pragma config LVP = OFF
#pragma config DEBUG = OFF
//-----------------------------------------------------------------------------

//-----------------------------------------------------------------------------
//Declaracion de variables GLOBALES
//-----------------------------------------------------------------------------
char sentido=0;//Indica la direccion en que se encienden los leds(1:drcha 0:izq )

//-----------------------------------------------------------------------------
//Prototipos de Funciones
//-----------------------------------------------------------------------------
//void ISRhigh(void);
//void ISRlow(void);
//void Inicializa(void);

//-----------------------------------------------------------------------------
//Main
//-----------------------------------------------------------------------------	
void main(void){

	Inicializa();

	while(1);

}

//---------------------------------------------------------------------
// Setup() inicializcion de registros
//---------------------------------------------------------------------
void Inicializa(void){

	//Habilitacion de prioridad de interrupciones
//	INTCONbits.GIEH = 1;
//	INTCONbits.GIEL = 1;

	//configuracion inicial TIMER0
//	OpenTimer0(TIMER_INT_ON & T0_16BIT & T0_SOURCE_INT & T0_PS_1_2);
//	WriteTimer0(25536);//Precarga TIMER0 para 40ms con preescaler 1:2
//	INTCONbits.TMR0IF = 0;

		 
//   TRISC = 0x00;//Inicializar puerto como salida
//	 PORTC=0x01;

}
	


//--------------------------------------------------------------------
//Inicializacion de los vectores de Interrupcion
//--------------------------------------------------------------------

/*
#pragma code high_vector = 0x08
void high_vector(void){
_asm GOTO ISRhigh _endasm
}
*/

/*
#pragma code low_vector = 0x18
void low_vector(void){
_asm GOTO ISRlow _endasm
}
*/

//--------------------------------------------------------------------
//Rutina de atencion a la Interrupcion
//--------------------------------------------------------------------

#pragma code

/*

#pragma interrupt ISRhigh
void ISRhigh(void){


	if(INTCONbits.TMR0IF == 1){


	}

	
}

*/

/*

#pragma interrupt ISRlow
void ISRlow(void){
	
}

*/
Reutilizar Curso
Descargar este curso