\doxysection{modbus\+\_\+holdregs.\+c}
\hypertarget{modbus__holdregs_8c_source}{}\label{modbus__holdregs_8c_source}\index{E:/.WORK/STM32/Diod\_Test/diode\_tester/Core/Modbus/Src/modbus\_holdregs.c@{E:/.WORK/STM32/Diod\_Test/diode\_tester/Core/Modbus/Src/modbus\_holdregs.c}}
\mbox{\hyperlink{modbus__holdregs_8c}{Go to the documentation of this file.}}
\begin{DoxyCode}{0}
\DoxyCodeLine{\Hypertarget{modbus__holdregs_8c_source_l00001}00001\ \textcolor{comment}{/**}}
\DoxyCodeLine{\Hypertarget{modbus__holdregs_8c_source_l00002}00002\ \textcolor{comment}{*******************************************************************************}}
\DoxyCodeLine{\Hypertarget{modbus__holdregs_8c_source_l00003}00003\ \textcolor{comment}{*\ @file\ modbus\_holdregs.c}}
\DoxyCodeLine{\Hypertarget{modbus__holdregs_8c_source_l00004}00004\ \textcolor{comment}{*\ @brief\ Реализация\ работы\ с\ регистрами\ хранения\ Modbus}}
\DoxyCodeLine{\Hypertarget{modbus__holdregs_8c_source_l00005}00005\ \textcolor{comment}{*******************************************************************************}}
\DoxyCodeLine{\Hypertarget{modbus__holdregs_8c_source_l00006}00006\ \textcolor{comment}{*\ @details}}
\DoxyCodeLine{\Hypertarget{modbus__holdregs_8c_source_l00007}00007\ \textcolor{comment}{Модуль\ для\ доступа\ к\ регистрам\ внутри\ программы:}}
\DoxyCodeLine{\Hypertarget{modbus__holdregs_8c_source_l00008}00008\ \textcolor{comment}{-\/\ Функции\ для\ доступа\ к\ регистрам\ хранения\ по\ глобальным\ адресам}}
\DoxyCodeLine{\Hypertarget{modbus__holdregs_8c_source_l00009}00009\ \textcolor{comment}{}}
\DoxyCodeLine{\Hypertarget{modbus__holdregs_8c_source_l00010}00010\ \textcolor{comment}{Модуль\ обработки\ команд\ для\ holding\ registers\ (регистров\ хранения):}}
\DoxyCodeLine{\Hypertarget{modbus__holdregs_8c_source_l00011}00011\ \textcolor{comment}{-\/\ Чтение\ множественных\ регистров\ (0x03)\ -\/\ копирование\ данных\ в\ буфер\ ответа}}
\DoxyCodeLine{\Hypertarget{modbus__holdregs_8c_source_l00012}00012\ \textcolor{comment}{-\/\ Запись\ одиночного\ регистра\ (0x06)\ -\/\ прямая\ запись\ значения}}
\DoxyCodeLine{\Hypertarget{modbus__holdregs_8c_source_l00013}00013\ \textcolor{comment}{-\/\ Запись\ множественных\ регистров\ (0x10)\ -\/\ пакетная\ запись\ из\ буфера}}
\DoxyCodeLine{\Hypertarget{modbus__holdregs_8c_source_l00014}00014\ \textcolor{comment}{}}
\DoxyCodeLine{\Hypertarget{modbus__holdregs_8c_source_l00015}00015\ \textcolor{comment}{@section\ hvalid\ Валидация\ данных:}}
\DoxyCodeLine{\Hypertarget{modbus__holdregs_8c_source_l00016}00016\ \textcolor{comment}{-\/\ Проверка\ соответствия\ количества\ байт\ и\ регистров}}
\DoxyCodeLine{\Hypertarget{modbus__holdregs_8c_source_l00017}00017\ \textcolor{comment}{-\/\ Валидация\ адресов\ через\ MB\_DefineRegistersAddress()}}
\DoxyCodeLine{\Hypertarget{modbus__holdregs_8c_source_l00018}00018\ \textcolor{comment}{-\/\ Обработка\ исключений\ при\ некорректных\ запросах}}
\DoxyCodeLine{\Hypertarget{modbus__holdregs_8c_source_l00019}00019\ \textcolor{comment}{******************************************************************************/}}
\DoxyCodeLine{\Hypertarget{modbus__holdregs_8c_source_l00020}00020\ \textcolor{preprocessor}{\#include\ "{}\mbox{\hyperlink{modbus__inputregs_8h}{modbus\_inputregs.h}}"{}}}
\DoxyCodeLine{\Hypertarget{modbus__holdregs_8c_source_l00021}00021\ }
\DoxyCodeLine{\Hypertarget{modbus__holdregs_8c_source_l00022}00022\ }
\DoxyCodeLine{\Hypertarget{modbus__holdregs_8c_source_l00023}00023\ \textcolor{preprocessor}{\#ifdef\ MODBUS\_ENABLE\_HOLDINGS}}
\DoxyCodeLine{\Hypertarget{modbus__holdregs_8c_source_l00024}00024\ }
\DoxyCodeLine{\Hypertarget{modbus__holdregs_8c_source_l00025}00025\ }
\DoxyCodeLine{\Hypertarget{modbus__holdregs_8c_source_l00026}00026\ \textcolor{comment}{}}
\DoxyCodeLine{\Hypertarget{modbus__holdregs_8c_source_l00027}00027\ \textcolor{comment}{/**\ }}
\DoxyCodeLine{\Hypertarget{modbus__holdregs_8c_source_l00028}00028\ \textcolor{comment}{\ \ *\ @brief\ \ \ \ Записать\ регистр\ хранения\ по\ глобальному\ адресу.}}
\DoxyCodeLine{\Hypertarget{modbus__holdregs_8c_source_l00029}00029\ \textcolor{comment}{\ \ *\ @param\ \ \ \ Addr\ \ \ \ \ \ \ \ \ \ Адрес\ регистра.}}
\DoxyCodeLine{\Hypertarget{modbus__holdregs_8c_source_l00030}00030\ \textcolor{comment}{\ \ *\ @param\ \ \ \ WriteVal\ \ \ \ \ \ Число\ для\ записи.}}
\DoxyCodeLine{\Hypertarget{modbus__holdregs_8c_source_l00031}00031\ \textcolor{comment}{\ \ *\ @return\ \ \ ExceptionCode\ Код\ исключения\ если\ регистра\ по\ адресу\ не\ существует,\ и\ ET\_NO\_ERRORS\ если\ все\ ок.}}
\DoxyCodeLine{\Hypertarget{modbus__holdregs_8c_source_l00032}00032\ \textcolor{comment}{\ \ *}}
\DoxyCodeLine{\Hypertarget{modbus__holdregs_8c_source_l00033}00033\ \textcolor{comment}{\ \ *\ @details\ \ Позволяет\ обратиться\ к\ любому\ регистру\ по\ его\ глобальному\ адрессу.}}
\DoxyCodeLine{\Hypertarget{modbus__holdregs_8c_source_l00034}00034\ \textcolor{comment}{\ \ \ \ \ \ \ \ \ \ \ \ \ \ Вне\ зависимости\ от\ того\ как\ регистры\ размещены\ в\ памяти.}}
\DoxyCodeLine{\Hypertarget{modbus__holdregs_8c_source_l00035}00035\ \textcolor{comment}{\ \ */}}
\DoxyCodeLine{\Hypertarget{modbus__holdregs_8c_source_l00036}\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_ga8b7134e2fc1b65111d536c5590321b80}{00036}}\ \mbox{\hyperlink{group___m_o_d_b_u_s___m_e_s_s_a_g_e___d_e_f_i_n_e_s_ga4ade64cb3fabf37f010c1e297489980c}{MB\_ExceptionTypeDef}}\ \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_ga8b7134e2fc1b65111d536c5590321b80}{MB\_Holding\_Write\_Global}}(uint16\_t\ Addr,\ uint16\_t\ WriteVal)}
\DoxyCodeLine{\Hypertarget{modbus__holdregs_8c_source_l00037}00037\ \{}
\DoxyCodeLine{\Hypertarget{modbus__holdregs_8c_source_l00038}00038\ \ \ \textcolor{comment}{//-\/-\/-\/-\/-\/-\/-\/-\/-\/CHECK\ FOR\ ERRORS-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/}}
\DoxyCodeLine{\Hypertarget{modbus__holdregs_8c_source_l00039}00039\ \ \ \mbox{\hyperlink{group___m_o_d_b_u_s___m_e_s_s_a_g_e___d_e_f_i_n_e_s_ga4ade64cb3fabf37f010c1e297489980c}{MB\_ExceptionTypeDef}}\ Exception\ =\ \mbox{\hyperlink{group___m_o_d_b_u_s___m_e_s_s_a_g_e___d_e_f_i_n_e_s_gga4ade64cb3fabf37f010c1e297489980caa6980c7a8d924dd975b8fa06a300eb74}{ET\_NO\_ERRORS}};}
\DoxyCodeLine{\Hypertarget{modbus__holdregs_8c_source_l00040}00040\ \ \ uint16\_t\ *pHoldRegs;}
\DoxyCodeLine{\Hypertarget{modbus__holdregs_8c_source_l00041}00041\ \ \ }
\DoxyCodeLine{\Hypertarget{modbus__holdregs_8c_source_l00042}00042\ \ \ \textcolor{comment}{//-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/WRITE\ COIL-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/}}
\DoxyCodeLine{\Hypertarget{modbus__holdregs_8c_source_l00043}00043\ \ \ Exception\ =\ \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_ga1e90bb28a4cf997250daab6470d5ffe3}{MB\_DefineRegistersAddress}}(\&pHoldRegs,\ Addr,\ 1,\ RegisterType\_Holding);}
\DoxyCodeLine{\Hypertarget{modbus__holdregs_8c_source_l00044}00044\ \ \ \textcolor{keywordflow}{if}(Exception\ ==\ \mbox{\hyperlink{group___m_o_d_b_u_s___m_e_s_s_a_g_e___d_e_f_i_n_e_s_gga4ade64cb3fabf37f010c1e297489980caa6980c7a8d924dd975b8fa06a300eb74}{ET\_NO\_ERRORS}})}
\DoxyCodeLine{\Hypertarget{modbus__holdregs_8c_source_l00045}00045\ \ \ \{}
\DoxyCodeLine{\Hypertarget{modbus__holdregs_8c_source_l00046}00046\ \ \ \ \ *(pHoldRegs)\ =\ WriteVal;}
\DoxyCodeLine{\Hypertarget{modbus__holdregs_8c_source_l00047}00047\ \ \ \}}
\DoxyCodeLine{\Hypertarget{modbus__holdregs_8c_source_l00048}00048\ \ \ \textcolor{keywordflow}{return}\ Exception;}
\DoxyCodeLine{\Hypertarget{modbus__holdregs_8c_source_l00049}00049\ \}}
\DoxyCodeLine{\Hypertarget{modbus__holdregs_8c_source_l00050}00050\ }
\DoxyCodeLine{\Hypertarget{modbus__holdregs_8c_source_l00051}00051\ \textcolor{comment}{}}
\DoxyCodeLine{\Hypertarget{modbus__holdregs_8c_source_l00052}00052\ \textcolor{comment}{/**\ }}
\DoxyCodeLine{\Hypertarget{modbus__holdregs_8c_source_l00053}00053\ \textcolor{comment}{\ \ *\ @brief\ \ \ \ Считать\ регистр\ хранения\ по\ глобальному\ адресу.}}
\DoxyCodeLine{\Hypertarget{modbus__holdregs_8c_source_l00054}00054\ \textcolor{comment}{\ \ *\ @param\ \ \ \ Addr\ \ \ \ \ \ \ \ \ \ Адрес\ регистра.}}
\DoxyCodeLine{\Hypertarget{modbus__holdregs_8c_source_l00055}00055\ \textcolor{comment}{\ \ *\ @param\ \ \ \ Exception\ \ \ \ \ Указатель\ на\ переменную\ для\ кода\ исключения,\ в\ случае\ неудачи\ при\ чтении.}}
\DoxyCodeLine{\Hypertarget{modbus__holdregs_8c_source_l00056}00056\ \textcolor{comment}{\ \ *\ @return\ \ \ uint16\_t\ \ \ \ \ \ Возвращает\ значение\ регистра.}}
\DoxyCodeLine{\Hypertarget{modbus__holdregs_8c_source_l00057}00057\ \textcolor{comment}{\ \ *}}
\DoxyCodeLine{\Hypertarget{modbus__holdregs_8c_source_l00058}00058\ \textcolor{comment}{\ \ *\ @details\ \ Позволяет\ обратиться\ к\ любому\ регистру\ по\ его\ глобальному\ адрессу.}}
\DoxyCodeLine{\Hypertarget{modbus__holdregs_8c_source_l00059}00059\ \textcolor{comment}{\ \ \ \ \ \ \ \ \ \ \ \ \ \ Вне\ зависимости\ от\ того\ как\ регистры\ размещены\ в\ памяти.}}
\DoxyCodeLine{\Hypertarget{modbus__holdregs_8c_source_l00060}00060\ \textcolor{comment}{\ \ */}}
\DoxyCodeLine{\Hypertarget{modbus__holdregs_8c_source_l00061}\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_ga0198b337d6944329b78c59521baf5738}{00061}}\ uint16\_t\ \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_ga0198b337d6944329b78c59521baf5738}{MB\_Holding\_Read\_Global}}(uint16\_t\ Addr,\ \mbox{\hyperlink{group___m_o_d_b_u_s___m_e_s_s_a_g_e___d_e_f_i_n_e_s_ga4ade64cb3fabf37f010c1e297489980c}{MB\_ExceptionTypeDef}}\ *Exception)}
\DoxyCodeLine{\Hypertarget{modbus__holdregs_8c_source_l00062}00062\ \{}
\DoxyCodeLine{\Hypertarget{modbus__holdregs_8c_source_l00063}00063\ \ \ \textcolor{comment}{//-\/-\/-\/-\/-\/-\/-\/-\/-\/CHECK\ FOR\ ERRORS-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/}}
\DoxyCodeLine{\Hypertarget{modbus__holdregs_8c_source_l00064}00064\ \ \ \mbox{\hyperlink{group___m_o_d_b_u_s___m_e_s_s_a_g_e___d_e_f_i_n_e_s_ga4ade64cb3fabf37f010c1e297489980c}{MB\_ExceptionTypeDef}}\ Exception\_tmp\ =\ 0;}
\DoxyCodeLine{\Hypertarget{modbus__holdregs_8c_source_l00065}00065\ \ \ \ \ }
\DoxyCodeLine{\Hypertarget{modbus__holdregs_8c_source_l00066}00066\ \ \ uint16\_t\ *pHoldRegs;}
\DoxyCodeLine{\Hypertarget{modbus__holdregs_8c_source_l00067}00067\ \ \ }
\DoxyCodeLine{\Hypertarget{modbus__holdregs_8c_source_l00068}00068\ \ \ \textcolor{comment}{//-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/READ\ COIL-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/}}
\DoxyCodeLine{\Hypertarget{modbus__holdregs_8c_source_l00069}00069\ \ \ Exception\_tmp\ =\ \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_ga1e90bb28a4cf997250daab6470d5ffe3}{MB\_DefineRegistersAddress}}(\&pHoldRegs,\ Addr,\ 1,\ RegisterType\_Holding);}
\DoxyCodeLine{\Hypertarget{modbus__holdregs_8c_source_l00070}00070\ }
\DoxyCodeLine{\Hypertarget{modbus__holdregs_8c_source_l00071}00071\ \ \ \textcolor{keywordflow}{if}(Exception)\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{comment}{//\ if\ exception\ is\ not\ given\ to\ func\ fill\ it}}
\DoxyCodeLine{\Hypertarget{modbus__holdregs_8c_source_l00072}00072\ \ \ \ \ *Exception\ =\ Exception\_tmp;}
\DoxyCodeLine{\Hypertarget{modbus__holdregs_8c_source_l00073}00073\ }
\DoxyCodeLine{\Hypertarget{modbus__holdregs_8c_source_l00074}00074\ \ \ \textcolor{keywordflow}{if}(Exception\_tmp\ ==\ \mbox{\hyperlink{group___m_o_d_b_u_s___m_e_s_s_a_g_e___d_e_f_i_n_e_s_gga4ade64cb3fabf37f010c1e297489980caa6980c7a8d924dd975b8fa06a300eb74}{ET\_NO\_ERRORS}})}
\DoxyCodeLine{\Hypertarget{modbus__holdregs_8c_source_l00075}00075\ \ \ \{}
\DoxyCodeLine{\Hypertarget{modbus__holdregs_8c_source_l00076}00076\ \ \ \ \ \textcolor{keywordflow}{return}\ *(pHoldRegs);}
\DoxyCodeLine{\Hypertarget{modbus__holdregs_8c_source_l00077}00077\ \ \ \}}
\DoxyCodeLine{\Hypertarget{modbus__holdregs_8c_source_l00078}00078\ \ \ \textcolor{keywordflow}{else}}
\DoxyCodeLine{\Hypertarget{modbus__holdregs_8c_source_l00079}00079\ \ \ \{}
\DoxyCodeLine{\Hypertarget{modbus__holdregs_8c_source_l00080}00080\ \ \ \ \ \textcolor{keywordflow}{return}\ 0;}
\DoxyCodeLine{\Hypertarget{modbus__holdregs_8c_source_l00081}00081\ \ \ \}}
\DoxyCodeLine{\Hypertarget{modbus__holdregs_8c_source_l00082}00082\ \}}
\DoxyCodeLine{\Hypertarget{modbus__holdregs_8c_source_l00083}00083\ }
\DoxyCodeLine{\Hypertarget{modbus__holdregs_8c_source_l00084}00084\ }
\DoxyCodeLine{\Hypertarget{modbus__holdregs_8c_source_l00085}00085\ \textcolor{comment}{}}
\DoxyCodeLine{\Hypertarget{modbus__holdregs_8c_source_l00086}00086\ \textcolor{comment}{/**}}
\DoxyCodeLine{\Hypertarget{modbus__holdregs_8c_source_l00087}00087\ \textcolor{comment}{\ \ *\ @brief\ \ \ \ Обработать\ функцию\ Read\ Holding\ Registers\ (03\ -\/\ 0x03).}}
\DoxyCodeLine{\Hypertarget{modbus__holdregs_8c_source_l00088}00088\ \textcolor{comment}{\ \ *\ @param\ \ \ \ modbus\_msg\ \ \ \ \ \ \ \ Указатель\ на\ структуру\ собщения\ modbus.}}
\DoxyCodeLine{\Hypertarget{modbus__holdregs_8c_source_l00089}00089\ \textcolor{comment}{\ \ *\ @return\ \ \ fMessageHandled\ \ \ Статус\ о\ результате\ обработки\ комманды.}}
\DoxyCodeLine{\Hypertarget{modbus__holdregs_8c_source_l00090}00090\ \textcolor{comment}{\ \ *\ @details\ \ Обработка\ команды\ Read\ Holding\ Registers.}}
\DoxyCodeLine{\Hypertarget{modbus__holdregs_8c_source_l00091}00091\ \textcolor{comment}{\ \ */}}
\DoxyCodeLine{\Hypertarget{modbus__holdregs_8c_source_l00092}\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_gac28127757ba25fe0b611612a785f663b}{00092}}\ 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_gac28127757ba25fe0b611612a785f663b}{MB\_Process\_Read\_Hold\_Regs}}(\mbox{\hyperlink{struct_r_s___msg_type_def}{RS\_MsgTypeDef}}\ *modbus\_msg)}
\DoxyCodeLine{\Hypertarget{modbus__holdregs_8c_source_l00093}00093\ \{}
\DoxyCodeLine{\Hypertarget{modbus__holdregs_8c_source_l00094}00094\ \ \ \textcolor{comment}{//-\/-\/-\/-\/-\/-\/-\/-\/-\/CHECK\ FOR\ ERRORS-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/\ }}
\DoxyCodeLine{\Hypertarget{modbus__holdregs_8c_source_l00095}00095\ \ \ \textcolor{comment}{//\ get\ origin\ address\ for\ data}}
\DoxyCodeLine{\Hypertarget{modbus__holdregs_8c_source_l00096}00096\ \ \ uint16\_t\ *pHoldRegs;}
\DoxyCodeLine{\Hypertarget{modbus__holdregs_8c_source_l00097}00097\ \ \ modbus\_msg-\/>\mbox{\hyperlink{struct_r_s___msg_type_def_a3dab5eaf3a1dd5719b8bfec1adad0d39}{Except\_Code}}\ =\ \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_ga1e90bb28a4cf997250daab6470d5ffe3}{MB\_DefineRegistersAddress}}(\&pHoldRegs,\ modbus\_msg-\/>\mbox{\hyperlink{struct_r_s___msg_type_def_af99048a71119ba4c17772bd5544b3eef}{Addr}},\ modbus\_msg-\/>\mbox{\hyperlink{struct_r_s___msg_type_def_a1ccb2bf492218a6ae3a5b6ad5cd4c82f}{Qnt}},\ RegisterType\_Holding);\ \textcolor{comment}{//\ определение\ адреса\ регистров}}
\DoxyCodeLine{\Hypertarget{modbus__holdregs_8c_source_l00098}00098\ \ \ \textcolor{keywordflow}{if}(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_gga4ade64cb3fabf37f010c1e297489980caa6980c7a8d924dd975b8fa06a300eb74}{ET\_NO\_ERRORS}})}
\DoxyCodeLine{\Hypertarget{modbus__holdregs_8c_source_l00099}00099\ \ \ \ \ \textcolor{keywordflow}{return}\ 0;}
\DoxyCodeLine{\Hypertarget{modbus__holdregs_8c_source_l00100}00100\ \ \ }
\DoxyCodeLine{\Hypertarget{modbus__holdregs_8c_source_l00101}00101\ }
\DoxyCodeLine{\Hypertarget{modbus__holdregs_8c_source_l00102}00102\ \ \ \textcolor{comment}{//-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/READING\ REGS-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/}}
\DoxyCodeLine{\Hypertarget{modbus__holdregs_8c_source_l00103}00103\ \ \ \textcolor{comment}{//\ setup\ output\ message\ data\ size\ }}
\DoxyCodeLine{\Hypertarget{modbus__holdregs_8c_source_l00104}00104\ \ \ modbus\_msg-\/>\mbox{\hyperlink{struct_r_s___msg_type_def_a5c69bf212dc5e7dc2eaa50971e27e2a6}{ByteCnt}}\ =\ modbus\_msg-\/>\mbox{\hyperlink{struct_r_s___msg_type_def_a1ccb2bf492218a6ae3a5b6ad5cd4c82f}{Qnt}}*2;\ \textcolor{comment}{//\ *2\ because\ we\ transmit\ 8\ bits,\ not\ 16\ bits}}
\DoxyCodeLine{\Hypertarget{modbus__holdregs_8c_source_l00105}00105\ \ \ \textcolor{comment}{//\ read\ data}}
\DoxyCodeLine{\Hypertarget{modbus__holdregs_8c_source_l00106}00106\ \ \ \textcolor{keywordtype}{int}\ i;}
\DoxyCodeLine{\Hypertarget{modbus__holdregs_8c_source_l00107}00107\ \ \ \textcolor{keywordflow}{for}\ (i\ =\ 0;\ i<modbus\_msg-\/>\mbox{\hyperlink{struct_r_s___msg_type_def_a1ccb2bf492218a6ae3a5b6ad5cd4c82f}{Qnt}};\ i++)}
\DoxyCodeLine{\Hypertarget{modbus__holdregs_8c_source_l00108}00108\ \ \ \{}
\DoxyCodeLine{\Hypertarget{modbus__holdregs_8c_source_l00109}00109\ \ \ \ \ modbus\_msg-\/>\mbox{\hyperlink{struct_r_s___msg_type_def_aacbc6754621bd84742cd6c2ba65ad094}{MbData}}[i]\ =\ *(pHoldRegs++);}
\DoxyCodeLine{\Hypertarget{modbus__holdregs_8c_source_l00110}00110\ \ \ \}\ }
\DoxyCodeLine{\Hypertarget{modbus__holdregs_8c_source_l00111}00111\ \ \ \textcolor{keywordflow}{return}\ 1;}
\DoxyCodeLine{\Hypertarget{modbus__holdregs_8c_source_l00112}00112\ \}}
\DoxyCodeLine{\Hypertarget{modbus__holdregs_8c_source_l00113}00113\ \textcolor{comment}{}}
\DoxyCodeLine{\Hypertarget{modbus__holdregs_8c_source_l00114}00114\ \textcolor{comment}{/**}}
\DoxyCodeLine{\Hypertarget{modbus__holdregs_8c_source_l00115}00115\ \textcolor{comment}{\ \ *\ @brief\ \ \ \ Обработать\ функцию\ Write\ Single\ Register\ (06\ -\/\ 0x06).}}
\DoxyCodeLine{\Hypertarget{modbus__holdregs_8c_source_l00116}00116\ \textcolor{comment}{\ \ *\ @param\ \ \ \ modbus\_msg\ \ \ \ \ \ \ \ Указатель\ на\ структуру\ собщения\ modbus.}}
\DoxyCodeLine{\Hypertarget{modbus__holdregs_8c_source_l00117}00117\ \textcolor{comment}{\ \ *\ @return\ \ \ fMessageHandled\ \ \ Статус\ о\ результате\ обработки\ комманды.}}
\DoxyCodeLine{\Hypertarget{modbus__holdregs_8c_source_l00118}00118\ \textcolor{comment}{\ \ *\ @details\ \ Обработка\ команды\ Write\ Single\ Register.}}
\DoxyCodeLine{\Hypertarget{modbus__holdregs_8c_source_l00119}00119\ \textcolor{comment}{\ \ */}}
\DoxyCodeLine{\Hypertarget{modbus__holdregs_8c_source_l00120}\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_ga02e192a3d9f31737c45f074a04b37648}{00120}}\ 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_ga02e192a3d9f31737c45f074a04b37648}{MB\_Process\_Write\_Single\_Reg}}(\mbox{\hyperlink{struct_r_s___msg_type_def}{RS\_MsgTypeDef}}\ *modbus\_msg)}
\DoxyCodeLine{\Hypertarget{modbus__holdregs_8c_source_l00121}00121\ \{\ }
\DoxyCodeLine{\Hypertarget{modbus__holdregs_8c_source_l00122}00122\ \ \ \textcolor{comment}{//\ get\ origin\ address\ for\ data}}
\DoxyCodeLine{\Hypertarget{modbus__holdregs_8c_source_l00123}00123\ \ \ uint16\_t\ *pHoldRegs;\ \ \ \ \ \ }
\DoxyCodeLine{\Hypertarget{modbus__holdregs_8c_source_l00124}00124\ \ \ modbus\_msg-\/>\mbox{\hyperlink{struct_r_s___msg_type_def_a3dab5eaf3a1dd5719b8bfec1adad0d39}{Except\_Code}}\ =\ \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_ga1e90bb28a4cf997250daab6470d5ffe3}{MB\_DefineRegistersAddress}}(\&pHoldRegs,\ modbus\_msg-\/>\mbox{\hyperlink{struct_r_s___msg_type_def_af99048a71119ba4c17772bd5544b3eef}{Addr}},\ 1,\ RegisterType\_Holding);\ \textcolor{comment}{//\ определение\ адреса\ регистров}}
\DoxyCodeLine{\Hypertarget{modbus__holdregs_8c_source_l00125}00125\ \ \ \textcolor{keywordflow}{if}(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_gga4ade64cb3fabf37f010c1e297489980caa6980c7a8d924dd975b8fa06a300eb74}{ET\_NO\_ERRORS}})}
\DoxyCodeLine{\Hypertarget{modbus__holdregs_8c_source_l00126}00126\ \ \ \ \ \textcolor{keywordflow}{return}\ 0;}
\DoxyCodeLine{\Hypertarget{modbus__holdregs_8c_source_l00127}00127\ \ \ }
\DoxyCodeLine{\Hypertarget{modbus__holdregs_8c_source_l00128}00128\ \ \ \textcolor{comment}{//-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/WRITTING\ REG-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/\ }}
\DoxyCodeLine{\Hypertarget{modbus__holdregs_8c_source_l00129}00129\ \ \ *(pHoldRegs)\ =\ modbus\_msg-\/>\mbox{\hyperlink{struct_r_s___msg_type_def_a1ccb2bf492218a6ae3a5b6ad5cd4c82f}{Qnt}};}
\DoxyCodeLine{\Hypertarget{modbus__holdregs_8c_source_l00130}00130\ \ \ \textcolor{keywordflow}{return}\ 1;}
\DoxyCodeLine{\Hypertarget{modbus__holdregs_8c_source_l00131}00131\ \}}
\DoxyCodeLine{\Hypertarget{modbus__holdregs_8c_source_l00132}00132\ \textcolor{comment}{}}
\DoxyCodeLine{\Hypertarget{modbus__holdregs_8c_source_l00133}00133\ \textcolor{comment}{/**}}
\DoxyCodeLine{\Hypertarget{modbus__holdregs_8c_source_l00134}00134\ \textcolor{comment}{\ \ *\ @brief\ \ \ \ Обработать\ функцию\ Write\ Multiple\ Registers\ (16\ -\/\ 0x10).}}
\DoxyCodeLine{\Hypertarget{modbus__holdregs_8c_source_l00135}00135\ \textcolor{comment}{\ \ *\ @param\ \ \ \ modbus\_msg\ \ \ \ \ \ \ \ Указатель\ на\ структуру\ собщения\ modbus.}}
\DoxyCodeLine{\Hypertarget{modbus__holdregs_8c_source_l00136}00136\ \textcolor{comment}{\ \ *\ @return\ \ \ fMessageHandled\ \ \ Статус\ о\ результате\ обработки\ комманды.}}
\DoxyCodeLine{\Hypertarget{modbus__holdregs_8c_source_l00137}00137\ \textcolor{comment}{\ \ *\ @details\ \ Обработка\ команды\ Write\ Multiple\ Registers.}}
\DoxyCodeLine{\Hypertarget{modbus__holdregs_8c_source_l00138}00138\ \textcolor{comment}{\ \ */}}
\DoxyCodeLine{\Hypertarget{modbus__holdregs_8c_source_l00139}\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_ga9c6ab159edb8dda6548b2228773ce919}{00139}}\ 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_ga9c6ab159edb8dda6548b2228773ce919}{MB\_Process\_Write\_Miltuple\_Regs}}(\mbox{\hyperlink{struct_r_s___msg_type_def}{RS\_MsgTypeDef}}\ *modbus\_msg)}
\DoxyCodeLine{\Hypertarget{modbus__holdregs_8c_source_l00140}00140\ \{}
\DoxyCodeLine{\Hypertarget{modbus__holdregs_8c_source_l00141}00141\ \ \ \textcolor{comment}{//-\/-\/-\/-\/-\/-\/-\/-\/-\/CHECK\ FOR\ ERRORS-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/}}
\DoxyCodeLine{\Hypertarget{modbus__holdregs_8c_source_l00142}00142\ \ \ \textcolor{keywordflow}{if}\ (modbus\_msg-\/>\mbox{\hyperlink{struct_r_s___msg_type_def_a1ccb2bf492218a6ae3a5b6ad5cd4c82f}{Qnt}}*2\ !=\ modbus\_msg-\/>\mbox{\hyperlink{struct_r_s___msg_type_def_a5c69bf212dc5e7dc2eaa50971e27e2a6}{ByteCnt}})}
\DoxyCodeLine{\Hypertarget{modbus__holdregs_8c_source_l00143}00143\ \ \ \{\ \textcolor{comment}{//\ if\ quantity\ and\ bytes\ count\ arent\ match}}
\DoxyCodeLine{\Hypertarget{modbus__holdregs_8c_source_l00144}00144\ \ \ \ \ modbus\_msg-\/>\mbox{\hyperlink{struct_r_s___msg_type_def_a3dab5eaf3a1dd5719b8bfec1adad0d39}{Except\_Code}}\ =\ 3;}
\DoxyCodeLine{\Hypertarget{modbus__holdregs_8c_source_l00145}00145\ \ \ \ \ \textcolor{keywordflow}{return}\ 0;}
\DoxyCodeLine{\Hypertarget{modbus__holdregs_8c_source_l00146}00146\ \ \ \}\ }
\DoxyCodeLine{\Hypertarget{modbus__holdregs_8c_source_l00147}00147\ \ \ \textcolor{comment}{//\ get\ origin\ address\ for\ data}}
\DoxyCodeLine{\Hypertarget{modbus__holdregs_8c_source_l00148}00148\ \ \ uint16\_t\ *pHoldRegs;\ \ \ \ \ \ }
\DoxyCodeLine{\Hypertarget{modbus__holdregs_8c_source_l00149}00149\ \ \ modbus\_msg-\/>\mbox{\hyperlink{struct_r_s___msg_type_def_a3dab5eaf3a1dd5719b8bfec1adad0d39}{Except\_Code}}\ =\ \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_ga1e90bb28a4cf997250daab6470d5ffe3}{MB\_DefineRegistersAddress}}(\&pHoldRegs,\ modbus\_msg-\/>\mbox{\hyperlink{struct_r_s___msg_type_def_af99048a71119ba4c17772bd5544b3eef}{Addr}},\ modbus\_msg-\/>\mbox{\hyperlink{struct_r_s___msg_type_def_a1ccb2bf492218a6ae3a5b6ad5cd4c82f}{Qnt}},\ RegisterType\_Holding);\ \textcolor{comment}{//\ определение\ адреса\ регистров}}
\DoxyCodeLine{\Hypertarget{modbus__holdregs_8c_source_l00150}00150\ \ \ \textcolor{keywordflow}{if}(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_gga4ade64cb3fabf37f010c1e297489980caa6980c7a8d924dd975b8fa06a300eb74}{ET\_NO\_ERRORS}})}
\DoxyCodeLine{\Hypertarget{modbus__holdregs_8c_source_l00151}00151\ \ \ \ \ \textcolor{keywordflow}{return}\ 0;}
\DoxyCodeLine{\Hypertarget{modbus__holdregs_8c_source_l00152}00152\ \ \ }
\DoxyCodeLine{\Hypertarget{modbus__holdregs_8c_source_l00153}00153\ \ \ \textcolor{comment}{//-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/WRITTING\ REGS-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/\ }}
\DoxyCodeLine{\Hypertarget{modbus__holdregs_8c_source_l00154}00154\ \ \ \textcolor{keywordflow}{for}\ (\textcolor{keywordtype}{int}\ i\ =\ 0;\ i<modbus\_msg-\/>\mbox{\hyperlink{struct_r_s___msg_type_def_a1ccb2bf492218a6ae3a5b6ad5cd4c82f}{Qnt}};\ i++)}
\DoxyCodeLine{\Hypertarget{modbus__holdregs_8c_source_l00155}00155\ \ \ \{}
\DoxyCodeLine{\Hypertarget{modbus__holdregs_8c_source_l00156}00156\ \ \ \ \ *(pHoldRegs++)\ =\ modbus\_msg-\/>\mbox{\hyperlink{struct_r_s___msg_type_def_aacbc6754621bd84742cd6c2ba65ad094}{MbData}}[i];}
\DoxyCodeLine{\Hypertarget{modbus__holdregs_8c_source_l00157}00157\ \ \ \}}
\DoxyCodeLine{\Hypertarget{modbus__holdregs_8c_source_l00158}00158\ \ \ \textcolor{keywordflow}{return}\ 1;}
\DoxyCodeLine{\Hypertarget{modbus__holdregs_8c_source_l00159}00159\ \}}
\DoxyCodeLine{\Hypertarget{modbus__holdregs_8c_source_l00160}00160\ }
\DoxyCodeLine{\Hypertarget{modbus__holdregs_8c_source_l00161}00161\ \textcolor{preprocessor}{\#endif\ }\textcolor{comment}{//MODBUS\_ENABLE\_HOLDINGS}}

\end{DoxyCode}
