function changeAdBoard(figHandle)

% called after the hardware source of the protocolViewer changes

	if nargin < 1
		figHandle = gcf;
	end
	
	handles = get(figHandle, 'userData');
	if get(handles.source, 'value') == get(handles.source, 'userData')
		% same as before so skip
		return
	end
    if isfield(handles, 'channelType')
        delete(handles.channelType);
        delete(handles.channelRange);
        delete(handles.channelExtGain);
        delete(handles.channelName);
    end
    
	switch get(handles.source, 'value')
        case 1 % itc 18 has 8 analog inputs
			n = 8;
			if ~ispref('amplifiers', 'amplifiers')
				currentAmps;
				if ~ispref('amplifiers', 'amplifiers')
					error('No amplifiers setup.  See file ''currentAmps.m'' for an example')
				end
			end
			set(handles.pnlChannelSpecs, 'position', [7.8 13.077 + (8 - n) * 1.769 74.4 15.864 - (8 - n) * 1.769]);				
			otherChannels = getpref('amplifiers', 'otherChannels');
			otherChannelFactors = getpref('amplifiers', 'otherChannelFactors');
			rangeNames = getpref('itc18', 'rangeNames');
			rangeScales = getpref('itc18', 'rangeScales');
			gainNames = getpref('itc18', 'gainNames');
			gainScales = getpref('itc18', 'gainScales');
			for x = n:-1:1
				uicontrol('unit', 'char', 'style', 'text', 'parent', handles.pnlChannelSpecs, 'position', [2.6  12.8 - (x-1) * 1.769 12.2 1.462], 'tag', 'channelName', 'string', ['A/D Chan ' num2str(x-1)]);
				setappdata(uicontrol('callback', 'saveProtocol; changeRunningChannel;', 'background', [1 1 1], 'unit', 'char', 'style', 'pop', 'parent', handles.pnlChannelSpecs, 'position', [18.6  13.077 - (x-1) * 1.769 19.8 1.538], 'tag', 'channelType', 'string', otherChannels, 'value', 1, 'userData', otherChannelFactors), 'source', ['AD ' sprintf('%1.0f', x - 1) ', ']);
				uicontrol('callback', 'saveProtocol', 'background', [1 1 1], 'unit', 'char', 'style', 'pop', 'parent', handles.pnlChannelSpecs, 'position', [40.8  13.077 - (x-1) * 1.769 19.8 1.538], 'tag', 'channelRange', 'string', rangeNames, 'value', 4, 'userData', rangeScales);       
				uicontrol('callback', 'saveProtocol', 'background', [1 1 1], 'unit', 'char', 'style', 'pop', 'parent', handles.pnlChannelSpecs, 'position', [62.0  13.077 - (x-1) * 1.769 10.0 1.538], 'tag', 'channelExtGain', 'string', gainNames, 'value', 1, 'userData', gainScales);               
			end			
	end
	set(figHandle, 'userData', guihandles(figHandle));
	set(handles.source, 'userData', get(handles.source, 'value'));