vead, make sure your not mixing up the upper case letter "O" and the number "0". (zero) Even though they look similar on the screen, the compiler treats them different. 0xff is number. Oxff doesn't mean anything.
The define command doesn't use an equal sign, so:
#define PORTB 0x01
... will set that value at compile-time. (The pre-compiler swaps out "PORTB" with "0x01" in one of the first compiler passes.)
When setting variables at run-time, code like this:
motor1=motor2=1; //or even like this (motor1=motor2=1);
will set both variables motor1 and also motor2 to the value 1.
A lot of people won't know that, so it good to seperate those out for clarity.
motor1=1;
motor2=1;
When posting c-code it is good to put some spacing before some lines to make it easier to read and put [ code] before your code and [/code] after so that the message board keep the spacing, like this:
Code:
#define DO_IT 1
#include <hello.h>
void main()
{
if( DO_IT > 0 )
{
//it will always do my function
Do_My_Function();
}
//thats' all
}
Since I don't know much about microcontrollers. Which one is this that you guys are talking about? (So I can follow along and learn.) Would I look up "PIC microcontroller" or something else?
--tim