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

? 歡迎來(lái)到蟲(chóng)蟲(chóng)下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲(chóng)蟲(chóng)下載站

?? c5111.txt

?? dsp&c51的編程,從小百合上down的
?? TXT
字號(hào):
發(fā)信人: reflection (似水流年), 信區(qū): EEtechnology 

標(biāo)  題: C51 primer (10) Miscellaneous Points 

發(fā)信站: 南京大學(xué)小百合站 (Wed Nov 24 12:03:29 1999), 轉(zhuǎn)信 

  

  

10 Miscellaneous Points 

10.1 Tying The C Program To The Restart Vector 

This is achieved by the assembler file STARTUP.A51. This program simply plac 

es a LJMP STARTUP at location C0000 (Lowest EPROM location 

The startup routine just clears the internal RAM and sets up the stack point 

er. Finally it executes a LJMP to "main", (hopefully) the first function in 

the C program. 

    LJMP main 

        . 

        . 

        . 

        . 

        main() 

        { 

        } 

In fact this need be the only assembler present in a C51 program. 

10.2 Intrinsic Functions 

There are a number of special 8051 assembler instructions which are not norm 

ally used by C51. For the sake of speed it is sometimes useful to get direct 

 access to these. 

Unlike the normal C51 '>>' functions, _cror_ allows direct usage of an 8051 

instruction set feature, in this case the "RR A" (rotate accumulator). This 

yields a much faster result than would be obtained by writing one using bits 

 and the normal >> operator. There are also _iror_ and _lror_ intrinsic func 

tions for integer and long data as well. 

The _nop_ function simply adds an in-line NOP instruction to generate a shor 

t and predictable time delay. Another function, _testbit_, makes use of the 

JBC instruction to allow a bit to be tested, a branch taken and the bit clea 

red if set. The only extra step necessary is to include "intrins.h" in the C 

51 source file. 

Here is an example of how the _testbit_() intrinsic function is used to save 

 a CLR instruction: 

; #include <intrins.h> 

; 

; 

; unsigned int shift_reg = 0 ; 

; 

; bit test_flag ; 

; 

; void main(void) { 

    RSEG  ?PR?main?T 

    USING    0 

main: 

            ; SOURCE LINE # 12 

; 

; /* Use Normal Approach */ 

; 

;    test_flag = 1 ; 

            ; SOURCE LINE # 14 

    SETB     test_flag 

; 

;    if(test_flag == 1) { 

            ; SOURCE LINE # 16 

    JNB      test_flag,?C0001 

;       test_flag = 0 ; 

            ; SOURCE LINE # 17 

    CLR      test_flag 

;       P1 = 0xff     ; 

            ; SOURCE LINE # 18 

    MOV      P1,#0FFH 

;       } 

            ; SOURCE LINE # 19 

?C0001: 

; 

; /* Use Intrinsic Function */ 

; 

;    test_flag = 1 ; 

            ; SOURCE LINE # 21 

    SETB     test_flag 

; 

;   if(!_testbit_(test_flag)) { 

            ; SOURCE LINE # 23 

    JBC      test_flag,?C0003 

;       P1 = 0xff     ; 

            ; SOURCE LINE # 24 

    MOV      P1,#0FFH 

;       } 

            ; SOURCE LINE # 25 

; 

;    } 

            ; SOURCE LINE # 27 

?C0003: 

    RET 

; END OF main 

    END 

See pages 9-17 in the C51 Manual 

10.3 EA Bit Control #pragma 

Whilst the interrupt modifier for function declarations remains unchanged a 

new directive, DISABLE, allows interrupts to be disabled for the duration of 

 a function. Note that this can be individually applied to separate function 

s within a module but is given as a #pragma rather than as part of the funct 

ion declaration. Although not verified yet, DISABLE gives the user some cont 

rol over the EA or EAL bit. 

10.4 16 Bit sfr Support 

Another new feature is the 16bit sfr type. Within expanded 8051 variants in 

particular, many 16 bit timer and capture registers exist. Rather than havin 

g to load the upper and lower bytes individually with separate C statements, 

 the sfr16 type is provided. The actual address declared for a 16 bit sfr in 

 the header file is always the low byte of the sfr. Now to load a 16 bit sfr 

 from C, only a single int load is required. Be warned - 8-bit instructions 

are still used, so the 16 bit load/read is not indivisible - odd things can 

happen if you load a timer and it overflows during the process! Note that us 

ually only timer 2 or above has the high/low bytes arranged sequentially. 

10.5 Function Level Optimisation 

Optimisation levels of 4 and above are essentially function optimisations an 

d, as such, the whole function must be held in PC memory for processing. If 

there is insufficient memory for this, a warning is issued and the additiona 

l optimisation abandoned. Code execution will still be correct however. See 

p1-8 in the C51 manual. 

10.6 In-Line Functions In C51 

One of the fundamentals of C is that code with a well-defined input, output 

and job is placed into a function i.e. a subroutine. This involves placing p 

arameters into a passing area, whether a stack or a register, and then execu 

ting a CALL. It is unavoidable that the call instruction will use two bytes 

of stack. 

In most 8051 applications this not a problem, as there is generally 256 on-c 

hip RAM potentially available as stack. Even after allowing for a few regist 

erbanks, there is normally sufficient stack space for deeply nested function 

s. 

However in the case of the 8031 and reduced devices such as the 87C751, ever 

y byte of RAM is critical. In the latter case there are only 64 bytes! 

A trick which can both save stack and reduce run time is to use macros with 

parameters to act like "in-line" functions. The ability to create macros wit 

h replaceable parameters is not commonly used but on limited RAM variants it 

 can be very useful. 

Here a strcpy() function created as a macro named "Inline_Strcpy", whilst it 

 looks like a normal function, it does not actually have any fixed addresses 

 or local data of its own. The '\' characters serve to allow the macro defin 

ition to continue to a new line, in this case to preserve the function-like 

appearance. 

It is "called" like a normal function with the parameters to be passed enclo 

sed in ( ). However no CALL is used and the necessary code is created in-lin 

e. The end result is that a strcpy is performed but no new RAM or stack is r 

equired. 

Please note however, the drawback with this very simple example is that the 

source and destination pointers are modified by the copying process and so i 

s rather suspect! 

A further benefit in this example is that the notional pointers s1 and s2 ar 

e automatically memory-specific and thus very efficient. Thus in situations 

where the same function must operate on pointer data in a variety of memory 

spaces, slow generic pointers are not required. 

#define Inline_Strcpy(s1,s2)  {\ while((*s1 = *s2) != 0)}\ 

                     {\*s1++ ; *s2++; }\ 

                               } 

char xdata *out_buffx = { "                           " } ; 

char xdata *in_buffx = { "Hello" } ; 

char idata *in_buffi = { "Hello" } ; 

char idata *out_buffi = { "                           " }  ; 

char code *in_buffc = { "Hello" } ; 

void main(void) { 

   Inline_Strcpy(out_buffx,in_buffx)  // In line functions 

   Inline_Strcpy(out_buffi,in_buffi) 

   Inline_Strcpy(out_buffx,in_buffc) 

   } 

Another good example of how a macro with parameters can be used to aid sourc 

e readability is in the optimisation feature in Appendix D. The interpolatio 

n calculation that originally formed a subroutine could easily be redefined 

as a macro with 5 parameters, realising a ram and run time saving at the exp 

ense of code size. 

Note that 'r', the fifth parameter, represents the return value which has to 

 be "passed" to the macro so that it has somewhere to put the result! 

#define interp_sub(x,y,n,d,r)  y -= x ; \ 

if(!CY) { r = (unsigned char) (x +(unsigned char)(((unsigned 

            int)(n * y))/d)) ;\ 

} else { r = (unsigned char) (x - (unsigned char)(((unsigned int)(n * -y))/d 

)) ; } 

This is then called by: 

/*Interpolate 2D Map Values */ 

/*Macro With Parameters Used*/ 

interp_sub(map_x1y1,map_x2y1,x_temp1,x_temp2,result_y1) 

and later it is reused with different parameters thus: 



interp_sub(map_x1y2,map_x2y2,x_temp1,x_temp2,result_y2) 

To summarise, parameter macros are a good way of telling C51 about a general 

ised series of operations whose memory spaces or input values change in prog 

rams where speed or RAM usage is critical. 

---------------------------------------------------------------------------- 

---- 

  

-- 

Ours is essentially a tragic age, so we refuse to take it tragically. 

  

?? 快捷鍵說(shuō)明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
制服丝袜中文字幕亚洲| 欧美日韩精品欧美日韩精品一 | 中文字幕日本不卡| 欧美午夜寂寞影院| 国产不卡视频在线播放| 亚洲成人综合网站| 欧美午夜电影网| 国产精品中文欧美| 亚洲色图清纯唯美| 91视频免费播放| 婷婷久久综合九色国产成人| 久久综合久久综合久久| 欧美久久久久久久久久| 国产一区999| 美腿丝袜亚洲色图| 午夜影院久久久| 亚洲一二三四区| 亚洲综合av网| 一区二区三区电影在线播| 国产欧美一区二区在线| 欧美成人激情免费网| 国产不卡在线播放| 国产在线观看一区二区| 六月丁香综合在线视频| 日韩av不卡一区二区| 亚洲国产va精品久久久不卡综合| 中文字幕亚洲视频| 日韩一区中文字幕| 欧美精品一区二区三区高清aⅴ | 欧美aaaaaa午夜精品| 91丨九色丨尤物| 欧美影院一区二区三区| 91蜜桃免费观看视频| 日韩一二三区视频| 国产精品人人做人人爽人人添| 国产精品日韩成人| 久久 天天综合| 精品视频一区三区九区| 欧美电视剧免费观看| 亚洲国产美国国产综合一区二区| 一区二区三区中文字幕精品精品| 亚洲r级在线视频| 欧美无砖砖区免费| 亚洲人成网站在线| 中文字幕欧美日韩一区| 中文字幕亚洲视频| 国产iv一区二区三区| 亚洲视频一区在线观看| 韩国精品主播一区二区在线观看| 日韩视频在线你懂得| 亚洲日穴在线视频| 欧美性一区二区| 亚洲三级在线免费观看| 欧美三级电影在线观看| 偷拍一区二区三区| 精品国产免费久久| 精品亚洲国产成人av制服丝袜 | 国产精品无遮挡| 一本到高清视频免费精品| 亚洲一区二区三区四区在线 | 亚洲成人动漫在线观看| 不卡在线观看av| 亚洲精品福利视频网站| 91视频在线看| 久久久久国产精品人| av资源站一区| 蜜桃在线一区二区三区| 国产精品美女一区二区| av电影一区二区| 美女视频黄久久| 亚洲精品免费在线| 欧美一区二区三区视频免费播放| 亚洲精选视频在线| 国产午夜久久久久| 91香蕉国产在线观看软件| 亚洲美腿欧美偷拍| 国产亚洲欧美日韩日本| 欧美性三三影院| 美女一区二区视频| 国产精品一区专区| 欧美一区二区观看视频| 午夜欧美2019年伦理| 精品国产sm最大网站免费看| 91丨porny丨首页| 国产黄人亚洲片| 国产精品国产馆在线真实露脸 | 亚洲欧美日韩国产综合| 日韩精品一区二区三区四区 | 91尤物视频在线观看| 一区二区三区成人| 国产精品午夜久久| 亚洲国产精品传媒在线观看| 在线观看不卡一区| 在线亚洲高清视频| 色妞www精品视频| 日本精品裸体写真集在线观看| 国产美女精品人人做人人爽| 日韩欧美的一区二区| 久久综合精品国产一区二区三区| 蜜桃av一区二区三区| 最好看的中文字幕久久| 国产日产欧美精品一区二区三区| 国产亚洲精品bt天堂精选| 欧美大片免费久久精品三p| 亚洲精品一区二区三区福利| 精品国产伦一区二区三区免费| 日韩欧美精品在线| 国产午夜亚洲精品理论片色戒| 欧美国产视频在线| 亚洲一区自拍偷拍| 日本va欧美va瓶| 精品一区二区av| 日本韩国一区二区三区视频| 欧美日韩国产乱码电影| 亚洲天堂网中文字| 91精品国产综合久久婷婷香蕉| 欧洲中文字幕精品| 中文字幕一区在线观看| 国产精品综合在线视频| 久久久久久久久久久电影| 裸体一区二区三区| 精品视频一区三区九区| 亚洲欧美激情在线| 在线视频国产一区| 亚洲国产精品综合小说图片区| 色久优优欧美色久优优| 一区二区三区日韩欧美| 欧美日韩精品三区| 老司机免费视频一区二区| 精品粉嫩超白一线天av| 国产高清不卡二三区| 成人高清视频在线| 欧美在线免费视屏| 国产精品久久久久久久浪潮网站| 日韩成人一区二区三区在线观看| 色噜噜狠狠成人中文综合| 国产精品丝袜久久久久久app| 九九视频精品免费| 欧美精品v国产精品v日韩精品| 亚洲欧美日韩国产手机在线| 91麻豆免费观看| 亚洲精品午夜久久久| 91免费版在线| 中文字幕高清不卡| 成人高清免费观看| 久久综合九色综合久久久精品综合| 久久99热这里只有精品| 欧美日韩一区二区三区视频| 国产精品福利电影一区二区三区四区| 国产一区二区精品在线观看| 久久久亚洲综合| 一本久久综合亚洲鲁鲁五月天| 亚洲精选在线视频| 欧美日韩国产精品成人| 蜜桃91丨九色丨蝌蚪91桃色| 国产亚洲精品资源在线26u| 成人精品小蝌蚪| 日日骚欧美日韩| 一区二区在线观看av| 91精品国产91久久久久久一区二区 | 国产亚洲成av人在线观看导航| 日韩国产成人精品| 欧美日韩免费电影| 亚欧色一区w666天堂| 欧洲人成人精品| 国产在线精品一区二区三区不卡| 欧美激情综合五月色丁香小说| 欧美午夜在线观看| 91高清视频在线| 欧美少妇bbb| 91丨porny丨首页| 91日韩在线专区| 91女神在线视频| 91国偷自产一区二区三区观看| 国产盗摄视频一区二区三区| 久久精品久久久精品美女| 丝瓜av网站精品一区二区 | 亚洲gay无套男同| 天天操天天综合网| 美女视频网站久久| 国产呦萝稀缺另类资源| 久久99久久久欧美国产| 天堂成人国产精品一区| 午夜激情久久久| 久久电影国产免费久久电影| 激情五月激情综合网| 丁香啪啪综合成人亚洲小说 | 国产精品视频看| 亚洲美女淫视频| 日韩精品电影一区亚洲| 麻豆91在线播放免费| 国产乱码精品一区二区三| 在线视频你懂得一区| 精品奇米国产一区二区三区| 国产精品久久夜| 男女男精品网站| 色94色欧美sute亚洲线路一久| 欧美精品丝袜久久久中文字幕| 亚洲国产精品国自产拍av| 五月婷婷综合激情|