beginners-question parallel port

Sibel sibelozer.ege at gmail.com
Sat Nov 19 12:41:29 UTC 2011


Hi Everybody,
Actually, Dear Maartje,
I also wonder the solution you found, would you mind sharing
it,please?

thank you, best,
Sibel

On 10 Kasım, 17:51, David McFarlane <mcfar... at msu.edu> wrote:
> Maartje,
>
> That's great, and thanks for writing back.  So
> what did you figure out, what was the problem?  I
> would like the opportunity to learn something from this.
>
> Thanks,
> -- David McFarlane
>
> At 11/9/2011 11:30 AM Wednesday, you wrote:
>
>
>
> >I think I fixed the problem. We are doing some pilotting now, to be
> >sure!
> >groeten,
> >Maartje
>
> >On Nov 8, 12:10 am, mrtj <maartjevrol... at gmail.com> wrote:
> > > Hi David,
>
> > > I did not manage to set up the Inline in the SessionProc and make it
> > > work on a trial level. Guess this means I have to put it in the
> > > script, but that did not work either. Putting an InLine at lower
> > > levels (where needed) did however do the trick. So for now I work
> > > with:
>
> > >      Const  OutPort as Integer = &h0378
> > >      Const  ShockSignal as Integer = &h80
>
> > >      ITI.OnsetSignalPort = OutPort
> > >      ITI.OnsetSignalData = ShockSignal
>
> > > Then, the inline in your trial Procedure reduces to simply
>
> > >      If (c.GetAttrib("Shock") = 1) Then
> > >          ITI.OnsetSignalEnabled = True
> > >      Else
> > >          ITI.OnsetSignalEnabled = False
> > >      End If
>
> > > (btw: I have several markers, for shock, noise burst and stimulus
> > > presentation)
>
> > > I hope to find out how to define at higher level as well, in time. But
> > > that is not my question: I was able to do some final testing and work
> > > through the whole experiment today. As I have set up the experiment
> > > right now, a Stimulus is displayed for 5 sec with No clearing after,
> > > Then a SoundOut is displayed for 3 sec (the sound file starts with a
> > > 40msec noiseburst and continues with silence). After the SoundOut,
> > > there is a (semi-random) variable ITI of 15 to 25 sec. To the
> > > participant it looks as if the Stimulus is displayed for 8s, and a
> > > soundburst is given at 5s into stimulus presentation.
> > > Depending on the Stimulus (picture) being presented, a shock will or
> > > will not be administered.
> > > The common way to send markers is by using Onset, so that is what I
> > > did. I used the Onset of the ITI to send a marker to (mark and)
> > > generate a shock. That works fine. The shock duration is set via the
> > > hardware of the shockstimulator (duration is 200ms).
> > > Now something funny happends when c.GetAttrib("Shock") = 1. The shock
> > > is administered as it should, at the onset of the ITI. It is again
> > > given some hundreds of ms later. And it is also given at the Offset of
> > > the ITI.
>
> > > I gather that the shock at Offset possibly has to do with the
> > > shockstimulator being sensitive to both increase and decrease in
> > > current/voltage/whatever the marker generates. I hope that I can
> > > overcome this by setting the marker for only a brief period of time. I
> > > was thinking along the lines of an Inline right after the SoundOut:
> > > WritePort &H378, 80
> > > sleep 5
> > > writePort &H378, 0
> > > (or could I do with WritePort OutPort, ShockSignal instead of &H378,
> > > 80?)
>
> > > I am not yet sure whether it will work (working from a laptop right
> > > now instead of my PC). But this trick won't solve the issue of the
> > > second (unwanted) shock that is given. Do you have any suggestions? I
> > > am puzzeled.
>
> > > groeten,
> > > Maartje
>
> > > Btw: the shockstimulator is a device that has been build by our
> > > faculty technicians. So I have no device name for you here.
>
> > > On Nov 6, 10:01 pm, mrtj <maartjevrol... at gmail.com> wrote:
>
> > > > Thank you so much! I can't wait to actually test this on my computer
> > > > (instead of my home-office laptop, which doesn't have a parallel
> > > > port...). Your explanation surely helps me get a (for now still small)
> > > > grasp on E-prime programming. I can do the usual drag and drop, but
> > > > other than that.... Well, at least I now know how to send triggers
> > > > through a parallel port :)
>
> > > > Apologies for not yet having incorporated your earlier suggestions in
> > > > my follow-up question.
> > > > groeten,
> > > > Maartje
>
> > > > On Nov 4, 7:45 pm, David McFarlane <mcfar... at msu.edu> wrote:
>
> > > > > Maartje,
>
> > > > > OK, first, putting on my full pedant's hat.  Next, I refuse to do
> > > > > this without proper named constants, so I will add those back in (and
> > > > > *please* do not strip them out for your next question, or I will
> > > > > refuse to answer).  I will also add some conventional capitalization
> > > > > and more parentheses, but I will not hold you to those :).  (I will
> > > > > give you credit for using proper hexadecimal notation from the outset.)
>
> > > > > Now, I presume that you put this inline in your trial Procedure, else
> > > > > it would not work at all.  Then, to begin with, you left the code out
> > > > > of your Else clause.  The full inline code should read instead
>
> > > > >      Const  OutPort as Integer = &h0378
> > > > >      Const  ShockSignal as Integer = &h80
>
> > > > >      If (c.GetAttrib("Shock") = 1) Then
> > > > >          ITI.OnsetSignalPort = OutPort
> > > > >          ITI.OnsetSignalData = ShockSignal
> > > > >          ITI.OnsetSignalEnabled = True
> > > > >      Else
> > > > >          ITI.OnsetSignalEnabled = False
> > > > >      End If
>
> > > > > At that point you are done, but I cannot let matters rest
> > > > > there.  Note that the only thing that changes from trial to trial is
> > > > > OnsetSignalEnabled; OnsetSignalPort and OnsetSignalData never
> > > > > change.  So why repeat those operations on every trial?  Out in
> > > > > SessionProc, before running your trial
> > List, add an inline to do the following
>
> > > > >      Const  OutPort as Integer = &h0378
> > > > >      Const  ShockSignal as Integer = &h80
>
> > > > >      ITI.OnsetSignalPort = OutPort
> > > > >      ITI.OnsetSignalData = ShockSignal
>
> > > > > Then, the inline in your trial Procedure reduces to simply
>
> > > > >      If (c.GetAttrib("Shock") = 1) Then
> > > > >          ITI.OnsetSignalEnabled = True
> > > > >      Else
> > > > >          ITI.OnsetSignalEnabled = False
> > > > >      End If
>
> > > > > (Or, if you like the more compact Iif statement (see that topic in
> > > > > the E-Basic Help facility), the inline in your trial Procedure could
> > > > > read simply
>
> > > > >      ITI.OnsetSignalEnabled = Iif( (c.GetAttrib("Shock") = 1), _
> > > > >          True, False )
>
> > > > > which I personally find easier to follow, but I am odd.)
>
> > > > > Next, if you want to prepare the way for other inlines in your
> > > > > program that may need those constants, you will move them out of
> > > > > SessionProc and into the global User script area (see Chapter 4 of
> > > > > the User's Guide that came with E-Prime).
>
> > > > > But wait, there's more!  You could do this with only *one* line of
> > > > > code in your trial Procedure and *no* If-Then.  Here's how.
>
> > > > > First set everything up with some inline
> > code out in the SessionProc, thus,
>
> > > > >      Const  OutPort as Integer = &h0378
>
> > > > >      ITI.OnsetSignalEnabled = True
> > > > >      ITI.OnsetSignalPort = OutPort
>
> > > > > (Again, you might instead move that constant out into the global User
> > > > > script area.)
>
> > > > > Note that we do *not* set OnsetSignalData out here, and in this
> > > > > scenario we leave OnsetSignalEnabled for all the trials.
>
> > > > > Next we make a different use of the Shock attribute in your trial
> > > > > List.  Instead of entering an arbitrary flag value that indirectly
> > > > > indicates whether or not to shock, simply enter an actual value to
> > > > > output to the BioPac with the ITI.  In particular, if the output sits
> > > > > at 0 in between shocks, then outputting an extra 0 does nothing.  So,
> > > > > simply set Shock to "&h80" for trials that get shock, and "0" for
> > > > > trials that do not get a shock.
>
> > > > > Now, down in your trial Procedure, you have one line of inline code
> > > > > before your ITI, thus,
>
> > > > >      ITI.OnsetSignalData = c.GetAttrib("Shock")
>
> > > > > And that's all!  Now, for shock trials, ITI outputs &h80, and for
> > > > > non-shock trials it outputs 0, but because the output is already 0
> > > > > nothing changes at the output so no shock.  Simple, eh?
>
> > > > > Something left out of this discussion is the need to *reset* the
> > > > > output (e.g., set output to 0) some time before outputting a new
> > > > > signal, possibly by means of OffsetSignal, or WritePort.  But since
> > > > > you do already get a shock on every trial with your existing code, I
> > > > > presume that you have that part worked out.
>
> > > > > BTW, I just wrote a video lesson on using E-Prime for fMRI, EEG, and
> > > > > psychophysiology, for an online course that we hope to offer by the
> > > > > start of the new year.
>
> > > > > -- David McFarlane, Professional Faultfinder
>
> > > > > At 11/4/2011 12:20 PM Friday, you wrote:
>
> > > > > >Thanks Paul, and thanks David. Your (David's) suggestion indeed looks
> > > > > >more fancy :-)
>
> > > > > >I have an additional question: I want e-prime to send a trigger to
> > > > > >BioPac for some but not all trials within a procedure: Based on the
> > > > > >attribute Shock (1 or 0) in the List I want Eprime to send a signal if
> > > > > >Shock = 1 and no signal if Shock = 0. I tried my very best with what
> > > > > >little I know of E-prime, and I ended up with the following
> > > > > >(nonfunctioning) Inline:
>
> > > > > >if c.GetAttrib("Shock") = 1 then
> > > > > >    ITI.OnsetSignalEnabled = True
> > > > > >    ITI.OnsetSignalPort = &H378
> > > > > >    ITI.OnsetSignalData = &H80
> > > > > >else
> > > > > >end if
>
> > > > > >What happens with this inline is that a shock is given with the start
> > > > > >of every ITI, instead of when Shock=1. What am I doing wrong?
> > > > > >Many thanks once again!
> > > > > >Maartje
>
> > > > > >On Oct 22, 5:45 pm, mcfar... at msu.edu wrote:
> > > > > > > Maartje ,
>
> > > > > > > And if you want to look like a real programmer instead of a novice,
> > > > > > > you will replace the "magic numbers" with named constants, thus,
>
> > > > > > > Const  OutPort as Integer = &h0378
> > > > > > > Const
>
> ...
>
> tamamını oku »- Alıntıyı gizle -
>
> - Alıntıyı göster -

-- 
You received this message because you are subscribed to the Google Groups "E-Prime" group.
To post to this group, send email to e-prime at googlegroups.com.
To unsubscribe from this group, send email to e-prime+unsubscribe at googlegroups.com.
For more options, visit this group at http://groups.google.com/group/e-prime?hl=en.



More information about the Eprime mailing list