IonicWind Software

IWBasic => The Roundtable => Topic started by: Techno on October 29, 2008, 01:38:53 PM

Title: High performance functions for the engenieers and electronics developers
Post by: Techno on October 29, 2008, 01:38:53 PM
Hi All

I have tested this code and it's works 100%

Timer32.inc


DECLARE "KERNEL32", Sleep(time:int)
DECLARE "KERNEL32", QueryPerformanceCounter (lpPerformanceCount : INT64), INT
DECLARE "KERNEL32", QueryPerformanceFrequency (lpFrequency : INT64), INT
DECLARE "KERNEL32", GetCurrentProcess (), INT
DECLARE "KERNEL32", SetPriorityClass (hProcess : INT, dwPriorityClass : INT), INT

DECLARE TimeInit()
DECLARE TimeRead(), DOUBLE
DECLARE Delay(dDelayTime AS DOUBLE)
DECLARE RealTime()
DECLARE NormalTime()

CONST NORMAL_PRIORITY_CLASS = 0x20
CONST IDLE_PRIORITY_CLASS    = 0x40
CONST HIGH_PRIORITY_CLASS    = 0x80
CONST REALTIME_PRIORITY_CLASS = 0x100


Timer32.lib en Timer32.dll


$INCLUDE "Timer32.inc"
EXPORT TimeInit
EXPORT TimeRead
EXPORT Delay
EXPORT RealTime
EXPORT NormalTime

DEF StartTime AS INT64
DEF TimeUnit  AS DOUBLE
TimeUnit = 0.000838096515

SUB TimeInit()
DEF f AS INT64 : f = 0
DEF x AS INT

x = QueryPerformanceFrequency(f)
TimeUnit = (1000 / f)
x = QueryPerformanceCounter(StartTime)
RETURN
ENDSUB

SUB TimeRead(), DOUBLE
DEF t AS INT64 : t = 0
DEF x AS INT

x = QueryPerformanceCounter(t)
RETURN((TimeUnit * (t - StartTime)))
ENDSUB

SUB Delay(dDelayTime AS DOUBLE)
DEF TimeStart AS DOUBLE

TimeStart = TimeRead()
WHILE TimeRead() < (TimeStart + dDelayTime)
ENDWHILE
RETURN
ENDSUB

SUB RealTime()
SetPriorityClass (GetCurrentProcess(),REALTIME_PRIORITY_CLASS)
RETURN
ENDSUB

SUB NormalTime()
SetPriorityClass (GetCurrentProcess(), NORMAL_PRIORITY_CLASS)
RETURN
ENDSUB


Its free for use
Title: Re: High performance functions for the engenieers and electronics developers
Post by: aurelCB on October 29, 2008, 02:18:44 PM
Ok and what with this timers,writte some graph program or what?
Title: Re: High performance functions for the engenieers and electronics developers
Post by: Techno on October 29, 2008, 03:01:12 PM
Hello

Can you test if you can to access the functions?
If you created the library dll en lib can you please send it to me Aure.
I can for you post here some examples

Kind regards
Stephane
Title: Re: High performance functions for the engenieers and electronics developers
Post by: aurelCB on October 30, 2008, 03:10:09 PM
Hi Techno i realy dont understand what you wannt with this functions?
Why you dont create dll with this functions?
I just dont have enough knowlege about this.
Title: Re: High performance functions for the engenieers and electronics developers
Post by: Techno on November 02, 2008, 09:14:00 AM
Sapero

Can you test my application of the Timers?

Thanks
Stephane