Código del programa en la sección Processor Expert
/* ###################################################################
** Filename : ProcessorExpert.c
** Project : ProcessorExpert
** Processor : MKL25Z128VLK4
** Version : Driver 01.01
** Compiler : GNU C Compiler
** Date/Time : 2013-08-29, 14:26, # CodeGen: 0
** Abstract :
**
** Proyecto:
Colores-tiempos
** Se
programará el microcontrolador FRDM-KL25Z para mostrar
** distintos
colores
** durante
tiempos diversos, empleando el LED tricolor integrado
** en el mismo.
**
** Settings :
** Contents :
** No public methods
**
**
###################################################################*/
/*!
** @file
ProcessorExpert.c
** @version 01.01
** @brief
** Main module.
** This module contains user's
application code.
*/
/*!
** @addtogroup ProcessorExpert_module
ProcessorExpert module documentation
** @{
*/
/* MODULE ProcessorExpert */
/* Including
needed modules to compile this module/procedure */
#include "Cpu.h"
#include "Events.h"
#include "LED_ROJO.h"
#include "BitIoLdd1.h"
#include "LED_VERDE.h"
#include "BitIoLdd2.h"
#include "LED_AZUL.h"
#include "BitIoLdd3.h"
#include "TI1.h"
#include "TimerIntLdd1.h"
#include "TU1.h"
/* Including
shared modules, which are used for whole project */
#include "PE_Types.h"
#include "PE_Error.h"
#include "PE_Const.h"
#include "IO_Map.h"
void f_LED(int);
void inicio(void);
typedef struct {int color; int tiempo;} Color_tiempo; // Define la estructura llamada Color_tiempo
void LED_Func(Color_tiempo *ap); // Función que
usará los datos en el apuntador.
enum colores{negro, azul, verde, cyan, rojo, magenta, amarillo, blanco};
enum bit_color{b_azul=1,b_verde=2,b_rojo=4};
extern int timmer;
int color_led;
/* User includes
(#include below this line is not maintained by Processor Expert) */
/*lint -save -e970 Disable MISRA rule (6.3) checking. */
int main(void)
/*lint -restore
Enable MISRA rule (6.3) checking. */
{
/* Write
your local variable definition here */
Color_tiempo arr_color_tiempo[]={{negro,30},{azul,20},{verde,10},{cyan,30},{magenta,20},{amarillo,10},{blanco,30},{0,0}};
Color_tiempo *apu_color_tiempo=arr_color_tiempo;
/*** Processor Expert internal initialization. DON'T REMOVE THIS
CODE!!! ***/
PE_low_level_init();
/*** End
of Processor Expert internal initialization. ***/
/* Write
your code here */
inicio();
for(;;)
{
while(timmer)
{}
LED_Func(apu_color_tiempo);
apu_color_tiempo++;
if(apu_color_tiempo->tiempo==0)
{apu_color_tiempo=arr_color_tiempo;}
}
/*** Don't
write any code pass this line, or it will be deleted during code generation.
***/
/*** RTOS
startup code. Macro PEX_RTOS_START is defined by the RTOS component. DON'T
MODIFY THIS CODE!!! ***/
#ifdef PEX_RTOS_START
PEX_RTOS_START();
/*
Startup of the selected RTOS. Macro is defined by the RTOS component. */
#endif
/*** End
of RTOS startup code. ***/
/***
Processor Expert end of main routine. DON'T MODIFY THIS CODE!!! ***/
for(;;){}
/***
Processor Expert end of main routine. DON'T WRITE CODE BELOW!!! ***/
} /*** End of main routine. DO NOT MODIFY THIS TEXT!!!
***/
/* END
ProcessorExpert */
/*!
** @}
*/
/*
** ###################################################################
** This file was created by Processor
Expert 10.2 [05.07]
** for the Freescale Kinetis series of
microcontrollers.
** ###################################################################
*/
void inicio(void)
{
timmer=0;
}
void LED_Func(Color_tiempo *ap)
{
timmer=ap->tiempo;
f_LED(ap->color);
}
void f_LED(int color_led)
{
if (color_led&b_rojo)
LED_ROJO_ClrVal();
else
LED_ROJO_SetVal();
if (color_led&b_verde)
LED_VERDE_ClrVal();
else
LED_VERDE_SetVal();
if (color_led&azul)
LED_AZUL_ClrVal();
else
LED_AZUL_SetVal();
}
|
Código del programa en la sección Events.c
/* ###################################################################
** Filename : Events.c
** Project : ProcessorExpert
** Processor : MKL25Z128VLK4
** Component : Events
** Version : Driver 01.00
** Compiler : GNU C Compiler
** Date/Time : 2013-08-29, 14:26, # CodeGen: 0
** Abstract :
** This is user's event module.
** Put your event handler code here.
** Settings :
** Contents :
** Cpu_OnNMIINT - void Cpu_OnNMIINT(void);
**
**
###################################################################*/
/*!
** @file Events.c
** @version 01.00
** @brief
** This is user's event module.
** Put your event handler code here.
*/
/*!
** @addtogroup Events_module Events
module documentation
** @{
*/
/* MODULE Events
*/
#include "Cpu.h"
#include "Events.h"
#ifdef __cplusplus
extern "C" {
#endif
int timmer;
/* User includes
(#include below this line is not maintained by Processor Expert) */
/*
**
===================================================================
** Event :
Cpu_OnNMIINT (module Events)
**
** Component : Cpu
[MKL25Z128LK4]
** Description :
** This event is called when the Non maskable
interrupt had
** occurred. This event is
automatically enabled when the <NMI
** interrupt> property is set to
'Enabled'.
** Parameters : None
** Returns : Nothing
**
===================================================================
*/
void Cpu_OnNMIINT(void)
{
/* Write
your code here ... */
}
/*
**
===================================================================
** Event :
TI1_OnInterrupt (module Events)
**
** Component :
TI1 [TimerInt]
** Description :
** When a timer interrupt occurs this
event is called (only
** when the component is enabled -
<Enable> and the events are
** enabled - <EnableEvent>). This
event is enabled only if a
** <interrupt service/event> is
enabled.
** Parameters : None
** Returns : Nothing
**
===================================================================
*/
void TI1_OnInterrupt(void)
{
if(timmer>0)
--timmer;
/* Write your code here ... */
}
/* END Events */
#ifdef __cplusplus
} /* extern
"C" */
#endif
/*!
|
No hay comentarios:
Publicar un comentario