TTL pulse

323 views
Skip to first unread message

David Moore

unread,
Apr 6, 2009, 4:27:12 AM4/6/09
to e-p...@googlegroups.com
Dear all,

I've written a script to present attentional tasks to participants however
I need to send a TTL pulse to an external device at random intervals.

I'm using eprime 2 and I have added the parallel port in the devices and
left the standard settings. I've then put in an inline with the command
WritePort &H378, 255 however I am not getting any pulse.

Can anyone help?

Dave

David McFarlane

unread,
Apr 8, 2009, 11:32:32 AM4/8/09
to e-p...@googlegroups.com

To send a pulse, you must both turn the pulse on and then turn it
off, with some duration in between. WritePort &H378, 255 will just
set all bits to 1, you still need to wait a moment and then send them
back to 0. Something like this:

WritePort &H378, 255 ' all bits to 1
Sleep 20 ' wait 20 ms
WritePort &H378, 0 ' all bits back to 0

Of course, you should first initialize all bits to 0 way at the start
of your program. And this assumes that &H378 is the correct port for
your case, you may need to contact your IT staff to verify
that. Finally, I think PST has a sample program at their website
that you can download to demonstrate some of this.

-- David McFarlane, Professional Faultfinder

David Moore

unread,
Apr 9, 2009, 9:40:10 AM4/9/09
to e-p...@googlegroups.com
Hi David,

Thanks for your advice, I have tried what you have suggested however I
still don't seem to be getting a pulse. Can you suggest what the settings
in the parallel port menu or how to set all bits to 0 at the beginning (I
have put an inline at the beginning with WritePort &H378, 0 in.

Thanks Dave

David McFarlane

unread,
Apr 9, 2009, 2:18:48 PM4/9/09
to e-p...@googlegroups.com
Dave,

At this stage you probably need to explore your specific hardware
setup in depth a little more, and that is not something that I can do
remotely, so you need to contact the IT staff at your company, and
they will need some in-depth knowledge about using a parallel
port. For one thing you need to make sure that &H378 is the correct
port number for your particular use, and that you have wired up to
the correct pins on the connector. If it were me I would try using
the old DOS debug command or something equally primitive so that I
could make sure that I fully understood the hardware at hand before I
tried throwing E-Prime at it.

PST has a Knowledge Base article about this at
http://www.pstnet.com/e-prime/support/kb.asp?TopicID=1320
(registration & login required), you might also look at another
article at http://www.pstnet.com/e-prime/support/kb.asp?TopicID=1318
. You might also try Google to find more technical articles on the
parallel port in general.

Oh, and as long as we're using hex notation, let's change
WritePort &H378, 255
to
WritePort &H378, &HFF
shall we?

Good luck,

Reply all
Reply to author
Forward
0 new messages