119 lines
18 KiB
TeX
119 lines
18 KiB
TeX
\doxysection{modbus\+\_\+inputregs.\+c}
|
||
\hypertarget{modbus__inputregs_8c_source}{}\label{modbus__inputregs_8c_source}\index{E:/.WORK/STM32/Diod\_Test/diode\_tester/Core/Modbus/Src/modbus\_inputregs.c@{E:/.WORK/STM32/Diod\_Test/diode\_tester/Core/Modbus/Src/modbus\_inputregs.c}}
|
||
\mbox{\hyperlink{modbus__inputregs_8c}{Go to the documentation of this file.}}
|
||
\begin{DoxyCode}{0}
|
||
\DoxyCodeLine{\Hypertarget{modbus__inputregs_8c_source_l00001}00001\ \textcolor{comment}{/**}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__inputregs_8c_source_l00002}00002\ \textcolor{comment}{*******************************************************************************}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__inputregs_8c_source_l00003}00003\ \textcolor{comment}{*\ @file\ modbus\_inputregs.c}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__inputregs_8c_source_l00004}00004\ \textcolor{comment}{*\ @brief\ Реализация\ работы\ с\ входными\ регистрами\ Modbus}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__inputregs_8c_source_l00005}00005\ \textcolor{comment}{*******************************************************************************}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__inputregs_8c_source_l00006}00006\ \textcolor{comment}{*\ @details}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__inputregs_8c_source_l00007}00007\ \textcolor{comment}{Модуль\ для\ доступа\ к\ регистрам\ внутри\ программы:}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__inputregs_8c_source_l00008}00008\ \textcolor{comment}{-\/\ Функции\ для\ доступа\ к\ входным\ регистрам\ по\ глобальным\ адресам}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__inputregs_8c_source_l00009}00009\ \textcolor{comment}{}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__inputregs_8c_source_l00010}00010\ \textcolor{comment}{Модуль\ обработки\ команды\ чтения\ input\ registers\ (0x04):}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__inputregs_8c_source_l00011}00011\ \textcolor{comment}{}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__inputregs_8c_source_l00012}00012\ \textcolor{comment}{@section\ ivalid\ Валидация\ данных:}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__inputregs_8c_source_l00013}00013\ \textcolor{comment}{-\/\ Проверка\ соответствия\ количества\ байт\ и\ регистров}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__inputregs_8c_source_l00014}00014\ \textcolor{comment}{-\/\ Валидация\ адресов\ через\ MB\_DefineRegistersAddress()}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__inputregs_8c_source_l00015}00015\ \textcolor{comment}{-\/\ Обработка\ исключений\ при\ некорректных\ запросах}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__inputregs_8c_source_l00016}00016\ \textcolor{comment}{******************************************************************************/}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__inputregs_8c_source_l00017}00017\ \textcolor{preprocessor}{\#include\ "{}\mbox{\hyperlink{modbus__inputregs_8h}{modbus\_inputregs.h}}"{}}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__inputregs_8c_source_l00018}00018\ }
|
||
\DoxyCodeLine{\Hypertarget{modbus__inputregs_8c_source_l00019}00019\ }
|
||
\DoxyCodeLine{\Hypertarget{modbus__inputregs_8c_source_l00020}00020\ \textcolor{preprocessor}{\#ifdef\ MODBUS\_ENABLE\_INPUTS}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__inputregs_8c_source_l00021}00021\ }
|
||
\DoxyCodeLine{\Hypertarget{modbus__inputregs_8c_source_l00022}00022\ \textcolor{comment}{}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__inputregs_8c_source_l00023}00023\ \textcolor{comment}{/**\ }}
|
||
\DoxyCodeLine{\Hypertarget{modbus__inputregs_8c_source_l00024}00024\ \textcolor{comment}{\ \ *\ @brief\ \ \ \ Записать\ входной\ регистр\ по\ глобальному\ адресу.}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__inputregs_8c_source_l00025}00025\ \textcolor{comment}{\ \ *\ @param\ \ \ \ Addr\ \ \ \ \ \ \ \ \ \ Адрес\ регистра.}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__inputregs_8c_source_l00026}00026\ \textcolor{comment}{\ \ *\ @param\ \ \ \ WriteVal\ \ \ \ \ \ Число\ для\ записи.}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__inputregs_8c_source_l00027}00027\ \textcolor{comment}{\ \ *\ @return\ \ \ ExceptionCode\ Код\ исключения\ если\ регистра\ по\ адресу\ не\ существует,\ и\ ET\_NO\_ERRORS\ если\ все\ ок.}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__inputregs_8c_source_l00028}00028\ \textcolor{comment}{\ \ *}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__inputregs_8c_source_l00029}00029\ \textcolor{comment}{\ \ *\ @details\ \ Позволяет\ обратиться\ к\ любому\ регистру\ по\ его\ глобальному\ адрессу.}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__inputregs_8c_source_l00030}00030\ \textcolor{comment}{\ \ \ \ \ \ \ \ \ \ \ \ \ \ Вне\ зависимости\ от\ того\ как\ регистры\ размещены\ в\ памяти.}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__inputregs_8c_source_l00031}00031\ \textcolor{comment}{\ \ */}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__inputregs_8c_source_l00032}\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_gafb57a29488a549d1c585234945549f2e}{00032}}\ \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_gafb57a29488a549d1c585234945549f2e}{MB\_Input\_Write\_Global}}(uint16\_t\ Addr,\ uint16\_t\ WriteVal)}
|
||
\DoxyCodeLine{\Hypertarget{modbus__inputregs_8c_source_l00033}00033\ \{}
|
||
\DoxyCodeLine{\Hypertarget{modbus__inputregs_8c_source_l00034}00034\ \ \ \textcolor{comment}{//-\/-\/-\/-\/-\/-\/-\/-\/-\/CHECK\ FOR\ ERRORS-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__inputregs_8c_source_l00035}00035\ \ \ \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__inputregs_8c_source_l00036}00036\ \ \ uint16\_t\ *pInRegs;}
|
||
\DoxyCodeLine{\Hypertarget{modbus__inputregs_8c_source_l00037}00037\ \ \ }
|
||
\DoxyCodeLine{\Hypertarget{modbus__inputregs_8c_source_l00038}00038\ \ \ \textcolor{comment}{//-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/WRITE\ COIL-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__inputregs_8c_source_l00039}00039\ \ \ 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}}(\&pInRegs,\ Addr,\ 1,\ RegisterType\_Input);}
|
||
\DoxyCodeLine{\Hypertarget{modbus__inputregs_8c_source_l00040}00040\ \ \ \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__inputregs_8c_source_l00041}00041\ \ \ \{}
|
||
\DoxyCodeLine{\Hypertarget{modbus__inputregs_8c_source_l00042}00042\ \ \ \ \ *(pInRegs)\ =\ WriteVal;}
|
||
\DoxyCodeLine{\Hypertarget{modbus__inputregs_8c_source_l00043}00043\ \ \ \}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__inputregs_8c_source_l00044}00044\ \ \ \textcolor{keywordflow}{return}\ Exception;}
|
||
\DoxyCodeLine{\Hypertarget{modbus__inputregs_8c_source_l00045}00045\ \}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__inputregs_8c_source_l00046}00046\ }
|
||
\DoxyCodeLine{\Hypertarget{modbus__inputregs_8c_source_l00047}00047\ \textcolor{comment}{}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__inputregs_8c_source_l00048}00048\ \textcolor{comment}{/**\ }}
|
||
\DoxyCodeLine{\Hypertarget{modbus__inputregs_8c_source_l00049}00049\ \textcolor{comment}{\ \ *\ @brief\ \ \ \ Считать\ входной\ регистр\ по\ глобальному\ адресу.}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__inputregs_8c_source_l00050}00050\ \textcolor{comment}{\ \ *\ @param\ \ \ \ Addr\ \ \ \ \ \ \ \ \ \ Адрес\ регистра.}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__inputregs_8c_source_l00051}00051\ \textcolor{comment}{\ \ *\ @param\ \ \ \ Exception\ \ \ \ \ Указатель\ на\ переменную\ для\ кода\ исключения,\ в\ случае\ неудачи\ при\ чтении.}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__inputregs_8c_source_l00052}00052\ \textcolor{comment}{\ \ *\ @return\ \ \ uint16\_t\ \ \ \ \ \ Возвращает\ значение\ регистра.}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__inputregs_8c_source_l00053}00053\ \textcolor{comment}{\ \ *}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__inputregs_8c_source_l00054}00054\ \textcolor{comment}{\ \ *\ @details\ \ Позволяет\ обратиться\ к\ любому\ регистру\ по\ его\ глобальному\ адрессу.}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__inputregs_8c_source_l00055}00055\ \textcolor{comment}{\ \ \ \ \ \ \ \ \ \ \ \ \ \ Вне\ зависимости\ от\ того\ как\ регистры\ размещены\ в\ памяти.}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__inputregs_8c_source_l00056}00056\ \textcolor{comment}{\ \ */}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__inputregs_8c_source_l00057}\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_ga28d00cd1df2a46a7a9a6a1b1fce99826}{00057}}\ 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_ga28d00cd1df2a46a7a9a6a1b1fce99826}{MB\_Input\_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__inputregs_8c_source_l00058}00058\ \{}
|
||
\DoxyCodeLine{\Hypertarget{modbus__inputregs_8c_source_l00059}00059\ \ \ \textcolor{comment}{//-\/-\/-\/-\/-\/-\/-\/-\/-\/CHECK\ FOR\ ERRORS-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__inputregs_8c_source_l00060}00060\ \ \ \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__inputregs_8c_source_l00061}00061\ \ \ \ \ }
|
||
\DoxyCodeLine{\Hypertarget{modbus__inputregs_8c_source_l00062}00062\ \ \ uint16\_t\ *pInRegs;}
|
||
\DoxyCodeLine{\Hypertarget{modbus__inputregs_8c_source_l00063}00063\ \ \ }
|
||
\DoxyCodeLine{\Hypertarget{modbus__inputregs_8c_source_l00064}00064\ \ \ \textcolor{comment}{//-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/READ\ COIL-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__inputregs_8c_source_l00065}00065\ \ \ 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}}(\&pInRegs,\ Addr,\ 1,\ RegisterType\_Input);}
|
||
\DoxyCodeLine{\Hypertarget{modbus__inputregs_8c_source_l00066}00066\ }
|
||
\DoxyCodeLine{\Hypertarget{modbus__inputregs_8c_source_l00067}00067\ \ \ \textcolor{keywordflow}{if}(Exception)\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{comment}{//\ if\ exception\ is\ not\ given\ to\ func\ fill\ it}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__inputregs_8c_source_l00068}00068\ \ \ \ \ *Exception\ =\ Exception\_tmp;}
|
||
\DoxyCodeLine{\Hypertarget{modbus__inputregs_8c_source_l00069}00069\ }
|
||
\DoxyCodeLine{\Hypertarget{modbus__inputregs_8c_source_l00070}00070\ \ \ \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__inputregs_8c_source_l00071}00071\ \ \ \{}
|
||
\DoxyCodeLine{\Hypertarget{modbus__inputregs_8c_source_l00072}00072\ \ \ \ \ \textcolor{keywordflow}{return}\ *(pInRegs);}
|
||
\DoxyCodeLine{\Hypertarget{modbus__inputregs_8c_source_l00073}00073\ \ \ \}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__inputregs_8c_source_l00074}00074\ \ \ \textcolor{keywordflow}{else}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__inputregs_8c_source_l00075}00075\ \ \ \{}
|
||
\DoxyCodeLine{\Hypertarget{modbus__inputregs_8c_source_l00076}00076\ \ \ \ \ \textcolor{keywordflow}{return}\ 0;}
|
||
\DoxyCodeLine{\Hypertarget{modbus__inputregs_8c_source_l00077}00077\ \ \ \}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__inputregs_8c_source_l00078}00078\ \}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__inputregs_8c_source_l00079}00079\ }
|
||
\DoxyCodeLine{\Hypertarget{modbus__inputregs_8c_source_l00080}00080\ \textcolor{comment}{}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__inputregs_8c_source_l00081}00081\ \textcolor{comment}{/**}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__inputregs_8c_source_l00082}00082\ \textcolor{comment}{\ \ *\ @brief\ \ \ \ Обработать\ функцию\ Read\ Input\ Registers\ (04\ -\/\ 0x04).}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__inputregs_8c_source_l00083}00083\ \textcolor{comment}{\ \ *\ @param\ \ \ \ modbus\_msg\ \ \ \ \ \ \ \ Указатель\ на\ структуру\ собщения\ modbus.}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__inputregs_8c_source_l00084}00084\ \textcolor{comment}{\ \ *\ @return\ \ \ fMessageHandled\ \ \ Статус\ о\ результате\ обработки\ комманды.}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__inputregs_8c_source_l00085}00085\ \textcolor{comment}{\ \ *\ @details\ \ Обработка\ команды\ Read\ Input\ Registers.}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__inputregs_8c_source_l00086}00086\ \textcolor{comment}{\ \ */}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__inputregs_8c_source_l00087}\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_gad13d010f43c7ab08a85667b9e1906b7d}{00087}}\ 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_gad13d010f43c7ab08a85667b9e1906b7d}{MB\_Process\_Read\_Input\_Regs}}(\mbox{\hyperlink{struct_r_s___msg_type_def}{RS\_MsgTypeDef}}\ *modbus\_msg)}
|
||
\DoxyCodeLine{\Hypertarget{modbus__inputregs_8c_source_l00088}00088\ \{}
|
||
\DoxyCodeLine{\Hypertarget{modbus__inputregs_8c_source_l00089}00089\ \ \ \textcolor{comment}{//-\/-\/-\/-\/-\/-\/-\/-\/-\/CHECK\ FOR\ ERRORS-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/\ }}
|
||
\DoxyCodeLine{\Hypertarget{modbus__inputregs_8c_source_l00090}00090\ \ \ \textcolor{comment}{//\ get\ origin\ address\ for\ data}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__inputregs_8c_source_l00091}00091\ \ \ uint16\_t\ *pInRegs;\ \ \ \ \ \ }
|
||
\DoxyCodeLine{\Hypertarget{modbus__inputregs_8c_source_l00092}00092\ \ \ 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}}(\&pInRegs,\ 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\_Input);\ \textcolor{comment}{//\ определение\ адреса\ регистров}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__inputregs_8c_source_l00093}00093\ \ \ \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__inputregs_8c_source_l00094}00094\ \ \ \ \ \textcolor{keywordflow}{return}\ 0;}
|
||
\DoxyCodeLine{\Hypertarget{modbus__inputregs_8c_source_l00095}00095\ \ \ }
|
||
\DoxyCodeLine{\Hypertarget{modbus__inputregs_8c_source_l00096}00096\ }
|
||
\DoxyCodeLine{\Hypertarget{modbus__inputregs_8c_source_l00097}00097\ \ \ \textcolor{comment}{//-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/READING\ REGS-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__inputregs_8c_source_l00098}00098\ \ \ \textcolor{comment}{//\ setup\ output\ message\ data\ size\ }}
|
||
\DoxyCodeLine{\Hypertarget{modbus__inputregs_8c_source_l00099}00099\ \ \ 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__inputregs_8c_source_l00100}00100\ \ \ \textcolor{comment}{//\ read\ data}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__inputregs_8c_source_l00101}00101\ \ \ \textcolor{keywordtype}{int}\ i;}
|
||
\DoxyCodeLine{\Hypertarget{modbus__inputregs_8c_source_l00102}00102\ \ \ \textcolor{keywordflow}{for}\ (i\ =\ 0;\ i<modbus\_msg-\/>\mbox{\hyperlink{struct_r_s___msg_type_def_a1ccb2bf492218a6ae3a5b6ad5cd4c82f}{Qnt}};\ i++)}
|
||
\DoxyCodeLine{\Hypertarget{modbus__inputregs_8c_source_l00103}00103\ \ \ \{}
|
||
\DoxyCodeLine{\Hypertarget{modbus__inputregs_8c_source_l00104}00104\ \ \ \ \ \textcolor{keywordflow}{if}(*((int16\_t\ *)pInRegs)\ >\ 0)}
|
||
\DoxyCodeLine{\Hypertarget{modbus__inputregs_8c_source_l00105}00105\ \ \ \ \ \ \ modbus\_msg-\/>\mbox{\hyperlink{struct_r_s___msg_type_def_aacbc6754621bd84742cd6c2ba65ad094}{MbData}}[i]\ =\ (*pInRegs++);}
|
||
\DoxyCodeLine{\Hypertarget{modbus__inputregs_8c_source_l00106}00106\ \ \ \ \ \textcolor{keywordflow}{else}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__inputregs_8c_source_l00107}00107\ \ \ \ \ \ \ modbus\_msg-\/>\mbox{\hyperlink{struct_r_s___msg_type_def_aacbc6754621bd84742cd6c2ba65ad094}{MbData}}[i]\ =\ (*pInRegs++);}
|
||
\DoxyCodeLine{\Hypertarget{modbus__inputregs_8c_source_l00108}00108\ \ \ \}\ }
|
||
\DoxyCodeLine{\Hypertarget{modbus__inputregs_8c_source_l00109}00109\ \ \ \textcolor{keywordflow}{return}\ 1;}
|
||
\DoxyCodeLine{\Hypertarget{modbus__inputregs_8c_source_l00110}00110\ \}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__inputregs_8c_source_l00111}00111\ }
|
||
\DoxyCodeLine{\Hypertarget{modbus__inputregs_8c_source_l00112}00112\ \textcolor{preprocessor}{\#endif\ }\textcolor{comment}{//MODBUS\_ENABLE\_INPUTS}}
|
||
|
||
\end{DoxyCode}
|