File Exchange
Try Origin for Free
The Origin Forum
Home
|
Profile
|
Register
|
Active Topics
|
Members
|
Search
|
FAQ
|
Send File to Tech support
Username:
Password:
Save Password
Forgot your Password?
|
Admin Options
All Forums
Origin Forum for Programming
Forum for Origin C
How insert a time out in a loop
New Topic
Reply to Topic
Printer Friendly
Author
Topic
gilles wat
France
20 Posts
Posted - 09/24/2003 : 12:25:26 PM
Does anybody know how insert a time out in a loop.
thank you
gilles
Mike Buess
USA
3037 Posts
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
gilles wat
France
20 Posts
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
USA
3037 Posts
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
cpyang
USA
1406 Posts
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
gilles wat
France
20 Posts
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
USA
1406 Posts
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
Topic
New Topic
Reply to Topic
Printer Friendly
Jump To:
Select Forum
Origin Forum
Origin Forum
Origin Viewer Forum
Origin Forum for Programming
Forum for Python
LabTalk Forum
Forum for Origin C
Forum for Automation Server/COM and LabVIEW
Origin中文论坛
Origin 中文论坛 (Chinese Origin Forum)
Japanese Origin Forum
Origin日本語フォーラム (Japanese Origin Forum)
Origin on Linux
The Origin on Linux Forum
Private Forums
Distributor Forum
--------------------
Home
Active Topics
Frequently Asked Questions
Member Information
Search Page
The Origin Forum
© 2020 Originlab Corporation
Snitz Forums 2000