simulink自动代码生成流水灯代码 xs128芯片
源程序如下:
- /*
- * File: xs128_main.c
- *
- * Code generated for Simulink model 'demo'.
- *
- * Model version : 1.24
- * Simulink Coder version : 8.11 (R2016b) 25-Aug-2016
- * C/C++ source code generated on : Fri May 19 14:45:39 2017
- *
- * Target selection: xs128.tlc
- * Embedded hardware selection: Freescale->S12x
- * Code generation objectives: Unspecified
- * Validation result: Not run
- */
- #include <hidef.h> /* common defines and macros */
- #include "derivative.h" /* derivative-specific definitions */
- #include "demo.h"
- unsigned int flag_100ms;
- void main(void)
- {
- /* include your code here */
- /* Initialize model */
- demo_initialize();
- EnableInterrupts; /* enable interrupts */
- for (;;) {
- __RESET_WATCHDOG(); /* feeds the dog */
- } /* loop forever */
- /* please make sure that you never leave main */
- }
- /* PIT定时中断处理函数 */
- #pragma CODE_SEG __NEAR_SEG NON_BANKED
- interrupt VectorNumber_Vpit0 void PIT_INTER0()
- {
- if (PITTF_PTF0 == 1) {
- PITTF_PTF0= 1; // 清中断标志位
- demo_step();
- /* Get model outputs here */
- flag_100ms++; /* task_100ms */
- if (flag_100ms==10) {
- flag_100ms= 0;
- task_100ms();
- }
- }
- }
- ……………………
- …………限于本文篇幅 余下代码请从51黑下载附件…………
复制代码
所有资料51hei提供下载:
Light_count.zip
(313.65 KB, 下载次数: 22)
|