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

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

?? c514.txt

?? dsp&c51的編程,從小百合上down的
?? TXT
?? 第 1 頁 / 共 2 頁
字號:
    bit flag_1 ; 

(Note: bit variables are always placed in the bit-addressable memory area of 

 the 8051 - see section 2.1.1) 

With a processor such as the 8086, int is probably the commonest data type. 

As this is a 16 bit processor, the handling of 16 bit numbers is generally t 

he most efficient. The distinction between int and unsigned int has no parti 

cular impact on the amount of code generated by the compiler, since it will 

simply use signed opcodes rather than the unsigned variety. 

For the 8051, naturally enough, the char should be the most used type. Again 

, the programmer has to be aware of the thoroughly 8 bit nature of the chip. 

 Extensive use of 16 bit variables will produce slower code, as the compiler 

 has to use library routines to achieve apparently innocuous 16 by 8 divides 

, for example. 

The use of signed numbers has to be regulated, as the 8051 does not have any 

 signed arithmetic instructions. Again, library routines have to do the donk 

ey work. 

An interesting development has been the Siemens 80C537, which does have an e 

xtended arithmetic instruction set. This has, for instance, 32 by 16 divide 

and integer instructions. Indeed, this device might be a good upgrade path f 

or those 8051 users who need more number crunching power and who might be co 

nsidering the 80C196. A suite of runtime libraries is available from Keil to 

 allow the compiler to take advantage of the 80C537 enhancements. 

3.4.2 Special Function Bits 

A major frustration for assembler programmers coming to C is the inability o 

f ANSI C to handle bits in the bit-addressable BDATA area directly. Commonly 

 bit masks are needed when testing for specific bits with chars and ints. In 

 C51 version 3 however, it is possible to force data into the bit-addressabl 

e area (starting at 0x20) where the 8051's bit instructions can be used dire 

ctly from C. 

An example is testing the sign of a char by checking for bit = 1. 

Here, the char is declared as "bdata" thus: 

    bdata char test ; 

    sign_bit is defined as: 

    sbit sign ^ 7   ; 

To use this: 

void main(void) { 

     test = -1 ; 

     if(test & 0x80) { // Conventional bit mask and & 

        test = 1 ;     // test was -ve 

        } 

     if(sign == 1) {   // Use sbit 

        test = 1 ;     // test was -ve 

        } 

      } 

Results in the assembler: 

    RSEG  ?BA?T2 

test:            DS  1 

sign    EQU    test.7 

; 

; bdata char test ; 

; sbit sign = test ^ 7 ; 

; 

; void main(void) { 

main: 

;   test = -1 ; 

    MOV      test,#0FFH 

; 

;   if(test & 0x80) { // Conventional bit mask and & 

    MOV      A,test 

    JNB      ACC.7,?C0001 

; 

;      test = 1 ;        // test was -ve 

    MOV      test,#01H 

;    } 

?C0001: 

; 

;   if(sign == 1) {      // Use sbit 

    JNB      sign,?C0003 

; 

;        test = 1 ;      // test was -ve 

    MOV      test,#01H 

;    } 

; 

;    } 

?C0003: 

    RET 

Here, using the sbit, the check of the sign bit is a single JNB instruction, 

 which is an awful lot faster than using bit masks and &'s in the first case 

! The situation with ints is somewhat more complicated. The problem is that 

the 8051 does not store things as you first expect. The same sign test for a 

n int would still require bit 7 to be tested. This is because the 8051 store 

s int's high byte at the lower address. Thus bit 7 is the highest bit of the 

 higher byte and 15 is the highest bit of the lower. 

Byte Number: test_int(high) 20H Bit Number: 0,1,2,3,4,5,6,7 

Byte Number: test_int+1(low) 21H Bit Number: 8,9,10,11,12,13,14,15 

Bit locations in an integer 

3.4.3 Converting Between Types 

One of the easiest mistakes to make in C is to neglect the implications of t 

ype within calculations or comparisons 

Taking a simple example: 

    unsigned char x ; 

    unsigned char y ; 

    unsigned char z ; 

    x = 10 ; 

    y = 5  ; 

    z = x * y ; 

Results in z = 50 

However: 

    x = 10 ; 

    y = 50 ; 

    z = x * y ; 

results in z = 244. The true answer of 500 (0x1F4) has been lost as z is una 

ble to accommodate it. The solution is, of course, to make z an unsigned int 

. However, it is always a good idea to explicitly cast the two unsigned char 

 operands up to int thus: 

    unsigned char x ; 

    unsigned char y ; 

    unsigned int z ; 

    z = (unsigned int) x * (unsigned int) y ; 

While C51 will automatically promote chars to int, it is best not to rely on 

 it! It could be argued that on any small microcontroller you should always 

be aware of exactly what size data is. 

3.4.4 A Non-ANSI Approach To Checking Data Type 

A very common situation is where two bytes are to be added together and the 

result limited to 255, i.e. the maximum byte value. With the 8051 being byte 

-orientated, incurring integers must be avoided if maximum speed is to be ac 

hieved. Likewise, if the sum of two numbers exceeds the type maximum the use 

 of integers is needed. 

In this example the first comparison uses a proper ANSI approach. Here, the 

two numbers are added byte-wise and any resulting carry used to form the lea 

st significant bit of the upper byte of the notional integer result. A norma 

l integer compare then follows. Whilst C51 makes a good job of this, a much 

faster route is possible, as shown in the second case. 

; #include <reg51.h> 

; 

; 

; unsigned char x, y, z ; 

; 

; /*** Add two bytes together and check if ***/ 

; /***the result has exceeded 255 ***/ 

; 

; void main(void) { 

    RSEG  ?PR?main?T 

    USING    0 

main: 

            ; SOURCE LINE # 8 

; 

;    if(((unsigned int)x + (unsigned int)y) > 0xff) { 

            ; SOURCE LINE # 10 

    MOV      A,x 

    ADD      A,y 

    MOV      R7,A 

    CLR      A 

    RLC      A 

    MOV      R6,A 

    SETB     C 

    MOV      A,R7 

    SUBB     A,#0FFH 

    MOV      A,R6 

    SUBB     A,#00H 

    JC       ?C0001 

; 

;       z = 0xff ;   // ANSI C version 

            ; SOURCE LINE # 12 

    MOV      z,#0FFH 

;       } 

            ; SOURCE LINE # 13 

In this case the carry flag, "CY", is checked directly, removing the need to 

 perform any integer operations, as any addition resulting in a value over 2 

55 sets the carry. Of course, this is no longer ANSI C as a reference to the 

 8051 carry flag has been made. 

?C0001: 

; 

;    z = x + y ; 

            ; SOURCE LINE # 15 

    MOV      A,x 

    ADD      A,y 

    MOV      z,A 

; 

;    if(CY) { 

            ; SOURCE LINE # 17 

    JNB      CY,?C0003 

; 

;       z = 0xff ;   // C51 Version using the carry flag 

            ; SOURCE LINE # 19 

    MOV      z,#0FFH 

;       } 

            ; SOURCE LINE # 20 

; 

; 

; 

; 

;    } 

            ; SOURCE LINE # 25 

?C0003: 

    RET 

The situation of an integer compare for greater than 65535 (0xffff) is even 

worse as long maths must be used. This is almost a disaster for code speed a 

s the 8051 has very poor 32 bit performance. The trick of checking the carry 

 flag is still valid as the final addition naturally involves the two upper 

bytes of the two integers. 

In any high performance 8051 system this loss of portability is acceptable, 

as it allows run time targets to be met. Unfortunately, complete portability 



 always compromises performance! 

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

---- 

  

-- 

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

  

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
在线视频你懂得一区| 亚洲欧洲日产国产综合网| 亚洲欧美怡红院| 国产a久久麻豆| 欧美不卡在线视频| 日韩高清在线电影| 日韩一二三区视频| 欧美aⅴ一区二区三区视频| 欧美日韩极品在线观看一区| 亚洲一区免费视频| 欧美日韩国产小视频| 视频在线观看91| 日韩免费观看高清完整版 | 色94色欧美sute亚洲13| 亚洲欧洲精品一区二区三区不卡| 99国产精品视频免费观看| 中文字幕中文字幕在线一区| 99re这里只有精品首页| 国产精品免费视频网站| 不卡的av网站| 久久久久久99精品| 波多野结衣的一区二区三区| 奇米一区二区三区av| 亚洲午夜羞羞片| 日本一道高清亚洲日美韩| 91成人免费在线| 爽爽淫人综合网网站| 欧美不卡激情三级在线观看| av不卡免费电影| 日韩黄色免费电影| 国产精品美女久久久久aⅴ国产馆 国产精品美女久久久久av爽李琼 国产精品美女久久久久高潮 | 久久久久久久久久久电影| av一二三不卡影片| 日韩精品午夜视频| 国产精品久久久久精k8| 欧美一二三四区在线| 色综合中文字幕国产| 国产精品国产精品国产专区不蜜| 成人中文字幕电影| 九一九一国产精品| 亚洲精品国产a| 国产精品免费视频观看| 欧美精品一区二区三区蜜桃| 欧美日韩高清在线| 不卡视频在线观看| 岛国精品在线观看| 国产一区二区伦理| 日本免费新一区视频| 亚洲成人一二三| 一二三四区精品视频| 亚洲卡通欧美制服中文| 国产精品高潮呻吟| 中文字幕综合网| 亚洲人成网站在线| 日韩一区在线看| 亚洲欧洲制服丝袜| 中文字幕在线播放不卡一区| 国产精品无圣光一区二区| 国产亚洲欧洲一区高清在线观看| 日韩欧美aaaaaa| 国产欧美日韩麻豆91| 亚洲精品在线免费播放| 欧美精品一区二区三区四区| 久久精品夜色噜噜亚洲a∨| 国产三级一区二区三区| 亚洲欧洲一区二区三区| 亚洲午夜精品网| 精品一区二区三区在线播放 | 亚洲欧洲精品天堂一级| 日韩一区在线播放| 日韩高清在线不卡| 国产自产2019最新不卡| 99re这里只有精品首页| 8v天堂国产在线一区二区| 精品国产免费视频| 亚洲黄色小视频| 精品在线亚洲视频| 色婷婷亚洲精品| xvideos.蜜桃一区二区| 亚洲视频网在线直播| 青青草精品视频| 99国产精品久久久久久久久久| 91精品国产综合久久久久| 中文字幕一区二区三区视频| 美女高潮久久久| 欧洲亚洲国产日韩| 国产欧美一区二区三区在线看蜜臀 | 在线亚洲人成电影网站色www| 精品成人a区在线观看| 日韩经典一区二区| 91亚洲精品乱码久久久久久蜜桃| 日韩精品在线一区| 亚洲一区二区欧美激情| 成人精品免费网站| 久久欧美一区二区| 免费成人av在线播放| 7777女厕盗摄久久久| 亚洲综合精品自拍| 99国产麻豆精品| 亚洲欧美另类在线| 91丨国产丨九色丨pron| 亚洲国产精品精华液2区45| 亚洲另类中文字| 亚洲婷婷在线视频| 一区二区免费在线| 色综合夜色一区| 亚洲男人的天堂av| 91久久精品日日躁夜夜躁欧美| 欧美精彩视频一区二区三区| 国产精品资源站在线| 久久精品视频一区| 国产毛片精品一区| 国产精品人人做人人爽人人添| 丰满少妇在线播放bd日韩电影| 国产精品久久看| 91视频www| 日韩精品一二区| 国产情人综合久久777777| 成人精品一区二区三区中文字幕| 国产精品久久久久7777按摩| 欧美日韩大陆在线| 国产精品一二二区| 亚洲一区在线看| 久久久九九九九| 欧美视频一区二区三区四区 | 成人精品高清在线| 一区二区三区高清| 国产人成一区二区三区影院| 欧美四级电影网| 成人h版在线观看| 日韩av中文字幕一区二区 | 中文字幕电影一区| 欧美精品九九99久久| 成人av资源下载| 蜜桃视频在线观看一区| 亚洲午夜国产一区99re久久| 久久嫩草精品久久久精品| 91麻豆精品国产91久久久久久久久| 国产成+人+日韩+欧美+亚洲| 蜜桃av一区二区三区电影| 亚洲最大成人综合| 亚洲色图制服诱惑| 国产欧美日韩视频在线观看| 欧美一区二区大片| 欧美久久久一区| 欧美专区日韩专区| 欧美综合一区二区三区| 色综合亚洲欧洲| 欧美亚洲丝袜传媒另类| 91蜜桃网址入口| 欧洲av一区二区嗯嗯嗯啊| 欧美综合一区二区| 欧美日韩精品一区二区天天拍小说| 91黄色激情网站| 欧美日韩一区二区三区四区 | 国产精品18久久久久久久网站| 天天爽夜夜爽夜夜爽精品视频| 一区二区三区在线免费视频 | 精品国产一区二区三区不卡| 日韩一区二区在线观看| 26uuu国产日韩综合| 欧美国产精品一区二区三区| 国产精品福利一区二区三区| 综合久久一区二区三区| 亚洲第一电影网| 久久99国产精品成人| 成人性色生活片免费看爆迷你毛片| 国产一区二区三区不卡在线观看| 国产91精品免费| 色欧美乱欧美15图片| 日韩欧美高清在线| 国产精品嫩草99a| 日日摸夜夜添夜夜添国产精品 | 美女一区二区三区| a美女胸又www黄视频久久| 欧美日韩你懂的| 国产午夜亚洲精品理论片色戒| 一区二区三区四区视频精品免费| 婷婷中文字幕一区三区| av在线不卡免费看| 欧美日韩中文一区| 中文字幕va一区二区三区| 日韩激情中文字幕| 91电影在线观看| 国产精品久久久久久福利一牛影视 | gogogo免费视频观看亚洲一| 欧美色精品在线视频| 日本一区二区久久| 伦理电影国产精品| 欧美日韩久久一区| 亚洲人吸女人奶水| www.激情成人| 91在线观看视频| 国产色产综合产在线视频| 久久激情五月激情| 欧美日韩国产在线播放网站| 亚洲色图第一区| 五月婷婷激情综合| 极品销魂美女一区二区三区| 99精品欧美一区二区蜜桃免费 |