Part Number: 12
Tool/software: TI C/C++ Compiler
Excuse me:
1. Can TI modify TSP in Mathworks c2000?
2. When generating the hardware code, the name of the initialization function is xxStart. How to modify it? which file we must modify? how to do it
This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Part Number: 12
Tool/software: TI C/C++ Compiler
Excuse me:
一、 TI在mathworks中TSP能否修改?
1. Can TI modify TSP in Mathworks c2000?
二、在生成底层代码时,初始化函数的名称是xxStart,怎么修改??
2. When generating the hardware code, the name of the initialization function is xxStart. How to modify it? which file we must modify? how to do it
Hi,
Can you share the code snippet to help us better understand which routines are being discussed.
Regards,
Venkatesh C
Mike,
Wanted to check in to see if you can share your code with Venkatesh from MathWorks or it you have resolved the issue off-forum.
Best,
Matthew
Mike,
I'm going to mark this as TI thinks resolved; if this is not the case, you can reply back and the post will re-open. You can start a new thread if there are additional questions.
Best,
Matthew
Hi,
When you observe the InitAdc() call closely, which I have captured below:
if (adcInitFlag == 0) { InitAdc(); adcInitFlag = 1; } config_ADC_SOC0 (); /* Start for S-Function (c2802xadc): '<S3>/ADC1' incorporates: * Outport: '<Root>/Out2' */ if (adcInitFlag == 0) { InitAdc(); adcInitFlag = 1; } Notice the flag 'adcInitFlag' which is set to 1 after call to first InitAdc();.
The next condition for this call checks the flag against 'zero' which will not pass and hence second instance of InitAdc(); will not execute. This Init is once required for the ADC module and is not block specific. For the second question, we are not providing any input to ePWM block which can change in runtime, the code generation creates a _start function which is called from Init only. However if user can provide some inputs to ePWM block like Timer Period value and provide sample time, the block will generate a function which is user defined and calls the same in step function. for Example:
/* Output and update for atomic system: '<Root>/InitPwm' */ void InitPwm(void) { /* local block i/o variables */ uint16_T rtb_DataTypeConversion; /* DataTypeConversion: <S2>/Data Type Conversion' incorporates: * Constant: '<S2>/Constant1' * Gain: '<S2>/PWM_Counter_Period' * Sum: '<S2>/Add' */ rtb_DataTypeConversion = (uint16_T)(__IQmpy(8L, ((int32_T) zhr486kgpfc0711_B.ui_Pfc_Adc_Va_ZYQ2 << 15U) + 32768L, 15) >> 2U); /* S-Function (c2802xpwm): '<S2>/ePWM' */ { EPwm1Regs.TBPRD = (uint16_T)(rtb_DataTypeConversion); } }
HTH,