Skip to content

Instantly share code, notes, and snippets.

@psychenjg
Created May 14, 2019 14:15
Show Gist options
  • Select an option

  • Save psychenjg/32d6812c8fb6bcebbee27eb72e05d0ae to your computer and use it in GitHub Desktop.

Select an option

Save psychenjg/32d6812c8fb6bcebbee27eb72e05d0ae to your computer and use it in GitHub Desktop.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Main.m
if prm.info.EEG == 1
%create an instance of the io64 object
prm.ioObj = io64;
%
% initialize the interface to the inpoutx64 system driver
prm.status = io64(prm.ioObj);
%
% if status = 0, you are now ready to write and read to a hardware port
prm.address = hex2dec('E010'); % %standard LPT1 output port address
prm.data_out_0 = 0; %0 cannot be showed %sample data value
prm.data_out_1 = 1; % trial start
prm.data_out_2 = 2; % stimulus start
prm.data_out_3 = 3; % fixation cue start
prm.data_out_4 = 4; % stimulus change
prm.data_out_5 = 5; % stimulus end
prm.data_out_6 = 6; % response ori end
prm.data_out_7 = 7; % response changes end
prm.data_out_8 = 8; % shift
% let's try sending the value to the parallel printer's output port (LPT1)
io64(prm.ioObj,prm.address,prm.data_out_1);
WaitSecs(0.003);
io64(prm.ioObj,prm.address,prm.data_out_0); % it cannot input two consequtive same value %output command
%
% when finished with the io64 object it can be discarded via
% 'clear all', 'clear mex', 'clear io64' or 'clear functions' command.
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Trial.m
% send trial number
if prm.info.EEG == 1
io64(prm.ioObj,prm.address,iTrial+100);
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Step 1: Preparing fixation.
drawFixation(CURRENT.leftright); % draw fixation
resp.tStart(iTrial) = Screen('Flip',prm.screen.window); % flip
eyemark(iTrial,'EVENT_FIXOn'); % eye tracking
if prm.info.EEG == 1
io64(prm.ioObj,prm.address,prm.data_out_1); % fixation trigger
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment