(OS9 port to OSX) MEX-files for NI PCI-DIO-96 and TEMPO VideoSync protocol

Dear Allen and other who have experience with the subject above (and
possibly using the VSG2/5 with TEMPO),

A group here at the Vanderbilt Vision Research Center is drawing up a
budget, asking me for advice, and I would like to advise them to use
the MATLAB and Psychtoolbox for visual stimulus presentation in their
new lab which will also use TEMPO for experimental control and PLEXON
for signal and event acquisition. It is sure to be a lot of work even
if it goes well, but I am hoping that you can screen my ideas to help
me avoid any major pitfalls at this time.

1. As MATLAB will need some way of communicating with TEMPO, should
the following MEX-files (created with CodeWarrior) currently used in a
different lab on an older OS9 Mac for communication with an installed
National Instruments PCI-DIO-96 card and TEMPO VideoSync protocol work
as well in "Classic" mode on a new Mac with MATLAB 5.2.1 and the same
PCI-DIO-96 card installed?:
Board_ID.mex
DIG_In_Port.mex
DIG_Out_Port.mex
DIG_Prt_Config.mex
RVS.mex

2. I have the source C-files and H-files for all, so should it be
possible to recompile the OS9 MEX-files into MEXMAC-files on OSX,
maybe using MATLAB's own "Lcc" compiler from the MATLAB command line?
(I have made small simple MEXMAC-files in OSX this way recently.)

3. The current protocol between the NI PCI-DIO-96 card and TEMPO
involves 20 digital input pins and 4 digital output pins (on the
MATLAB/NI PCI-DIO-96 side). I do not have experience using OSX's
PsychHID.mex yet, but looking at the Denis' USB page, do you think
that any of the USB-HID devices would be an acceptable alternative to
an NI PCI-DIO-96 card and porting the OS9 MEX-files to OSX
MEXMAC-files? (My first concern would be that the USB-HID devices
shown do not have enough pins. But theoretically, could it accomplish
the same thing?)

4. What does one need to consider before splitting a VGA video output
to 2 monitors instead of 1, one for the subject, and the other for the
user running the experiment to see the same.

5. I program visual stimuli on Cambridge Research System's VSG2/5
with Windows MATLAB in yet another lab. In addition to its video
output to the stimulus monitor, the VSG2/5 has 10 input and 10 output
pins for digital communication and triggering. Anyone out there
successfully using a VSG2/5 with TEMPO?

Thanks very much for any and all feedback.

Daniel Shima
Vanderbilt Vision Research Center
dear dan

here are my thoughts, interspersed with your queries, below.

denis

Denis Pelli
Professor of Psychology and Neural Science
http://psych.nyu.edu/pelli/

On Mar 20, 2005, at 11:31 PM, Daniel Shima wrote:

>
> Dear Allen and other who have experience with the subject above (and
> possibly using the VSG2/5 with TEMPO),
>
> A group here at the Vanderbilt Vision Research Center is drawing up a
> budget, asking me for advice, and I would like to advise them to use
> the MATLAB and Psychtoolbox for visual stimulus presentation in their
> new lab which will also use TEMPO for experimental control and PLEXON
> for signal and event acquisition. It is sure to be a lot of work even
> if it goes well, but I am hoping that you can screen my ideas to help
> me avoid any major pitfalls at this time.
>
> 1. As MATLAB will need some way of communicating with TEMPO, should
> the following MEX-files (created with CodeWarrior) currently used in a
> different lab on an older OS9 Mac for communication with an installed
> National Instruments PCI-DIO-96 card and TEMPO VideoSync protocol work
> as well in "Classic" mode on a new Mac with MATLAB 5.2.1 and the same
> PCI-DIO-96 card installed?:
> Board_ID.mex
> DIG_In_Port.mex
> DIG_Out_Port.mex
> DIG_Prt_Config.mex
> RVS.mex

Essentially everything that worked under OS9, also runs under Classic.
However, Apple shortchanged Classic in that video synching is a fake.
You are synching to an autonomous 60 Hz clock unrelated to the display.
Thus Classic is NOT a good environment for running experiments that
care about time. Your long-term plans should NOT rely on Classic.

Instead you should run under OSX. The rules for writing a MATLAB mex
file have changed very little for OSX, so it should be easy to port
your MEXs to OSX provided you aren't using features of OS9 that are
absent or changed in OSX. I would be surprised if that were true of the
routines you list above since they are dealing with cards, not the OS.

However, I think you should take a critical look at the hardware you're
using. Hardware fashions change and you should try to keep up, as old
hardware can become expensive to maintain. I would guess that it'd be
much better for your group to switch to a new USB device, replacing the
old PCI-DIO-96.

> 2. I have the source C-files and H-files for all, so should it be
> possible to recompile the OS9 MEX-files into MEXMAC-files on OSX,
> maybe using MATLAB's own "Lcc" compiler from the MATLAB command line?
> (I have made small simple MEXMAC-files in OSX this way recently.)

Yes, port your MEXs to OSX. My OSX experience is limited to enhancing
the PsychHID.mexmac that Allen wrote, but i wrote lots of MEXs under
OS9. I've only used Xcode, which is very good and free from Apple, so i
recommend that.

> 3. The current protocol between the NI PCI-DIO-96 card and TEMPO
> involves 20 digital input pins and 4 digital output pins (on the
> MATLAB/NI PCI-DIO-96 side). I do not have experience using OSX's
> PsychHID.mex yet, but looking at the Denis' USB page, do you think
> that any of the USB-HID devices would be an acceptable alternative to
> an NI PCI-DIO-96 card and porting the OS9 MEX-files to OSX
> MEXMAC-files? (My first concern would be that the USB-HID devices
> shown do not have enough pins. But theoretically, could it accomplish
> the same thing?)

Yes. There are lots of new USB DAQs and some have many digital lines.
Few are HID-compliant. If it's not HID-compliant then you can't use
PsychHID. However, it turns out that communication with any DAQ boils
down to sending a block of data and receiving a block of data. In
programming the PMD-1208FS I use only the HID-defined SetReport and
GetReport commands. However, the LabJack people tell me that the basic
USB "bulk" protocol is just as good and easier to program. So you could
plan to write a new extension, perhaps called PsychUSB that would
support sending and receiving a block of data through the USB bulk
protocol. I think that would be about a week's work and would support
all USB DAQS for which the manufacturers will supply the necessary USB
programming specifications. That may be true of the NI devices--it's
not clear to me whether the C software from National Instruments
actually exposes everything or hides key parts in a binary library.

The PMD-1208FS (HID-compliant, USB 2, $150) has 16 digital io lines.
You can attach multiple USB devices, even of the same kind. They're not
expensive. Two of these would satisfy the requirements you describe
above.
http://www.measurementcomputing.com/cbicatalog/cbiproduct_new.asp?
dept_ID=367&pf_id=1665

The LabJack UE9 (USB "bulk" protocol, USB 2, $400) has 23 digital io
liines.
http://www.labjack.com/labjack_ue9.html

Progress report on PsychHID and PMD-1208FS:
I have been working hard to get PsychHID to control my PMD-1208FS. The
manufacturer gave me a complete manual for the USB-HID commands to do
this. I'm sending data to it just fine, but i haven't yet succeeded in
receiving data. I've asked the engineers at Measurement Computing for
help and I'm optimistic that communication with their DAQ will be soon
be working fully.

> 4. What does one need to consider before splitting a VGA video output
> to 2 monitors instead of 1, one for the subject, and the other for the
> user running the experiment to see the same.

Just do it. No issues.

good luck.

denis

> 5. I program visual stimuli on Cambridge Research System's VSG2/5
> with Windows MATLAB in yet another lab. In addition to its video
> output to the stimulus monitor, the VSG2/5 has 10 input and 10 output
> pins for digital communication and triggering. Anyone out there
> successfully using a VSG2/5 with TEMPO?
>
> Thanks very much for any and all feedback.
>
> Daniel Shima
> Vanderbilt Vision Research Center
>
>
> Post your message to: psychtoolbox@yahoogroups.com
> Please indicate OS9, OSX, or WIN version, and include your full name.
> Denis Pelli, David Brainard, and Allen Ingling.
> http://psychtoolbox.org
>
> Yahoo! Groups Links
>
>
>
>
>
>
>