CODIGO
PROCESSOR EXPERT
/*
###################################################################
** Filename
: ProcessorExpert.c
**
Project : USO DEL ADC Y
COMUNICACION SERIAL
** Processor
: MKL25Z128VLK4
** Version
: FINAL
** Compiler
: GNU C Compiler
** Date/Time
: 2013-09-21, 19:21, # CodeGen: 0
** Abstract
:
** Main module.
** This module contains user's
application code.
** 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 "AD1.h"
#include "AdcLdd1.h"
#include "AS1.h"
#include "ASerialLdd1.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"
static uint16_t valor;
volatile byte bandera;
char dato[6];
uint16_t size = 1;
/* 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 */
/*** Processor Expert internal initialization.
DON'T REMOVE THIS CODE!!! ***/
PE_low_level_init();
/*** End of Processor Expert internal initialization. ***/
/* Write your code here */
/* For example: for(;;) { } */
for(;;){
(void) AD1_Measure(TRUE);
(void) AD1_GetValue16(&valor);
dato[5]=((valor)%10)+48;
dato[4]=((valor/10)%10)+48;
dato[3]=((valor/100)%10)+48;
dato[2]=((valor/1000)%10)+48;
dato[1]=((valor/10000)%10)+48;
dato[0]='-';
if (bandera=='1')
{
AS1_SendChar('-');
AS1_SendChar(dato[1]);
AS1_SendChar(dato[2]);
AS1_SendChar(dato[3]);
AS1_SendChar(dato[4]);
AS1_SendChar(dato[5]);
bandera='0';
}
}
/*** 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.06]
** for the Freescale Kinetis
series of microcontrollers.
**
**
###################################################################
*/
EVENT C
/*
###################################################################
** Filename
: Events.c
** Project
: ProcessorExpert
** Processor
: MKL25Z128VLK4
** Component
: Events
** Version
: Driver 01.00
** Compiler
: GNU C Compiler
** Date/Time
: 2013-09-21, 19:21, # 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
/* 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
: AD1_OnEnd (module Events)
**
** Component
: AD1 [ADC]
** Description :
** This event is called after the
measurement (which consists
** of <1 or more conversions>)
is/are finished.
** The event is available only when the
<Interrupt
** service/event> property is enabled.
** Parameters
: None
** Returns
: Nothing
**
===================================================================
*/
void AD1_OnEnd(void)
{
/* Write your code here ... */
}
/*
**
===================================================================
** Event
: AD1_OnCalibrationEnd (module
Events)
**
** Component
: AD1 [ADC]
** Description :
** This event is called when the
calibration has been finished.
** User should check if the calibration
pass or fail by
** Calibration status method./nThis event
is enabled only if
** the <Interrupt service/event>
property is enabled.
** Parameters
: None
** Returns
: Nothing
**
===================================================================
*/
void AD1_OnCalibrationEnd(void)
{
/* Write your code here ... */
}
/*
**
===================================================================
** Event
: AS1_OnError (module Events)
**
** Component
: AS1 [AsynchroSerial]
** Description :
** This event is called when a channel
error (not the error
** returned by a given method) occurs.
The errors can be read
** using <GetError> method.
** The event is available only when the
<Interrupt
** service/event> property is enabled.
** Parameters
: None
** Returns
: Nothing
**
===================================================================
*/
void AS1_OnError(void)
{
/* Write your code here ... */
}
/*
**
===================================================================
** Event
: AS1_OnRxChar (module Events)
**
** Component
: AS1 [AsynchroSerial]
** Description :
** This event is called after a correct
character is received.
** The event is available only when the
<Interrupt
** service/event> property is enabled and
either the <Receiver>
** property is enabled or the <SCI
output mode> property (if
** supported) is set to Single-wire mode.
** Parameters
: None
** Returns
: Nothing
** ===================================================================
*/
void AS1_OnRxChar(void)
{
/* Write your code here ... */
}
/*
**
===================================================================
** Event
: AS1_OnTxChar (module Events)
**
** Component
: AS1 [AsynchroSerial]
** Description :
** This event is called after a character
is transmitted.
** Parameters
: None
** Returns
: Nothing
**
===================================================================
*/
void AS1_OnTxChar(void)
{
/* Write your code here ... */
}
/*
**
===================================================================
** Event
: AS1_OnFullRxBuf (module Events)
**
** Component
: AS1 [AsynchroSerial]
** Description :
** This event is called when the input
buffer is full;
** i.e. after reception of the last
character
** that was successfully placed into
input buffer.
** Parameters
: None
** Returns
: Nothing
** ===================================================================
*/
void AS1_OnFullRxBuf(void)
{
/* Write your code here ... */
}
/*
**
===================================================================
** Event
: AS1_OnFreeTxBuf (module Events)
**
** Component
: AS1 [AsynchroSerial]
** Description :
** This event is called after the last
character in output
** buffer is transmitted.
** Parameters
: None
** Returns
: Nothing
** ===================================================================
*/
void AS1_OnFreeTxBuf(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)
{
/* Write your code here ... */
extern volatile byte bandera;
bandera='1';
}
/* END Events */
#ifdef __cplusplus
} /* extern "C" */
#endif
/*!
** @}
*/
/*
**
###################################################################
**
** This file was created by Processor Expert
10.2 [05.06]
** for the Freescale Kinetis
series of microcontrollers.
**
**
###################################################################
*/
No hay comentarios:
Publicar un comentario