Sonsivri
 
*
Welcome, Guest. Please login or register.
Did you miss your activation email?
April 19, 2024, 03:38:24 15:38


Login with username, password and session length


Pages: [1]
Print
Author Topic: Need Help for PICC18 pro Recursive Macro Error  (Read 4041 times)
0 Members and 1 Guest are viewing this topic.
Sepiroth
Newbie
*
Offline Offline

Posts: 27

Thank You
-Given: 5
-Receive: 6


« 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,

Logged

-sepiroth >_>
ALLPIC
Active Member
***
Offline Offline

Posts: 114

Thank You
-Given: 64
-Receive: 72


« Reply #1 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

Smiley
Logged
Pages: [1]
Print
Jump to:  


DISCLAIMER
WE DONT HOST ANY ILLEGAL FILES ON THE SERVER
USE CONTACT US TO REPORT ILLEGAL FILES
ADMINISTRATORS CANNOT BE HELD RESPONSIBLE FOR USERS POSTS AND LINKS

... Copyright © 2003-2999 Sonsivri.to ...
Powered by SMF 1.1.18 | SMF © 2006-2009, Simple Machines LLC | HarzeM Dilber MC