60 lines
1.3 KiB
C
60 lines
1.3 KiB
C
#include "mcu_wrapper_conf.h"
|
|
|
|
#ifndef PWM_SIM
|
|
#define PWM_SIM
|
|
|
|
|
|
// Äëÿ ìîäåëèðîâàíèÿ Event Manager
|
|
// ... Dead-Band Submodule
|
|
typedef struct
|
|
{
|
|
int DtCntPeriod;
|
|
int stateDt;
|
|
int dtcnt;
|
|
int ciA_DT;
|
|
int ciB_DT;
|
|
}DeadBandSimHandle;
|
|
// ... Time-Base Submodule, Counter-Compare Submodule è Event-Trigger Submodule
|
|
typedef struct
|
|
{
|
|
|
|
double TxCntPlus;
|
|
double TPr;
|
|
double tcntAux;
|
|
double tcntAuxPrev;
|
|
double tcnt;
|
|
double cmpA;
|
|
double cmpB;
|
|
int ciA;
|
|
int ciB;
|
|
DeadBandSimHandle dtsim;
|
|
}TimerSimHandle;
|
|
|
|
extern TimerSimHandle t1sim;
|
|
extern TimerSimHandle t2sim;
|
|
extern TimerSimHandle t3sim;
|
|
extern TimerSimHandle t4sim;
|
|
extern TimerSimHandle t5sim;
|
|
extern TimerSimHandle t6sim;
|
|
extern TimerSimHandle t7sim;
|
|
extern TimerSimHandle t8sim;
|
|
extern TimerSimHandle t9sim;
|
|
extern TimerSimHandle t10sim;
|
|
extern TimerSimHandle t11sim;
|
|
extern TimerSimHandle t12sim;
|
|
|
|
|
|
|
|
void Simulate_Timers(void);
|
|
void Init_Timers(void);
|
|
|
|
|
|
void initSimulateTim(TimerSimHandle* tsim, int period, double step);
|
|
void SimulateMainPWM(TimerSimHandle* tsim, int compare);
|
|
void SimulatePWM(TimerSimHandle* tsim, int compare);
|
|
int simulateTimAndGetCompare(TimerSimHandle* tsim, int compare);
|
|
void simulateActionActionQualifierSubmodule(TimerSimHandle* tsim);
|
|
void simulateDeadBendSubmodule(TimerSimHandle* tsim);
|
|
void simulateTripZoneSubmodule(TimerSimHandle* tsim);
|
|
#endif //PWM_SIM
|