/******************************************************************************
COPYRIGHT 2002 STMicroelectronics
Source File Name :  main.c  
Group            :  IPSW,CMG-IPDF
Author           : MCD Application Team
Date First Issued:  06/03/2002
********************************Documentation**********************************
General Purpose - This program configures Fcpu main clock frequency as 2 MHz, 
oscillator interrupt time base as 4ms and generates 1 KHz beep signal. 	
********************************Revision History*******************************
_______________________________________________________________________________
Date :06/03/2002                  Release:1.0 
Date :28/04/04                    MISRA changes       	  
--*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-**/

#include "ST7lib_config.h"       
                /* File for user to select device as ST72F521, Fosc2 as 8MHz */

//protoytpe declaration
void MCC_IT_Routine (void);
void main(void);
                
void main (void)
{
     /* MCC initialised. Main clock out and oscillator interrupt enabled */
     MCC_Init (((unsigned char)MCO_ENABLE | (unsigned char)MCC_IT_ENABLE));
     EnableInterrupts
     MCC_SlowMode (MCC_SLOW_ENABLE, MCC_CLK_4);
                                                   /* Fcpu selected as 2 MHz */
     MCC_RTC_Timer (MCC_RTC_1);                 /* Time base selected as 4ms */
     WaitforInterrupt                              /* Waiting for interrupt */
}

/******************************************************************************
Interrupt Service Routine:
    An example of 1kHz beep signal generation in BEEP pin, is given, which will
    be executed when RTC interrupt is generated.
******************************************************************************/
#ifdef _HIWARE_                                  /* Test for HIWARE Compiler */
#pragma TRAP_PROC SAVE_REGS            /* Additional registers will be saved */
#else
#ifdef _COSMIC_                                  /* Test for Cosmic Compiler */
@interrupt                                      /* Cosmic interrupt handling */
#else
#error"Unsupported Compiler!"                 /* Compiler Defines not found! */
#endif
#endif
void MCC_IT_Routine (void)
{
     MCC_Clear_IT ();                                /* Clears the interrupt */
     MCC_Beep (MCC_BEEP_2);                   /* Generates 1 KHz beep signal */
}					
/*** (c) 2002   STMicroelectronics *************************** END OF FILE ***/
