亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? chapter 1 program structure -- valvano.htm

?? 用c語言開發嵌入實時系統
?? HTM
?? 第 1 頁 / 共 5 頁
字號:
href="http://www.ece.utexas.edu/~valvano/embed/app1/app1.htm#CPPCOMMENT">compiler 
option dialog</A>). The start comment sequence is <CODE>// </CODE>and the 
comment ends at the next line break or end of file. Thus, the following two 
lines are equivalent:</P>
<DIR>
<P><CODE>OpenSCI(); /* turn on SCI serial port */<BR>OpenSCI(); // turn on SCI 
serial port</CODE></P></DIR>
<P>C does allow the comment start and stop sequences within character constants 
and string constants. For example the following string contains all 7 
characters, not just the <FONT face=Monaco>ac</FONT>:</P>
<DIR>
<P><CODE>str="a/*b*/c";</CODE></P></DIR>
<P>ICC11 and ICC12 unfortunately do not support comment nesting. This makes it 
difficult to comment out sections of logic that are themselves commented. For 
example, the following attempt to comment-out the call to <CODE>OpenSCI</CODE> 
will result in a compiler error.</P>
<DIR>
<P><CODE>void main(void){ unsigned char 
Info;<BR>/*<BR>&nbsp;&nbsp;&nbsp;OpenSCI();&nbsp;&nbsp;&nbsp;&nbsp;/* turn on 
SCI serial port 
*/<BR>*/<BR>&nbsp;&nbsp;&nbsp;DDRC=0x00;&nbsp;&nbsp;&nbsp;&nbsp;/* specify Port 
C as input 
*/<BR>&nbsp;&nbsp;&nbsp;while(1){<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Info=PORTC;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/* 
input 8 bits from parallel port C 
*/<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;OutSCI(Info);}}&nbsp;&nbsp;/* output 8 bits 
to serial port */</CODE></P></DIR>
<P>The<A 
href="http://www.ece.utexas.edu/~valvano/embed/chap11/chap11.htm#CONDITION"> 
conditional compilation</A> feature can be used to temporarily remove and 
restore blocks of code.</P>
<P><B><I><FONT face=Helvetica,Arial><A name=PREPROCESSOR></A>Preprocessor 
Directives</FONT></I></B></P>
<P>Preprocessor directives begin with <CODE># </CODE>in the first column. As the 
name implies preprocessor commands are processed first. I.e., the compiler 
passes through the program handling the preprocessor directives. Although there 
are many possibilities (assembly language, conditional compilation, interrupt 
service routines), I thought I'd mention the two most important ones early in 
this document. We have already seen the macro definition (<B>#define</B>) used 
to define I/O ports and bit fields. A second important directive is the 
<CODE>#include</CODE>, which allows you to include another entire file at that 
position within the program. The following directive will define all the 6811 
I/O port names. </P>
<DIR>
<P><CODE>#include "HC11.h"</CODE></P></DIR>
<P>Examples of <CODE>#include</CODE> are shown <A 
href="http://www.ece.utexas.edu/~valvano/embed/chap1/chap1.htm#SOURCE">below</A>, 
and more in <A 
href="http://www.ece.utexas.edu/~valvano/embed/chap11/chap11.htm#INCLUDE">Chapter 
11</A>.</P>
<P><B><I><FONT face=Helvetica,Arial><A name=GLOBAL></A>Global 
Declarations</FONT></I></B></P>
<P>An object may be a data structure or a function. Objects that are not defined 
within functions are global. Objects that may be declared in ICC11/ICC12/Hiware 
include:</P>
<DIR>
<P>integer variables (16 bit signed or unsigned) <B><FONT 
face=Monaco><BR></FONT></B>character variables (8 bit signed or 
unsigned)<B><FONT face=Monaco><BR></FONT></B>arrays of integers or characters 
<B><FONT face=Monaco><BR></FONT></B>pointers to integers or characters <B><FONT 
face=Monaco><BR></FONT></B>arrays of pointers<B><FONT 
face=Monaco><BR></FONT></B>structure (grouping of other objects)<B><FONT 
face=Monaco><BR></FONT></B>unions (redefinitions of storage)<B><FONT 
face=Monaco><BR></FONT></B>functions </P></DIR>
<P>Both Hiware and ICC12 support 32 bit long integers and floating point. In 
this document we will focus on 8 and 16 bit objects. Oddly the object code 
generated with the these compilers is often more efficient using 16 bit 
parameters rather than 8 bit ones.</P>
<P><B><I><FONT face=Helvetica,Arial><A name=DECLARATIONS></A>Declarations and 
Definitions</FONT></I></B></P>
<P>It is important for the C programmer two distinguish the two terms 
<I>declaration</I> and <I>definition</I>. A function declaration specifies its 
name, its input parameters and its output parameter. Another name for a function 
declaration is <I>prototype</I>. A data structure declaration specifies its type 
and format. On the other hand, a function definition specifies the exact 
sequence of operations to execute when it is called. A function definition will 
generate object code (machine instructions to be loaded into memory that perform 
the intended operations). A data structure definition will reserve space in 
memory for it. The confusing part is that the definition will repeat the 
declaration specifications. We can declare something without defining it, but we 
cannot define it without declaring it. For example the declaration for the 
function <CODE>OutSCI</CODE><FONT face=Monaco> </FONT>could be written as</P>
<DIR>
<P><CODE>void OutSCI(unsigned char);</CODE></P></DIR>
<P>We can see that the declaration shows us how to use the function, not how the 
function works. Because the C compilation is a one-pass process, an object must 
be declared or defined before it can be used in a statement. (Actually the 
preprocess performs a pass through the program that handles the preprocessor 
directives.) Notice that the function <CODE>OutSCI</CODE><FONT face=Monaco> 
</FONT>was defined before it was used in the above <A 
href="http://www.ece.utexas.edu/~valvano/embed/chap1/chap1.htm#LISTING">listing</A>. 
The following alternative approach first declares the functions, uses them, and 
lastly defines the functions:</P>
<DIR>
<P><CODE>/* Translates parallel input data to serial outputs */<BR>#define PORTC 
*(unsigned char volatile *)(0x1003)<BR>#define DDRC *(unsigned char volatile 
*)(0x1007)<BR>#define BAUD *(unsigned char volatile *)(0x102B)<BR>#define SCCR2 
*(unsigned char volatile *)(0x102D)<BR>#define SCSR *(unsigned char volatile 
*)(0x102E)<BR>#define SCDR *(unsigned char volatile *)(0x102F)<BR>void 
OpenSCI(void);<BR>void OutSCI(unsigned char);<BR>void main(void){ unsigned char 
Info;<BR>&nbsp;&nbsp;OpenSCI(); /* turn on SCI serial port 
*/<BR>&nbsp;&nbsp;&nbsp;DDRC=0x00; /* specify Port C as input 
*/<BR>&nbsp;&nbsp;&nbsp;while(1){<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Info=PORTC; 
/* input 8 bits from parallel port C 
*/<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;OutSCI(Info);}} /* output 8 bits to serial 
port */<BR>void OpenSCI(void) { <BR>&nbsp;&nbsp;&nbsp;BAUD=0x30; /* 9600 baud 
*/<BR>&nbsp;&nbsp;&nbsp;SCCR2=0x0C;} /* enable SCI, no interrupts */<BR>/* Data 
is 8 bit value to send out serial port */<BR>#define TDRE 0x80<BR>void 
OutSCI(unsigned char Data){<BR>&nbsp;&nbsp;while ((SCSR &amp; TDRE) == 0); /* 
Wait for TDRE to be set */ <BR>&nbsp;&nbsp;SCDR=Data; } /* then output 
*/</CODE></P></DIR>
<P><I>Listing 1-7: Alternate ICC11 Program</I></P>
<P>An object may be said to exist in the file in which it is defined, since 
compiling the file yields a module containing the object. On the other hand, an 
object may be declared within a file in which it does not exist. Declarations of 
data structures are preceded by the keyword <B>extern</B>. Thus,</P>
<DIR>
<P><CODE>short RunFlag;</CODE></P></DIR>
<P>defines a 16 bit signed integer called <CODE>RunFlag</CODE>; whereas,</P>
<DIR>
<P><CODE>extern short RunFlag;</CODE></P></DIR>
<P>only declares the <CODE><B>RunFlag</B> </CODE>to exist in another, separately 
compiled, module. We will use external function declarations in the ICC11/ICC12 
VECTOR.C file when we create the reset/interrupt vector table. Thus the line</P>
<DIR>
<P><CODE>extern void TOFhandler();</CODE></P></DIR>
<P>declares the function name and type just like a regular function declaration. 
The <B>extern</B><FONT face=Monaco> </FONT>tells the compiler that the actual 
function exists in another module and the linker will combine the modules so 
that the proper action occurs at run time. The compiler knows everything about 
extern objects except where they are. The linker is responsible for resolving 
that discrepancy. The compiler simply tells the assembler that the objects are 
in fact external. And the assembler, in turn, makes this known to the 
linker.</P>
<P><B><I><FONT face=Helvetica,Arial><A 
name=FUNCTIONS></A>Functions</FONT></I></B></P>
<P>A <I>function</I> is a sequence of operations that can be invoked from other 
places within the software. We can pass 0 or more parameters into a function. 
The code generated by the ICC11 and ICC12 compilers pass the first input 
parameter in Register D and the remaining parameters are passed on the stack. A 
function can have 0 or 1 output parameter. The code generated by the ICC11 and 
ICC12 compilers pass the return parameter in Register D (8 bit return parameters 
are promoted to 16 bits.) The <CODE>add</CODE> function below has two 16 bit 
signed input parameters, and one 16 bit output parameter. Again the numbers in 
the first column are not part of the software, but added to simplify our 
discussion.</P>
<DIR>
<P><CODE>1 &nbsp;&nbsp;short add(short x, short y){ short z;<BR>2 
&nbsp;&nbsp;&nbsp;&nbsp;z=x+y; <BR>3 
&nbsp;&nbsp;&nbsp;&nbsp;if((x&gt;0)&amp;&amp;(y&gt;0)&amp;&amp;(z&lt;0))z=32767; 
<BR>4 
&nbsp;&nbsp;&nbsp;&nbsp;if((x&lt;0)&amp;&amp;(y&lt;0)&amp;&amp;(z&gt;0))z=-32768; 
<BR>5 &nbsp;&nbsp;&nbsp;&nbsp;return(z);} <BR>6 &nbsp;&nbsp;void main(void){ 
short a,b;<BR>7 &nbsp;&nbsp;&nbsp;&nbsp;a=add(2000,2000)<BR>8 
&nbsp;&nbsp;&nbsp;&nbsp;b=0<BR>9 &nbsp;&nbsp;&nbsp;&nbsp;while(1){<BR>10 
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;b=add(b,1);<BR>11 
&nbsp;&nbsp;}</CODE></P></DIR>
<P><I>Listing 1-8: Example of a function call</I></P>
<P>The interesting part is that after the operations within the function are 
performed control returns to the place right after where the function was 
called. In C, execution begins with the <B>main</B> program. The execution 
sequence is shown below:</P>
<DIR>
<P><CODE>6 &nbsp;&nbsp;void main(void){ short a,b;<BR>7 
&nbsp;&nbsp;&nbsp;&nbsp;a=add(2000,2000);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/* 
call to add*/<BR>1 &nbsp;&nbsp;short add(short x, short y){ short z;<BR>2 
&nbsp;&nbsp;&nbsp;&nbsp;z=x+y; 
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/* 
z=4000*/<BR>3 
&nbsp;&nbsp;&nbsp;&nbsp;if((x&gt;0)&amp;&amp;(y&gt;0)&amp;&amp;(z&lt;0))z=32767; 
<BR>4 
&nbsp;&nbsp;&nbsp;&nbsp;if((x&lt;0)&amp;&amp;(y&lt;0)&amp;&amp;(z&gt;0))z=-32768; 
<BR>5 &nbsp;&nbsp;&nbsp;&nbsp;return(z);} 
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/* 
return 4000 from call*/<BR>8 &nbsp;&nbsp;&nbsp;&nbsp;b=0<BR>9 
&nbsp;&nbsp;&nbsp;&nbsp;while(1){<BR>10 
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;b=add(b,1); 
}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/* call 
to add*/<BR>1 &nbsp;&nbsp;short add(short x, short y){ short z;<BR>2 
&nbsp;&nbsp;&nbsp;&nbsp;z=x+y; 
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/* 
z=1*/<BR>3 
&nbsp;&nbsp;&nbsp;&nbsp;if((x&gt;0)&amp;&amp;(y&gt;0)&amp;&amp;(z&lt;0))z=32767; 
<BR>4 
&nbsp;&nbsp;&nbsp;&nbsp;if((x&lt;0)&amp;&amp;(y&lt;0)&amp;&amp;(z&gt;0))z=-32768; 
<BR>5 &nbsp;&nbsp;&nbsp;&nbsp;return(z);} 
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/* 
return 1 from call*/<BR>11 &nbsp;&nbsp;}<BR>9 
&nbsp;&nbsp;&nbsp;&nbsp;while(1){<BR>10 
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;b=add(b,1); 
}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/* call 
to add*/<BR>1 &nbsp;&nbsp;short add(short x, short y){ short z;<BR>2 
&nbsp;&nbsp;&nbsp;&nbsp;z=x+y; 
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/* 
z=2*/<BR>3 
&nbsp;&nbsp;&nbsp;&nbsp;if((x&gt;0)&amp;&amp;(y&gt;0)&amp;&amp;(z&lt;0))z=32767; 
<BR>4 
&nbsp;&nbsp;&nbsp;&nbsp;if((x&lt;0)&amp;&amp;(y&lt;0)&amp;&amp;(z&gt;0))z=-32768; 
<BR>5 &nbsp;&nbsp;&nbsp;&nbsp;return(z);} 
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/* 
return 2 from call*/<BR>11 &nbsp;&nbsp;}</CODE></P></DIR>
<P>Notice that the return from the first call goes to line 8, while all the 
other returns go to line 11. The execution sequence repeats lines 
9,10,1,2,3,4,5,11 indefinitely.</P>
<P>The programming language Pascal distinguishes between functions and 
procedures. In Pascal a function returns a parameter while a procedure does not. 
C eliminates the distinction by accepting a bare or <CODE>void</CODE> expression 
as its return parameter. </P>
<P>C does not allow for the nesting of procedural declarations. In other words 
you can not define a function within another function. In particular all 
function declarations must occur at the global level. </P>
<P>A function declaration consists of two parts: a <I>declarator</I> and a 
<I>body</I>. The declarator states the name of the function and the names of 
arguments passed to it. The names of the argument are only used inside the 
function. In the add function above, the declarator is <B>(short x, short y)</B> 
meaning it has two 16 bit input parameters. ICC11 and ICC12 accept both 
approaches for defining the input parameter list. The following three statements 
are equivalent:</P>
<DIR>

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲成人综合在线| 99精品黄色片免费大全| jlzzjlzz欧美大全| 成人一区二区在线观看| 欧美军同video69gay| ●精品国产综合乱码久久久久| 午夜婷婷国产麻豆精品| 国产成人午夜精品5599| 日韩欧美的一区二区| 午夜久久久影院| 91国在线观看| 成人免费小视频| 成人污污视频在线观看| 欧美日韩高清一区二区| 国产精品成人免费| 蜜臀av性久久久久蜜臀aⅴ流畅| 蜜臀精品久久久久久蜜臀 | 亚洲乱码日产精品bd| 国产.欧美.日韩| 国产农村妇女精品| 国产精品自拍在线| 国产精品天美传媒| 97国产一区二区| 一区二区三区四区不卡视频| 成人app网站| 亚洲综合视频在线观看| 欧美性色黄大片| 蜜乳av一区二区| 国产精品美女久久久久aⅴ国产馆 国产精品美女久久久久av爽李琼 国产精品美女久久久久高潮 | 亚洲风情在线资源站| 成人动漫一区二区在线| 一二三区精品福利视频| 欧美一区二区精美| 国产精品亚洲第一| 亚洲综合免费观看高清在线观看 | 国产精品欧美久久久久无广告| 国产精品一区二区不卡| 亚洲免费三区一区二区| 欧美tk—视频vk| 久久丝袜美腿综合| 喷白浆一区二区| 国产欧美综合色| 666欧美在线视频| 国产麻豆精品theporn| 天天综合色天天综合| 欧美成人艳星乳罩| 在线看不卡av| 成人一区在线看| 奇米精品一区二区三区在线观看一| 精品国产人成亚洲区| 日本韩国欧美一区二区三区| 精品一区二区av| 天天综合网天天综合色| 自拍偷拍欧美激情| 欧美mv和日韩mv国产网站| 色婷婷av一区| 在线免费av一区| 成人av在线电影| 国产在线精品免费av| 日韩制服丝袜av| 亚洲福中文字幕伊人影院| 1024国产精品| 亚洲欧洲一区二区在线播放| 中文字幕av资源一区| 国产色产综合产在线视频| www国产成人| 亚洲国产精品v| 国产精品成人免费精品自在线观看| 91精品在线免费| 69久久99精品久久久久婷婷| 欧美伦理影视网| 欧美专区亚洲专区| 欧美中文字幕亚洲一区二区va在线 | 欧美aaaaaa午夜精品| 日韩专区中文字幕一区二区| 日韩激情在线观看| 精品一区二区三区欧美| 国产麻豆精品theporn| 黄网站免费久久| 91亚洲国产成人精品一区二区三| 97精品国产露脸对白| 日韩欧美国产麻豆| 久久亚洲捆绑美女| 亚洲精品美腿丝袜| 蜜臀av一级做a爰片久久| 国产成人免费视频网站高清观看视频| 国产一区二区三区日韩| 欧洲人成人精品| 欧美变态口味重另类| 亚洲国产精品综合小说图片区| 国产一区二区毛片| 日韩欧美成人一区| 一区二区三区在线免费播放| 国产成人午夜视频| 日韩视频永久免费| 日韩激情一区二区| 69堂国产成人免费视频| 五月综合激情网| 在线看国产日韩| 亚洲一区电影777| 色94色欧美sute亚洲线路一久| 久久精品综合网| 国产精品亚洲第一| 欧美国产亚洲另类动漫| 韩国女主播一区二区三区| 精品国免费一区二区三区| 蜜臀av性久久久久蜜臀aⅴ四虎| 国产乱码精品1区2区3区| 成人黄色小视频| 精品国产乱码久久久久久老虎| 久久se这里有精品| 精品国产91亚洲一区二区三区婷婷| 免费在线观看一区| 久久久美女艺术照精彩视频福利播放| 精品一区二区免费在线观看| 精品久久久久久久一区二区蜜臀| 国产一区二区三区四| 国产精品久久久久一区| 欧美性猛交xxxx黑人交| 男女男精品视频| 亚洲欧美在线高清| 日韩一区二区三区电影| 国产乱人伦偷精品视频免下载| 国产视频一区不卡| 欧美嫩在线观看| 91丝袜美女网| 精品一区二区三区在线观看国产 | 亚洲精品在线观看视频| 国产91丝袜在线播放0| 亚洲一区二区三区四区五区中文| 欧美在线视频不卡| 国产成人在线看| 婷婷综合另类小说色区| 国产欧美中文在线| 欧美日韩高清一区二区不卡| 99久久精品情趣| 国产 欧美在线| 激情综合色丁香一区二区| 亚洲女人****多毛耸耸8| 日韩免费性生活视频播放| 色拍拍在线精品视频8848| 国产成人午夜视频| 国产综合久久久久影院| 免费观看成人鲁鲁鲁鲁鲁视频| 亚洲精品中文字幕在线观看| 国产日韩欧美高清在线| 久久久久久久精| 国产午夜精品久久久久久免费视 | 国产日韩一级二级三级| 日韩一区二区在线观看视频播放| 欧美日韩精品电影| 欧美日韩国产另类不卡| 337p亚洲精品色噜噜| 日韩女优毛片在线| 精品国产区一区| 国产色产综合产在线视频| 国产三级精品视频| 国产精品丝袜91| 亚洲国产精品成人综合色在线婷婷| 久久久久成人黄色影片| 中文字幕 久热精品 视频在线 | 久久精品国产亚洲一区二区三区| 免费在线观看精品| 成人一区二区三区视频| 91麻豆福利精品推荐| 91精选在线观看| 久久久www成人免费毛片麻豆| 精品入口麻豆88视频| 中文字幕一区二区三| 午夜激情一区二区| 国产一区二区按摩在线观看| 成人高清视频在线| 欧美人牲a欧美精品| 久久蜜桃香蕉精品一区二区三区| 国产精品国产三级国产三级人妇| 亚洲人成亚洲人成在线观看图片| 性久久久久久久久久久久| 激情偷乱视频一区二区三区| caoporm超碰国产精品| 91精品国产综合久久精品性色| 久久久99精品久久| 午夜精品成人在线视频| 丁香一区二区三区| 精品国产乱子伦一区| 亚洲大片精品永久免费| 91蝌蚪国产九色| 国内精品久久久久影院色| 久久99国产精品麻豆| 欧美日韩国产在线观看| 亚洲欧美日韩在线| 国产精品一卡二| 日韩精品一区二区三区蜜臀| 一区二区三区高清| 成人天堂资源www在线| 精品久久人人做人人爰| 久久国产剧场电影| 欧美一区二区在线不卡| 亚洲国产精品久久久久婷婷884 | 久久久精品国产免费观看同学| 日韩成人午夜精品|