admin - Fri, 11/17/2006 - 10:48
You maybe don't know or probably didn't think about this but you are using program preprocessing before compiling it. As I said before compiling I mean, that each time you are compiling your project, C compiler prepares program file to be ready for compilation. Preprocessor includes other files to main file, defines symbol constants and macros, prepares conditional compilation of code. All preprocessor tasks are marked with ampersand symbol “#”. Lets go through most of directives of preprocessor:
admin - Thu, 09/14/2006 - 06:46
I am sure- typecasting is one of common practices in embedded C when converting one variable to another. As AVR microcontrollers are 8 bit systems and sometimes we operate with 16, 32 or even 64 bit length variables we have an ability to change like 16 bit integer value to 8 bit char and so on. This operations is so called typecasting. So it is important to understand this operation in order to use it properly and get desired result.
admin - Thu, 09/14/2006 - 06:19
This is similar to #define preprocessor where you can describe a set of constatnts. Using preprocessor we use:
#define zero 0
#define one 1
#define two 3
But there is an alternative of using enumerating using keyword enum:
enum (zero=0,one, two); //zero=0, one=1; two=2
By default enumeration assigns values from 0 and up.
Now you can use enumeration like in following example: