Hi,
I tried my best to understand how to use the parPulse function sending triggers as the official website explained https://display-corner.epfl.ch/index.php?title=ParPulse&oldid=845, but failed. The main issue result from the different Syntax between the io64 function and the parPulse function.
This is a sample code of io64.
%trialstart marker using the io64 function
if measureEEG == 1
data_out = startmark;
io64(ioObj,address,data_out);
WaitSecs(0.01);
io64(ioObj,address,0); %reset to zero
end
Should the afterVal of parPulse be reset to the zero value after the trigger sending, as the io64 function?
The main syntax of parPulse is
parPulse([portAddr,] pulseVal, afterVal, valMask, pulseTi);
The sample code of parPulse is
parPulse(hex2dec('d030')); % Initialize port
parPulse(0,0,255,0); % Set all data lines to 0
parPulse(0,1,255,0); % Set all data lines to 0, except for line 0 which is set to 1
for i=1:50
parPulse(2,1,3,1e-3); % 1ms pulse on data line 0 (negative pulse)
% and line 1 (positive pulse)
pause(100e-3); % Pause for roughly 100ms
end
In my understanding, the afterVal is the EEG mark in experiments (If not, please correct me). But I cannot get the meaning of pulseVal and valMask.
For the pulseVal
I cannot understand:
- why there needs a output value during pulse, what is the function of this value?
- In an EEG experiment, what value should be set to the pulseVal, is it varied as different stimuli presented?
For the valMask
The official web said that the valMask indicats which output lines of the parallel port will actually be affected by pulseVal and afterVal.
My question is:
-
Which output lines of the parallel port should be set in normal EEG experiments? Is the valMask a constant value during the whole experiment?
-
What is the meaning when the valMask was set as “255” as the line 2 of sample code “parPulse(0,0,255,0)” illustrated? Does it mean that there are 255 lines in the parallel port? Or, does “255” mean all data lines? (I guess this is the case.) If so, again, whilch line should be programmed by pulseVal and afterVal in a normal EEG experiment.
Other specific questions for the sample code of parPulse:
parPulse(0,1,255,0); % Set all data lines to 0, except for line 0 which is set to 1
The first one is which position of the four value in the aboved code indicating the line 0 is set to 1, which value indicates all the other lines is set to 0.
In my understanding, the code means all lines (the third value: 255) is set to 1 (the second value which means afterVal: 1). But this is not matched with the comment.
for i=1:50
parPulse(2,1,3,1e-3); % 1ms pulse on data line 0 (negative pulse)
% and line 1 (positive pulse)
pause(100e-3); % Pause for roughly 100ms
end
The last question: which value means the line 0 and which means the line 1 in the above code “parPulse(2,1,3,1e-3)” ? How could I figure out whether the pulse is a negative pulse or a positive pulse as the comment said.
That’s all.
This is the last part of my first EEG experiment, and very appreciate to anyone who can explain these questions clearly.
Thanks again,
Huizhong