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

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

?? c5112.txt

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

標  題: C51 Primer (11) Some C51 Tricks 

發信站: 南京大學小百合站 (Wed Nov 24 12:04:12 1999), 轉信 

  

  

11 Some C51 Programming Tricks 

11.1 Accessing R0 etc. directly from C51 

A C51 user was using existing assembler routines to perform a specific task. 

 For historical reasons the 8 bit return value from the assembler was left i 

n R0 of register bank 3. Ordinarily C51 would return chars in R7 and therefo 

re simply equating a variable to the assembler function call would not work. 

  

The solution was to declare an uncommitted memory specific pointer to the DA 

TA area. At run time the absolute address of the register (here 0x18) was as 

signed to the pointer. The return value was then picked up via the pointer a 

fter exiting the assembler section. 

/*** Example Of Accessing Specific Registers In C ***/ 

char data *dptr ;  // Create pointer to DATA location 

/* Define Address Of Register */ 

#define R0_bank3 0x40018L   /* Address of R0 in */ 

                            /* bank 3, 4 => DATA space */ 

char x,y ; 

/* Execute */ 

main() { 

dptr = (char*) R0_bank3 ;  // Point at R0, bank3 

x = 10 ; 

dptr[0] = x ;   // Write x into R0, bank3 

y = *dptr ;     // Get value of R0, bank3 

} 

An alternative might have been to declare a variable to hold the return valu 

e in a separate module and to use the linker to fix that module's DATA segme 

nt address at 0x18. This method is more robust and code efficient but is con 

siderably less flexible. 

11.2 Making Use Of Unused Interrupt Sources 

One problem with the 8051 is the lack of a TRAP or software interrupt instru 

ction. While C166 users have the luxury of real hardware support for such th 

ings, 8051 programmers have to be more cunning. 

A situation arose recently where the highest priority interrupt function in 

a system had to run until a certain point, from which lesser interrupts coul 

d then come in. Unfortunately, changing the interrupt priority registers par 

t way through the interrupt function did not work, the lesser interrupts sim 

ply waiting until the RETI. The solution was to hijack the unused A/D conver 

ter interrupt, IADC, and attach the second section of the interrupt function 

 to it. Then by deliberately setting the IADC pending flag just before the c 

losing "}", the second section could be made to run immediately afterwards. 

As the priority of the ADC interrupt had been set to a low level, it was int 

erruptable. 

/* Primary Interrupt Attached In CC0 Input Capture */ 

tdc_int() interrupt 8 { 

/* High priority section - may not be interrupted */ 

/* Enable lower priority section attached to */ 

                            /* ADC interrupt */ 

IADC = 1 ; // Force ADCinterrupt 

EADC = 1 ; // Enable ADC interrupt 

} 

/* Lower priority section attached to ADC interrupt */ 

tdc_int_low_priority() interrupt 10 

IADC = 0 ; // Prevent further calls 

EADC = 0 ; 

/* Low priority section which must be interruptable and */ 

    /* guaranteed to follow high priority section above */ 

} 

11.3 Code Memory Device Switching 

This dodge was used during the development of a HEX file loader for a simple 

 8051 monitor. After receiving a hexfile into a RAM via the serial port, the 

 new file was to be executed in RAM starting from 0000H. A complication was 

that the memory map had to be switched immediately prior to hitting 0000H. 

The solution was to place the map switching section at 0xfffd so that the ne 

xt instruction would be fetched from 0x0000, thus simulating a reset. Ideall 

y all registers and flags should be cleared before this. 

"reg.h" 

#include "cemb537.h" 

#include  <stdio.h> 

   main() 

      { 

      unsigned char tx_char,rx_char,i ; 

      P4 = map2 ; 

#include 

      v24ini_537() ; 

      timer0_init_537() ; 

      hexload_ini() ; 

      EAL = 1 ; 

      while(download_completed == 0) 

         { 

         while(char_received_fl == 0) 

            { receive_byte() ; } 

         tx_byte = rx_byte ; /* Echo */ 

         hexload() ; 

         send_byte(tx_byte) ; 

         char_received_fl = 0 ; 

         } 

      real_time_count = 0 ; 

      while(real_time_count < 200) 

         { ; } 

      i = ((unsigned char (code*)(void)) 0xFFFD) () ; 

                       // Jump to absolute address. 

      } 

//^^^^^^^^^^^^^^^^^^^^^^^ End of Module 

; 

   NAME SWITCH 

; 

; Cause PC to roll-over at FFFFH to simulate reset 

; 

   P4      DATA 0E8H 

; 

   CSEG AT 0FFFDH 

; 

   MOV  P4,#02Fh  ; 

; 

   END 

//^^^^^^^^^^^^^^^^^^^^^^^ End of Module "MAPCON" 

There are other ways of doing this. For instance the code for the MAPCON mod 

ule could be located at link time thus: CODE(SWITCH(0FFFDH)), so dispensing 

with the "CSEG AT". 

11.4 Simulating A Software Reset 

In a similar vein to the above, the 8051 does not possess a software reset i 

nstruction, unlike the 80C166 etc.. This method uses abstract pointers to cr 

eate a call to address zero, thus simulating a software reset. 

However it should be remembered that all internal locations must be cleared 

before the CPU can be considered properly reset! The return address must be 

reset as the stack still contains the return address from the call. 

; 

; 

; void main(void) { 

    RSEG  ?PR?main?T1 

    USING    0 

main: 

            ; SOURCE LINE # 9 

; 

; ((void (code*) (void)) 0x0000) () ; 

            ; SOURCE LINE # 11 

    LCALL    00H       ; Jump to address ZERO! 



; 

; } 

            ; SOURCE LINE # 13 

    RET 

; END OF main 

11.5 The Compiler Preprocessor - #define 

This is really just a text replacement device. 

It can be used to improve program readability by giving constants meaningful 

 names, for example: 

    #define fuel_constant 100 * 2 

so that the statement temp = fuel_constant will assign the value 200 to temp 

. 

Note that the preprocessor only allows integer calculations. 

Other more sophisticated examples are given in the C51 manual, pages 4-2. 

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

---- 

  

-- 

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

  

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美一级黄色片| 欧美综合欧美视频| 欧美日韩精品综合在线| 亚洲精品伦理在线| 91丨porny丨首页| 亚洲精品免费播放| 日韩欧美三级在线| 国产99精品国产| 亚洲欧美国产三级| 亚洲精品一区二区三区四区高清| 国内精品久久久久影院色| 久久久久久久综合色一本| 色婷婷综合久色| 日本伊人色综合网| 中文一区二区完整视频在线观看| 色综合久久久久综合| 日韩国产精品久久久久久亚洲| 国产精品视频观看| 91精品国产免费| 91久久精品日日躁夜夜躁欧美| 久久国产乱子精品免费女| 亚洲私人影院在线观看| 日韩三级电影网址| 91精品蜜臀在线一区尤物| 99这里都是精品| 久久精品国产成人一区二区三区 | 久久综合一区二区| 欧美精品在线观看播放| 99久精品国产| 成人午夜短视频| 国产成人小视频| 国内精品久久久久影院薰衣草| 人人爽香蕉精品| 久久99国产精品免费网站| 精品一区二区三区蜜桃| 久久国产精品第一页| 日本成人在线视频网站| 免费一级欧美片在线观看| 麻豆精品视频在线观看免费| 日本在线不卡一区| 国产精品白丝av| 99视频精品全部免费在线| 色一区在线观看| 欧美日韩国产美| 国产欧美一区二区精品仙草咪| 国产精品女人毛片| 男人的天堂久久精品| 国产成人啪午夜精品网站男同| 91免费在线播放| 日韩视频永久免费| 日韩理论片一区二区| 日韩和欧美的一区| 99v久久综合狠狠综合久久| 欧美精品一二三| 中文字幕在线观看不卡| 免费在线观看一区| 欧美日韩精品欧美日韩精品| 伊人婷婷欧美激情| 在线观看三级视频欧美| 亚洲午夜电影在线观看| 粉嫩aⅴ一区二区三区四区五区| 日韩欧美国产一区二区三区| 一区二区三区四区激情| 91美女蜜桃在线| 亚洲理论在线观看| 高清不卡一区二区在线| 337p粉嫩大胆色噜噜噜噜亚洲| 九九在线精品视频| 国产欧美一区二区精品性| 精品在线观看免费| 日韩欧美一二区| 国产精品一区二区黑丝| 91精品欧美久久久久久动漫| 日韩成人免费在线| 国产午夜精品一区二区三区四区| 国产一区二区日韩精品| 国产精品盗摄一区二区三区| 成人av在线资源网| 日韩中文欧美在线| 国产精品毛片无遮挡高清| 99久久婷婷国产精品综合| 亚洲婷婷在线视频| 欧美一二三区在线观看| 国产成人亚洲综合a∨猫咪| 2014亚洲片线观看视频免费| 国产成人av一区二区三区在线观看| 久久精品夜色噜噜亚洲a∨| 色婷婷综合久久久中文一区二区| 亚洲不卡在线观看| 国产精品亲子伦对白| 日韩一级完整毛片| bt欧美亚洲午夜电影天堂| 日本午夜精品视频在线观看| 中文字幕欧美区| 欧美videossexotv100| 欧美这里有精品| 91网页版在线| 97久久超碰精品国产| 国产精品一区二区在线观看不卡 | 91在线一区二区| 成人午夜激情在线| 中文字幕一区在线观看视频| 91免费国产在线| 成人国产一区二区三区精品| 日本三级亚洲精品| 天堂在线亚洲视频| 亚洲日本电影在线| 欧美国产国产综合| 久久久高清一区二区三区| 久久久久久久久久美女| 欧美一区二区三级| 国产三区在线成人av| 中文字幕欧美三区| 一区二区三区欧美激情| 亚洲香蕉伊在人在线观| 夜夜嗨av一区二区三区网页 | 久久狠狠亚洲综合| 国产精品一级在线| www.欧美.com| 91黄视频在线观看| 欧美高清视频不卡网| 欧美一区二区三区免费视频| 亚洲精品在线电影| 日韩欧美成人午夜| 一区二区三区在线高清| 欧美aaa在线| 岛国精品在线播放| 欧美三日本三级三级在线播放| 欧美亚洲日本一区| 欧美精选午夜久久久乱码6080| 精品国产网站在线观看| 亚洲欧洲精品天堂一级| 蜜乳av一区二区| 色狠狠综合天天综合综合| 日韩精品一区国产麻豆| 亚洲一级电影视频| 99精品一区二区| 日韩亚洲欧美成人一区| 国产精品二三区| 国产一区二区三区免费播放| 欧美日韩亚洲综合| 亚洲精品第一国产综合野| 久久精品国内一区二区三区| 欧美一区二视频| 亚洲福中文字幕伊人影院| 国产一区不卡在线| 日韩精品一区二区三区中文不卡| 日韩成人免费看| 日本福利一区二区| 日韩电影在线免费观看| 欧美成人vr18sexvr| 福利电影一区二区| 亚洲午夜久久久久久久久久久| 欧美日韩亚洲综合在线 | 精品国产亚洲在线| 久久综合狠狠综合| 欧美日韩高清一区二区三区| 天天av天天翘天天综合网| 久久久久97国产精华液好用吗| 丁香激情综合五月| 91久久精品一区二区三| 国产精品人妖ts系列视频| 成人动漫精品一区二区| 午夜影院久久久| 伊人婷婷欧美激情| 亚洲欧美二区三区| 中文字幕精品一区| 国产精品视频一二三区| 久久久亚洲高清| 欧美v亚洲v综合ⅴ国产v| 色偷偷88欧美精品久久久| 国产乱人伦偷精品视频免下载 | 午夜在线成人av| 亚洲最色的网站| 国产欧美日韩精品在线| 不卡的电影网站| 国产成人啪免费观看软件| 青青草一区二区三区| 日韩精品亚洲专区| 一区二区三区蜜桃| 亚洲久草在线视频| 国产精品成人免费| 亚洲天堂中文字幕| 中文字幕一区二区三区蜜月| 国产丝袜欧美中文另类| 国产亚洲精品免费| 久久久综合网站| 久久亚洲欧美国产精品乐播| 欧美成人一区二区三区在线观看| 欧美挠脚心视频网站| 欧美卡1卡2卡| 国产亚洲午夜高清国产拍精品| 久久天天做天天爱综合色| 亚洲欧洲色图综合| 亚洲欧美经典视频| 亚洲国产成人porn| 国产一区二区三区| 在线这里只有精品| 国产亚洲精久久久久久| 亚洲最新视频在线观看|