...when you spell it correctly...
+1. And I note that the original post spelled it correctly. That's why people should be very careful to show us the exact code they are testing, not just re-type what they think they are using.
Also, as I tried to hint at in my previous post, _delay
works if you give it an argument, for example
What I don't see is how the heck using _delay()
with no argument can give the error message reported in the first post.
A prototype for _delay
with an argument is declared in pic.h or pic18.h depending on the processor used.
And the appropriate one of those is automatically included when you #include <xc.h>
With XC8 version 2.05 in C99 mode invoking _delay()
with no argument in a PIC16 MCC project gives me the compiler errormain.c:110:12: error: too few arguments to function call, expected 1, have 0 _delay(); ~~~~~~ ^/opt/microchip/xc8/v2.05/pic/include/pic.h:92:1: note: '_delay' declared hereextern __nonreentrant void _delay(unsigned long);
A similar, but slightly less informative, error message occurs for the C90 mode.
Both modes accept and generate viable code for _delay(100);
It seems to me that to get the error reported in the original post, one would have to, somehow, get the compiler to accept the function invocation with no arguments. I don't know how the heck you could do that, and that's why I asked the question the way I did
post edited by davekw7x - 2019/03/25 12:21:47