473,386 Members | 1,758 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

timing response times in milliseconds

I'm using an access xp form to present stimuli which participants in
an experiment must respond to as quickly as they can. I need to time
their responses as accurately as possible. At the moment I have a
timer with interval set to 1 and increment a variable by 1 each timer
event then compare the time of presentation with the time of the
keypress. However this is very inaccurate bacuse the timer event
doesn't actually happen this often, it seems to me to be quite
irregular and unless I set the interval to something much slower (e.g.
500 ms) it doesn't seem to be able to keep up. It's crucial that I can
accuratly measure response times to at least 10 ms.
Thanks
Sha
x
Nov 13 '05 #1
3 2337
Don't use a timer at all. Instead use a module level variable to hold
the time when the stimuli is presented. The difference between that
and the time of the response event would give the response interval.

- Jim

On 31 May 2004 04:19:34 -0700, sh**********@hotmail.com (Sha Crawford)
wrote:
I'm using an access xp form to present stimuli which participants in
an experiment must respond to as quickly as they can. I need to time
their responses as accurately as possible. At the moment I have a
timer with interval set to 1 and increment a variable by 1 each timer
event then compare the time of presentation with the time of the
keypress. However this is very inaccurate bacuse the timer event
doesn't actually happen this often, it seems to me to be quite
irregular and unless I set the interval to something much slower (e.g.
500 ms) it doesn't seem to be able to keep up. It's crucial that I can
accuratly measure response times to at least 10 ms.
Thanks
Sha
x


Nov 13 '05 #2
Sha Crawford wrote:
I'm using an access xp form to present stimuli which participants in
an experiment must respond to as quickly as they can. I need to time
their responses as accurately as possible. At the moment I have a
timer with interval set to 1 and increment a variable by 1 each timer
event then compare the time of presentation with the time of the
keypress. However this is very inaccurate bacuse the timer event
doesn't actually happen this often, it seems to me to be quite
irregular and unless I set the interval to something much slower (e.g.
500 ms) it doesn't seem to be able to keep up. It's crucial that I can
accuratly measure response times to at least 10 ms.
Thanks
Sha
x


From a google message I found the following.

Put this declaration and function in a standard module:

Declare Function GetTickCount Lib "kernel32" () As Long

Public Sub Pause(HowLong As Long)
Dim u%, tick As Long
tick = GetTickCount()

Do
u% = DoEvents
Loop Until tick + HowLong < GetTickCount
End Sub

You can then pause code anywhere like this:

Pause 2000

The above will pause for 2 seconds (values are in milliseconds)

Nov 13 '05 #3
Salad <oi*@vinegar.com> wrote in
news:mR*****************@newsread2.news.pas.earthl ink.net:
Sha Crawford wrote:
I'm using an access xp form to present stimuli which
participants in an experiment must respond to as quickly as
they can. I need to time their responses as accurately as
possible. At the moment I have a timer with interval set to 1
and increment a variable by 1 each timer event then compare
the time of presentation with the time of the keypress.
However this is very inaccurate bacuse the timer event
doesn't actually happen this often, it seems to me to be
quite irregular and unless I set the interval to something
much slower (e.g. 500 ms) it doesn't seem to be able to keep
up. It's crucial that I can accuratly measure response times
to at least 10 ms. Thanks
Sha
x

Ignore the timer event.
there is a timer function that you can use incode that returns
the number of seconds since midnight as a single precision
number.

I would dim a form level variable StartTime as single in the form
declarations section and set it in the place you increment
Then simply compare that with the value of timer at keypress.

me.elapsed = timer - starttime in seconds and milliseconds.

Since it's derived from the system clock, and there is no time
lost in looping and updating your counter, it should be much more
precise.
Bob Quintal

From a google message I found the following.

Put this declaration and function in a standard module:

Declare Function GetTickCount Lib "kernel32" () As Long

Public Sub Pause(HowLong As Long)
Dim u%, tick As Long
tick = GetTickCount()

Do
u% = DoEvents
Loop Until tick + HowLong < GetTickCount
End Sub

You can then pause code anywhere like this:

Pause 2000

The above will pause for 2 seconds (values are in
milliseconds)


Nov 13 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Dan | last post by:
I have an app that uses the wininet.dll APIs to get web pages and to post to web forms. My problem is that some of my users systems will literally wait an hour before an Internet call to a site...
6
by: S. David Rose | last post by:
Hello All! I am new to Python, and wanted to know if I might ask you a question regarding timing. I want a main loop which takes photos from 8 different web-cams, each can be addressed by...
5
by: Larry L | last post by:
I want to play a repetitive sound, and have a user click on a button each time it plays (say 5-10 times) and measure how far off he is from the sound each time. The only way I know to play a...
7
by: jamie | last post by:
hey all, I am attempting to do motion control for a final project, but I have a concern.... For motion control, timing is everyting, the better it is, the better it works. Currently I am...
9
by: Amir Ghezelbash | last post by:
Hey every body i had a question i am in process of writing an application, where this application needs to check the database on hourly bases to see if they are any information that are needed...
15
by: Jay | last post by:
I have a multi threaded VB.NET application (4 threads) that I use to send text messages to many, many employees via system.timer at a 5 second interval. Basically, I look in a SQL table (queue) to...
5
by: =?Utf-8?B?dWxpbGxpbGxpYQ==?= | last post by:
I've had two issues plaguing me for 4 months now and I haven't gotten anywhere. I'm into making 2D games and these things are essential to games. These are my issues: 1. I need timing precise...
1
by: MartyFromIreland | last post by:
Hi There! Run into a bit of a dilemma, I'm new to C# but I'm sure stacks of you will find this easy! Its regarding the timer functions, I've tried and failed numerous times as they just don't...
2
by: DR | last post by:
What is the best possible resolution that C# timing tests can get? milliseconds? nanoseconds?
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.