# re DAQ toolbox

**URL:** <https://psychtoolbox.discourse.group/t/re-daq-toolbox/1973>\
**Category:** Uncategorized\
**Created:** [May 14, 2008, 1:31pm UTC](https://psychtoolbox.discourse.group/t/re-daq-toolbox/1973 "2008-05-14T13:31:18Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Allen\_Ingling](https://avatars.discourse-cdn.com/v4/letter/a/a183cd/32.png) [@Allen\_Ingling](https://psychtoolbox.discourse.group/u/Allen_Ingling)\
**Post date:** [May 14, 2008, 1:31pm UTC](https://psychtoolbox.discourse.group/t/re-daq-toolbox/1973/1 "2008-05-14T13:31:18Z")

</div>

Hi  
  
I get a 'device not attached' error using DaqDOut, I've called  
DaqDeviceIndex to get a handle for the USB-1208fs and that returns a  
value of 4.  
  
If I pass that value to DaqDOut it generates the 'not attached' error.  
The USB-1208fs is definitely attached with a green light so no problem  
there.  
  
DaqAOut works fine, I suspect I have not understood the device  
index/inferface distinction properly.   
  
Previous posts (i.e. Adam Greenberg's code example posted jun 11 2007)  
seem to suggest that the value returned by DaqDeviceIndex is the  
handle to pass into DaqDOut but there is still a problem  
  
Any help much appreciated  
  
L\_W

---

<div class="post-metadata">

**Author:** ![TGFikes](https://avatars.discourse-cdn.com/v4/letter/t/977dab/32.png) [@TGFikes](https://psychtoolbox.discourse.group/u/TGFikes)\
**Post date:** [May 14, 2008, 11:56pm UTC](https://psychtoolbox.discourse.group/t/re-daq-toolbox/1973/2 "2008-05-14T23:56:58Z")

</div>

L\_W:
  

What platform, OS, and version of matlab & ptb are you running?Did you configure the port as output (DaqDConfigPort)?

  

I just ran the following script on my macs (OS 10.4, both intel and ppc) a few days ago with matlab R2007a, ptb 3.0.8, using a PMD1208fs, and it worked fine. It just blinks a couple of LEDs with various stimulus onset asynchronies.

  

-tom

  

% PMD\_LED\_test.m

%

% script to blink LEDs on A1 and A2 of PMD's USB 1208FS I/O device. wiring:

% pin21--\>1k resistor --\>(flat)LED(round) --\> pin40

% pin22--\>1k resistor --\>(flat)LED(round) --\> pin40

% 

% 2/Oct/2007 -tgf

% set port and SOA (in sec)

port=0;

SOA=[50 45 40 35 30 25 20 15 10 5]./1000; 

% set port 

port=0;

% get device number of USB 1208FS & pull port A low

device=DaqDeviceIndex; % find device number for attached PMD device

DaqDConfigPort(device, port, 0); % configure for output

err=DaqDOut(device,port,0); % make sure all bits cleared

firststim=[1 1 2 1 2 2 1 2 2 1];

for i=1:length(firststim)

 WaitSecs(1);

 err=DaqDOut(device,port,firststim(i)); 

 WaitSecs(SOA(i)); 

 err=DaqDOut(device,port,3);

while CharAvail; 

 FlushEvents; 

end

 [ch(i), rt(i)]=GetChar;

 err=DaqDOut(device,port,0);

end

  

On May 14, 2008, at 6:31 AM, luxton\_wood wrote:
  

> > Hi  
> >   
> > I get a 'device not attached' error using DaqDOut, I've called  
> > DaqDeviceIndex to get a handle for the USB-1208fs and that returns a  
> > value of 4.  
> >   
> > If I pass that value to DaqDOut it generates the 'not attached' error.  
> > The USB-1208fs is definitely attached with a green light so no problem  
> > there.  
> >   
> > DaqAOut works fine, I suspect I have not understood the device  
> > index/inferface distinction properly.   
> >   
> > Previous posts (i.e. Adam Greenberg's code example posted jun 11 2007)  
> > seem to suggest that the value returned by DaqDeviceIndex is the  
> > handle to pass into DaqDOut but there is still a problem  
> >   
> > Any help much appreciated  
> >   
> > L\_W

  

   

  

::::::::::::::\\\\\\\\\\\\\\\\\\\\\\\\\|/////////////////////////::::::::::::::

Thomas G. Fikes

Professor of Psychology and Neuroscience

Westmont College, Santa Barbara, CA

805.565.6115 [fikes@...](mailto:fikes@...)
:::::::::::::://///////////////////////|\\\\\\\\\\\\\\\\\\\\\\\\\::::::::::::::
