Shop OBEX P1 Docs P2 Docs Learn Events
Stimulus Response Timing Measurement — Parallax Forums

Stimulus Response Timing Measurement

ArchiverArchiver Posts: 46,084
edited 2002-02-09 06:34 in General Discussion
Hello All,
I am new to the stamp list and after reviewing many pages in the
archive of this list have a question which I hope you can help with.
I have a BSII. Need to build a device where the BSII turns on a
light ... then a user must hit a switch..the time between stimulus
and response is stored.. the stamp then activates another light and
the user turns a switch under that light...and so on for 9 different
inputs. The subjects may or may not be impaired so timing could be
in the tenths of seconds (requiring 1/100 resolution) or in the 2
minute range. Any ideas on how to do this cleanly and efficiently
would be appreciated.
Thanks!!
VF

Comments

  • ArchiverArchiver Posts: 46,084
    edited 2002-02-09 06:34
    >Hello All,
    >I am new to the stamp list and after reviewing many pages in the
    >archive of this list have a question which I hope you can help with.
    >I have a BSII. Need to build a device where the BSII turns on a
    >light ... then a user must hit a switch..the time between stimulus
    >and response is stored.. the stamp then activates another light and
    >the user turns a switch under that light...and so on for 9 different
    >inputs. The subjects may or may not be impaired so timing could be
    >in the tenths of seconds (requiring 1/100 resolution) or in the 2
    >minute range. Any ideas on how to do this cleanly and efficiently
    >would be appreciated.
    >Thanks!!
    >VF

    One way to do this would be by use of an external timer chip, such as
    the ones sold by Al Williams or by Peter Anderson.

    If you do not want to use an external chip, the Stamp alone is
    capable of running a timing loop with about 1 millisecond of
    resolution, although it may take a little bit of calibration to get
    the best accuracy.
    http://www.emesystems.com/BS2speed.htm#longpulse

    BASICally

    high p8 ' turn on light on p8

    ' now time how long input pin p0 switch stays high (up to ~45 seconds)
    xc var word
    loop: ' ~1426 loops per second, 7.013E-4 seconds per loop
    xc=xc+1
    if in0 then loop ' count until in0 input goes low
    debug dec xc**45960,cr ' ** converts the count to straight milliseconds
    ' you will need to calibrate this value

    The reason you need to calibrate it is (1) individual stamps have
    slightly different operating frequencies (which may depend to a
    fraction of 1% on operating temperature) and (2) the exact timing
    depends on a which pin you use for the input, where the variable is
    in memory, how many subroutines there are in your program etc. etc.
    But once you have it done, the timing will be very stable from then
    on out.

    -- regards,
    Tracy Allen
    electronically monitored ecosystems
    mailto:tracy@e...
    http://www.emesystems.com
Sign In or Register to comment.