Sonsivri

Electronics => Pic C Languages => Topic started by: Sepiroth on April 05, 2010, 12:38:30 12:38



Title: Need Help for PICC18 pro Recursive Macro Error
Post by: Sepiroth on April 05, 2010, 12:38:30 12:38
Hi all,
I'm trying to compile the following code snippet in PICC18 9.63PL3 PRO and get the error below;
Code:
#define Delay100ns()	asm("nop");
#define Delay500ns() {asm("nop");asm("nop");asm("nop");asm("nop");asm("nop");}
#define Delay1us() Delay500ns();Delay500ns();
#define Delay5us() Delay1us();Delay1us();Delay1us();Delay1us();Delay1us()

The error i got is;
Code:
Error   [115] Delay1us; 178.0 recursive preprocessor macro definition of "Delay500ns" defined by "Delay500ns"

But when i try to compile this in STD version, i get no errors. Why PICC gives this recursive error, while there is no situation like it goes to a infinite recursive loop?
Thanks in advance,



Title: Re: Need Help for PICC18 pro Recursive Macro Error
Post by: ALLPIC on April 25, 2010, 04:59:10 04:59
wrong C assignment

#define Delay100ns()   (asm("nop"))
#define Delay500ns()   (asm("nop"),asm("nop"),asm("nop"),asm("nop"),asm("nop"))
#define Delay1us()    (Delay500ns(),Delay500ns())
#define Delay5us()    (Delay1us(),Delay1us(),Delay1us(),Delay1us(),Delay1us())

void main(void)
{
Delay100ns();
Delay500ns();
Delay1us();
Delay5us() ;
}

simple

:)