NerdKits - electronics education for a digital generation

You are not logged in. [log in]

NEW: Learning electronics? Ask your questions on the new Electronics Questions & Answers site hosted by CircuitLab.

Microcontroller Programming » Using #define

June 18, 2012
by Ralphxyz
Ralphxyz's Avatar

I am having problems using a #define

#define LRSTEP1 ((1<<2) | (1<<3) | (1<<4)

//PORTB = 14;      // Works no complaints!!
PORTB = LRSTEP1;   // Error

 error: expected ')' before ';' token

If I hardcode the value

PORTB = 14;

It works fine.

So how would I use the #define?

This is a continuation of my Stepper Motor Programming thread.

Ralph

June 18, 2012
by Rick_S
Rick_S's Avatar

You are missing the closing parenthesis in your define line.

June 19, 2012
by Ralphxyz
Ralphxyz's Avatar

Darn, now how the heck did that happen? Must be those Gremlins.

Thanks Rick, it now compiles and even two other errors disappeared.

Now back to my other thread to get the motor to turn.

Ralph

Post a Reply

Please log in to post a reply.

Did you know that LEDs (light emitting diodes) only conduct current in one direction, like normal diodes? Learn more...