📄 main_8c.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1"><title>AVR323 Interfacing GSM modems: main.c File Reference</title><link href="doxygen.css" rel="stylesheet" type="text/css"></head><body><!-- Generated by Doxygen 1.3.7 --><div class="qindex"><a class="qindex" href="main.html">Main Page</a> | <a class="qindex" href="annotated.html">Data Structures</a> | <a class="qindex" href="files.html">File List</a> | <a class="qindex" href="functions.html">Data Fields</a> | <a class="qindex" href="globals.html">Globals</a></div><h1>ATAVRBFLY_FILES/main.c File Reference</h1><hr><a name="_details"></a><h2>Detailed Description</h2>Atmel Corporation<p><ul><li>File : <a class="el" href="main_8c.html">main.c</a></li><li>Compiler : IAR EWAAVR 4.11a</li></ul><p><ul><li>Support mail : <a href="mailto:avr@atmel.com">avr@atmel.com</a></li></ul><p><ul><li>Supported devices : All devices with a UART/USART can be used. The example is written for ATmega169</li></ul><p><ul><li>AppNote : AVR323 - Interfacing GSM modems</li></ul><p><ul><li>Description : Example of how to use AT-Commands to control a GSM modem</li></ul><p><dl compact><dt><b>Revision</b></dt><dd>1.2 </dd></dl><dl compact><dt><b>Date</b></dt><dd>Wednesday, January 26, 2005 10:43:44 UTC </dd></dl><p>Definition in file <a class="el" href="main_8c-source.html">main.c</a>.<p><code>#include <inavr.h></code><br><code>#include <iom169.h></code><br><code>#include "<a class="el" href="main_8h-source.html">main.h</a>"</code><br><code>#include "LCD_functions.h"</code><br><code>#include "<a class="el" href="LCD__driver_8h-source.html">LCD_driver.h</a>"</code><br><code>#include "<a class="el" href="button_8h-source.html">button.h</a>"</code><br><code>#include "<a class="el" href="BCD_8h-source.html">BCD.h</a>"</code><br><code>#include "<a class="el" href="types_8h-source.html">types.h</a>"</code><br><code>#include "<a class="el" href="STATE__functions_8h-source.html">STATE_functions.h</a>"</code><br><code>#include "<a class="el" href="menu_8h-source.html">menu.h</a>"</code><br><code>#include "<a class="el" href="AVRGSM__api_8h-source.html">..\AVRGSM_FILES\AVRGSM_api.h</a>"</code><br><code>#include "<a class="el" href="AVRGSM__com_8h-source.html">..\AVRGSM_FILES\AVRGSM_com.h</a>"</code><br><p>Include dependency graph for main.c:<p><center><img src="main_8c__incl.png" border="0" usemap="#main.c_map" alt="Include dependency graph"></center><map name="main.c_map"><area href="main_8h.html" shape="rect" coords="97,108,159,135" alt=""><area href="LCD__driver_8h.html" shape="rect" coords="77,209,179,236" alt=""><area href="button_8h.html" shape="rect" coords="93,260,163,287" alt=""><area href="BCD_8h.html" shape="rect" coords="97,311,159,337" alt=""><area href="types_8h.html" shape="rect" coords="95,361,161,388" alt=""><area href="STATE__functions_8h.html" shape="rect" coords="60,412,196,439" alt=""><area href="menu_8h.html" shape="rect" coords="95,463,161,489" alt=""><area href="AVRGSM__api_8h.html" shape="rect" coords="12,513,244,540" alt=""><area href="AVRGSM__com_8h.html" shape="rect" coords="8,564,248,591" alt=""></map><p><a href="main_8c-source.html">Go to the source code of this file.</a><table border=0 cellpadding=0 cellspacing=0><tr><td></td></tr><tr><td colspan=2><br><h2>Defines</h2></td></tr><tr><td class="memItemLeft" nowrap align=right valign=top>#define </td><td class="memItemRight" valign=bottom><a class="el" href="main_8c.html#a0">pLCDREG_test</a> (*(char *)(0xEC))</td></tr><tr><td colspan=2><br><h2>Functions</h2></td></tr><tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="main_8c.html#a6">Initialization</a> (void)</td></tr><tr><td class="mdescLeft"> </td><td class="mdescRight">This function setup the hardware. <a href="#a6"></a><br><br></td></tr><tr><td class="memItemLeft" nowrap align=right valign=top>__C_task void </td><td class="memItemRight" valign=bottom><a class="el" href="main_8c.html#a4">main</a> (void)</td></tr><tr><td class="mdescLeft"> </td><td class="mdescRight">This function is the main loop. <a href="#a4"></a><br><br></td></tr><tr><td class="memItemLeft" nowrap align=right valign=top>unsigned char </td><td class="memItemRight" valign=bottom><a class="el" href="main_8c.html#a5">StateMachine</a> (char <a class="el" href="main_8c.html#a3">state</a>, unsigned char stimuli)</td></tr><tr><td class="mdescLeft"> </td><td class="mdescRight">This function controls the state machine. <a href="#a5"></a><br><br></td></tr><tr><td colspan=2><br><h2>Variables</h2></td></tr><tr><td class="memItemLeft" nowrap align=right valign=top>__flash unsigned int </td><td class="memItemRight" valign=bottom><a class="el" href="main_8c.html#a2">LCD_character_table</a> []</td></tr><tr><td class="memItemLeft" nowrap align=right valign=top>int </td><td class="memItemRight" valign=bottom><a class="el" href="main_8c.html#a1">rx_ack</a></td></tr><tr><td class="mdescLeft"> </td><td class="mdescRight">Extern flag from AVRSMS_com.c. <a href="#a1"></a><br><br></td></tr><tr><td class="memItemLeft" nowrap align=right valign=top>unsigned char </td><td class="memItemRight" valign=bottom><a class="el" href="main_8c.html#a3">state</a></td></tr></table><hr><h2>Define Documentation</h2><a class="anchor" name="a0" doxytag="main.c::pLCDREG_test" ></a><p><table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> <tr> <td class="mdRow"> <table cellpadding="0" cellspacing="0" border="0"> <tr> <td class="md" nowrap valign="top"> #define pLCDREG_test (*(char *)(0xEC)) </td> </tr> </table> </td> </tr></table><table cellspacing=5 cellpadding=0 border=0> <tr> <td> </td> <td><p><p>Definition at line <a class="el" href="main_8c-source.html#l00064">64</a> of file <a class="el" href="main_8c-source.html">main.c</a>. </td> </tr></table><hr><h2>Function Documentation</h2><a class="anchor" name="a6" doxytag="main.c::Initialization" ></a><p><table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> <tr> <td class="mdRow"> <table cellpadding="0" cellspacing="0" border="0"> <tr> <td class="md" nowrap valign="top"> void Initialization </td> <td class="md" valign="top">( </td> <td class="md" nowrap valign="top">void </td> <td class="mdname1" valign="top" nowrap> </td> <td class="md" valign="top"> ) </td> <td class="md" nowrap></td> </tr> </table> </td> </tr></table><table cellspacing=5 cellpadding=0 border=0> <tr> <td> </td> <td><p>This function setup the hardware. <p>Set up:<br> *PORTB<br> *PORTE<br> *Serial communication<br> *Buttons<br> *LCD<p><dl compact><dt><b>Parameters:</b></dt><dd> <table border="0" cellspacing="2" cellpadding="0"> <tr><td></td><td valign=top><em>void</em> </td><td></td></tr> </table></dl><dl compact><dt><b>Return values:</b></dt><dd> <table border="0" cellspacing="2" cellpadding="0"> <tr><td></td><td valign=top><em>none</em> </td><td></td></tr> </table></dl><p>Definition at line <a class="el" href="main_8c-source.html#l00206">206</a> of file <a class="el" href="main_8c-source.html">main.c</a>.<p>References <a class="el" href="button_8c-source.html#l00050">Button_Init()</a>, <a class="el" href="AVRGSM__com_8c-source.html#l00066">COM_init()</a>, and <a class="el" href="LCD__driver_8c-source.html#l00134">LCD_Init()</a>.<p>Referenced by <a class="el" href="main_8c-source.html#l00084">main()</a>.<p><pre class="fragment"><div>00207 {00208 00209 PORTB = (15<<PORTB0); <span class="comment">// Enable pullup on</span>00210 PORTE = (15<<PORTE4);00211 00212 <a class="code" href="AVRGSM__com_8h.html#a7">COM_init</a>( 51 ); <span class="comment">//9600bps @ 8MHz</span>00213 <a class="code" href="button_8c.html#a3">Button_Init</a>( ); <span class="comment">// Initialize pin change interrupt on joystick</span>00214 <a class="code" href="LCD__driver_8c.html#a11">LCD_Init</a>( ); <span class="comment">// initialize the LCD</span>00215 }</div></pre><p>Here is the call graph for this function:<p><center><img src="main_8c_a6_cgraph.png" border="0" usemap="#main_8c_a6_cgraph_map" alt=""></center><map name="main_8c_a6_cgraph_map"><area href="button_8c.html#a3" shape="rect" coords="149,7,235,33" alt=""><area href="AVRGSM__com_8h.html#a7" shape="rect" coords="153,57,231,84" alt=""><area href="LCD__driver_8c.html#a11" shape="rect" coords="155,108,229,135" alt=""><area href="AVRGSM__com_8c.html#a13" shape="rect" coords="296,57,405,84" alt=""><area href="LCD__driver_8h.html#a20" shape="rect" coords="285,108,416,135" alt=""></map> </td> </tr></table><a class="anchor" name="a4" doxytag="main.c::main" ></a><p><table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> <tr> <td class="mdRow"> <table cellpadding="0" cellspacing="0" border="0"> <tr> <td class="md" nowrap valign="top"> __C_task void main </td> <td class="md" valign="top">( </td> <td class="md" nowrap valign="top">void </td> <td class="mdname1" valign="top" nowrap> </td> <td class="md" valign="top"> ) </td> <td class="md" nowrap></td> </tr> </table> </td> </tr></table><table cellspacing=5 cellpadding=0 border=0> <tr> <td> </td> <td><p>This function is the main loop. <p>The main loop control a state machine, and reacts on joypad stimuli or arrival<br> of new messages.<p><dl compact><dt><b>Parameters:</b></dt><dd> <table border="0" cellspacing="2" cellpadding="0"> <tr><td></td><td valign=top><em>void</em> </td><td></td></tr> </table></dl><dl compact><dt><b>Return values:</b></dt><dd> <table border="0" cellspacing="2" cellpadding="0"> <tr><td></td><td valign=top><em>none</em> </td><td></td></tr> </table></dl><p>Local variables<p>Initialization of state variables<p>Program initalization<p>DO this forever <p>Definition at line <a class="el" href="main_8c-source.html#l00084">84</a> of file <a class="el" href="main_8c-source.html">main.c</a>.<p>References <a class="el" href="button_8c-source.html#l00161">getkey()</a>, <a class="el" href="main_8c-source.html#l00206">Initialization()</a>, <a class="el" href="main_8h-source.html#l00059">input</a>, <a class="el" href="main_8h.html#a27a17">KEY_NULL</a>, <a class="el" href="LCD__functions_8c-source.html#l00171">LCD_Colon()</a>, <a class="el" href="LCD__functions_8c-source.html#l00051">LCD_puts_f()</a>, <a class="el" href="menu_8h-source.html#l00101">menu_state</a>, <a class="el" href="menu_8h-source.html#l00048">MT_IDLE</a>, <a class="el" href="types_8h-source.html#l00027">NULL</a>, <a class="el" href="structMENU__STATE.html#o0">MENU_STATE::pFunc</a>, <a class="el" href="menu_8h-source.html#l00042">MENU_STATE::pText</a>, <a class="el" href="AVRGSM__api_8c-source.html#l00039">rx_ack</a>, <a class="el" href="main_8h.html#a26a2">ST_AVR_IDLE</a>, <a class="el" href="main_8h.html#a26a9">ST_AVR_NEW_SMS_function</a>, <a class="el" href="main_8h.html#a26a4">ST_AVR_READY</a>, <a class="el" href="STATE__functions_8c-source.html#l00141">ST_get_index()</a>, <a class="el" href="menu_8h-source.html#l00041">MENU_STATE::state</a>, <a class="el" href="main_8c-source.html#l00071">state</a>, and <a class="el" href="main_8c-source.html#l00171">StateMachine()</a>.<p><pre class="fragment"><div>00085 {00086 00088 <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> nextstate;00089 <span class="keyword">static</span> <span class="keywordtype">char</span> __flash *statetext;00090 char (*pStateFunc)(<span class="keywordtype">char</span>);00091 <span class="keywordtype">char</span> <a class="code" href="main_8h.html#a27">input</a>;00092 <span class="keywordtype">char</span> i;00093 00095 <a class="code" href="main_8c.html#a3">state</a> = nextstate = <a class="code" href="main_8h.html#a26a2">ST_AVR_IDLE</a>;00096 statetext = <a class="code" href="menu_8h.html#a0">MT_IDLE</a>;00097 pStateFunc = <a class="code" href="types_8h.html#a3">NULL</a>;00098 00099 00101 <a class="code" href="main_8c.html#a6">Initialization</a>( );00102 __enable_interrupt();
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -