добавлены параметры упп в модель симулинк

This commit is contained in:
2025-05-10 22:08:06 +03:00
parent 97368919cb
commit c3d30fa6f1
7 changed files with 57 additions and 39 deletions

View File

@@ -185,8 +185,10 @@ static void mdlInitializeSampleTimes(SimStruct* S)
static void mdlTerminate(SimStruct* S)
{
hmcu.fMCU_Stop = 1;
#ifdef RUN_APP_MAIN_FUNC_THREAD
ResumeThread(hmcu.hMCUThread);
WaitForSingleObject(hmcu.hMCUThread, 10000);
#endif
SIM_deInitialize_Simulation();
mexUnlock();
}

View File

@@ -108,7 +108,7 @@ void MCU_writeOutputs(SimStruct* S)
/* Get S-Function descrete array */
real_T* Out_Buff = ssGetDiscStates(S);
//Simulate_GPIO_BSRR();
Simulate_GPIO_BSRR();
WriteFromSFunc(Out_Buff);
}
//-----------------CONTROLLER SIMULATE FUNCTIONS---------------//
@@ -169,9 +169,13 @@ void SIM_Initialize_Simulation(void)
*/
void SIM_deInitialize_Simulation(void)
{
//#ifdef DEINITIALIZE_AFTER_SIM
#include "upp.h"
memset(&Upp, 0, sizeof(Upp));
// simulate structures of peripheral deinitialization
deInitialize_Periph_Sim();
// mcu peripheral memory deinitialization
deInitialize_MCU();
//#endif
}
//-------------------------------------------------------------//

View File

@@ -49,11 +49,14 @@
#define MCU_CORE_CLOCK 72000000
//#define DEINITIALIZE_AFTER_SIM ///< Enable deinitializing structures at simulation ends
#define PORT_WIDTH 16 ///< width of one port
#define PORT_NUMB 3 ///< amount of ports
// Parameters of S_Function
#define NPARAMS 1 ///< number of input parametrs (only Ts)
#define IN_PORT_WIDTH (3) ///< width of input ports
#define IN_PORT_WIDTH (8) ///< width of input ports
#define IN_PORT_NUMB 1 ///< number of input ports
#define OUT_PORT_WIDTH PORT_WIDTH ///< width of output ports
#define OUT_PORT_NUMB PORT_NUMB ///< number of output ports

View File

@@ -81,3 +81,4 @@ IF [%1]==[debug] (set debug= -g)
::------START COMPILING-------
echo Compiling...
mex %output% %defines% %includes% %codes% %debug%
echo %DATE% %TIME%