void API_Error(WORD _Sender, WORD _Error)
{
static ErrorCounter = 0;
WORD_VAL error;
BYTE Data[2];
if(ErrorCounter == MAX_ERRORS) ErrorCounter = 0;
LastError[ErrorCounter].error = _Error;
LastError[ErrorCounter].time.Time.Days = RtccSw.Time.Days;
LastError[ErrorCounter].time.Time.Hour = RtccSw.Time.Hour;
LastError[ErrorCounter].time.Time.Minute = RtccSw.Time.Minute;
LastError[ErrorCounter].time.Time.Second = RtccSw.Time.Second;
LastError[ErrorCounter].time.Time.Thousandth = RtccSw.Time.Thousandth;
ErrorCounter++;
error.Val = _Error;
Data[0] = error.byte.HB;
Data[1] = error.byte.LB;
if(error.Val = API_PutEvent(_Sender, BE_ERROR | ERROR_FLAG | EVENT_FLAG, Data, 2)){
if(ErrorCounter == MAX_ERRORS) ErrorCounter = 0;
LastError[ErrorCounter].error = error.Val;
LastError[ErrorCounter].time.Time.Days = RtccSw.Time.Days;
LastError[ErrorCounter].time.Time.Hour = RtccSw.Time.Hour;
LastError[ErrorCounter].time.Time.Minute = RtccSw.Time.Minute;
LastError[ErrorCounter].time.Time.Second = RtccSw.Time.Second;
LastError[ErrorCounter].time.Time.Thousandth = RtccSw.Time.Thousandth;
ErrorCounter++;
}
}