Changes

Jump to navigation Jump to search
913 bytes added ,  13:50, 7 August 2019
no edit summary
Line 1: Line 1:  +
{{Infobox tsg
 +
| name          = Buttonbox (2018)
 +
| image          = Buttonbox_2018_1.png
 +
| caption        = 2018 Buttonbox
 +
| downloads      = {{bulleted list
 +
      | [https://surfdrive.surf.nl/files/index.php/s/PPTKCyrjLkN4XUO Buttonbox 2018]
 +
      | [https://pypi.python.org/pypi/RuSocSci RuSocSci] (Python package)
 +
  }}
 +
}}
 
{{Infobox tsg
 
{{Infobox tsg
 
| name          = Buttonbox
 
| name          = Buttonbox
Line 4: Line 13:  
| caption        = 2013 Buttonbox
 
| caption        = 2013 Buttonbox
 
| downloads      = {{bulleted list
 
| downloads      = {{bulleted list
       | [[Buttonbox 2013 Hardware|Buttonbox 2013 Hardware Design]]
+
       | [https://surfdrive.surf.nl/files/index.php/s/72XEcu2XKSgzxjp Buttonbox 2015]
      | [[Media:BITSI_tempalte2015_duemilanove.zip|Code Template 2015 (Duemilanove)]]
   
       | [https://pypi.python.org/pypi/RuSocSci RuSocSci] (Python package)
 
       | [https://pypi.python.org/pypi/RuSocSci RuSocSci] (Python package)
 
   }}
 
   }}
Line 13: Line 21:     
The output connector has two binary eight bit ports: input and output. The two ports can be used for responses (input) and stimulus triggers (output). Two 12 bits analog outputs and three 12 bits analog inputs. The output connector has a sound and voicekey which triggers when a amplitude reaches a threshold. By using the serial port, the BITSI can be used platform independently: it works on Windows, Linux and Mac OSX. Most programming environments and stimulus packages support serial communication.
 
The output connector has two binary eight bit ports: input and output. The two ports can be used for responses (input) and stimulus triggers (output). Two 12 bits analog outputs and three 12 bits analog inputs. The output connector has a sound and voicekey which triggers when a amplitude reaches a threshold. By using the serial port, the BITSI can be used platform independently: it works on Windows, Linux and Mac OSX. Most programming environments and stimulus packages support serial communication.
 +
 +
There is currently a [[Microsoft Windows driver issue]].
    
== BITSI Protocol ==
 
== BITSI Protocol ==
Line 52: Line 62:  
===Output===
 
===Output===
   −
Output knows two protocols: '''BITSI simple''' or '''BITSI extended'''. To enter a certain protocol two buttons have to be pressed when the BITSIbox is powered. '''Press button H and A for simple mode and H and B for extended mode.'''
+
Output knows two protocols: '''BITSI simple''' or '''BITSI extended'''. To enter a certain protocol two buttons have to be pressed when the BITSIbox is powered or com port opens. '''[2015]Press button H and A for simple mode and H and B for extended mode. [2018]Press button E and A for simple mode and E and B for extended mode.'''
    
If no button is pressed when powered it boots the last known protocol. In the simple protocol every byte sent to the BITSI over the serial port, is represented at the 8 bit output.
 
If no button is pressed when powered it boots the last known protocol. In the simple protocol every byte sent to the BITSI over the serial port, is represented at the 8 bit output.
Line 109: Line 119:     
The 25 pins female connector has 8 inputs and 8 outputs, respectively 1-8 are inputs and 9-16 are outputs. Three analog input with an analog to digital convertor of 12 bit, pins 17,18,20 and 21. Two analog outputs with an digital to analog convertor of 12 bits on pins 22 and 23.
 
The 25 pins female connector has 8 inputs and 8 outputs, respectively 1-8 are inputs and 9-16 are outputs. Three analog input with an analog to digital convertor of 12 bit, pins 17,18,20 and 21. Two analog outputs with an digital to analog convertor of 12 bits on pins 22 and 23.
 +
 +
The inputs 1-8 will be pulled down from 5V to GND when the buttons are pressed. The outputs 9-16 will be pulled up from GND to 5V when the output is activated.
    
===Serial port===
 
===Serial port===
Line 172: Line 184:  
* Rate must be set 115200, Parity to None, Data Bits to 8 and Stop Bits to 1, Uncheck FIFO Interrupt.
 
* Rate must be set 115200, Parity to None, Data Bits to 8 and Stop Bits to 1, Uncheck FIFO Interrupt.
   −
[[File:Buttonbox1.png]]
+
[[File:Buttonbox2.png]]
    
'''Testing Buttonbox'''
 
'''Testing Buttonbox'''
Line 211: Line 223:  
=== Python/PsychoPy ===
 
=== Python/PsychoPy ===
   −
Download this site-package to use the buttonbox: [https://pypi.python.org/pypi/RuSocSci rusocsci]
+
Download this site-package to use the buttonbox: [https://pypi.python.org/pypi/RuSocSci rusocsci]  
 +
 
 +
or use in windows command 'pip install --upgrade rusocsci'
    
'''Example using buttons from the buttonbox in Python:'''
 
'''Example using buttons from the buttonbox in Python:'''
Line 275: Line 289:  
# make a buttonbox
 
# make a buttonbox
 
ser = serial.Serial("COM2", 115200, timeout = 0.10 )
 
ser = serial.Serial("COM2", 115200, timeout = 0.10 )
 +
ser = serial.Serial("/dev/ttyUSB0", 115200, timeout = 0.10 )
    
while True:
 
while True:
Line 343: Line 358:  
% or
 
% or
 
%
 
%
% to send a marker: (marker: a numeric value)
+
% to send a marker: (marker: a numeric value; Fs: sampling frequency device)
% buttonbox(marker)
+
% buttonbox(marker,Fs)
 
%
 
%
 
% or
 
% or
Line 362: Line 377:  
bb.StopBits  = 1;
 
bb.StopBits  = 1;
 
bb.Parity    = 'none';  
 
bb.Parity    = 'none';  
 +
 
if nargin < 1
 
if nargin < 1
 
   cmd = 'open';
 
   cmd = 'open';
 
end
 
end
if nargin > 1
+
if nargin > 1 && isstruct(varargin{1})
 
   % user overwrites default settings
 
   % user overwrites default settings
 
   flds = fields(varargin{1});
 
   flds = fields(varargin{1});
Line 373: Line 389:  
end
 
end
 
if nargin==1 && isnumeric(cmd)
 
if nargin==1 && isnumeric(cmd)
 +
  error('Please also specify acquisition sampling frequency of device that receives the marker');
 +
end
 +
if nargin > 1 && isnumeric(cmd)
 
   marker = cmd;
 
   marker = cmd;
 
   cmd = 'marker';
 
   cmd = 'marker';
 +
  Fs = varargin{1};
 
end
 
end
   Line 388: Line 408:  
   case 'marker'
 
   case 'marker'
 
       fwrite(handle, uint8(marker));%IOPort('Write', handle, uint8(marker), 1); % last argument: blocking
 
       fwrite(handle, uint8(marker));%IOPort('Write', handle, uint8(marker), 1); % last argument: blocking
       WaitSecs(0.002);
+
       WaitSecs(2/Fs);
 
       fwrite(handle, uint8(0));%IOPort('Write', handle, uint8(0), 0); % last argument: blocking
 
       fwrite(handle, uint8(0));%IOPort('Write', handle, uint8(0), 0); % last argument: blocking
 
       return
 
       return
Line 525: Line 545:  
   end  
 
   end  
 
end
 
end
end</syntaxhighlight>
+
end</syntaxhighlight>

Navigation menu