2011年5月25日 星期三

C、C++ 函式庫Reference , Borland C適用

找不到 DOS.H、BIOS.H ??
請服用
http://www.digitalmars.com/rtl/dos.html

printf fromat

%[flags][min field width][precision][length]conversion specifier
  -----  ---------------  ---------  ------ -------------------
   \             #,*        .#, .*     /             \
    \                                 /               \
   #,0,-,+, ,',I                 hh,h,l,ll,j,z,L    c,d,u,x,X,e,f,g,s,p,%
   -------------                 ---------------    -----------------------
   # | Alternate,                 hh | char,           c | unsigned char,
   0 | zero pad,                   h | short,          d | signed int,
   - | left align,                 l | long,           u | unsigned int,
   + | explicit + - sign,         ll | long long,      x | unsigned hex int,
     | space for + sign,           j | [u]intmax_t,    X | unsigned HEX int,
   ' | locale thousands grouping,  z | size_t,         e | [-]d.ddde±dd double,
   I | Use locale's alt digits     t | ptrdiff_t,      E | [-]d.dddE±dd double,
                                   L | long double,  ---------=====
   if no precision   => 6 decimal places            /  f | [-]d.ddd double,
   if precision = 0  => 0 decimal places      _____/   g | e|f as appropriate,
   if precision = #  => # decimal places               G | E|F as appropriate,
   if flag = #       => always show decimal point      s | string,
                                             ..............------
                                               /          p | pointer,
   if precision      => max field width    /           % | %

Examples of common combinations:
formatoutput
printf("%08X",32_bit_var);0000ABCD
printf("%lu",32_bit_var);43981
printf("%'d",32_bit_var);43,981
printf("%10s","string"); string
printf("%*s",10,"string"); string
printf("%-10s","string");string
printf("%-10.10s","truncateiftoolong");truncateif



REF: http://www.pixelbeat.org/programming/gcc/format_specs.html

2011年4月21日 星期四

使用codewarrior 注意點點

compile錯誤描述: reference to lable '233' is out of range

敘述:
在程式碼加上兩行程式碼
cmp.l #40,D0
beq  C_lable1
就發生錯誤..

花了挺多時間還是搞不懂,最後由david回答,特此紀念XD
david said:當發生reference to lable '233' is out of range ,此類無法判斷的錯誤訊息,需注意
1:程式碼寫法
2.前後文友寫跳躍的部份是否異常
結果證明是2,因為前面不遠處有短距跳躍 beq.s 敘述,在其後面加上了上面的兩行程式碼,結果造成距離過長跳躍不到所指向的label !!!!!!

話說,想想之前好像也遇到過一樣的問題,還是打上網誌不會忘記。錯誤描述只能參考用!!!

2011年3月13日 星期日

coldfire 縮寫術語

Table i. Acronyms and Abbreviated Terms
Term Meaning
ADC Analog-to-digital conversion
ALU Arithmetic logic unit
BDM Background debug mode
BIST Built-in self test
BSDL Boundary-scan description language
CODEC Code/decode
DAC Digital-to-analog conversion
DMA Direct memory access
DSP Digital signal processing
EA Effective address
FIFO First-in, first-out
GPIO General-purpose I/O
I2C Inter-integrated circuit
IEEE Institute for Electrical and Electronics Engineers
IFP Instruction fetch pipeline

IPL Interrupt priority level
JEDEC Joint Electron Device Engineering Council
JTAG Joint Test Action Group
LIFO Last-in, first-out
LRU Least recently used
LSB Least-significant byte
lsb Least-significant bit
MAC Multiply accumulate unit, also Media access controller
MBAR Memory base address register
MSB Most-significant byte
msb Most-significant bit
Mux Multiplex
NOP No operation
OEP Operand execution pipeline
PC Program counter

PCLK Processor clock
PLIC Physical layer interface controller
PLL Phase-locked loop
POR Power-on reset
PQFP Plastic quad flat pack
PWM Pulse width modulation
QSPI Queued serial peripheral interface
RISC Reduced instruction set computing
Rx Receive
SIM System integration module
SOF Start of frame
TAP Test access port
TTL Transistor transistor logic
Tx Transmit
UART Universal asynchronous/synchronous receiver transmitter

2011年3月3日 星期四

(咬 )文(嚼 )字

宏:「」指的是用一個字串代替另一個字串的功能。在makefile中可以使用「=」號來定義宏,使用「$(宏名)」來使用宏;還可以用「:=」追加宏的內容。習慣上,宏名使用大寫。

有一些編譯器輸出的代碼,將執行於與編譯器所在相同型別的電腦和作業系統之上,這種編譯器叫做原生編譯器。輸出可以執行於不同的平台之上的編譯器,叫做交叉編譯器。由於嵌入式系統通常沒有軟體開發環境,因此,為這類系統開發軟體時,通常需要使用交叉編譯器