c_tips_and_tricks_for_pic_programming
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
c_tips_and_tricks_for_pic_programming [2008/04/05 21:03] – Added info for the gpasm toolchain stryd_one | c_tips_and_tricks_for_pic_programming [2011/09/15 07:14] (current) – ichaljhe | ||
---|---|---|---|
Line 15: | Line 15: | ||
\\ | \\ | ||
\\ | \\ | ||
+ | |||
==== MIOS LIBSDCC Library ==== | ==== 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**: | + | 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**. |
- | \\ | + | |
- | If multiplications, | + | |
- | You Should specify your custom linker script in the makefile if using the new gpasm based mios toolchain. | + | |
- | \\ | + | |
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. | 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. | ||
Line 27: | Line 25: | ||
\\ | \\ | ||
- | ====== 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 54: | Line 52: | ||
// get number | // get number | ||
mynum = something.ALL; | mynum = something.ALL; | ||
+ | |||
</ | </ | ||
- | >> | + | |
+ | >> 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 210: | 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. |
c_tips_and_tricks_for_pic_programming.1207429405.txt.gz · Last modified: 2008/05/02 16:40 (external edit)