By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,163 Members | 976 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,163 IT Pros & Developers. It's quick & easy.

timing response times in milliseconds

P: n/a
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
Share this Question
Share on Google+
3 Replies


P: n/a
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

P: n/a
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

P: n/a
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 discussion thread is closed

Replies have been disabled for this discussion.