\doxysection{modbus\+\_\+diag.\+c}
\hypertarget{modbus__diag_8c_source}{}\label{modbus__diag_8c_source}\index{E:/.WORK/STM32/Diod\_Test/diode\_tester/Core/Modbus/Src/modbus\_diag.c@{E:/.WORK/STM32/Diod\_Test/diode\_tester/Core/Modbus/Src/modbus\_diag.c}}
\mbox{\hyperlink{modbus__diag_8c}{Go to the documentation of this file.}}
\begin{DoxyCode}{0}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00001}00001\ \textcolor{comment}{/**}}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00002}00002\ \textcolor{comment}{*******************************************************************************}}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00003}00003\ \textcolor{comment}{*\ @file\ modbus\_diag.c}}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00004}00004\ \textcolor{comment}{*\ @brief\ Реализация\ диагностики\ устройства\ Modbus}}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00005}00005\ \textcolor{comment}{*******************************************************************************}}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00006}00006\ \textcolor{comment}{*\ @details}}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00007}00007\ \textcolor{comment}{Модуль\ обработки\ запросов\ диагностической\ информации\ (0x08):}}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00008}00008\ \textcolor{comment}{-\/\ Полная\ поддержка\ всех\ подфункций\ диагностики\ согласно\ спецификации\ Modbus}}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00009}00009\ \textcolor{comment}{-\/\ Выставление\ любого\ бита\ в\ Diagnostics\ Register}}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00010}00010\ \textcolor{comment}{-\/\ Сбор\ статистики\ работы\ устройства}}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00011}00011\ \textcolor{comment}{-\/\ Управление\ режимами\ работы\ (Normal/Listen\ Only)}}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00012}00012\ \textcolor{comment}{******************************************************************************/}}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00013}00013\ \textcolor{preprocessor}{\#include\ "{}\mbox{\hyperlink{modbus__diag_8h}{modbus\_diag.h}}"{}}}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00014}00014\ }
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00015}00015\ \textcolor{preprocessor}{\#ifdef\ MODBUS\_ENABLE\_DIAGNOSTICS}}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00016}00016\ }
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00017}\mbox{\hyperlink{group___m_o_d_b_u_s___d_i_a_g_ga4ba6111ac80e342396f9703239323936}{00017}}\ \mbox{\hyperlink{struct_m_b___diagnostics_info_type_def}{MB\_DiagnosticsInfoTypeDef}}\ \mbox{\hyperlink{group___m_o_d_b_u_s___d_i_a_g_ga4ba6111ac80e342396f9703239323936}{MB\_DIAG}}\ =\ \{0\};\ \textcolor{comment}{///<\ Глобальная\ структура\ диагностики}}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00018}00018\ \textcolor{comment}{}}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00019}00019\ \textcolor{comment}{/**}}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00020}00020\ \textcolor{comment}{\ \ *\ @brief\ Инициализация\ диагностических\ счетчиков}}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00021}00021\ \textcolor{comment}{\ \ */}}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00022}\mbox{\hyperlink{group___m_o_d_b_u_s___d_i_a_g_ga9b61a6d4139bac318868e93f03cd82c7}{00022}}\ \textcolor{keywordtype}{void}\ \mbox{\hyperlink{group___m_o_d_b_u_s___d_i_a_g_ga9b61a6d4139bac318868e93f03cd82c7}{MB\_DiagnosticsInit}}(\textcolor{keywordtype}{void})}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00023}00023\ \{}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00024}00024\ \ \ \mbox{\hyperlink{group___m_o_d_b_u_s___d_i_a_g_ga4ba6111ac80e342396f9703239323936}{MB\_DIAG}}.DiagnosticRegister\ =\ 0;}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00025}00025\ \ \ \mbox{\hyperlink{group___m_o_d_b_u_s___d_i_a_g_ga4ba6111ac80e342396f9703239323936}{MB\_DIAG}}.DeviceMode\ =\ MODBUS\_NORMAL\_MODE;}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00026}00026\ \ \ }
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00027}00027\ \ \ \textcolor{comment}{//\ Инициализация\ счетчиков}}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00028}00028\ \ \ \mbox{\hyperlink{group___m_o_d_b_u_s___d_i_a_g_ga4ba6111ac80e342396f9703239323936}{MB\_DIAG}}.Counters.BusMessage\ =\ 0;}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00029}00029\ \ \ \mbox{\hyperlink{group___m_o_d_b_u_s___d_i_a_g_ga4ba6111ac80e342396f9703239323936}{MB\_DIAG}}.Counters.BusCommunicationErr\ =\ 0;}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00030}00030\ \ \ \mbox{\hyperlink{group___m_o_d_b_u_s___d_i_a_g_ga4ba6111ac80e342396f9703239323936}{MB\_DIAG}}.Counters.BusExceptionErr\ =\ 0;}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00031}00031\ \ \ \mbox{\hyperlink{group___m_o_d_b_u_s___d_i_a_g_ga4ba6111ac80e342396f9703239323936}{MB\_DIAG}}.Counters.SlaveMessage\ =\ 0;}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00032}00032\ \ \ \mbox{\hyperlink{group___m_o_d_b_u_s___d_i_a_g_ga4ba6111ac80e342396f9703239323936}{MB\_DIAG}}.Counters.SlaveNoResponse\ =\ 0;}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00033}00033\ \ \ \mbox{\hyperlink{group___m_o_d_b_u_s___d_i_a_g_ga4ba6111ac80e342396f9703239323936}{MB\_DIAG}}.Counters.SlaveNAK\ =\ 0;}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00034}00034\ \ \ \mbox{\hyperlink{group___m_o_d_b_u_s___d_i_a_g_ga4ba6111ac80e342396f9703239323936}{MB\_DIAG}}.Counters.SlaveBusy\ =\ 0;}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00035}00035\ \ \ \mbox{\hyperlink{group___m_o_d_b_u_s___d_i_a_g_ga4ba6111ac80e342396f9703239323936}{MB\_DIAG}}.Counters.BusCharacterOverrun\ =\ 0;}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00036}00036\ \}}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00037}00037\ }
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00038}00038\ \textcolor{comment}{}}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00039}00039\ \textcolor{comment}{/**}}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00040}00040\ \textcolor{comment}{\ \ *\ @brief\ \ \ \ Выставить\ бит\ в\ регистре\ диагностике}}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00041}00041\ \textcolor{comment}{\ \ *\ @param\ \ \ \ bit\_num\ \ \ \ \ \ \ \ \ Номер\ бита\ для\ выставления\ (1-\/15,\ 0\ бит\ нельзя\ выставить)}}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00042}00042\ \textcolor{comment}{\ \ *\ @param\ \ \ \ bit\_state\ \ \ \ \ \ \ Состояние\ бита\ для\ выставления\ (Выставить/Сбросить)}}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00043}00043\ \textcolor{comment}{\ \ *\ @return\ \ \ >0\ -\/\ номер\ выставленного\ бита,\ 0\ -\/\ ошибка}}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00044}00044\ \textcolor{comment}{\ \ */}}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00045}\mbox{\hyperlink{group___m_o_d_b_u_s___d_a_t_a___a_c_c_e_s_s___f_u_n_c_t_i_o_n_s_gab1237f28e2db2cd2e8a93b31cd9a61be}{00045}}\ \textcolor{keywordtype}{int}\ \mbox{\hyperlink{group___m_o_d_b_u_s___d_a_t_a___a_c_c_e_s_s___f_u_n_c_t_i_o_n_s_gab1237f28e2db2cd2e8a93b31cd9a61be}{MB\_Diagnostics\_WriteBit}}(\textcolor{keywordtype}{int}\ bit\_num,\ \textcolor{keywordtype}{int}\ bit\_state)}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00046}00046\ \{}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00047}00047\ \ \ \textcolor{keywordflow}{if}(bit\_num\ ==\ 0\ ||\ bit\_num\ >\ 15)}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00048}00048\ \ \ \ \ \textcolor{keywordflow}{return}\ 0;}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00049}00049\ \ \ }
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00050}00050\ \ \ \textcolor{keywordflow}{if}(bit\_state)}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00051}00051\ \ \ \ \ \mbox{\hyperlink{group___m_o_d_b_u_s___d_i_a_g_ga4ba6111ac80e342396f9703239323936}{MB\_DIAG}}.DiagnosticRegister\ |=\ (1\ <<\ bit\_num);}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00052}00052\ \ \ \textcolor{keywordflow}{else}}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00053}00053\ \ \ \ \ \mbox{\hyperlink{group___m_o_d_b_u_s___d_i_a_g_ga4ba6111ac80e342396f9703239323936}{MB\_DIAG}}.DiagnosticRegister\ \&=\ \string~(1\ <<\ bit\_num);}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00054}00054\ \ \ }
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00055}00055\ \ \ \textcolor{keywordflow}{return}\ bit\_num;}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00056}00056\ \}\textcolor{comment}{}}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00057}00057\ \textcolor{comment}{/**}}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00058}00058\ \textcolor{comment}{\ \ *\ @brief\ \ \ \ Прочитать\ состояние\ бита\ диагностического\ регистра}}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00059}00059\ \textcolor{comment}{\ \ *\ @param\ \ \ \ bit\_num\ \ \ \ \ \ \ \ \ Номер\ бита\ (0-\/15)}}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00060}00060\ \textcolor{comment}{\ \ *\ @return\ \ \ 1\ -\/\ бит\ установлен,\ 0\ -\/\ бит\ сброшен\ или\ ошибка}}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00061}00061\ \textcolor{comment}{\ \ */}}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00062}\mbox{\hyperlink{group___m_o_d_b_u_s___d_a_t_a___a_c_c_e_s_s___f_u_n_c_t_i_o_n_s_ga5588ddb15ee2580e7659701e5e671e8f}{00062}}\ \textcolor{keywordtype}{int}\ \mbox{\hyperlink{group___m_o_d_b_u_s___d_a_t_a___a_c_c_e_s_s___f_u_n_c_t_i_o_n_s_ga5588ddb15ee2580e7659701e5e671e8f}{MB\_Diagnostics\_GetBit}}(\textcolor{keywordtype}{int}\ bit\_num)}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00063}00063\ \{}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00064}00064\ \ \ \textcolor{keywordflow}{if}(bit\_num\ <\ 0\ ||\ bit\_num\ >\ 15)}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00065}00065\ \ \ \ \ \textcolor{keywordflow}{return}\ 0;}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00066}00066\ \ \ \ \ }
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00067}00067\ \ \ \textcolor{keywordflow}{return}\ (\mbox{\hyperlink{group___m_o_d_b_u_s___d_i_a_g_ga4ba6111ac80e342396f9703239323936}{MB\_DIAG}}.DiagnosticRegister\ >>\ bit\_num)\ \&\ 0x01;}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00068}00068\ \}}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00069}00069\ \textcolor{comment}{}}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00070}00070\ \textcolor{comment}{/**}}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00071}00071\ \textcolor{comment}{\ \ *\ @brief\ \ \ \ Обработать\ функцию\ Diagnostics\ (Serial\ Line\ only)\ (0x08)}}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00072}00072\ \textcolor{comment}{\ \ *\ @param\ \ \ \ modbus\_msg\ \ \ \ \ \ \ \ Указатель\ на\ структуру\ сообщения\ modbus}}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00073}00073\ \textcolor{comment}{\ \ *\ @return\ \ \ fMessageHandled\ \ \ Статус\ обработки\ команды}}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00074}00074\ \textcolor{comment}{\ \ */}}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00075}\mbox{\hyperlink{group___m_o_d_b_u_s___c_m_d___p_r_o_c_e_s_s___f_u_n_c_t_i_o_n_s_ga6bbfc53b20b4698a08d79851b5db65f0}{00075}}\ uint8\_t\ \mbox{\hyperlink{group___m_o_d_b_u_s___c_m_d___p_r_o_c_e_s_s___f_u_n_c_t_i_o_n_s_ga6bbfc53b20b4698a08d79851b5db65f0}{MB\_Process\_Diagnostics}}(\mbox{\hyperlink{struct_r_s___msg_type_def}{RS\_MsgTypeDef}}\ *modbus\_msg)}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00076}00076\ \{}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00077}00077\ \ \ uint16\_t\ sub\_function\ =\ modbus\_msg-\/>\mbox{\hyperlink{struct_r_s___msg_type_def_aacbc6754621bd84742cd6c2ba65ad094}{MbData}}[0];}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00078}00078\ \ \ uint16\_t\ request\_data\ =\ modbus\_msg-\/>\mbox{\hyperlink{struct_r_s___msg_type_def_aacbc6754621bd84742cd6c2ba65ad094}{MbData}}[1];}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00079}00079\ \ \ }
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00080}00080\ \ \ \textcolor{comment}{//\ Если\ устройство\ в\ режиме\ Listen\ Only,\ отвечаем\ только\ на\ sub-\/function\ 0x01}}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00081}00081\ \ \ \textcolor{keywordflow}{if}\ (\mbox{\hyperlink{group___m_o_d_b_u_s___d_i_a_g_ga4ba6111ac80e342396f9703239323936}{MB\_DIAG}}.DeviceMode\ ==\ MODBUS\_LISTEN\_ONLY\_MODE\ \&\&\ sub\_function\ !=\ 0x0001)}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00082}00082\ \ \ \{}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00083}00083\ \ \ \ \ \textcolor{keywordflow}{return}\ 0;\ \textcolor{comment}{//\ Не\ отвечаем\ в\ режиме\ Listen\ Only}}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00084}00084\ \ \ \}}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00085}00085\ \ \ }
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00086}00086\ \ \ \textcolor{keywordflow}{switch}(sub\_function)}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00087}00087\ \ \ \{}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00088}00088\ \ \ \ \ \textcolor{keywordflow}{case}\ 0x0000:\ \textcolor{comment}{//\ Return\ Query\ Data}}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00089}00089\ \ \ \ \ \ \ \textcolor{comment}{//\ Эхо-\/ответ\ с\ теми\ же\ данными}}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00090}00090\ \ \ \ \ \ \ modbus\_msg-\/>\mbox{\hyperlink{struct_r_s___msg_type_def_aacbc6754621bd84742cd6c2ba65ad094}{MbData}}[0]\ =\ sub\_function;}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00091}00091\ \ \ \ \ \ \ modbus\_msg-\/>\mbox{\hyperlink{struct_r_s___msg_type_def_aacbc6754621bd84742cd6c2ba65ad094}{MbData}}[1]\ =\ request\_data;}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00092}00092\ \ \ \ \ \ \ modbus\_msg-\/>\mbox{\hyperlink{struct_r_s___msg_type_def_a5c69bf212dc5e7dc2eaa50971e27e2a6}{ByteCnt}}\ =\ 4;}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00093}00093\ \ \ \ \ \ \ \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00094}00094\ \ \ \ \ \ \ \ \ }
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00095}00095\ \ \ \ \ \textcolor{keywordflow}{case}\ 0x0001:\ \textcolor{comment}{//\ Restart\ Communications}}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00096}00096\ \ \ \ \ \ \ \textcolor{comment}{//\ Перезапуск\ коммуникаций\ -\/\ выходим\ из\ Listen\ Only\ режима}}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00097}00097\ \ \ \ \ \ \ \mbox{\hyperlink{group___m_o_d_b_u_s___d_i_a_g_ga4ba6111ac80e342396f9703239323936}{MB\_DIAG}}.DeviceMode\ =\ MODBUS\_NORMAL\_MODE;}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00098}00098\ \ \ \ \ \ \ }
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00099}00099\ \ \ \ \ \ \ \textcolor{comment}{//\ Если\ request\_data\ =\ 0xFF00,\ очищаем\ лог\ событий}}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00100}00100\ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ (request\_data\ ==\ 0xFF00)}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00101}00101\ \ \ \ \ \ \ \{}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00102}00102\ \ \ \ \ \ \ \ \ \ \ \mbox{\hyperlink{group___m_o_d_b_u_s___d_i_a_g_ga9b61a6d4139bac318868e93f03cd82c7}{MB\_DiagnosticsInit}}();\ \textcolor{comment}{//\ Полный\ сброс}}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00103}00103\ \ \ \ \ \ \ \}}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00104}00104\ \ \ \ \ \ \ \textcolor{keywordflow}{else}}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00105}00105\ \ \ \ \ \ \ \{}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00106}00106\ \ \ \ \ \ \ \ \ \textcolor{comment}{//\ Очищаем\ только\ счетчики,\ но\ не\ регистр\ диагностики}}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00107}00107\ \ \ \ \ \ \ \ \ \mbox{\hyperlink{group___m_o_d_b_u_s___d_i_a_g_ga4ba6111ac80e342396f9703239323936}{MB\_DIAG}}.Counters.BusMessage\ =\ 0;}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00108}00108\ \ \ \ \ \ \ \ \ \mbox{\hyperlink{group___m_o_d_b_u_s___d_i_a_g_ga4ba6111ac80e342396f9703239323936}{MB\_DIAG}}.Counters.BusCommunicationErr\ =\ 0;}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00109}00109\ \ \ \ \ \ \ \ \ \mbox{\hyperlink{group___m_o_d_b_u_s___d_i_a_g_ga4ba6111ac80e342396f9703239323936}{MB\_DIAG}}.Counters.BusExceptionErr\ =\ 0;}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00110}00110\ \ \ \ \ \ \ \ \ \mbox{\hyperlink{group___m_o_d_b_u_s___d_i_a_g_ga4ba6111ac80e342396f9703239323936}{MB\_DIAG}}.Counters.SlaveMessage\ =\ 0;}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00111}00111\ \ \ \ \ \ \ \ \ \mbox{\hyperlink{group___m_o_d_b_u_s___d_i_a_g_ga4ba6111ac80e342396f9703239323936}{MB\_DIAG}}.Counters.SlaveNoResponse\ =\ 0;}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00112}00112\ \ \ \ \ \ \ \ \ \mbox{\hyperlink{group___m_o_d_b_u_s___d_i_a_g_ga4ba6111ac80e342396f9703239323936}{MB\_DIAG}}.Counters.SlaveNAK\ =\ 0;}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00113}00113\ \ \ \ \ \ \ \ \ \mbox{\hyperlink{group___m_o_d_b_u_s___d_i_a_g_ga4ba6111ac80e342396f9703239323936}{MB\_DIAG}}.Counters.SlaveBusy\ =\ 0;}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00114}00114\ \ \ \ \ \ \ \ \ \mbox{\hyperlink{group___m_o_d_b_u_s___d_i_a_g_ga4ba6111ac80e342396f9703239323936}{MB\_DIAG}}.Counters.BusCharacterOverrun\ =\ 0;}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00115}00115\ \ \ \ \ \ \ \}}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00116}00116\ \ \ \ \ \ \ }
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00117}00117\ \ \ \ \ \ \ modbus\_msg-\/>\mbox{\hyperlink{struct_r_s___msg_type_def_aacbc6754621bd84742cd6c2ba65ad094}{MbData}}[0]\ =\ sub\_function;}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00118}00118\ \ \ \ \ \ \ modbus\_msg-\/>\mbox{\hyperlink{struct_r_s___msg_type_def_aacbc6754621bd84742cd6c2ba65ad094}{MbData}}[1]\ =\ request\_data;}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00119}00119\ \ \ \ \ \ \ modbus\_msg-\/>\mbox{\hyperlink{struct_r_s___msg_type_def_a5c69bf212dc5e7dc2eaa50971e27e2a6}{ByteCnt}}\ =\ 4;}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00120}00120\ \ \ \ \ \ \ \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00121}00121\ \ \ \ \ \ \ \ \ }
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00122}00122\ \ \ \ \ \textcolor{keywordflow}{case}\ 0x0002:\ \textcolor{comment}{//\ Return\ Diagnostic\ Register}}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00123}00123\ \ \ \ \ \ \ modbus\_msg-\/>\mbox{\hyperlink{struct_r_s___msg_type_def_aacbc6754621bd84742cd6c2ba65ad094}{MbData}}[0]\ =\ sub\_function;}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00124}00124\ \ \ \ \ \ \ modbus\_msg-\/>\mbox{\hyperlink{struct_r_s___msg_type_def_aacbc6754621bd84742cd6c2ba65ad094}{MbData}}[1]\ =\ \mbox{\hyperlink{group___m_o_d_b_u_s___d_i_a_g_ga4ba6111ac80e342396f9703239323936}{MB\_DIAG}}.DiagnosticRegister;}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00125}00125\ \ \ \ \ \ \ modbus\_msg-\/>\mbox{\hyperlink{struct_r_s___msg_type_def_a5c69bf212dc5e7dc2eaa50971e27e2a6}{ByteCnt}}\ =\ 4;}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00126}00126\ \ \ \ \ \ \ \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00127}00127\ \ \ \ \ \ \ \ \ }
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00128}00128\ \ \ \ \ \textcolor{keywordflow}{case}\ 0x0003:\ \textcolor{comment}{//\ Change\ ASCII\ Input\ Delimiter}}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00129}00129\ \ \ \ \ \ \ \textcolor{comment}{//\ В\ RTU\ режиме\ не\ поддерживается}}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00130}00130\ \ \ \ \ \ \ modbus\_msg-\/>\mbox{\hyperlink{struct_r_s___msg_type_def_a176d779ab0d7fd06a4303e6e6acb6ca9}{FuncCode}}\ |=\ \mbox{\hyperlink{group___m_o_d_b_u_s___m_e_s_s_a_g_e___d_e_f_i_n_e_s_ga822b0fd9ae9ff25dfa6748473e8e8627}{FC\_ERR\_VALUES\_START}};}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00131}00131\ \ \ \ \ \ \ modbus\_msg-\/>\mbox{\hyperlink{struct_r_s___msg_type_def_a3dab5eaf3a1dd5719b8bfec1adad0d39}{Except\_Code}}\ =\ \mbox{\hyperlink{group___m_o_d_b_u_s___m_e_s_s_a_g_e___d_e_f_i_n_e_s_gga4ade64cb3fabf37f010c1e297489980cae81af967ab54904738ee391eb7478ad1}{ET\_ILLEGAL\_FUNCTION}};}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00132}00132\ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ 0;}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00133}00133\ \ \ \ \ \ \ \ \ }
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00134}00134\ \ \ \ \ \textcolor{keywordflow}{case}\ 0x0004:\ \textcolor{comment}{//\ Force\ Listen\ Only\ Mode}}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00135}00135\ \ \ \ \ \ \ \mbox{\hyperlink{group___m_o_d_b_u_s___d_i_a_g_ga4ba6111ac80e342396f9703239323936}{MB\_DIAG}}.DeviceMode\ =\ MODBUS\_LISTEN\_ONLY\_MODE;}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00136}00136\ \ \ \ \ \ \ \textcolor{comment}{//\ В\ режиме\ Listen\ Only\ не\ отправляем\ ответ}}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00137}00137\ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ 0;}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00138}00138\ \ \ \ \ \ \ \ \ }
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00139}00139\ \ \ \ \ \textcolor{keywordflow}{case}\ 0x000A:\ \textcolor{comment}{//\ Clear\ Counters\ and\ Diagnostic\ Register}}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00140}00140\ \ \ \ \ \ \ \mbox{\hyperlink{group___m_o_d_b_u_s___d_i_a_g_ga9b61a6d4139bac318868e93f03cd82c7}{MB\_DiagnosticsInit}}();\ \textcolor{comment}{//\ Полный\ сброс}}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00141}00141\ \ \ \ \ \ \ modbus\_msg-\/>\mbox{\hyperlink{struct_r_s___msg_type_def_aacbc6754621bd84742cd6c2ba65ad094}{MbData}}[0]\ =\ sub\_function;}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00142}00142\ \ \ \ \ \ \ modbus\_msg-\/>\mbox{\hyperlink{struct_r_s___msg_type_def_aacbc6754621bd84742cd6c2ba65ad094}{MbData}}[1]\ =\ 0;}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00143}00143\ \ \ \ \ \ \ modbus\_msg-\/>\mbox{\hyperlink{struct_r_s___msg_type_def_a5c69bf212dc5e7dc2eaa50971e27e2a6}{ByteCnt}}\ =\ 4;}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00144}00144\ \ \ \ \ \ \ \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00145}00145\ \ \ \ \ \ \ \ \ }
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00146}00146\ \ \ \ \ \textcolor{keywordflow}{case}\ 0x000B:\ \textcolor{comment}{//\ Return\ Bus\ Message\ Count}}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00147}00147\ \ \ \ \ \ \ modbus\_msg-\/>\mbox{\hyperlink{struct_r_s___msg_type_def_aacbc6754621bd84742cd6c2ba65ad094}{MbData}}[0]\ =\ sub\_function;}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00148}00148\ \ \ \ \ \ \ modbus\_msg-\/>\mbox{\hyperlink{struct_r_s___msg_type_def_aacbc6754621bd84742cd6c2ba65ad094}{MbData}}[1]\ =\ \mbox{\hyperlink{group___m_o_d_b_u_s___d_i_a_g_ga4ba6111ac80e342396f9703239323936}{MB\_DIAG}}.Counters.BusMessage;}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00149}00149\ \ \ \ \ \ \ modbus\_msg-\/>\mbox{\hyperlink{struct_r_s___msg_type_def_a5c69bf212dc5e7dc2eaa50971e27e2a6}{ByteCnt}}\ =\ 4;}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00150}00150\ \ \ \ \ \ \ \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00151}00151\ \ \ \ \ \ \ \ \ }
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00152}00152\ \ \ \ \ \textcolor{keywordflow}{case}\ 0x000C:\ \textcolor{comment}{//\ Return\ Bus\ Communication\ Error\ Count}}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00153}00153\ \ \ \ \ \ \ modbus\_msg-\/>\mbox{\hyperlink{struct_r_s___msg_type_def_aacbc6754621bd84742cd6c2ba65ad094}{MbData}}[0]\ =\ sub\_function;}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00154}00154\ \ \ \ \ \ \ modbus\_msg-\/>\mbox{\hyperlink{struct_r_s___msg_type_def_aacbc6754621bd84742cd6c2ba65ad094}{MbData}}[1]\ =\ \mbox{\hyperlink{group___m_o_d_b_u_s___d_i_a_g_ga4ba6111ac80e342396f9703239323936}{MB\_DIAG}}.Counters.BusCommunicationErr;}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00155}00155\ \ \ \ \ \ \ modbus\_msg-\/>\mbox{\hyperlink{struct_r_s___msg_type_def_a5c69bf212dc5e7dc2eaa50971e27e2a6}{ByteCnt}}\ =\ 4;}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00156}00156\ \ \ \ \ \ \ \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00157}00157\ \ \ \ \ \ \ \ \ }
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00158}00158\ \ \ \ \ \textcolor{keywordflow}{case}\ 0x000D:\ \textcolor{comment}{//\ Return\ Bus\ Exception\ Error\ Count}}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00159}00159\ \ \ \ \ \ \ modbus\_msg-\/>\mbox{\hyperlink{struct_r_s___msg_type_def_aacbc6754621bd84742cd6c2ba65ad094}{MbData}}[0]\ =\ sub\_function;}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00160}00160\ \ \ \ \ \ \ modbus\_msg-\/>\mbox{\hyperlink{struct_r_s___msg_type_def_aacbc6754621bd84742cd6c2ba65ad094}{MbData}}[1]\ =\ \mbox{\hyperlink{group___m_o_d_b_u_s___d_i_a_g_ga4ba6111ac80e342396f9703239323936}{MB\_DIAG}}.Counters.BusExceptionErr;}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00161}00161\ \ \ \ \ \ \ modbus\_msg-\/>\mbox{\hyperlink{struct_r_s___msg_type_def_a5c69bf212dc5e7dc2eaa50971e27e2a6}{ByteCnt}}\ =\ 4;}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00162}00162\ \ \ \ \ \ \ \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00163}00163\ \ \ \ \ \ \ \ \ }
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00164}00164\ \ \ \ \ \textcolor{keywordflow}{case}\ 0x000E:\ \textcolor{comment}{//\ Return\ Server\ Message\ Count}}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00165}00165\ \ \ \ \ \ \ modbus\_msg-\/>\mbox{\hyperlink{struct_r_s___msg_type_def_aacbc6754621bd84742cd6c2ba65ad094}{MbData}}[0]\ =\ sub\_function;}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00166}00166\ \ \ \ \ \ \ modbus\_msg-\/>\mbox{\hyperlink{struct_r_s___msg_type_def_aacbc6754621bd84742cd6c2ba65ad094}{MbData}}[1]\ =\ \mbox{\hyperlink{group___m_o_d_b_u_s___d_i_a_g_ga4ba6111ac80e342396f9703239323936}{MB\_DIAG}}.Counters.SlaveMessage;}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00167}00167\ \ \ \ \ \ \ modbus\_msg-\/>\mbox{\hyperlink{struct_r_s___msg_type_def_a5c69bf212dc5e7dc2eaa50971e27e2a6}{ByteCnt}}\ =\ 4;}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00168}00168\ \ \ \ \ \ \ \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00169}00169\ \ \ \ \ \ \ \ \ }
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00170}00170\ \ \ \ \ \textcolor{keywordflow}{case}\ 0x000F:\ \textcolor{comment}{//\ Return\ Slave\ No\ Response\ Count}}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00171}00171\ \ \ \ \ \ \ modbus\_msg-\/>\mbox{\hyperlink{struct_r_s___msg_type_def_aacbc6754621bd84742cd6c2ba65ad094}{MbData}}[0]\ =\ sub\_function;}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00172}00172\ \ \ \ \ \ \ modbus\_msg-\/>\mbox{\hyperlink{struct_r_s___msg_type_def_aacbc6754621bd84742cd6c2ba65ad094}{MbData}}[1]\ =\ \mbox{\hyperlink{group___m_o_d_b_u_s___d_i_a_g_ga4ba6111ac80e342396f9703239323936}{MB\_DIAG}}.Counters.SlaveNoResponse;}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00173}00173\ \ \ \ \ \ \ modbus\_msg-\/>\mbox{\hyperlink{struct_r_s___msg_type_def_a5c69bf212dc5e7dc2eaa50971e27e2a6}{ByteCnt}}\ =\ 4;}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00174}00174\ \ \ \ \ \ \ \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00175}00175\ \ \ \ \ \ \ \ \ }
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00176}00176\ \ \ \ \ \textcolor{keywordflow}{case}\ 0x0010:\ \textcolor{comment}{//\ Return\ Slave\ NAK\ Count}}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00177}00177\ \ \ \ \ \ \ modbus\_msg-\/>\mbox{\hyperlink{struct_r_s___msg_type_def_aacbc6754621bd84742cd6c2ba65ad094}{MbData}}[0]\ =\ sub\_function;}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00178}00178\ \ \ \ \ \ \ modbus\_msg-\/>\mbox{\hyperlink{struct_r_s___msg_type_def_aacbc6754621bd84742cd6c2ba65ad094}{MbData}}[1]\ =\ \mbox{\hyperlink{group___m_o_d_b_u_s___d_i_a_g_ga4ba6111ac80e342396f9703239323936}{MB\_DIAG}}.Counters.SlaveNAK;}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00179}00179\ \ \ \ \ \ \ modbus\_msg-\/>\mbox{\hyperlink{struct_r_s___msg_type_def_a5c69bf212dc5e7dc2eaa50971e27e2a6}{ByteCnt}}\ =\ 4;}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00180}00180\ \ \ \ \ \ \ \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00181}00181\ \ \ \ \ \ \ \ \ }
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00182}00182\ \ \ \ \ \textcolor{keywordflow}{case}\ 0x0011:\ \textcolor{comment}{//\ Return\ Slave\ Busy\ Count}}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00183}00183\ \ \ \ \ \ \ modbus\_msg-\/>\mbox{\hyperlink{struct_r_s___msg_type_def_aacbc6754621bd84742cd6c2ba65ad094}{MbData}}[0]\ =\ sub\_function;}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00184}00184\ \ \ \ \ \ \ modbus\_msg-\/>\mbox{\hyperlink{struct_r_s___msg_type_def_aacbc6754621bd84742cd6c2ba65ad094}{MbData}}[1]\ =\ \mbox{\hyperlink{group___m_o_d_b_u_s___d_i_a_g_ga4ba6111ac80e342396f9703239323936}{MB\_DIAG}}.Counters.SlaveBusy;}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00185}00185\ \ \ \ \ \ \ modbus\_msg-\/>\mbox{\hyperlink{struct_r_s___msg_type_def_a5c69bf212dc5e7dc2eaa50971e27e2a6}{ByteCnt}}\ =\ 4;}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00186}00186\ \ \ \ \ \ \ \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00187}00187\ \ \ \ \ \ \ \ \ }
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00188}00188\ \ \ \ \ \textcolor{keywordflow}{case}\ 0x0012:\ \textcolor{comment}{//\ Return\ Bus\ Character\ Overrun\ Count}}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00189}00189\ \ \ \ \ \ \ modbus\_msg-\/>\mbox{\hyperlink{struct_r_s___msg_type_def_aacbc6754621bd84742cd6c2ba65ad094}{MbData}}[0]\ =\ sub\_function;}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00190}00190\ \ \ \ \ \ \ modbus\_msg-\/>\mbox{\hyperlink{struct_r_s___msg_type_def_aacbc6754621bd84742cd6c2ba65ad094}{MbData}}[1]\ =\ \mbox{\hyperlink{group___m_o_d_b_u_s___d_i_a_g_ga4ba6111ac80e342396f9703239323936}{MB\_DIAG}}.Counters.BusCharacterOverrun;}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00191}00191\ \ \ \ \ \ \ modbus\_msg-\/>\mbox{\hyperlink{struct_r_s___msg_type_def_a5c69bf212dc5e7dc2eaa50971e27e2a6}{ByteCnt}}\ =\ 4;}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00192}00192\ \ \ \ \ \ \ \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00193}00193\ \ \ \ \ \ \ \ \ }
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00194}00194\ \ \ \ \ \textcolor{keywordflow}{case}\ 0x0014:\ \textcolor{comment}{//\ Clear\ Overrun\ Counter\ and\ Flag}}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00195}00195\ \ \ \ \ \ \ \mbox{\hyperlink{group___m_o_d_b_u_s___d_i_a_g_ga4ba6111ac80e342396f9703239323936}{MB\_DIAG}}.Counters.BusCharacterOverrun\ =\ 0;}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00196}00196\ \ \ \ \ \ \ \textcolor{comment}{//\ Сбрасываем\ флаг\ переполнения\ в\ DiagnosticRegister}}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00197}00197\ \ \ \ \ \ \ \mbox{\hyperlink{group___m_o_d_b_u_s___d_i_a_g_ga4ba6111ac80e342396f9703239323936}{MB\_DIAG}}.DiagnosticRegister\ \&=\ \string~(1<<0);}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00198}00198\ \ \ \ \ \ \ modbus\_msg-\/>\mbox{\hyperlink{struct_r_s___msg_type_def_aacbc6754621bd84742cd6c2ba65ad094}{MbData}}[0]\ =\ sub\_function;}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00199}00199\ \ \ \ \ \ \ modbus\_msg-\/>\mbox{\hyperlink{struct_r_s___msg_type_def_aacbc6754621bd84742cd6c2ba65ad094}{MbData}}[1]\ =\ 0;}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00200}00200\ \ \ \ \ \ \ modbus\_msg-\/>\mbox{\hyperlink{struct_r_s___msg_type_def_a5c69bf212dc5e7dc2eaa50971e27e2a6}{ByteCnt}}\ =\ 4;}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00201}00201\ \ \ \ \ \ \ \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00202}00202\ \ \ \ \ \ \ \ \ }
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00203}00203\ \ \ \ \ \textcolor{keywordflow}{default}:}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00204}00204\ \ \ \ \ \ \ modbus\_msg-\/>\mbox{\hyperlink{struct_r_s___msg_type_def_a176d779ab0d7fd06a4303e6e6acb6ca9}{FuncCode}}\ |=\ \mbox{\hyperlink{group___m_o_d_b_u_s___m_e_s_s_a_g_e___d_e_f_i_n_e_s_ga822b0fd9ae9ff25dfa6748473e8e8627}{FC\_ERR\_VALUES\_START}};}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00205}00205\ \ \ \ \ \ \ modbus\_msg-\/>\mbox{\hyperlink{struct_r_s___msg_type_def_a3dab5eaf3a1dd5719b8bfec1adad0d39}{Except\_Code}}\ =\ \mbox{\hyperlink{group___m_o_d_b_u_s___m_e_s_s_a_g_e___d_e_f_i_n_e_s_gga4ade64cb3fabf37f010c1e297489980cae81af967ab54904738ee391eb7478ad1}{ET\_ILLEGAL\_FUNCTION}};}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00206}00206\ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ 0;}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00207}00207\ \ \ \}}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00208}00208\ \ \ }
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00209}00209\ \ \ \textcolor{keywordflow}{return}\ 1;}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00210}00210\ \}}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00211}00211\ \textcolor{comment}{}}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00212}00212\ \textcolor{comment}{/**}}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00213}00213\ \textcolor{comment}{\ \ *\ @brief\ \ \ \ Увеличивает\ счетчик\ сообщений\ на\ шине}}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00214}00214\ \textcolor{comment}{\ \ */}}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00215}\mbox{\hyperlink{group___m_o_d_b_u_s___d_a_t_a___a_c_c_e_s_s___f_u_n_c_t_i_o_n_s_gae379458fa9cea50d5e313a68e716cb83}{00215}}\ \textcolor{keywordtype}{void}\ \mbox{\hyperlink{group___m_o_d_b_u_s___d_a_t_a___a_c_c_e_s_s___f_u_n_c_t_i_o_n_s_gae379458fa9cea50d5e313a68e716cb83}{MB\_Diagnostics\_BusMessageCnt}}(\textcolor{keywordtype}{void})}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00216}00216\ \{}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00217}00217\ \ \ \mbox{\hyperlink{group___m_o_d_b_u_s___d_i_a_g_ga4ba6111ac80e342396f9703239323936}{MB\_DIAG}}.Counters.BusMessage++;}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00218}00218\ \}}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00219}00219\ \textcolor{comment}{}}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00220}00220\ \textcolor{comment}{/**}}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00221}00221\ \textcolor{comment}{\ \ *\ @brief\ Увеличивает\ счетчик\ ошибок\ связи}}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00222}00222\ \textcolor{comment}{\ \ */}}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00223}\mbox{\hyperlink{group___m_o_d_b_u_s___d_a_t_a___a_c_c_e_s_s___f_u_n_c_t_i_o_n_s_ga10f9e4dd9f3dda4bb0f66c323d6b29d7}{00223}}\ \textcolor{keywordtype}{void}\ \mbox{\hyperlink{group___m_o_d_b_u_s___d_a_t_a___a_c_c_e_s_s___f_u_n_c_t_i_o_n_s_ga10f9e4dd9f3dda4bb0f66c323d6b29d7}{MB\_Diagnostics\_CommunicationErrorCnt}}(\textcolor{keywordtype}{void})}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00224}00224\ \{}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00225}00225\ \ \ \textcolor{keywordflow}{if}\ (\mbox{\hyperlink{group___m_o_d_b_u_s___d_i_a_g_ga4ba6111ac80e342396f9703239323936}{MB\_DIAG}}.Counters.BusCommunicationErr\ <\ 0xFFFF)}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00226}00226\ \ \ \ \ \mbox{\hyperlink{group___m_o_d_b_u_s___d_i_a_g_ga4ba6111ac80e342396f9703239323936}{MB\_DIAG}}.Counters.BusCommunicationErr++;}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00227}00227\ \}}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00228}00228\ \textcolor{comment}{}}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00229}00229\ \textcolor{comment}{/**}}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00230}00230\ \textcolor{comment}{\ \ *\ @brief\ Увеличивает\ счетчик\ исключений}}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00231}00231\ \textcolor{comment}{\ \ */}}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00232}\mbox{\hyperlink{group___m_o_d_b_u_s___d_a_t_a___a_c_c_e_s_s___f_u_n_c_t_i_o_n_s_ga82e0bf0c4452c25bf3f05a20abb7cc74}{00232}}\ \textcolor{keywordtype}{void}\ \mbox{\hyperlink{group___m_o_d_b_u_s___d_a_t_a___a_c_c_e_s_s___f_u_n_c_t_i_o_n_s_ga82e0bf0c4452c25bf3f05a20abb7cc74}{MB\_Diagnostics\_ExceptionErrorCnt}}(\textcolor{keywordtype}{void})}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00233}00233\ \{}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00234}00234\ \ \ \textcolor{keywordflow}{if}\ (\mbox{\hyperlink{group___m_o_d_b_u_s___d_i_a_g_ga4ba6111ac80e342396f9703239323936}{MB\_DIAG}}.Counters.BusExceptionErr\ <\ 0xFFFF)}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00235}00235\ \ \ \ \ \mbox{\hyperlink{group___m_o_d_b_u_s___d_i_a_g_ga4ba6111ac80e342396f9703239323936}{MB\_DIAG}}.Counters.BusExceptionErr++;}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00236}00236\ \}}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00237}00237\ \textcolor{comment}{}}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00238}00238\ \textcolor{comment}{/**}}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00239}00239\ \textcolor{comment}{\ \ *\ @brief\ Увеличивает\ счетчик\ переполнения\ символов}}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00240}00240\ \textcolor{comment}{\ \ */}}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00241}\mbox{\hyperlink{group___m_o_d_b_u_s___d_a_t_a___a_c_c_e_s_s___f_u_n_c_t_i_o_n_s_gaff7c464d7d66399232770bac78b653a4}{00241}}\ \textcolor{keywordtype}{void}\ \mbox{\hyperlink{group___m_o_d_b_u_s___d_a_t_a___a_c_c_e_s_s___f_u_n_c_t_i_o_n_s_gaff7c464d7d66399232770bac78b653a4}{MB\_Diagnostics\_CharacterOverrunCnt}}(\textcolor{keywordtype}{void})}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00242}00242\ \{}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00243}00243\ \ \ \textcolor{keywordflow}{if}\ (\mbox{\hyperlink{group___m_o_d_b_u_s___d_i_a_g_ga4ba6111ac80e342396f9703239323936}{MB\_DIAG}}.Counters.BusCharacterOverrun\ <\ 0xFFFF)}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00244}00244\ \ \ \{}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00245}00245\ \ \ \ \ \mbox{\hyperlink{group___m_o_d_b_u_s___d_i_a_g_ga4ba6111ac80e342396f9703239323936}{MB\_DIAG}}.Counters.BusCharacterOverrun++;}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00246}00246\ \ \ \ \ \textcolor{comment}{//\ Устанавливаем\ флаг\ переполнения\ в\ DiagnosticRegister}}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00247}00247\ \ \ \ \ \mbox{\hyperlink{group___m_o_d_b_u_s___d_i_a_g_ga4ba6111ac80e342396f9703239323936}{MB\_DIAG}}.DiagnosticRegister\ |=\ (1\ <<\ 0);}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00248}00248\ \ \ \}}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00249}00249\ \}}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00250}00250\ \textcolor{comment}{}}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00251}00251\ \textcolor{comment}{/**}}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00252}00252\ \textcolor{comment}{\ \ *\ @brief\ Увеличивает\ счетчик\ отсутствия\ ответов}}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00253}00253\ \textcolor{comment}{\ \ */}}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00254}\mbox{\hyperlink{group___m_o_d_b_u_s___d_a_t_a___a_c_c_e_s_s___f_u_n_c_t_i_o_n_s_ga22a48a04ef64f74b5974c4fdb1445936}{00254}}\ \textcolor{keywordtype}{void}\ \mbox{\hyperlink{group___m_o_d_b_u_s___d_a_t_a___a_c_c_e_s_s___f_u_n_c_t_i_o_n_s_ga22a48a04ef64f74b5974c4fdb1445936}{MB\_Diagnostics\_SlaveMessageCnt}}(\textcolor{keywordtype}{void})}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00255}00255\ \{}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00256}00256\ \ \ \textcolor{keywordflow}{if}\ (\mbox{\hyperlink{group___m_o_d_b_u_s___d_i_a_g_ga4ba6111ac80e342396f9703239323936}{MB\_DIAG}}.Counters.SlaveMessage\ <\ 0xFFFF)}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00257}00257\ \ \ \ \ \mbox{\hyperlink{group___m_o_d_b_u_s___d_i_a_g_ga4ba6111ac80e342396f9703239323936}{MB\_DIAG}}.Counters.SlaveMessage++;}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00258}00258\ \}}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00259}00259\ \textcolor{comment}{}}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00260}00260\ \textcolor{comment}{/**}}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00261}00261\ \textcolor{comment}{\ \ *\ @brief\ Увеличивает\ счетчик\ отсутствия\ ответов}}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00262}00262\ \textcolor{comment}{\ \ */}}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00263}\mbox{\hyperlink{group___m_o_d_b_u_s___d_a_t_a___a_c_c_e_s_s___f_u_n_c_t_i_o_n_s_gabf80c0e24a0ed3736338218c003d001d}{00263}}\ \textcolor{keywordtype}{void}\ \mbox{\hyperlink{group___m_o_d_b_u_s___d_a_t_a___a_c_c_e_s_s___f_u_n_c_t_i_o_n_s_gabf80c0e24a0ed3736338218c003d001d}{MB\_Diagnostics\_SlaveNoResponseCnt}}(\textcolor{keywordtype}{void})}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00264}00264\ \{}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00265}00265\ \ \ \textcolor{keywordflow}{if}\ (\mbox{\hyperlink{group___m_o_d_b_u_s___d_i_a_g_ga4ba6111ac80e342396f9703239323936}{MB\_DIAG}}.Counters.SlaveNoResponse\ <\ 0xFFFF)}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00266}00266\ \ \ \ \ \mbox{\hyperlink{group___m_o_d_b_u_s___d_i_a_g_ga4ba6111ac80e342396f9703239323936}{MB\_DIAG}}.Counters.SlaveNoResponse++;}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00267}00267\ \}}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00268}00268\ \textcolor{comment}{}}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00269}00269\ \textcolor{comment}{/**}}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00270}00270\ \textcolor{comment}{\ \ *\ @brief\ Увеличивает\ счетчик\ NAK\ ответов}}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00271}00271\ \textcolor{comment}{\ \ */}}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00272}\mbox{\hyperlink{group___m_o_d_b_u_s___d_a_t_a___a_c_c_e_s_s___f_u_n_c_t_i_o_n_s_ga2585ebac184f7fa56059c81419c614b9}{00272}}\ \textcolor{keywordtype}{void}\ \mbox{\hyperlink{group___m_o_d_b_u_s___d_a_t_a___a_c_c_e_s_s___f_u_n_c_t_i_o_n_s_ga2585ebac184f7fa56059c81419c614b9}{MB\_Diagnostics\_SlaveNAKCnt}}(\textcolor{keywordtype}{void})}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00273}00273\ \{}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00274}00274\ \ \ \textcolor{keywordflow}{if}\ (\mbox{\hyperlink{group___m_o_d_b_u_s___d_i_a_g_ga4ba6111ac80e342396f9703239323936}{MB\_DIAG}}.Counters.SlaveNAK\ <\ 0xFFFF)}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00275}00275\ \ \ \ \ \mbox{\hyperlink{group___m_o_d_b_u_s___d_i_a_g_ga4ba6111ac80e342396f9703239323936}{MB\_DIAG}}.Counters.SlaveNAK++;}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00276}00276\ \}}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00277}00277\ \textcolor{comment}{}}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00278}00278\ \textcolor{comment}{/**}}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00279}00279\ \textcolor{comment}{\ \ *\ @brief\ Увеличивает\ счетчик\ занятости\ устройства}}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00280}00280\ \textcolor{comment}{\ \ */}}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00281}\mbox{\hyperlink{group___m_o_d_b_u_s___d_a_t_a___a_c_c_e_s_s___f_u_n_c_t_i_o_n_s_ga4baad1102ba3f09cf3cc121b8d548ddb}{00281}}\ \textcolor{keywordtype}{void}\ \mbox{\hyperlink{group___m_o_d_b_u_s___d_a_t_a___a_c_c_e_s_s___f_u_n_c_t_i_o_n_s_ga4baad1102ba3f09cf3cc121b8d548ddb}{MB\_Diagnostics\_SlaveBusyCnt}}(\textcolor{keywordtype}{void})}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00282}00282\ \{}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00283}00283\ \ \ \textcolor{keywordflow}{if}\ (\mbox{\hyperlink{group___m_o_d_b_u_s___d_i_a_g_ga4ba6111ac80e342396f9703239323936}{MB\_DIAG}}.Counters.SlaveBusy\ <\ 0xFFFF)}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00284}00284\ \ \ \ \ \mbox{\hyperlink{group___m_o_d_b_u_s___d_i_a_g_ga4ba6111ac80e342396f9703239323936}{MB\_DIAG}}.Counters.SlaveBusy++;}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00285}00285\ \}}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00286}00286\ \textcolor{comment}{}}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00287}00287\ \textcolor{comment}{/**}}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00288}00288\ \textcolor{comment}{\ \ *\ @brief\ \ \ \ Получение\ текущего\ режима\ устройства}}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00289}00289\ \textcolor{comment}{\ \ *\ @return\ \ \ Текущий\ режим\ работы\ устройства}}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00290}00290\ \textcolor{comment}{\ \ */}}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00291}\mbox{\hyperlink{group___m_o_d_b_u_s___d_a_t_a___a_c_c_e_s_s___f_u_n_c_t_i_o_n_s_gae7b613f24e9e3d9d95a789c404a3a485}{00291}}\ \mbox{\hyperlink{group___m_o_d_b_u_s___d_i_a_g_ga9d139168bb88bfa1ba1597eeff9ebf6a}{MB\_DeviceModeTypeDef}}\ \mbox{\hyperlink{group___m_o_d_b_u_s___d_a_t_a___a_c_c_e_s_s___f_u_n_c_t_i_o_n_s_gae7b613f24e9e3d9d95a789c404a3a485}{MB\_GetDeviceMode}}(\textcolor{keywordtype}{void})}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00292}00292\ \{}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00293}00293\ \ \ \textcolor{keywordflow}{return}\ \mbox{\hyperlink{group___m_o_d_b_u_s___d_i_a_g_ga4ba6111ac80e342396f9703239323936}{MB\_DIAG}}.DeviceMode;}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00294}00294\ \}}
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00295}00295\ }
\DoxyCodeLine{\Hypertarget{modbus__diag_8c_source_l00296}00296\ \textcolor{preprocessor}{\#endif\ }\textcolor{comment}{//MODBUS\_ENABLE\_DIAGNOSTICS}}

\end{DoxyCode}
