Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

(25 points) Write a 68HC11 assembly language program that uses the HC1I ADC (Ana

ID: 3604656 • Letter: #

Question

(25 points) Write a 68HC11 assembly language program that uses the HC1I ADC (Analog-to-Digital Converter) to: Read - continuously- analog inputs from channels 4, 5, 6,7 and Outputs (writes) consecutively - after a time delay of 0.6 ms (millisecond)- each of the digitized input values to Port In other words, the digitized input value from channel 4 is written to Port C first, then after a time delay of 0.6 ms the digitized input value from channel 5 is written to Port C, then after another time delay of 0.6 ms the digitized input value from channel 6 is written to Port C, etc. Assume that the 68HC11 is operating at l MHz. You have to implement the time delay as a subroutine!

Explanation / Answer

optargs = {true,'DEFAULT',round(0.2*fs),round(.36*fs),round(.15*fs)}; % default values newVals = cellfun(@(x) ~isempty(x), varargin); optargs(newVals) = varargin(newVals); [verbose,str_ident,refrac,refracT,QRSmaxwidth] = optargs{:}; if nargin > 7 error('Wrong number of input arguments specified!'); end if ~islogical(verbose) error('Verbose option must be boolean.') end if (size(data,1) > size(data,2)) data = data'; elseif (size(data,1) == size(data,2)) error('check input data dimension. input data vector is of size 1x1'); elseif (~((size(data,1) == 1)||(size(data,2) == 1))) error('check input data dimension. input data vector seems to contain multiple channels'); end if (size(data,2) < (3*fs)) error('check input data dimension. input data vector containing less then 3s of data'); end qrs_pos = []; thresholdI1m = []; thresholdF1m = []; %% allow one of both thresholds I or F to be deceeded if associated region is detected regionFLAG = 1; %% general signal preparation % baseline-wander [BWb,BWa] = butter(5,[1.0].*2/fs,'high'); data = filtfilt(BWb,BWa,data); % normalization data = data./std(data); %% treat case of negative QRS sign checkSign = sort(data,'descend'); signFLAG = mean(abs(checkSign(length(data)-round(0.1*length(checkSign)):length(data))))>mean(abs(checkSign(1:round(0.1*length(checkSign))))); if (signFLAG) && verbose disp('input channel inverted due to possible negative QRS manifestation'); data = -data; end