音影先锋亚洲天堂网|电影世界尽头的爱完整版播放|国产 熟女 91|高清无码免费观看欧美日韩|韩国一区二区三区黄色录像|美女亚洲加勒比在线|亚洲综合网 开心五月|7x成人在线入口|成人网站免费日韩毛片区|国产黄片?一级?二级?三级

登錄 免費(fèi)注冊 首頁 | 行業(yè)黑名單 | 幫助
維庫電子市場網(wǎng)
技術(shù)交流 | 電路欣賞 | 工控天地 | 數(shù)字廣電 | 通信技術(shù) | 電源技術(shù) | 測控之家 | EMC技術(shù) | ARM技術(shù) | EDA技術(shù) | PCB技術(shù) | 嵌入式系統(tǒng)
驅(qū)動(dòng)編程 | 集成電路 | 器件替換 | 模擬技術(shù) | 新手園地 | 單 片 機(jī) | DSP技術(shù) | MCU技術(shù) | IC 設(shè)計(jì) | IC 產(chǎn)業(yè) | CAN-bus/DeviceNe

請教:下面的兩個(gè)##起什么作用呢?謝謝。

作者:lpcfans 欄目:單片機(jī)
請教:下面的兩個(gè)##起什么作用呢?謝謝。
#define setRegBit(reg, bit)         (reg |= reg##_##bit##_##MASK)

* - 本貼最后修改時(shí)間:2007-1-17 14:31:17 修改者:lpcfans

2樓: >>參與討論
lpcfans
在幫助找到的
When some LABELS are defined in HLI Assembler Macros, if you invoke the same macro twice in the same function, the ANSI C preprocessor generates the same label twice (once in each macro expansion). Use the special string concatenation operator of the ANSI-C preprocessor ('##') in order to generate unique LABELS. See Listing 8.57.

Listing 8.57 Using the ANSI C preprocessor string concatenation operator

/* The following macro copies the string pointed to by 'src'
   into the string pointed to by 'dest'.
   'src' and 'dest' must be valid arrays of characters.
   'inst' is the instance NUMBER of the macro call. This
   parameter must be different for each invocation of the
   macro to allow the generation of unique LABELS. */
#pragma NO_STRING_CONSTR
#define copyMacro2(src, dest, inst) { \
  __asm           LOAD   @src,Reg0;  /* load src addr */ \
  __asm           LOAD   @dest,Reg1; /* load dst addr */ \
  __asm           CLR    Reg2;        /* clear index reg */ \
  __asm lp##inst: LOADB  (Reg2, Reg0); /* load byte reg indir */  \
  __asm           STOREB (Reg2, Reg1); /* store byte reg indir */ \
  __asm           ADD    #1,Reg2; /* increment index register */   \
  __asm           TST    Reg2;     /* TEST if not zero */           \
  __asm           BNE    lp##inst; }
Invoking the copyMacro2 macro in the source code:

  copyMacro2(source2, destination2, 1);
  copyMacro2(source2, destination3, 2);
During expansion of the first macro, the preprocessor generates an 'lp1' label. During expansion of the second macro, an 'lp2' label is created.


* - 本貼最后修改時(shí)間:2007-1-17 14:31:57 修改者:lpcfans

參與討論
昵稱:
討論內(nèi)容:
 
 
相關(guān)帖子
張工能否寫一個(gè)moto單片機(jī)簡單的教程,我學(xué)PIC時(shí)就是看的您寫的PIC的教程
霧里看MC9RS08KA2——從匠人和張明峰大哥一段未解的情緣說起
一個(gè)老問題:為什么校準(zhǔn)8M下的RC頻率老出錯(cuò)?
有沒有想做IMX31板子的人
請教:MC908JL16英語怎么讀?
免費(fèi)注冊為維庫電子開發(fā)網(wǎng)會(huì)員,參與電子工程師社區(qū)討論,點(diǎn)此進(jìn)入


Copyright © 1998-2006 m.58mhw.cn 浙ICP證030469號