/*
 * File: Master_main.c
 *
 * Real-Time Workshop code generated for Simulink model Master.
 *
 * Model version                        : 1.257
 * Real-Time Workshop file version      : 7.3  (R2009a)  15-Jan-2009
 * Real-Time Workshop file generated on : Tue May 21 16:11:30 2013
 * TLC version                          : 7.3 (Jan 18 2009)
 * C source code generated on           : Tue May 21 16:11:31 2013
 *--------------------------------------------------------------
 *   Embedded Coder for Microchip dsPIC family.                 |
 *   Generate .c and .h files from your Matlab/simulink model   |
 *   and compile the diagram to .hex and .coff file that can be |
 *   downloaded directly into the microcontroller               |
 *                                                              |
 * Licence Accorded to Ing. Robert Grepl, Ph.D.                 |
 *                     Technical University Brno                |
 *                                                              |
 *   Written by Lubin KERHUEL -  http://www.kerhuel.eu          |
 *  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
 *   Version 3.5                               27-Apr-2011      |
 *   For Matlab 7.8             R2009a                          |
 *--------------------------------------------------------------
 */

#include "Master.h"
#include "Master_private.h"
#ifdef _FSS                            /* for chip with memory protection options */

_FSS( RSS_NO_RAM & SSS_NO_FLASH & SWRP_WRPROTECT_OFF )
#endif
  _FGS( GCP_OFF & GSS_OFF & GWRP_OFF )
  _FOSCSEL( FNOSC_FRCPLL & IESO_OFF & 0xFFFF )
  _FOSC( FCKSM_CSDCMD & OSCIOFNC_ON & POSCMD_NONE )
  _FPOR( FPWRT_PWR1 )
  _FWDT( FWDTEN_OFF )
  _FICD( JTAGEN_OFF & ICS_PGD1 )
  void rt_OneStep()
{
  /* Disable interrupts here */

  /* Save FPU context here (if necessary) */
  /* Re-enable timer or interrupt here */
  Master_step();

  /* Get model outputs here */

  /* Disable interrupts here */
  /* Restore FPU context here (if necessary) */
  /* Enable interrupts here */
}

int main(void)
{
  PLLFBD = 30;                         /* configure clock speed */
  CLKDIV = 64;

  /* Initialize model */
  Master_initialize(1);
  for (;;) {
    /* Associate rt_OneStep() with a timer that executes at the base rate of the model */
    while (!_T1IF) ;
    _T1IF = 0;
    rt_OneStep();
  }
}

/* File trailer for Real-Time Workshop generated code.
 *
 * [EOF]
 */
