標(biāo)題: xs128 simulink自動(dòng)代碼生成流水燈代碼 [打印本頁(yè)]

作者: hujihao    時(shí)間: 2017-6-5 16:52
標(biāo)題: xs128 simulink自動(dòng)代碼生成流水燈代碼
simulink自動(dòng)代碼生成流水燈代碼 xs128芯片


源程序如下:
  1. /*
  2. * File: xs128_main.c
  3. *
  4. * Code generated for Simulink model 'demo'.
  5. *
  6. * Model version                  : 1.24
  7. * Simulink Coder version         : 8.11 (R2016b) 25-Aug-2016
  8. * C/C++ source code generated on : Fri May 19 14:45:39 2017
  9. *
  10. * Target selection: xs128.tlc
  11. * Embedded hardware selection: Freescale->S12x
  12. * Code generation objectives: Unspecified
  13. * Validation result: Not run
  14. */

  15. #include <hidef.h>                     /* common defines and macros */
  16. #include "derivative.h"                /* derivative-specific definitions */
  17. #include "demo.h"

  18. unsigned int flag_100ms;
  19. void main(void)
  20. {
  21.   /* include your code here */
  22.   /* Initialize model */
  23.   demo_initialize();
  24.   EnableInterrupts;                    /* enable interrupts */
  25.   for (;;) {
  26.     __RESET_WATCHDOG();                /* feeds the dog */
  27.   }                                    /* loop forever */

  28.   /* please make sure that you never leave main */
  29. }

  30. /* PIT定時(shí)中斷處理函數(shù) */
  31. #pragma CODE_SEG __NEAR_SEG NON_BANKED

  32. interrupt VectorNumber_Vpit0 void PIT_INTER0()
  33. {
  34.   if (PITTF_PTF0 == 1) {
  35.     PITTF_PTF0= 1;                     // 清中斷標(biāo)志位
  36.     demo_step();

  37.     /* Get model outputs here */
  38.     flag_100ms++;                      /* task_100ms */
  39.     if (flag_100ms==10) {
  40.       flag_100ms= 0;
  41.       task_100ms();
  42.     }
  43.   }
  44. }
  45. ……………………

  46. …………限于本文篇幅 余下代碼請(qǐng)從51黑下載附件…………
復(fù)制代碼

所有資料51hei提供下載:
Light_count.zip (313.65 KB, 下載次數(shù): 22)









歡迎光臨 (http://www.torrancerestoration.com/bbs/) Powered by Discuz! X3.1