% This file writes a file that can be used to output a cosine to the % ADuC841's DAC. t = 0:1/256:255/256; y = cos(2*pi*t); figure(1) plot(t,y) z = round(128 + 100 * y); % Note that this keeps the output away from the extremes. This keeps the % op-amp on the development kit from getting too close to the "rails." figure(2) plot(t,z) fid = fopen('Table.asm','w'); fprintf(fid,'Cosine:\n'); for i = 1:256 fprintf(fid,' DB %d \n',z(i)); end fclose(fid)