C Delay Code Execution

NMartin's Avatar, Join Date: May 2008
Newbie Member

I am trying to write a program in C for an M16C microcontroller. I want to delay the execution of a piece of code for maybe a millisecond then carry on with the program:

P = 1
wait 1 ms
P = 0

Does anyone have any ideas on how to do this and what header files I might need for the code?

atul.sharma12's Avatar, Join Date: May 2008
Go4Expert Member
use sleep function where u want the delay. it provides the delay in miliseconds when used.

For more information refer link:
NMartin's Avatar, Join Date: May 2008
Newbie Member
I've tried using the sleep() function but it gives me an undeclared external error when I try to compile, I think its because I don't have the right header file included but I can't get <windows.h> to work.

Also I don't seem to be able to access the web address attached.