May 08, 2024, 01:01:08 AM

News:

Own IWBasic 2.x ? -----> Get your free upgrade to 3.x now.........


High performance functions for the engenieers and electronics developers

Started by Techno, October 29, 2008, 01:38:53 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Techno

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

aurelCB

Ok and what with this timers,writte some graph program or what?

Techno

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

aurelCB

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.

Techno