Does any one can help me?
I want to make a demo on DEVKIT-5744P, which a led's state can toggle at 1s(1s light on, and then 1s light off) . But it can not build successfully. It seems that my state A is not known by PIT ISR.
0.Error message
pit_ch1_isr.c: In function 'PIT_Ch1_ISR':
pit_ch1_isr.c:24:38: error: 'TIMER_LED_IN_A' undeclared (first use in this function)
TIMER_LED_DW.is_c1_TIMER_LED = TIMER_LED_IN_A;
^
pit_ch1_isr.c:24:38: note: each undeclared identifier is reported only once for each function it appears in
pit_ch1_isr.c:29:40: error: 'TIMER_LED_IN_A1' undeclared (first use in this function)
TIMER_LED_DW.is_c1_TIMER_LED = TIMER_LED_IN_A1;
^
gmake: *** [pit_ch1_isr.o] Error 1
### Creating HTML report file TIMER_LED_codegen_rpt.html
1.Environment
EVB: DEVKIT-5744P
Reference demo : mbdtbx_MPC574xP\mbdtbx_pnt\Examples\eTimer_QD_pnt.mdl.
2.Settings
Figure1 System diagram
Figure2 PIT's Function Call Subsystem1
Figure3 State flow A and A1
Hello fortunely,
Sorry for the late reply.
It seems to be a problem with the fact that the #define TIMER_LED_IN_A is in the <model_name>.c and used in pit_ch1_isr.c. This last file does not include the #defines from any .c file. There is a quick fix for you to force the TIMER_LED_IN_A not to be used in pit_ch1_isr.c file. You'll have to:
- right click on the chart from Function-Call Subsystem 1, go to Block_Parameters
- from there, please go to Code Generation tab
- and select Nonreusable function
In this way, Simulink Coder will generate a function call in pit_ch1_isr.c (something like TIMER_LED_Chart() ), that function being defined in <model_name>.c file.
Hope this helps,
Razvan.
This is the option I was talking about above^ . You can leave the rest options set to their default values, or even better, select 'Use subsystem name' for Function name options, so that the code generated is easier to read.
Hope this helps,
Razvan.