163 lines
16 KiB
HTML
163 lines
16 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: main.c Source File</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('main_8c_source.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="headertitle"><div class="title">main.c</div></div>
|
||
|
</div><!--header-->
|
||
|
<div class="contents">
|
||
|
<a href="main_8c.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a id="l00001" name="l00001"></a><span class="lineno"> 1</span> </div>
|
||
|
<div class="line"><a id="l00011" name="l00011"></a><span class="lineno"> 11</span><span class="preprocessor">#include "<a class="code" href="mcc_8h.html">mcc_generated_files/mcc.h</a>"</span></div>
|
||
|
<div class="line"><a id="l00012" name="l00012"></a><span class="lineno"> 12</span><span class="preprocessor">#include "<a class="code" href="lcd_8h.html">lcd/lcd.h</a>"</span></div>
|
||
|
<div class="line"><a id="l00013" name="l00013"></a><span class="lineno"> 13</span><span class="preprocessor">#include "<a class="code" href="measure_8h.html">measure.h</a>"</span></div>
|
||
|
<div class="line"><a id="l00014" name="l00014"></a><span class="lineno"> 14</span><span class="preprocessor">#include "<a class="code" href="modbus_8h.html">modbus.h</a>"</span></div>
|
||
|
<div class="line"><a id="l00015" name="l00015"></a><span class="lineno"> 15</span> </div>
|
||
|
<div class="line"><a id="l00016" name="l00016"></a><span class="lineno"><a class="line" href="main_8c.html#a97e80440b5a5ec2ffc172dead9f8d2ec"> 16</a></span><span class="preprocessor">#define MAX_COL 16 </span></div>
|
||
|
<div class="line"><a id="l00017" name="l00017"></a><span class="lineno"> 17</span> </div>
|
||
|
<div class="line"><a id="l00018" name="l00018"></a><span class="lineno"><a class="line" href="main_8c.html#a6288eba0f8e8ad3ab1544ad731eb7667"> 18</a></span><span class="keywordtype">void</span> <a class="code hl_function" href="main_8c.html#a6288eba0f8e8ad3ab1544ad731eb7667">main</a>(<span class="keywordtype">void</span>) {</div>
|
||
|
<div class="line"><a id="l00019" name="l00019"></a><span class="lineno"> 19</span> </div>
|
||
|
<div class="line"><a id="l00025" name="l00025"></a><span class="lineno"> 25</span> <a class="code hl_function" href="mcc_8c.html#a5e8391114a0cf91ac20002be25e3d352">SYSTEM_Initialize</a>();</div>
|
||
|
<div class="line"><a id="l00026" name="l00026"></a><span class="lineno"> 26</span> </div>
|
||
|
<div class="line"><a id="l00027" name="l00027"></a><span class="lineno"> 27</span> <a class="code hl_function" href="lcd_8c.html#ae3e90a42efbeab0e5b0c6478e01e80ba">Lcd_Init</a>(); </div>
|
||
|
<div class="line"><a id="l00028" name="l00028"></a><span class="lineno"> 28</span> <a class="code hl_function" href="measure_8c.html#a2b815e6730e8723a6d1d06d9ef8f31c0">adc_init</a>(); </div>
|
||
|
<div class="line"><a id="l00029" name="l00029"></a><span class="lineno"> 29</span> <a class="code hl_function" href="modbus_8c.html#a67d9839b8e221bcb53bbbb2ba59ff618">modbus_init</a>(0x80); </div>
|
||
|
<div class="line"><a id="l00030" name="l00030"></a><span class="lineno"> 30</span> </div>
|
||
|
<div class="line"><a id="l00032" name="l00032"></a><span class="lineno"> 32</span> <a class="code hl_define" href="interrupt__manager_8h.html#ab801e88ce18e2d200429ffbaa67dbf2b">INTERRUPT_GlobalInterruptEnable</a>();</div>
|
||
|
<div class="line"><a id="l00033" name="l00033"></a><span class="lineno"> 33</span> </div>
|
||
|
<div class="line"><a id="l00035" name="l00035"></a><span class="lineno"> 35</span> <a class="code hl_define" href="interrupt__manager_8h.html#a35865b73bdecc073d43ad4e0c62187ea">INTERRUPT_PeripheralInterruptEnable</a>();</div>
|
||
|
<div class="line"><a id="l00036" name="l00036"></a><span class="lineno"> 36</span> </div>
|
||
|
<div class="line"><a id="l00044" name="l00044"></a><span class="lineno"> 44</span> <a class="code hl_function" href="epwm1_8c.html#acb3f0021b8789111ae243d1cd4c5942c">EPWM1_LoadDutyValue</a>(0);</div>
|
||
|
<div class="line"><a id="l00045" name="l00045"></a><span class="lineno"> 45</span> <span class="keyword">const</span> uint16_t offsetCurrent = <a class="code hl_function" href="measure_8c.html#ad77a3b79bc20b11c0d5462cc0b7134b3">measure_current</a>(offsetCurrent);</div>
|
||
|
<div class="line"><a id="l00046" name="l00046"></a><span class="lineno"> 46</span> </div>
|
||
|
<div class="line"><a id="l00048" name="l00048"></a><span class="lineno"> 48</span> <span class="keywordtype">char</span> msg[<a class="code hl_define" href="main_8c.html#a97e80440b5a5ec2ffc172dead9f8d2ec">MAX_COL</a>+1]; </div>
|
||
|
<div class="line"><a id="l00049" name="l00049"></a><span class="lineno"> 49</span> </div>
|
||
|
<div class="line"><a id="l00054" name="l00054"></a><span class="lineno"> 54</span> <span class="keywordflow">while</span> (1) {</div>
|
||
|
<div class="line"><a id="l00055" name="l00055"></a><span class="lineno"> 55</span> </div>
|
||
|
<div class="line"><a id="l00057" name="l00057"></a><span class="lineno"> 57</span> <a class="code hl_variable" href="modbus_8c.html#af231936e7cd39b49156a2a178f3d54eb">input_registers</a>[0] = <a class="code hl_function" href="measure_8c.html#a104c0f284978c4cc8d34d36677a97e72">measure_voltage</a>();</div>
|
||
|
<div class="line"><a id="l00058" name="l00058"></a><span class="lineno"> 58</span> <a class="code hl_variable" href="modbus_8c.html#af231936e7cd39b49156a2a178f3d54eb">input_registers</a>[1] = <a class="code hl_function" href="measure_8c.html#ad77a3b79bc20b11c0d5462cc0b7134b3">measure_current</a>(offsetCurrent);</div>
|
||
|
<div class="line"><a id="l00059" name="l00059"></a><span class="lineno"> 59</span> </div>
|
||
|
<div class="line"><a id="l00061" name="l00061"></a><span class="lineno"> 61</span> sprintf(msg, <span class="stringliteral">"U = %04d [mV] "</span>, <a class="code hl_variable" href="modbus_8c.html#af231936e7cd39b49156a2a178f3d54eb">input_registers</a>[0]);</div>
|
||
|
<div class="line"><a id="l00062" name="l00062"></a><span class="lineno"> 62</span> <a class="code hl_function" href="lcd_8c.html#ae82c1ee673779250514a3227235976e4">LCD_2x16_WriteMsg</a>(msg,0);</div>
|
||
|
<div class="line"><a id="l00063" name="l00063"></a><span class="lineno"> 63</span> </div>
|
||
|
<div class="line"><a id="l00065" name="l00065"></a><span class="lineno"> 65</span> sprintf(msg, <span class="stringliteral">"I = %04d [uA] "</span>, <a class="code hl_variable" href="modbus_8c.html#af231936e7cd39b49156a2a178f3d54eb">input_registers</a>[1]);</div>
|
||
|
<div class="line"><a id="l00066" name="l00066"></a><span class="lineno"> 66</span> <a class="code hl_function" href="lcd_8c.html#ae82c1ee673779250514a3227235976e4">LCD_2x16_WriteMsg</a>(msg,1);</div>
|
||
|
<div class="line"><a id="l00067" name="l00067"></a><span class="lineno"> 67</span> </div>
|
||
|
<div class="line"><a id="l00069" name="l00069"></a><span class="lineno"> 69</span> <a class="code hl_function" href="epwm1_8c.html#acb3f0021b8789111ae243d1cd4c5942c">EPWM1_LoadDutyValue</a>(<a class="code hl_variable" href="modbus_8c.html#a2aac17f17a0fbffad12e7ca46ed8ae0f">holding_registers</a>[0]);</div>
|
||
|
<div class="line"><a id="l00070" name="l00070"></a><span class="lineno"> 70</span> } </div>
|
||
|
<div class="line"><a id="l00071" name="l00071"></a><span class="lineno"> 71</span>}</div>
|
||
|
<div class="ttc" id="aepwm1_8c_html_acb3f0021b8789111ae243d1cd4c5942c"><div class="ttname"><a href="epwm1_8c.html#acb3f0021b8789111ae243d1cd4c5942c">EPWM1_LoadDutyValue</a></div><div class="ttdeci">void EPWM1_LoadDutyValue(uint16_t dutyValue)</div><div class="ttdef"><b>Definition:</b> <a href="epwm1_8c_source.html#l00085">epwm1.c:85</a></div></div>
|
||
|
<div class="ttc" id="ainterrupt__manager_8h_html_a35865b73bdecc073d43ad4e0c62187ea"><div class="ttname"><a href="interrupt__manager_8h.html#a35865b73bdecc073d43ad4e0c62187ea">INTERRUPT_PeripheralInterruptEnable</a></div><div class="ttdeci">#define INTERRUPT_PeripheralInterruptEnable()</div><div class="ttdef"><b>Definition:</b> <a href="interrupt__manager_8h_source.html#l00086">interrupt_manager.h:86</a></div></div>
|
||
|
<div class="ttc" id="ainterrupt__manager_8h_html_ab801e88ce18e2d200429ffbaa67dbf2b"><div class="ttname"><a href="interrupt__manager_8h.html#ab801e88ce18e2d200429ffbaa67dbf2b">INTERRUPT_GlobalInterruptEnable</a></div><div class="ttdeci">#define INTERRUPT_GlobalInterruptEnable()</div><div class="ttdef"><b>Definition:</b> <a href="interrupt__manager_8h_source.html#l00063">interrupt_manager.h:63</a></div></div>
|
||
|
<div class="ttc" id="alcd_8c_html_ae3e90a42efbeab0e5b0c6478e01e80ba"><div class="ttname"><a href="lcd_8c.html#ae3e90a42efbeab0e5b0c6478e01e80ba">Lcd_Init</a></div><div class="ttdeci">int8_t Lcd_Init(void)</div><div class="ttdef"><b>Definition:</b> <a href="lcd_8c_source.html#l00017">lcd.c:17</a></div></div>
|
||
|
<div class="ttc" id="alcd_8c_html_ae82c1ee673779250514a3227235976e4"><div class="ttname"><a href="lcd_8c.html#ae82c1ee673779250514a3227235976e4">LCD_2x16_WriteMsg</a></div><div class="ttdeci">void LCD_2x16_WriteMsg(unsigned char *msg, uint8_t line)</div><div class="ttdef"><b>Definition:</b> <a href="lcd_8c_source.html#l00074">lcd.c:74</a></div></div>
|
||
|
<div class="ttc" id="alcd_8h_html"><div class="ttname"><a href="lcd_8h.html">lcd.h</a></div></div>
|
||
|
<div class="ttc" id="amain_8c_html_a6288eba0f8e8ad3ab1544ad731eb7667"><div class="ttname"><a href="main_8c.html#a6288eba0f8e8ad3ab1544ad731eb7667">main</a></div><div class="ttdeci">void main(void)</div><div class="ttdef"><b>Definition:</b> <a href="main_8c_source.html#l00018">main.c:18</a></div></div>
|
||
|
<div class="ttc" id="amain_8c_html_a97e80440b5a5ec2ffc172dead9f8d2ec"><div class="ttname"><a href="main_8c.html#a97e80440b5a5ec2ffc172dead9f8d2ec">MAX_COL</a></div><div class="ttdeci">#define MAX_COL</div><div class="ttdoc">columns for lcd screen (and 2 rows)</div><div class="ttdef"><b>Definition:</b> <a href="main_8c_source.html#l00016">main.c:16</a></div></div>
|
||
|
<div class="ttc" id="amcc_8c_html_a5e8391114a0cf91ac20002be25e3d352"><div class="ttname"><a href="mcc_8c.html#a5e8391114a0cf91ac20002be25e3d352">SYSTEM_Initialize</a></div><div class="ttdeci">void SYSTEM_Initialize(void)</div><div class="ttdef"><b>Definition:</b> <a href="mcc_8c_source.html#l00050">mcc.c:50</a></div></div>
|
||
|
<div class="ttc" id="amcc_8h_html"><div class="ttname"><a href="mcc_8h.html">mcc.h</a></div></div>
|
||
|
<div class="ttc" id="ameasure_8c_html_a104c0f284978c4cc8d34d36677a97e72"><div class="ttname"><a href="measure_8c.html#a104c0f284978c4cc8d34d36677a97e72">measure_voltage</a></div><div class="ttdeci">uint16_t measure_voltage()</div><div class="ttdef"><b>Definition:</b> <a href="measure_8c_source.html#l00037">measure.c:37</a></div></div>
|
||
|
<div class="ttc" id="ameasure_8c_html_a2b815e6730e8723a6d1d06d9ef8f31c0"><div class="ttname"><a href="measure_8c.html#a2b815e6730e8723a6d1d06d9ef8f31c0">adc_init</a></div><div class="ttdeci">void adc_init(void)</div><div class="ttdef"><b>Definition:</b> <a href="measure_8c_source.html#l00016">measure.c:16</a></div></div>
|
||
|
<div class="ttc" id="ameasure_8c_html_ad77a3b79bc20b11c0d5462cc0b7134b3"><div class="ttname"><a href="measure_8c.html#ad77a3b79bc20b11c0d5462cc0b7134b3">measure_current</a></div><div class="ttdeci">uint16_t measure_current(uint16_t offset)</div><div class="ttdef"><b>Definition:</b> <a href="measure_8c_source.html#l00049">measure.c:49</a></div></div>
|
||
|
<div class="ttc" id="ameasure_8h_html"><div class="ttname"><a href="measure_8h.html">measure.h</a></div><div class="ttdoc">Measuring current and voltage from the solar panel.</div></div>
|
||
|
<div class="ttc" id="amodbus_8c_html_a2aac17f17a0fbffad12e7ca46ed8ae0f"><div class="ttname"><a href="modbus_8c.html#a2aac17f17a0fbffad12e7ca46ed8ae0f">holding_registers</a></div><div class="ttdeci">uint16_t holding_registers[2]</div><div class="ttdef"><b>Definition:</b> <a href="modbus_8c_source.html#l00014">modbus.c:14</a></div></div>
|
||
|
<div class="ttc" id="amodbus_8c_html_a67d9839b8e221bcb53bbbb2ba59ff618"><div class="ttname"><a href="modbus_8c.html#a67d9839b8e221bcb53bbbb2ba59ff618">modbus_init</a></div><div class="ttdeci">void modbus_init(uint8_t address)</div><div class="ttdef"><b>Definition:</b> <a href="modbus_8c_source.html#l00108">modbus.c:108</a></div></div>
|
||
|
<div class="ttc" id="amodbus_8c_html_af231936e7cd39b49156a2a178f3d54eb"><div class="ttname"><a href="modbus_8c.html#af231936e7cd39b49156a2a178f3d54eb">input_registers</a></div><div class="ttdeci">uint16_t input_registers[2]</div><div class="ttdef"><b>Definition:</b> <a href="modbus_8c_source.html#l00013">modbus.c:13</a></div></div>
|
||
|
<div class="ttc" id="amodbus_8h_html"><div class="ttname"><a href="modbus_8h.html">modbus.h</a></div><div class="ttdoc">Modbus serial library.</div></div>
|
||
|
</div><!-- fragment --></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="main_8c.html">main.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>
|