matlab_23550/Inu/Src/main_matlab/init28335.c

67 lines
1.6 KiB
C

/**************************************************************************
Description: Ïîñëå çàãðóçêè ïðîöåññîðà ôóíêöèÿ âûçûâàåòñÿ îäèí ðàç
è èíèöèàëèçèðóåò óïðàâëÿþùèå ðåãèñòðû ïðîöåññîðà
TMS320F28335/TMS320F28379D.
Àâòîð: Óëèòîâñêèé Ä.È.
Äàòà ïîñëåäíåãî îáíîâëåíèÿ: 2021.10.04
**************************************************************************/
#include "def.h"
#include "init28335.h"
#define FREQ_TIMER_3 (FREQ_PWM*2)
void init28335(void) {
edrk.flag_second_PCH = 0;
edrk_init_variables_matlab();
init_global_time_struct(FREQ_TIMER_3);
} //void init28335(void)
void edrk_init_variables_matlab(void)
{
initVectorControl();
InitXPWM(FREQ_PWM);
InitPWM_Variables(edrk.flag_second_PCH);
//#if(SENSOR_ALG==SENSOR_ALG_23550)
// rotorInit();
//#endif
//#if(SENSOR_ALG==SENSOR_ALG_22220)
// // 22220
// rotorInit_22220();
//#endif
control_station.clear(&control_station);
edrk_init_matlab();
init_ramp_all_zadanie();
init_all_limit_koeffs();
}
void edrk_init_matlab(void)
{
edrk.Uzad_max = _IQ(K_STATOR_MAX); // ìàêñ àìïëèòóäà â Êì äëÿ ìèíèìàëüíîãî èìïóëüñà = DEF_PERIOD_MIN_MKS
edrk.iq_bpsi_normal = _IQ(BPSI_NORMAL / NORMA_FROTOR);
// edrk.iq_bpsi_max = _IQ(BPSI_MAXIMAL/NORMA_FROTOR);
// edrk.iq_f_provorot = _IQ(F_PROVOROT/NORMA_FROTOR);
edrk.flag_enable_update_hmi = 1;
edrk.zadanie.ZadanieU_Charge = NOMINAL_U_ZARYAD;
edrk.zadanie.iq_ZadanieU_Charge = _IQ(NOMINAL_U_ZARYAD / NORMA_ACP);
edrk.zadanie.iq_set_break_level = _IQ(NOMINAL_U_BREAK_LEVEL / NORMA_ACP);
control_station.setup_time_detect_active[CONTROL_STATION_TERMINAL_RS232] = 50;
}