536 lines
27 KiB
HTML
536 lines
27 KiB
HTML
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||
|
<html xmlns="http://www.w3.org/1999/xhtml" lang="en-US">
|
||
|
<head>
|
||
|
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
|
||
|
<meta http-equiv="X-UA-Compatible" content="IE=11"/>
|
||
|
<meta name="generator" content="Doxygen 1.9.6"/>
|
||
|
<meta name="viewport" content="width=device-width, initial-scale=1"/>
|
||
|
<title>Solar panel: modbus.c File Reference</title>
|
||
|
<link href="tabs.css" rel="stylesheet" type="text/css"/>
|
||
|
<script type="text/javascript" src="jquery.js"></script>
|
||
|
<script type="text/javascript" src="dynsections.js"></script>
|
||
|
<link href="navtree.css" rel="stylesheet" type="text/css"/>
|
||
|
<script type="text/javascript" src="resize.js"></script>
|
||
|
<script type="text/javascript" src="navtreedata.js"></script>
|
||
|
<script type="text/javascript" src="navtree.js"></script>
|
||
|
<link href="search/search.css" rel="stylesheet" type="text/css"/>
|
||
|
<script type="text/javascript" src="search/searchdata.js"></script>
|
||
|
<script type="text/javascript" src="search/search.js"></script>
|
||
|
<link href="doxygen.css" rel="stylesheet" type="text/css" />
|
||
|
</head>
|
||
|
<body>
|
||
|
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
|
||
|
<div id="titlearea">
|
||
|
<table cellspacing="0" cellpadding="0">
|
||
|
<tbody>
|
||
|
<tr id="projectrow">
|
||
|
<td id="projectalign">
|
||
|
<div id="projectname">Solar panel
|
||
|
</div>
|
||
|
</td>
|
||
|
</tr>
|
||
|
</tbody>
|
||
|
</table>
|
||
|
</div>
|
||
|
<!-- end header part -->
|
||
|
<!-- Generated by Doxygen 1.9.6 -->
|
||
|
<script type="text/javascript">
|
||
|
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */
|
||
|
var searchBox = new SearchBox("searchBox", "search/",'.html');
|
||
|
/* @license-end */
|
||
|
</script>
|
||
|
<script type="text/javascript" src="menudata.js"></script>
|
||
|
<script type="text/javascript" src="menu.js"></script>
|
||
|
<script type="text/javascript">
|
||
|
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */
|
||
|
$(function() {
|
||
|
initMenu('',true,false,'search.php','Search');
|
||
|
$(document).ready(function() { init_search(); });
|
||
|
});
|
||
|
/* @license-end */
|
||
|
</script>
|
||
|
<div id="main-nav"></div>
|
||
|
</div><!-- top -->
|
||
|
<div id="side-nav" class="ui-resizable side-nav-resizable">
|
||
|
<div id="nav-tree">
|
||
|
<div id="nav-tree-contents">
|
||
|
<div id="nav-sync" class="sync"></div>
|
||
|
</div>
|
||
|
</div>
|
||
|
<div id="splitbar" style="-moz-user-select:none;"
|
||
|
class="ui-resizable-handle">
|
||
|
</div>
|
||
|
</div>
|
||
|
<script type="text/javascript">
|
||
|
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */
|
||
|
$(document).ready(function(){initNavTree('modbus_8c.html',''); initResizable(); });
|
||
|
/* @license-end */
|
||
|
</script>
|
||
|
<div id="doc-content">
|
||
|
<!-- window showing the filter options -->
|
||
|
<div id="MSearchSelectWindow"
|
||
|
onmouseover="return searchBox.OnSearchSelectShow()"
|
||
|
onmouseout="return searchBox.OnSearchSelectHide()"
|
||
|
onkeydown="return searchBox.OnSearchSelectKey(event)">
|
||
|
</div>
|
||
|
|
||
|
<!-- iframe showing the search results (closed by default) -->
|
||
|
<div id="MSearchResultsWindow">
|
||
|
<div id="MSearchResults">
|
||
|
<div class="SRPage">
|
||
|
<div id="SRIndex">
|
||
|
<div id="SRResults"></div>
|
||
|
<div class="SRStatus" id="Loading">Loading...</div>
|
||
|
<div class="SRStatus" id="Searching">Searching...</div>
|
||
|
<div class="SRStatus" id="NoMatches">No Matches</div>
|
||
|
</div>
|
||
|
</div>
|
||
|
</div>
|
||
|
</div>
|
||
|
|
||
|
<div class="header">
|
||
|
<div class="summary">
|
||
|
<a href="#define-members">Macros</a> |
|
||
|
<a href="#func-members">Functions</a> |
|
||
|
<a href="#var-members">Variables</a> </div>
|
||
|
<div class="headertitle"><div class="title">modbus.c File Reference</div></div>
|
||
|
</div><!--header-->
|
||
|
<div class="contents">
|
||
|
<div class="textblock"><code>#include "<a class="el" href="modbus_8h_source.html">modbus.h</a>"</code><br />
|
||
|
<code>#include "<a class="el" href="crc_8h_source.html">crc.h</a>"</code><br />
|
||
|
</div>
|
||
|
<p><a href="modbus_8c_source.html">Go to the source code of this file.</a></p>
|
||
|
<table class="memberdecls">
|
||
|
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="define-members" name="define-members"></a>
|
||
|
Macros</h2></td></tr>
|
||
|
<tr class="memitem:a860e48854b8e16a310dd29fe6e069561"><td class="memItemLeft" align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="modbus_8c.html#a860e48854b8e16a310dd29fe6e069561">READ_INPUT_REGISTERS</a>   0x04</td></tr>
|
||
|
<tr class="memdesc:a860e48854b8e16a310dd29fe6e069561"><td class="mdescLeft"> </td><td class="mdescRight">Modbus function for read input register = 04. <br /></td></tr>
|
||
|
<tr class="separator:a860e48854b8e16a310dd29fe6e069561"><td class="memSeparator" colspan="2"> </td></tr>
|
||
|
<tr class="memitem:a72629c87e1b18706ed17ee3dc768d5d1"><td class="memItemLeft" align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="modbus_8c.html#a72629c87e1b18706ed17ee3dc768d5d1">READ_HOLDING_REGISTERS</a>   0x03</td></tr>
|
||
|
<tr class="memdesc:a72629c87e1b18706ed17ee3dc768d5d1"><td class="mdescLeft"> </td><td class="mdescRight">Modbus function for read holding register = 03. <br /></td></tr>
|
||
|
<tr class="separator:a72629c87e1b18706ed17ee3dc768d5d1"><td class="memSeparator" colspan="2"> </td></tr>
|
||
|
<tr class="memitem:ae193fb8e7fb5dafe59b40642c13b4b42"><td class="memItemLeft" align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="modbus_8c.html#ae193fb8e7fb5dafe59b40642c13b4b42">WRITE_SINGLE_REGISTER</a>   0x06</td></tr>
|
||
|
<tr class="memdesc:ae193fb8e7fb5dafe59b40642c13b4b42"><td class="mdescLeft"> </td><td class="mdescRight">Modbus function for write a single register = 06. <br /></td></tr>
|
||
|
<tr class="separator:ae193fb8e7fb5dafe59b40642c13b4b42"><td class="memSeparator" colspan="2"> </td></tr>
|
||
|
<tr class="memitem:a262addcd07ad5759dbeca3efe5d808d3"><td class="memItemLeft" align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="modbus_8c.html#a262addcd07ad5759dbeca3efe5d808d3">ILLEGAL_FUNCTION</a>   1</td></tr>
|
||
|
<tr class="separator:a262addcd07ad5759dbeca3efe5d808d3"><td class="memSeparator" colspan="2"> </td></tr>
|
||
|
<tr class="memitem:ad36357dad4ceb8b0ecb0f5f53eee1502"><td class="memItemLeft" align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="modbus_8c.html#ad36357dad4ceb8b0ecb0f5f53eee1502">ILLEGAL_DATA_ADDRESS</a>   2</td></tr>
|
||
|
<tr class="separator:ad36357dad4ceb8b0ecb0f5f53eee1502"><td class="memSeparator" colspan="2"> </td></tr>
|
||
|
<tr class="memitem:a2a9c40f66b96eb93a9dbb17d1f79443d"><td class="memItemLeft" align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="modbus_8c.html#a2a9c40f66b96eb93a9dbb17d1f79443d">ILLEGAL_DATA_VALUE</a>   3</td></tr>
|
||
|
<tr class="separator:a2a9c40f66b96eb93a9dbb17d1f79443d"><td class="memSeparator" colspan="2"> </td></tr>
|
||
|
<tr class="memitem:a92cb3f97527a2fbca9881dc0c14d98eb"><td class="memItemLeft" align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="modbus_8c.html#a92cb3f97527a2fbca9881dc0c14d98eb">SLAVE_DEVICE_FAILURE</a>   4</td></tr>
|
||
|
<tr class="separator:a92cb3f97527a2fbca9881dc0c14d98eb"><td class="memSeparator" colspan="2"> </td></tr>
|
||
|
</table><table class="memberdecls">
|
||
|
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="func-members" name="func-members"></a>
|
||
|
Functions</h2></td></tr>
|
||
|
<tr class="memitem:add3e4a272cc65130d4e9f9c53caa61db"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="modbus_8c.html#add3e4a272cc65130d4e9f9c53caa61db">modbus_timer</a> (void)</td></tr>
|
||
|
<tr class="separator:add3e4a272cc65130d4e9f9c53caa61db"><td class="memSeparator" colspan="2"> </td></tr>
|
||
|
<tr class="memitem:a104c0f284978c4cc8d34d36677a97e72"><td class="memItemLeft" align="right" valign="top">uint16_t </td><td class="memItemRight" valign="bottom"><a class="el" href="modbus_8c.html#a104c0f284978c4cc8d34d36677a97e72">measure_voltage</a> ()</td></tr>
|
||
|
<tr class="separator:a104c0f284978c4cc8d34d36677a97e72"><td class="memSeparator" colspan="2"> </td></tr>
|
||
|
<tr class="memitem:a6ae3279c3dcad4aa532eb07689f242e1"><td class="memItemLeft" align="right" valign="top">uint8_t </td><td class="memItemRight" valign="bottom"><a class="el" href="modbus_8c.html#a6ae3279c3dcad4aa532eb07689f242e1">modbus_analyse_and_answer</a> (void)</td></tr>
|
||
|
<tr class="separator:a6ae3279c3dcad4aa532eb07689f242e1"><td class="memSeparator" colspan="2"> </td></tr>
|
||
|
<tr class="memitem:aacb32a5aea357fae4e7fde574f95bfb9"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="modbus_8c.html#aacb32a5aea357fae4e7fde574f95bfb9">modbus_char_recvd</a> (void)</td></tr>
|
||
|
<tr class="separator:aacb32a5aea357fae4e7fde574f95bfb9"><td class="memSeparator" colspan="2"> </td></tr>
|
||
|
<tr class="memitem:af1b0553ef81d80e21233e23c3253ae61"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="modbus_8c.html#af1b0553ef81d80e21233e23c3253ae61">modbus_send</a> (uint8_t length)</td></tr>
|
||
|
<tr class="separator:af1b0553ef81d80e21233e23c3253ae61"><td class="memSeparator" colspan="2"> </td></tr>
|
||
|
<tr class="memitem:a67d9839b8e221bcb53bbbb2ba59ff618"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="modbus_8c.html#a67d9839b8e221bcb53bbbb2ba59ff618">modbus_init</a> (uint8_t address)</td></tr>
|
||
|
<tr class="separator:a67d9839b8e221bcb53bbbb2ba59ff618"><td class="memSeparator" colspan="2"> </td></tr>
|
||
|
</table><table class="memberdecls">
|
||
|
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="var-members" name="var-members"></a>
|
||
|
Variables</h2></td></tr>
|
||
|
<tr class="memitem:a32ee4d57aa4ff7f7fce07fbe100dc0c2"><td class="memItemLeft" align="right" valign="top">uint8_t </td><td class="memItemRight" valign="bottom"><a class="el" href="modbus_8c.html#a32ee4d57aa4ff7f7fce07fbe100dc0c2">modbusAddress</a></td></tr>
|
||
|
<tr class="separator:a32ee4d57aa4ff7f7fce07fbe100dc0c2"><td class="memSeparator" colspan="2"> </td></tr>
|
||
|
<tr class="memitem:af231936e7cd39b49156a2a178f3d54eb"><td class="memItemLeft" align="right" valign="top">uint16_t </td><td class="memItemRight" valign="bottom"><a class="el" href="modbus_8c.html#af231936e7cd39b49156a2a178f3d54eb">input_registers</a> [2]</td></tr>
|
||
|
<tr class="separator:af231936e7cd39b49156a2a178f3d54eb"><td class="memSeparator" colspan="2"> </td></tr>
|
||
|
<tr class="memitem:a2aac17f17a0fbffad12e7ca46ed8ae0f"><td class="memItemLeft" align="right" valign="top">uint16_t </td><td class="memItemRight" valign="bottom"><a class="el" href="modbus_8c.html#a2aac17f17a0fbffad12e7ca46ed8ae0f">holding_registers</a> [2]</td></tr>
|
||
|
<tr class="separator:a2aac17f17a0fbffad12e7ca46ed8ae0f"><td class="memSeparator" colspan="2"> </td></tr>
|
||
|
<tr class="memitem:a95463de2dabcd8671528bb72c7139e46"><td class="memItemLeft" align="right" valign="top">uint8_t </td><td class="memItemRight" valign="bottom"><a class="el" href="modbus_8c.html#a95463de2dabcd8671528bb72c7139e46">rx_buf</a> [256]</td></tr>
|
||
|
<tr class="separator:a95463de2dabcd8671528bb72c7139e46"><td class="memSeparator" colspan="2"> </td></tr>
|
||
|
<tr class="memitem:a579f15c7d6aeee8d684dce40e205c54b"><td class="memItemLeft" align="right" valign="top">uint8_t </td><td class="memItemRight" valign="bottom"><a class="el" href="modbus_8c.html#a579f15c7d6aeee8d684dce40e205c54b">tx_buf</a> [256]</td></tr>
|
||
|
<tr class="separator:a579f15c7d6aeee8d684dce40e205c54b"><td class="memSeparator" colspan="2"> </td></tr>
|
||
|
<tr class="memitem:a9acb7baf86b62d19a199e672316e6294"><td class="memItemLeft" align="right" valign="top">uint8_t </td><td class="memItemRight" valign="bottom"><a class="el" href="modbus_8c.html#a9acb7baf86b62d19a199e672316e6294">recPtr</a> = 0</td></tr>
|
||
|
<tr class="separator:a9acb7baf86b62d19a199e672316e6294"><td class="memSeparator" colspan="2"> </td></tr>
|
||
|
</table>
|
||
|
<h2 class="groupheader">Macro Definition Documentation</h2>
|
||
|
<a id="ad36357dad4ceb8b0ecb0f5f53eee1502" name="ad36357dad4ceb8b0ecb0f5f53eee1502"></a>
|
||
|
<h2 class="memtitle"><span class="permalink"><a href="#ad36357dad4ceb8b0ecb0f5f53eee1502">◆ </a></span>ILLEGAL_DATA_ADDRESS</h2>
|
||
|
|
||
|
<div class="memitem">
|
||
|
<div class="memproto">
|
||
|
<table class="memname">
|
||
|
<tr>
|
||
|
<td class="memname">#define ILLEGAL_DATA_ADDRESS   2</td>
|
||
|
</tr>
|
||
|
</table>
|
||
|
</div><div class="memdoc">
|
||
|
|
||
|
<p class="definition">Definition at line <a class="el" href="modbus_8c_source.html#l00019">19</a> of file <a class="el" href="modbus_8c_source.html">modbus.c</a>.</p>
|
||
|
|
||
|
</div>
|
||
|
</div>
|
||
|
<a id="a2a9c40f66b96eb93a9dbb17d1f79443d" name="a2a9c40f66b96eb93a9dbb17d1f79443d"></a>
|
||
|
<h2 class="memtitle"><span class="permalink"><a href="#a2a9c40f66b96eb93a9dbb17d1f79443d">◆ </a></span>ILLEGAL_DATA_VALUE</h2>
|
||
|
|
||
|
<div class="memitem">
|
||
|
<div class="memproto">
|
||
|
<table class="memname">
|
||
|
<tr>
|
||
|
<td class="memname">#define ILLEGAL_DATA_VALUE   3</td>
|
||
|
</tr>
|
||
|
</table>
|
||
|
</div><div class="memdoc">
|
||
|
|
||
|
<p class="definition">Definition at line <a class="el" href="modbus_8c_source.html#l00020">20</a> of file <a class="el" href="modbus_8c_source.html">modbus.c</a>.</p>
|
||
|
|
||
|
</div>
|
||
|
</div>
|
||
|
<a id="a262addcd07ad5759dbeca3efe5d808d3" name="a262addcd07ad5759dbeca3efe5d808d3"></a>
|
||
|
<h2 class="memtitle"><span class="permalink"><a href="#a262addcd07ad5759dbeca3efe5d808d3">◆ </a></span>ILLEGAL_FUNCTION</h2>
|
||
|
|
||
|
<div class="memitem">
|
||
|
<div class="memproto">
|
||
|
<table class="memname">
|
||
|
<tr>
|
||
|
<td class="memname">#define ILLEGAL_FUNCTION   1</td>
|
||
|
</tr>
|
||
|
</table>
|
||
|
</div><div class="memdoc">
|
||
|
|
||
|
<p class="definition">Definition at line <a class="el" href="modbus_8c_source.html#l00018">18</a> of file <a class="el" href="modbus_8c_source.html">modbus.c</a>.</p>
|
||
|
|
||
|
</div>
|
||
|
</div>
|
||
|
<a id="a72629c87e1b18706ed17ee3dc768d5d1" name="a72629c87e1b18706ed17ee3dc768d5d1"></a>
|
||
|
<h2 class="memtitle"><span class="permalink"><a href="#a72629c87e1b18706ed17ee3dc768d5d1">◆ </a></span>READ_HOLDING_REGISTERS</h2>
|
||
|
|
||
|
<div class="memitem">
|
||
|
<div class="memproto">
|
||
|
<table class="memname">
|
||
|
<tr>
|
||
|
<td class="memname">#define READ_HOLDING_REGISTERS   0x03</td>
|
||
|
</tr>
|
||
|
</table>
|
||
|
</div><div class="memdoc">
|
||
|
|
||
|
<p>Modbus function for read holding register = 03. </p>
|
||
|
|
||
|
<p class="definition">Definition at line <a class="el" href="modbus_8c_source.html#l00008">8</a> of file <a class="el" href="modbus_8c_source.html">modbus.c</a>.</p>
|
||
|
|
||
|
</div>
|
||
|
</div>
|
||
|
<a id="a860e48854b8e16a310dd29fe6e069561" name="a860e48854b8e16a310dd29fe6e069561"></a>
|
||
|
<h2 class="memtitle"><span class="permalink"><a href="#a860e48854b8e16a310dd29fe6e069561">◆ </a></span>READ_INPUT_REGISTERS</h2>
|
||
|
|
||
|
<div class="memitem">
|
||
|
<div class="memproto">
|
||
|
<table class="memname">
|
||
|
<tr>
|
||
|
<td class="memname">#define READ_INPUT_REGISTERS   0x04</td>
|
||
|
</tr>
|
||
|
</table>
|
||
|
</div><div class="memdoc">
|
||
|
|
||
|
<p>Modbus function for read input register = 04. </p>
|
||
|
|
||
|
<p class="definition">Definition at line <a class="el" href="modbus_8c_source.html#l00007">7</a> of file <a class="el" href="modbus_8c_source.html">modbus.c</a>.</p>
|
||
|
|
||
|
</div>
|
||
|
</div>
|
||
|
<a id="a92cb3f97527a2fbca9881dc0c14d98eb" name="a92cb3f97527a2fbca9881dc0c14d98eb"></a>
|
||
|
<h2 class="memtitle"><span class="permalink"><a href="#a92cb3f97527a2fbca9881dc0c14d98eb">◆ </a></span>SLAVE_DEVICE_FAILURE</h2>
|
||
|
|
||
|
<div class="memitem">
|
||
|
<div class="memproto">
|
||
|
<table class="memname">
|
||
|
<tr>
|
||
|
<td class="memname">#define SLAVE_DEVICE_FAILURE   4</td>
|
||
|
</tr>
|
||
|
</table>
|
||
|
</div><div class="memdoc">
|
||
|
|
||
|
<p class="definition">Definition at line <a class="el" href="modbus_8c_source.html#l00021">21</a> of file <a class="el" href="modbus_8c_source.html">modbus.c</a>.</p>
|
||
|
|
||
|
</div>
|
||
|
</div>
|
||
|
<a id="ae193fb8e7fb5dafe59b40642c13b4b42" name="ae193fb8e7fb5dafe59b40642c13b4b42"></a>
|
||
|
<h2 class="memtitle"><span class="permalink"><a href="#ae193fb8e7fb5dafe59b40642c13b4b42">◆ </a></span>WRITE_SINGLE_REGISTER</h2>
|
||
|
|
||
|
<div class="memitem">
|
||
|
<div class="memproto">
|
||
|
<table class="memname">
|
||
|
<tr>
|
||
|
<td class="memname">#define WRITE_SINGLE_REGISTER   0x06</td>
|
||
|
</tr>
|
||
|
</table>
|
||
|
</div><div class="memdoc">
|
||
|
|
||
|
<p>Modbus function for write a single register = 06. </p>
|
||
|
|
||
|
<p class="definition">Definition at line <a class="el" href="modbus_8c_source.html#l00009">9</a> of file <a class="el" href="modbus_8c_source.html">modbus.c</a>.</p>
|
||
|
|
||
|
</div>
|
||
|
</div>
|
||
|
<h2 class="groupheader">Function Documentation</h2>
|
||
|
<a id="a104c0f284978c4cc8d34d36677a97e72" name="a104c0f284978c4cc8d34d36677a97e72"></a>
|
||
|
<h2 class="memtitle"><span class="permalink"><a href="#a104c0f284978c4cc8d34d36677a97e72">◆ </a></span>measure_voltage()</h2>
|
||
|
|
||
|
<div class="memitem">
|
||
|
<div class="memproto">
|
||
|
<table class="memname">
|
||
|
<tr>
|
||
|
<td class="memname">uint16_t measure_voltage </td>
|
||
|
<td>(</td>
|
||
|
<td class="paramname"></td><td>)</td>
|
||
|
<td></td>
|
||
|
</tr>
|
||
|
</table>
|
||
|
</div><div class="memdoc">
|
||
|
<p>Measure the voltage on the channel for the current. This function is expected to do some filtering.</p>
|
||
|
<dl class="section return"><dt>Returns</dt><dd>The offset </dd></dl>
|
||
|
|
||
|
<p class="definition">Definition at line <a class="el" href="measure_8c_source.html#l00037">37</a> of file <a class="el" href="measure_8c_source.html">measure.c</a>.</p>
|
||
|
|
||
|
</div>
|
||
|
</div>
|
||
|
<a id="a6ae3279c3dcad4aa532eb07689f242e1" name="a6ae3279c3dcad4aa532eb07689f242e1"></a>
|
||
|
<h2 class="memtitle"><span class="permalink"><a href="#a6ae3279c3dcad4aa532eb07689f242e1">◆ </a></span>modbus_analyse_and_answer()</h2>
|
||
|
|
||
|
<div class="memitem">
|
||
|
<div class="memproto">
|
||
|
<table class="memname">
|
||
|
<tr>
|
||
|
<td class="memname">uint8_t modbus_analyse_and_answer </td>
|
||
|
<td>(</td>
|
||
|
<td class="paramtype">void </td>
|
||
|
<td class="paramname"></td><td>)</td>
|
||
|
<td></td>
|
||
|
</tr>
|
||
|
</table>
|
||
|
</div><div class="memdoc">
|
||
|
<p>Analyses the received frame and answer to server</p>
|
||
|
<dl class="section return"><dt>Returns</dt><dd>an error code if frame not valid </dd></dl>
|
||
|
|
||
|
<p class="definition">Definition at line <a class="el" href="modbus_8c_source.html#l00040">40</a> of file <a class="el" href="modbus_8c_source.html">modbus.c</a>.</p>
|
||
|
|
||
|
</div>
|
||
|
</div>
|
||
|
<a id="aacb32a5aea357fae4e7fde574f95bfb9" name="aacb32a5aea357fae4e7fde574f95bfb9"></a>
|
||
|
<h2 class="memtitle"><span class="permalink"><a href="#aacb32a5aea357fae4e7fde574f95bfb9">◆ </a></span>modbus_char_recvd()</h2>
|
||
|
|
||
|
<div class="memitem">
|
||
|
<div class="memproto">
|
||
|
<table class="memname">
|
||
|
<tr>
|
||
|
<td class="memname">void modbus_char_recvd </td>
|
||
|
<td>(</td>
|
||
|
<td class="paramtype">void </td>
|
||
|
<td class="paramname"></td><td>)</td>
|
||
|
<td></td>
|
||
|
</tr>
|
||
|
</table>
|
||
|
</div><div class="memdoc">
|
||
|
<p>This function will be called every time a character has been received on the Modbus serial port. It is called from the interrupt hander.</p>
|
||
|
<dl class="params"><dt>Parameters</dt><dd>
|
||
|
<table class="params">
|
||
|
<tr><td class="paramname">c</td><td>: the received char // removed ! </td></tr>
|
||
|
</table>
|
||
|
</dd>
|
||
|
</dl>
|
||
|
<dl class="section see"><dt>See also</dt><dd>interrupts.c. </dd></dl>
|
||
|
|
||
|
<p class="definition">Definition at line <a class="el" href="modbus_8c_source.html#l00085">85</a> of file <a class="el" href="modbus_8c_source.html">modbus.c</a>.</p>
|
||
|
|
||
|
</div>
|
||
|
</div>
|
||
|
<a id="a67d9839b8e221bcb53bbbb2ba59ff618" name="a67d9839b8e221bcb53bbbb2ba59ff618"></a>
|
||
|
<h2 class="memtitle"><span class="permalink"><a href="#a67d9839b8e221bcb53bbbb2ba59ff618">◆ </a></span>modbus_init()</h2>
|
||
|
|
||
|
<div class="memitem">
|
||
|
<div class="memproto">
|
||
|
<table class="memname">
|
||
|
<tr>
|
||
|
<td class="memname">void modbus_init </td>
|
||
|
<td>(</td>
|
||
|
<td class="paramtype">uint8_t </td>
|
||
|
<td class="paramname"><em>address</em></td><td>)</td>
|
||
|
<td></td>
|
||
|
</tr>
|
||
|
</table>
|
||
|
</div><div class="memdoc">
|
||
|
<p>Initializes this Modbus library.</p>
|
||
|
<p>Initialize pins, timer, serial port and variables. Interrupts MUST be initialized for the timer and the serial port.</p>
|
||
|
<dl class="params"><dt>Parameters</dt><dd>
|
||
|
<table class="params">
|
||
|
<tr><td class="paramname">address</td><td>: the Modbus address of this device</td></tr>
|
||
|
</table>
|
||
|
</dd>
|
||
|
</dl>
|
||
|
<dl class="section see"><dt>See also</dt><dd><a class="el" href="modbus_8h.html#aacb32a5aea357fae4e7fde574f95bfb9">modbus_char_recvd</a> </dd>
|
||
|
<dd>
|
||
|
<a class="el" href="modbus_8h.html#add3e4a272cc65130d4e9f9c53caa61db">modbus_timer</a> </dd>
|
||
|
<dd>
|
||
|
interrupts.c </dd></dl>
|
||
|
|
||
|
<p class="definition">Definition at line <a class="el" href="modbus_8c_source.html#l00108">108</a> of file <a class="el" href="modbus_8c_source.html">modbus.c</a>.</p>
|
||
|
|
||
|
</div>
|
||
|
</div>
|
||
|
<a id="af1b0553ef81d80e21233e23c3253ae61" name="af1b0553ef81d80e21233e23c3253ae61"></a>
|
||
|
<h2 class="memtitle"><span class="permalink"><a href="#af1b0553ef81d80e21233e23c3253ae61">◆ </a></span>modbus_send()</h2>
|
||
|
|
||
|
<div class="memitem">
|
||
|
<div class="memproto">
|
||
|
<table class="memname">
|
||
|
<tr>
|
||
|
<td class="memname">void modbus_send </td>
|
||
|
<td>(</td>
|
||
|
<td class="paramtype">uint8_t </td>
|
||
|
<td class="paramname"><em>length</em></td><td>)</td>
|
||
|
<td></td>
|
||
|
</tr>
|
||
|
</table>
|
||
|
</div><div class="memdoc">
|
||
|
<p>Send the Modbus frame on tx_buf with CRC added</p>
|
||
|
<dl class="params"><dt>Parameters</dt><dd>
|
||
|
<table class="params">
|
||
|
<tr><td class="paramname">length</td><td>: length of the frame without the CRC </td></tr>
|
||
|
</table>
|
||
|
</dd>
|
||
|
</dl>
|
||
|
|
||
|
<p class="definition">Definition at line <a class="el" href="modbus_8c_source.html#l00092">92</a> of file <a class="el" href="modbus_8c_source.html">modbus.c</a>.</p>
|
||
|
|
||
|
</div>
|
||
|
</div>
|
||
|
<a id="add3e4a272cc65130d4e9f9c53caa61db" name="add3e4a272cc65130d4e9f9c53caa61db"></a>
|
||
|
<h2 class="memtitle"><span class="permalink"><a href="#add3e4a272cc65130d4e9f9c53caa61db">◆ </a></span>modbus_timer()</h2>
|
||
|
|
||
|
<div class="memitem">
|
||
|
<div class="memproto">
|
||
|
<table class="memname">
|
||
|
<tr>
|
||
|
<td class="memname">void modbus_timer </td>
|
||
|
<td>(</td>
|
||
|
<td class="paramtype">void </td>
|
||
|
<td class="paramname"></td><td>)</td>
|
||
|
<td></td>
|
||
|
</tr>
|
||
|
</table>
|
||
|
</div><div class="memdoc">
|
||
|
<p>Modbus timer finished. This function is called by the interrupt handler when a MODBUS frame is finished. It must analyse the received packet and reply if required.</p>
|
||
|
<dl class="section see"><dt>See also</dt><dd>interrupts.c </dd></dl>
|
||
|
|
||
|
<p class="definition">Definition at line <a class="el" href="modbus_8c_source.html#l00033">33</a> of file <a class="el" href="modbus_8c_source.html">modbus.c</a>.</p>
|
||
|
|
||
|
</div>
|
||
|
</div>
|
||
|
<h2 class="groupheader">Variable Documentation</h2>
|
||
|
<a id="a2aac17f17a0fbffad12e7ca46ed8ae0f" name="a2aac17f17a0fbffad12e7ca46ed8ae0f"></a>
|
||
|
<h2 class="memtitle"><span class="permalink"><a href="#a2aac17f17a0fbffad12e7ca46ed8ae0f">◆ </a></span>holding_registers</h2>
|
||
|
|
||
|
<div class="memitem">
|
||
|
<div class="memproto">
|
||
|
<table class="memname">
|
||
|
<tr>
|
||
|
<td class="memname">uint16_t holding_registers[2]</td>
|
||
|
</tr>
|
||
|
</table>
|
||
|
</div><div class="memdoc">
|
||
|
|
||
|
<p class="definition">Definition at line <a class="el" href="modbus_8c_source.html#l00014">14</a> of file <a class="el" href="modbus_8c_source.html">modbus.c</a>.</p>
|
||
|
|
||
|
</div>
|
||
|
</div>
|
||
|
<a id="af231936e7cd39b49156a2a178f3d54eb" name="af231936e7cd39b49156a2a178f3d54eb"></a>
|
||
|
<h2 class="memtitle"><span class="permalink"><a href="#af231936e7cd39b49156a2a178f3d54eb">◆ </a></span>input_registers</h2>
|
||
|
|
||
|
<div class="memitem">
|
||
|
<div class="memproto">
|
||
|
<table class="memname">
|
||
|
<tr>
|
||
|
<td class="memname">uint16_t input_registers[2]</td>
|
||
|
</tr>
|
||
|
</table>
|
||
|
</div><div class="memdoc">
|
||
|
|
||
|
<p class="definition">Definition at line <a class="el" href="modbus_8c_source.html#l00013">13</a> of file <a class="el" href="modbus_8c_source.html">modbus.c</a>.</p>
|
||
|
|
||
|
</div>
|
||
|
</div>
|
||
|
<a id="a32ee4d57aa4ff7f7fce07fbe100dc0c2" name="a32ee4d57aa4ff7f7fce07fbe100dc0c2"></a>
|
||
|
<h2 class="memtitle"><span class="permalink"><a href="#a32ee4d57aa4ff7f7fce07fbe100dc0c2">◆ </a></span>modbusAddress</h2>
|
||
|
|
||
|
<div class="memitem">
|
||
|
<div class="memproto">
|
||
|
<table class="memname">
|
||
|
<tr>
|
||
|
<td class="memname">uint8_t modbusAddress</td>
|
||
|
</tr>
|
||
|
</table>
|
||
|
</div><div class="memdoc">
|
||
|
|
||
|
<p class="definition">Definition at line <a class="el" href="modbus_8c_source.html#l00012">12</a> of file <a class="el" href="modbus_8c_source.html">modbus.c</a>.</p>
|
||
|
|
||
|
</div>
|
||
|
</div>
|
||
|
<a id="a9acb7baf86b62d19a199e672316e6294" name="a9acb7baf86b62d19a199e672316e6294"></a>
|
||
|
<h2 class="memtitle"><span class="permalink"><a href="#a9acb7baf86b62d19a199e672316e6294">◆ </a></span>recPtr</h2>
|
||
|
|
||
|
<div class="memitem">
|
||
|
<div class="memproto">
|
||
|
<table class="memname">
|
||
|
<tr>
|
||
|
<td class="memname">uint8_t recPtr = 0</td>
|
||
|
</tr>
|
||
|
</table>
|
||
|
</div><div class="memdoc">
|
||
|
|
||
|
<p class="definition">Definition at line <a class="el" href="modbus_8c_source.html#l00031">31</a> of file <a class="el" href="modbus_8c_source.html">modbus.c</a>.</p>
|
||
|
|
||
|
</div>
|
||
|
</div>
|
||
|
<a id="a95463de2dabcd8671528bb72c7139e46" name="a95463de2dabcd8671528bb72c7139e46"></a>
|
||
|
<h2 class="memtitle"><span class="permalink"><a href="#a95463de2dabcd8671528bb72c7139e46">◆ </a></span>rx_buf</h2>
|
||
|
|
||
|
<div class="memitem">
|
||
|
<div class="memproto">
|
||
|
<table class="memname">
|
||
|
<tr>
|
||
|
<td class="memname">uint8_t rx_buf[256]</td>
|
||
|
</tr>
|
||
|
</table>
|
||
|
</div><div class="memdoc">
|
||
|
<p>Buffers for serial receive and send operations which are more than one byte long </p>
|
||
|
|
||
|
<p class="definition">Definition at line <a class="el" href="modbus_8c_source.html#l00027">27</a> of file <a class="el" href="modbus_8c_source.html">modbus.c</a>.</p>
|
||
|
|
||
|
</div>
|
||
|
</div>
|
||
|
<a id="a579f15c7d6aeee8d684dce40e205c54b" name="a579f15c7d6aeee8d684dce40e205c54b"></a>
|
||
|
<h2 class="memtitle"><span class="permalink"><a href="#a579f15c7d6aeee8d684dce40e205c54b">◆ </a></span>tx_buf</h2>
|
||
|
|
||
|
<div class="memitem">
|
||
|
<div class="memproto">
|
||
|
<table class="memname">
|
||
|
<tr>
|
||
|
<td class="memname">uint8_t tx_buf[256]</td>
|
||
|
</tr>
|
||
|
</table>
|
||
|
</div><div class="memdoc">
|
||
|
|
||
|
<p class="definition">Definition at line <a class="el" href="modbus_8c_source.html#l00028">28</a> of file <a class="el" href="modbus_8c_source.html">modbus.c</a>.</p>
|
||
|
|
||
|
</div>
|
||
|
</div>
|
||
|
</div><!-- contents -->
|
||
|
</div><!-- doc-content -->
|
||
|
<!-- start footer part -->
|
||
|
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
|
||
|
<ul>
|
||
|
<li class="navelem"><a class="el" href="modbus_8c.html">modbus.c</a></li>
|
||
|
<li class="footer">Generated by <a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.9.6 </li>
|
||
|
</ul>
|
||
|
</div>
|
||
|
</body>
|
||
|
</html>
|