User Tools

Site Tools


c_tips_and_tricks_for_pic_programming

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
c_tips_and_tricks_for_pic_programming [2008/02/11 13:40]
stryd_one Bitfields >8bit work!
c_tips_and_tricks_for_pic_programming [2011/09/15 07:14] (current)
ichaljhe
Line 13: Line 13:
   * The [[http://​www.midibox.org/​forum/​index.php/​topic,​9666.msg73781.html#​msg73781|Re:​ Scan Matrix extended : VOIRINOV]] thread has an explanation of what the declaration of the bitfield is all about.   * The [[http://​www.midibox.org/​forum/​index.php/​topic,​9666.msg73781.html#​msg73781|Re:​ Scan Matrix extended : VOIRINOV]] thread has an explanation of what the declaration of the bitfield is all about.
   * If this is not enough, you could search for ASM optimized custom functions. You'll find some in code examples of TK, the [[ACSensorizer]] and a lot of PIC-Specialized Webpages – or of course the forum.   * If this is not enough, you could search for ASM optimized custom functions. You'll find some in code examples of TK, the [[ACSensorizer]] and a lot of PIC-Specialized Webpages – or of course the forum.
-  * If that still is not enough or you have no time and a lot of processing power / space available on your PIC, you can include the **libsdcc library** +\\ 
-  ​* ​When using the library, sometimes the compiler will optimise multiplications to bitshifts (as demonstrated above) automatically. You can check the output files to see if this has occurred, but it is recommended to code the bitshifts manually, to be sure. +\\ 
->> //if multiplications,​ divisions, pointer operations, etc. are used in the .c code, the linker may fail due to missing functions, which are part of the libsdcc.lib library. The common library for pic16 derivatives is not compatible to MIOS, therefore I've created a special one which can be downloaded from [[http://​www.ucapps.de/​mios/​mios_libsdcc_v2_5_0.zip|here]]. Read the README.txt file for further details. [[http://​www.ucapps.de/​mios_c.html|TK on the C-Page]] //+ 
 +==== MIOS LIBSDCC Library ==== 
 + 
 +If that still is not enough or you have no time and a lot of processing power / space available on your PIC, you can include the **libsdcc library**. Using the new MIOS GPUtils structure, this will be included automatically as required. 
 + 
 +When using the library, sometimes the compiler will optimise multiplications to bitshifts (as demonstrated above) automatically. You can check the output files to see if this has occurred, but it is recommended to code the bitshifts manually, to be sure.
  
  
 \\ \\
-====== Bitfields, Unions & Structs ​======+ 
 +==== Bitfields, Unions & Structs ====
  
   * Avoid using huge int- or char-arrays when you just need to store some ON/OFF values. Use a bitfield instead   * Avoid using huge int- or char-arrays when you just need to store some ON/OFF values. Use a bitfield instead
Line 46: Line 52:
 // get number // get number
 mynum = something.ALL;​ mynum = something.ALL;​
 +
 </​code>​ </​code>​
->> ​// It has been confirmed with recent versions of SDCC, that bitfields are not limited to 8bits as was previously expected.+ 
 +>> It has been confirmed with recent versions of SDCC, that bitfields are not limited to 8bits as was previously expected.
  
  
-\\ 
 ====== C Functions ====== ====== C Functions ======
  
Line 202: Line 209:
 // //
 // //
-Note that stacks greater than 256 bytes will not work with SDCC at present.+Note that stacks greater than 256 bytes will not work with SDCC at present. ​[[http://​wemelt.com/​ipaymu-com-pembayaran-online-indonesia/​|iPaymu.com Pembayaran Online Indonesia]]
c_tips_and_tricks_for_pic_programming.1202737235.txt.gz · Last modified: 2008/04/05 21:03 (external edit)