I've been using defines as fucntions like this:
sbit DRIVE_PIN05 = P1^3;
#define DRIVE_PIN05_HIGH (P1MDOUT |= 0x08);(DRIVE_PIN05 = 0) #define DRIVE_PIN05_LOW (P1MDOUT |= 0x08);(DRIVE_PIN05 = 1) #define DRIVE_PIN05_OFF (P1MDOUT &= 0xF7);(DRIVE_PIN05 = 1)
Is it there anything wrong with doing it like this? It gives me problems when I include the above define into another define, why?
#define SUPPLY_ON (DRIVE_PIN05_HIGH);(DRIVE_PIN24_LOW) #define SUPPLY_OFF (DRIVE_PIN05_OFF);(DRIVE_PIN24_OFF)
Maybe my syntax is incorrect or it can't be done?
It gives me problems when I include the above define into another define, why?
Impossible to tell, from the given info. You forgot to disclose both the actual problems this gave you, and an actual, compilable example case. So nobody can see the error messages you're seeing.
That leaves guesswork, most of which would reduce to: you want to (re-)read the C FAQ, in particular this node: c-faq.com/.../multistmt.html
Thanks to Dan and Hans-Bernhard.
I appreciate the help, solved the problem looking at your macro defenitions and the link.
MC