Simon Khuu wrote:
forum, someone there would know the answer.
parallel port. Is this because you want the source to the 'serial' function
for use as an example when writing a function to control the parallel port ?
If so, then the dll file won't help you. Or are you using the terms
'serial port' and 'parallel port' interchangeably, unaware that they are
different ports, and that the PC has both ?
And do you only mean labelling ? Or in addition to the label indicating
the number of the trial, does the arrival time of the label signal to the
ERP device the onset of the stimulus ?
within Matlab.
I can think of two approaches. I assume that your neuroscan 4 ERP device
acts like a printer in that it receives a series of bytes from the windows
computer and that the transfer of those bytes is synchronized between sender
and receiver by handshaking lines on the parallel port. (The alternative is
that a Matlab script would directly specify the states of pins on the port,
and this 4 ERP device samples, at times undetermined by the sender, the
states of those pins.)
One option is to get MS Visual C++, find windows documentation describing
the parallel port API, and write a C file which compiles to a mex file.
Matlab is distributed with example mex projects and the Matlab API manual
has annotated examples that get you up to speed fast on using the MEX API.
The source code for the PsychToolbox also includes a blank psychtoolbox
project to start from.
The other approach would be to call MSDOS shell commands within Matlab to
control a system interface to the port. I don't have any experience doing
this sort of thing in Matlab for Windows. But I can say a few things about
how it might look. I expect that you can issue DOS shell commands from
within Matlab. So in Matlab you could direct a string to the parallel port
device just as you would from the DOS shell, except wrap the shell command
in quotes and whatever is the Matlab shell escape command. You might have
to use matlab's "eval" there also, if you're passing a string in a matlab
variable. Calling shell commands to direct a string to a port should be
easy for anyone who knows DOS well. I don't. While this solution should
be easy to implement, it's going to execute more slowly than a .mex file
would.
Note that if the issuance of these numbers from the parallel port must
coincide precisely with the stimulus onset, then either of these approaches
might fail. There is more hope for the first than the second.
Also, if this ERP device doesn't use a printer handshaking protocol, the
second approach wouldn't' work at all.
-- Allen
> Hi Allen,I don't know the answer to that. I'll copy this reply to the Psychtoolbox
>
> I am I correct in assuming that there is not yet a windows equilivant of
> the function 'serial?'
forum, someone there would know the answer.
>You are looking for a serial port function because you want to control the
> If there is could you email me a copy of the dll
> or the c source.
> The reason is that I need a function in matlab that can open a parallel
> port and send a number maker 1,2,3,4 etc to a neuroscan 4 ERP device for
> labelling the onset and offset of the stimulus.
parallel port. Is this because you want the source to the 'serial' function
for use as an example when writing a function to control the parallel port ?
If so, then the dll file won't help you. Or are you using the terms
'serial port' and 'parallel port' interchangeably, unaware that they are
different ports, and that the PC has both ?
And do you only mean labelling ? Or in addition to the label indicating
the number of the trial, does the arrival time of the label signal to the
ERP device the onset of the stimulus ?
>I will comment on how you might go about controlling the parallel port from
> Could you suggest how I might go about doing this
within Matlab.
I can think of two approaches. I assume that your neuroscan 4 ERP device
acts like a printer in that it receives a series of bytes from the windows
computer and that the transfer of those bytes is synchronized between sender
and receiver by handshaking lines on the parallel port. (The alternative is
that a Matlab script would directly specify the states of pins on the port,
and this 4 ERP device samples, at times undetermined by the sender, the
states of those pins.)
One option is to get MS Visual C++, find windows documentation describing
the parallel port API, and write a C file which compiles to a mex file.
Matlab is distributed with example mex projects and the Matlab API manual
has annotated examples that get you up to speed fast on using the MEX API.
The source code for the PsychToolbox also includes a blank psychtoolbox
project to start from.
The other approach would be to call MSDOS shell commands within Matlab to
control a system interface to the port. I don't have any experience doing
this sort of thing in Matlab for Windows. But I can say a few things about
how it might look. I expect that you can issue DOS shell commands from
within Matlab. So in Matlab you could direct a string to the parallel port
device just as you would from the DOS shell, except wrap the shell command
in quotes and whatever is the Matlab shell escape command. You might have
to use matlab's "eval" there also, if you're passing a string in a matlab
variable. Calling shell commands to direct a string to a port should be
easy for anyone who knows DOS well. I don't. While this solution should
be easy to implement, it's going to execute more slowly than a .mex file
would.
Note that if the issuance of these numbers from the parallel port must
coincide precisely with the stimulus onset, then either of these approaches
might fail. There is more hope for the first than the second.
Also, if this ERP device doesn't use a printer handshaking protocol, the
second approach wouldn't' work at all.
-- Allen
> Hi Allen,
>
> I am I correct in assuming that there is not yet a windows equilivant of
> the function 'serial?' If there is could you email me a copy of the dll
> or the c source.
>
> The reason is that I need a function in matlab that can open a parallel
> port and send a number maker 1,2,3,4 etc to a neuroscan 4 ERP device for
> labelling the onset and offset of the stimulus.
>
> Could you suggest how I might go about doing this
>
> Your response will be much appreciated
>
> Simon
> Human Vision Lab
> University of Western Australia
>