/*
 * File: Vejlupek_CAR4_dsPIC33_ACU44_SlaveBoard_direct_main.c
 *
 * Real-Time Workshop code generated for Simulink model Vejlupek_CAR4_dsPIC33_ACU44_SlaveBoard_direct.
 *
 * Model version                        : 1.809
 * Real-Time Workshop file version      : 7.3  (R2009a)  15-Jan-2009
 * Real-Time Workshop file generated on : Tue Apr 13 23:03:43 2010
 * TLC version                          : 7.3 (Jan 18 2009)
 * C source code generated on           : Tue Apr 13 23:03:44 2010
 *--------------------------------------------------------------
 *   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.1                               26-Nov-2009      |
 *   For Matlab 7.8             R2009a                          |
 *--------------------------------------------------------------
 */

#include "Vejlupek_CAR4_dsPIC33_ACU44_SlaveBoard_direct.h"
#include "Vejlupek_CAR4_dsPIC33_ACU44_SlaveBoard_direct_private.h"

_FSS( RSS_NO_RAM & SSS_NO_FLASH & SWRP_WRPROTECT_OFF )
  _FGS( GCP_OFF & GSS_OFF & GWRP_OFF )
  _FOSCSEL( FNOSC_PRIPLL & IESO_OFF & 0xFFFF )
  _FOSC( FCKSM_CSDCMD & OSCIOFNC_OFF & POSCMD_HS)
  _FPOR( FPWRT_PWR64 )
  _FWDT( FWDTEN_OFF )
  _FICD( JTAGEN_OFF )
  void rt_OneStep()
{
  boolean_T eventFlags[3];
  int_T i;

  /* Disable interrupts here */
  /* Save FPU context here (if necessary) */
  /* Re-enable timer or interrupt here */
  Vejlupek_CAR4_dsPIC33_ACU44_SlaveBoard_direct_SetEventsForThisBaseStep
    (eventFlags);
  Vejlupek_CAR4_dsPIC33_ACU44_SlaveBoard_direct_step(0);

  /* Get model outputs here */
  for (i = 1; i < 3; i++) {
    if (eventFlags[i]) {
      Vejlupek_CAR4_dsPIC33_ACU44_SlaveBoard_direct_step(i);

      /* Get model outputs here */
    }
  }

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

int main(void)
{
  PLLFBD = 38;                         /* configure clock speed */
  CLKDIV = 67;

  /* Initialize model */
  Vejlupek_CAR4_dsPIC33_ACU44_SlaveBoard_direct_initialize(1);

  /* Associate rt_OneStep() with a timer that executes at the base rate of the model */
  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]
 */
