% IVOVI 2000 % Example of using INOUTP toolbox for LPT control function pptest(bit) global o global i global stop lpt1=hex2dec('378'); lpt1s=hex2dec('379'); if nargin<1, value=0; stop=0; a = figure('Color',[0.8 0.8 0.8], ... 'Position',[381 284 560 420], ... 'Name','Parallel cable test'); o(1) = uicontrol('Parent',a, ... 'Units','points', ... 'Position',[42 30.75 84.75 23.25], ... 'Style','checkbox', ... 'String','DO0 (TDI)', ... 'CallBack','pptest(1)'); o(2) = uicontrol('Parent',a, ... 'Units','points', ... 'Position',[42 64 84.75 23.25], ... 'String','DO1 (TCK)', ... 'Style','checkbox', ... 'CallBack','pptest(1)'); o(3) = uicontrol('Parent',a, ... 'Units','points', ... 'Position',[42 97.25 84.75 23.25], ... 'Style','checkbox', ... 'String','DO2 (TMS)', ... 'CallBack','pptest(1)'); o(4) = uicontrol('Parent',a, ... 'Units','points', ... 'Position',[42 130.5 84.75 23.25], ... 'Style','checkbox', ... 'String','DO3 (ISPEN\)', ... 'CallBack','pptest(1)', ... 'Tag','Checkbox1'); o(5) = uicontrol('Parent',a, ... 'Units','points', ... 'Position',[42 163.75 84.75 23.25], ... 'Style','checkbox', ... 'String','DO4 (RESET)', ... 'CallBack','pptest(1)', ... 'Tag','Checkbox1'); o(6) = uicontrol('Parent',a, ... 'Units','points', ... 'Position',[42 197 84.75 23.25], ... 'Style','checkbox', ... 'String','DO5', ... 'CallBack','pptest(1)'); o(7) = uicontrol('Parent',a, ... 'Units','points', ... 'Position',[42 230.25 84.75 23.25], ... 'Style','checkbox', ... 'String','DO6 (Cable sense)', ... 'CallBack','pptest(1)'); o(8) = uicontrol('Parent',a, ... 'Units','points', ... 'Position',[42 263.5 84.75 23.25], ... 'Style','checkbox', ... 'String','DO7', ... 'CallBack','pptest(1)'); i(4) = uicontrol('Parent',a, ... 'Units','points', ... 'Position',[166.5 130.5 84.75 23.25], ... 'Style','checkbox', ... 'String','DI3 (VCC sense)', ... 'Enable','inactive'); i(5) = uicontrol('Parent',a, ... 'Units','points', ... 'Position',[166.5 164.25 84.75 23.25], ... 'Style','checkbox', ... 'String','DI4', ... 'Enable','inactive'); i(6) = uicontrol('Parent',a, ... 'Units','points', ... 'Position',[166.5 197.25 84.75 23.25], ... 'Style','checkbox', ... 'String','DI5 (Cable sense)', ... 'Enable','inactive'); i(7) = uicontrol('Parent',a, ... 'Units','points', ... 'Position',[166.5 230.25 84.75 23.25], ... 'Style','checkbox', ... 'String','DI6 (TDO)', ... 'Enable','inactive'); i(8) = uicontrol('Parent',a, ... 'Units','points', ... 'Position',[166.5 264 84.75 23.25], ... 'Style','checkbox', ... 'String','DI7', ... 'Enable','inactive'); b = uicontrol('Parent',a, ... 'Units','points', ... 'BackgroundColor',[0.658824 0.66078 0.564706], ... 'Position',[31.5 21.75 108.75 283.5], ... 'String','Status(IN)', ... 'Style','frame'); b = uicontrol('Parent',a, ... 'Units','points', ... 'BackgroundColor',[0.658824 0.66078 0.564706], ... 'Position',[156.75 21.75 108.75 283.5], ... 'String','Data (OUT)', ... 'Style','frame'); b = uicontrol('Parent',a, ... 'Units','points', ... 'BackgroundColor',[0.658824 0.596078 0.564706], ... 'Enable','inactive', ... 'Interruptible','off', ... 'Position',[43.5 296.25 84.75 15], ... 'String','Data (OUT)', ... 'Style','text'); b = uicontrol('Parent',a, ... 'Units','points', ... 'BackgroundColor',[0.658824 0.596078 0.564706], ... 'Enable','inactive', ... 'Interruptible','off', ... 'Position',[169.5 296.25 84.75 15], ... 'String','Satus (IN)', ... 'Style','text'); b = uicontrol('Parent',a, ... 'Units','points', ... 'BackgroundColor',[0.658824 0.596078 0.564706], ... 'Interruptible','off', ... 'Position',[300 296.25 84.75 15], ... 'String','Close', ... 'Style','pushbutton', ... 'CallBack','global stop;stop=1;'); outp(lpt1,0); while stop==0, value=inp(lpt1s); for j=4:8, set(i(j),'Value',bitget(value,j)); end; pause(1); end; close(gcf); else value=0; for j=1:8, value=value+get(o(j),'Value')*2^(j-1); end; outp(lpt1,value) end;