function dwn_oscope(vert_range,mcc_output_gain_scaling_factor)
%plots the data input from channels one and two (add 3 for temp)

%cleanup the workspace before getting underway
hdfml('closeall')
d1input=[];
delete(d1input)
clear d1input
%clear all
%_________________
% mcc_output_gain_scaling_factor=1000; %(pA/V) this depends on two settings in MCC, the feedback resistor (under gains) for voltage clamp, and the output gain;  this factor gives the number of pA of membrane current for each V recorded on the BNC board
sampling_rate=10000
samples_per_cycle=1000 %used in plotting
%_________________
%building the input object
d1input=analoginput('nidaq');
addchannel(d1input,0);
addchannel(d1input,1); 
%addchannel(d1input,2); %for temperature data
set(d1input,'SampleRate',sampling_rate)   
set(d1input,'SamplesPerTrigger',sampling_rate)
%set(d1input,'ChannelSkewMode','Minimum')
%set(d1input,'TransferMode','SingleDMA')
%set(d1input,'TransferMode','Interrupts')
%set(d1input,'TriggerType','Immediate')
set(d1input,'TriggerType','Manual')
set(d1input,'TriggerRepeat',inf)
set(d1input,'LoggingMode','Memory')
%set(d1input,'SamplesAcquiredFcnCount',samples_per_cycle) %SamplesAcquired... remnants from other attempted approaches to running multiple stimuli rapidly
%set(d1input,'SamplesAcquiredFcn',plot(getdata(d1input)))
%get(d1input)

figure(21)
clf
colordef(figure(21),'black')
set(21,'Position',[408 266 859 665])
set(21,'doublebuffer','on') %Reduce plot flicker, purportedly
set(21,'ButtonDownFcn','global stop_loop, stop_loop = 1')
set(gca,'ButtonDownFcn','global stop_loop, stop_loop=1')

global stop_loop
stop_loop=0
start(d1input),trigger(d1input)

while ~stop_loop
    while d1input.SamplesAcquired < d1input.SamplesPerTrigger
    end
    data = peekdata(d1input,samples_per_cycle);
    data=data*mcc_output_gain_scaling_factor;   %converting to pA
    P=plot([1:length(data)],data);%,'linewidth',2);
    xlim([0 samples_per_cycle])
    ylim([vert_range(1) vert_range(2)])
    drawnow
    if stop_loop,stop(d1input),end
end

d1input=[];
delete(d1input)
clear d1input
clear all