The Origin Forum
File Exchange
Try Origin for Free
The Origin Forum
Home | Profile | Register | Active Topics | Members | Search | FAQ | Send File to Tech support
 All Forums
 Origin Forum for Programming
 Forum for Origin C
 How insert a time out in a loop

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

Screensize:
UserName:
Password:
Anti-Spam Code:
Format Mode:
Format: BoldItalicizedUnderlineStrikethrough Align LeftCenteredAlign Right Horizontal Rule Insert HyperlinkUpload FileInsert Image Insert CodeInsert QuoteInsert List
   
Message:

* HTML is OFF
* Forum Code is ON
Smilies
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Clown [:o)]
Black Eye [B)] Eight Ball [8] Frown [:(] Shy [8)]
Shocked [:0] Angry [:(!] Dead [xx(] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
gilles wat Posted - 09/24/2003 : 12:25:26 PM
Does anybody know how insert a time out in a loop.
thank you
gilles
6   L A T E S T    R E P L I E S    (Newest First)
cpyang Posted - 10/20/2003 : 05:38:49 AM
It is better to write

#pragma dll(msvcrt, system)

to avoid hard coded path to your msvcrt dll.

CP


gilles wat Posted - 09/29/2003 : 11:20:29 AM
Thank you for all.
I am added the function time to Origin C with the header:

#include <common.h>
#pragma dll(c:\WINNT\SYSTEM32\Msvcrt)
typedef long time_t;
typedef long* ptime;

int __cdecl _inp(unsigned short port);
int __cdecl _outp(unsigned short port, int value);
time_t __cdecl time(ptime temps);
cpyang Posted - 09/25/2003 : 8:01:09 PM
You can test time by using GetTickCount, and use either

Sleep(N);// Origin will wait, nothing can be done in Origin

or

LT_execute("set -p 0.5"); // you can still do other things in Origin while waiting


CP


Mike Buess Posted - 09/25/2003 : 08:59:05 AM
Hi gilles,

Can't you use Sleep in a do or while loop and require a status change to exit the loop? Something like this...

do
{
Sleep(100);
} while (//-no status change-);

Mike Buess
Origin WebRing Member

Edited by - Mike Buess on 09/25/2003 09:01:44 AM
gilles wat Posted - 09/25/2003 : 08:30:37 AM
Hi Mike
I wait a change on a status line during a data acquisition. If no change occures the loop does not finish. In C++ the function TIME() allows solving this problem with a test on time. This function is not in Origin C.
Thank you
Mike Buess Posted - 09/24/2003 : 2:16:41 PM
Hi gilles,

I'm not sure what kind of time out you need, but this LabTalk command

sec -p n;

pauses script execution for n seconds. In Origin C you can use

Sleep(N);

where N is in milliseconds.

Mike Buess
Origin WebRing Member

The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000