Go4Expert (http://www.go4expert.com/)
-   C (http://www.go4expert.com/forums/c/)
-   -   C Delay Code Execution (http://www.go4expert.com/forums/c-delay-code-execution-t10753/)

NMartin 23May2008 17:02

C Delay Code Execution

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 23May2008 17:20

Re: C Delay Code Execution
use sleep function where u want the delay. it provides the delay in miliseconds when used.

For more information refer link:

NMartin 23May2008 17:39

Re: C Delay Code Execution
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.


All times are GMT +5.5. The time now is 04:13.