//-------------------------------------------------------// // Project Code : V2H6K01-23-ENEMAN // File Name : RoutineT500ms.cpp // Created on : 2023. 8. 8. // Description : // Author : KimJeongWoo // Last modified Date : //-------------------------------------------------------// #include "Cpu1DeviceDefine.h" int FlagAdcReset = 0; int Testpcs5 = 0; int off_duration = 3; int on_duration = 1; int cnt = 0; bool led_state = false; // LED 상태를 추적하는 플래그 void RoutineT500ms() { DacaRegs.DACVALS.bit.DACVALS = Testpcs1; DacbRegs.DACVALS.bit.DACVALS = Testpcs2; DaccRegs.DACVALS.bit.DACVALS = Testpcs3; ScaleUpdate(); OffsetUpdate(); Lpf1stCoefUpdate(); if(FlagAdcReset == 1) { SetupAdcSoc(); FlagAdcReset = 0; } if(SystemFault == 1) { if(Dout.Data.bit.Ch03 == 0) { Dout.Data.bit.Ch03 = 1; } if (!led_state && ++cnt >= off_duration) { Dout.Data.bit.Ch02 = 0; // Dout.Data.bit.Ch03 = 1; led_state = true; // LED 상태 업데이트 cnt = 0; // 카운터 초기화 } else if (led_state && ++cnt >= on_duration) { Dout.Data.bit.Ch02 = 1; Dout.Data.bit.Ch03 = 0; led_state = false; // LED 상태 업데이트 cnt = 0; // 카운터 초기화 on_duration += 1; // 다음 켜짐 시간 증가 // on_duration이 너무 커지면 리셋 if (on_duration > off_duration) { on_duration = 1; // 켜짐 시간 초기화 } } } else { Dout.Data.bit.Ch02 = 0; Dout.Data.bit.Ch03 = 0; } ////////////////////////////////////// if(State_RTC_Write_complete == 1) { // RtcWriteTime(); SPI_RTC_Write_Sequence(); // State_RTC_Write_complete = 0; } if(Testpcs5 == 1) { SPI_RTC_Read_Sequence(); // Testpcs5 = 0; // RtcRun(); } } void RoutineT1s() { }