Editing BoostC tiny Wiki
Jump to navigation
Jump to search
Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.
The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.
Latest revision | Your text | ||
Line 16: | Line 16: | ||
===Go to [[PIC Links]]=== | ===Go to [[PIC Links]]=== | ||
Go to and search ( page search not google ) on "BoostC". There are projects, tips, tutorials..... | Go to and search ( page search not google ) on "BoostC". There are projects, tips, tutorials..... | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
=== and even more comming soon.....=== | === and even more comming soon.....=== | ||
Line 59: | Line 51: | ||
This may be standard C or just BoostC, but type checking is not as strict as languages like Java. Especially be careful of the idea that booleans and numbers are interchangable. Especially do not think that 0 is false and 1 is true. You can count on 0 being false ( I think ) I have seen test_bit evaluate to 64. | This may be standard C or just BoostC, but type checking is not as strict as languages like Java. Especially be careful of the idea that booleans and numbers are interchangable. Especially do not think that 0 is false and 1 is true. You can count on 0 being false ( I think ) I have seen test_bit evaluate to 64. | ||
− | |||
− | |||
− | |||
− | |||
=== BootLoader Madness === | === BootLoader Madness === | ||
Line 68: | Line 56: | ||
Had a program, programmed with a programmer, worked fine. Added a bootloader, bootloaded the program, NG. Why why why! | Had a program, programmed with a programmer, worked fine. Added a bootloader, bootloaded the program, NG. Why why why! | ||
− | Some hints, the fuses are inherited from the bootloader, your program cannot change, but that is not what got me. I did not use, set, or enable interrupts. This defult worked fine, but the bootloader apparently did not leave the settings in the default condition. My fix, added an interrupt handler which did nothing, but even more important turned the global interrupts off at the very beginning of my program. Not all bootloaders may behave in this way, but if you have a problem, consider the above. | + | Some hints, the fuses are inherited from the bootloader, your program cannot change, but that is not what got me. I did not use, set, or enable interrupts. This defult worked fine, but the bootloader apparently did not leave the settings in the default condition. My fix, added an interrupt handler which did nothing, but even more important turned the global interrupts off at the very beginning of my program. Not all bootloaders may behave in this way, but if you have a problem, consider the above. |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
== Standard C Issues == | == Standard C Issues == | ||
Line 126: | Line 102: | ||
In the good "old days" of the PDP-11 where large memory was measured in killobytes it was necessary to conserve memory -- even at the source code level. In the 21st century environment of gigabyte memories it's no longer necessary to conserve bytes at the expense of readability and clarity. Many programmers (particularly the old grumpy ones) take pride in saving a few bytes -- but mostly its a tradition thing except where the shortcuts save a bit of program run time. ....but then there might be a reason why they call it 'code'. | In the good "old days" of the PDP-11 where large memory was measured in killobytes it was necessary to conserve memory -- even at the source code level. In the 21st century environment of gigabyte memories it's no longer necessary to conserve bytes at the expense of readability and clarity. Many programmers (particularly the old grumpy ones) take pride in saving a few bytes -- but mostly its a tradition thing except where the shortcuts save a bit of program run time. ....but then there might be a reason why they call it 'code'. | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
==== Read This ==== | ==== Read This ==== | ||
Line 202: | Line 157: | ||
== Code Snips that may Be Helpful == | == Code Snips that may Be Helpful == | ||
+ | You are counting down and want to know when an unsigned number goes negative ( never ). You could declare it signed, slowing everything down. Instead check against FF. This assumes you do not use FF on the positive side. It also assumes you are counting down by one, else you could skip over FF. | ||
− | + | if ( 0xFF == ix ) .. | |
== Example Programs and Projects == | == Example Programs and Projects == | ||
Line 223: | Line 179: | ||
* [http://en.wikibooks.org/wiki/C_programming Wikibooks: C programming] is about C programming in general (alas, focuses on programs running on desktop computers, rather than small microcontrollers). | * [http://en.wikibooks.org/wiki/C_programming Wikibooks: C programming] is about C programming in general (alas, focuses on programs running on desktop computers, rather than small microcontrollers). | ||
− | |||
[[Category:BoostC]][[Category:PIC]] | [[Category:BoostC]][[Category:PIC]] |