#### File: D:\bobes\0 skola\_car4\my matlab\HIL - PID speed\firmware\Vejlupek_Car4_HIL_PIDSpeed_dspic\sources\Vejlupek_Car4_HIL_PIDSpeed_main.c
        1   /*
        2    * File: Vejlupek_Car4_HIL_PIDSpeed_main.c
        3    *
        4    * Real-Time Workshop code generated for Simulink model Vejlupek_Car4_HIL_PIDSpeed.
        5    *
        6    * Model version                        : 1.460
        7    * Real-Time Workshop file version      : 7.3  (R2009a)  15-Jan-2009
        8    * Real-Time Workshop file generated on : Fri Apr 30 16:12:44 2010
        9    * TLC version                          : 7.3 (Jan 18 2009)
       10    * C source code generated on           : Fri Apr 30 16:12:44 2010
       11    *--------------------------------------------------------------
       12    *   Embedded Coder for Microchip dsPIC family.                 |
       13    *   Generate .c and .h files from your Matlab/simulink model   |
       14    *   and compile the diagram to .hex and .coff file that can be |
       15    *   downloaded directly into the microcontroller               |
       16    *                                                              |
       17    * Licence Accorded to Ing. Robert Grepl, Ph.D.                 |
       18    *                     Technical University Brno                |
       19    *                                                              |
       20    *   Written by Lubin KERHUEL -  http://www.kerhuel.eu          |
       21    *  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
       22    *   Version 3.1                               26-Nov-2009      |
       23    *   For Matlab 7.8             R2009a                          |
       24    *--------------------------------------------------------------
       25    */
       26
       27   #include "Vejlupek_Car4_HIL_PIDSpeed.h"
       28   #include "Vejlupek_Car4_HIL_PIDSpeed_private.h"
       29
       30   _FSS( RSS_NO_RAM & SSS_NO_FLASH & SWRP_WRPROTECT_OFF )
       31     _FGS( GCP_OFF & GSS_OFF & GWRP_OFF )
       32     _FOSCSEL( FNOSC_PRIPLL & IESO_OFF & 0xFFFF )
       33     _FOSC( FCKSM_CSDCMD & OSCIOFNC_OFF & POSCMD_HS)
       34     _FPOR( FPWRT_PWR64 )
       35     _FWDT( FWDTEN_OFF )
       36     _FICD( JTAGEN_OFF )
       37     void rt_OneStep()
       38   {
       39     boolean_T eventFlags[2];
       40     int_T i;
       41
       42     /* Disable interrupts here */
       43     /* Save FPU context here (if necessary) */
       44     /* Re-enable timer or interrupt here */
       45     Vejlupek_Car4_HIL_PIDSpeed_SetEventsForThisBaseStep(eventFlags);
       46     Vejlupek_Car4_HIL_PIDSpeed_step(0);
       47
       48     /* Get model outputs here */
       49     for (i = 1; i < 2; i++) {
       50       if (eventFlags[i]) {
       51         Vejlupek_Car4_HIL_PIDSpeed_step(i);
       52
       53         /* Get model outputs here */
       54       }
       55     }
       56
       57     /* Disable interrupts here */
       58     /* Restore FPU context here (if necessary) */
       59     /* Enable interrupts here */
       60   }
       61
       62   int main(void)
       63   {
       64     PLLFBD = 38;                         /* configure clock speed */
       65     CLKDIV = 67;
       66
       67     /* Initialize model */
       68     Vejlupek_Car4_HIL_PIDSpeed_initialize(1);
       69
       70     /* Associate rt_OneStep() with a timer that executes at the base rate of the model */
       71     for (;;) {
       72       /* Associate rt_OneStep() with a timer that executes at the base rate of the model */
       73       while (!_T1IF) ;
       74       _T1IF = 0;
       75       rt_OneStep();
       76     }
       77   }
       78
       79   /* File trailer for Real-Time Workshop generated code.
       80    *
       81    * [EOF]
       82    */