Download C Compiler V3 user's Guide
Transcript
C Compiler V3 user's Guide 4. Inline function definition: Built-in Function Description GCC_RL(varname)[1] varname rotates left without carry GCC_RLC(varname) [1] varname rotates left with carry GCC_RR(varname) [1] varname rotates right without carry GCC_RRC(varname) [1] varname rotates right with carry GCC_NOP()/_nop() execute a dummy instruction (NOP) GCC_SWAP(varname) [1] exchange the first four bits and the last four bits of varname GCC_HALT()/_halt() execute a HALT instruction GCC_CLRWDT()/_clrwdt() clear the watchdog timer (CLRWDT) GCC_CLRWDT2()/_clrwdt2() clear the watchdog timer (CLRWDT2) GCC_CLRWDT1()/_clrwdt1() clear the watchdog timer (CLRWDT1) GCC_DELAY(n) [2] Delay n instructions Note: [1] varname must be a 8-bit variable [2] 0 <= n < 263690 5. If MCU contains EEPROM, then define __EEPROM_DATA (a, b, c, d, e, f, g, h); Using this statement to write a value to EEPROM: #define ___mkstr(x) #x #define __EEPROM_DATA(a, b, c, d, e, f, g, h) \ asm(“eeprom_data .section ‘eeprom’”); \ asm(“db\t” ___mkstr(a)); \ asm(“db\t” ___mkstr(b)); \ asm(“db\t” ___mkstr(c)); \ asm(“db\t” ___mkstr(d)); \ asm(“db\t” ___mkstr(e)); \ asm(“db\t” ___mkstr(f)); \ asm(“db\t” ___mkstr(g)); \ asm(“db\t” ___mkstr(h)); 8 values can be written in order at once, such as: __EEPROM_DATA(1, 2, 3, 4, 5, 6, 7, 8); Note: __EEPROM_DATA can not be written into the function body. Rev. 1.00 37 December 26, 2014