% PMD1208_2ch.m - sample two A/D channels on PMD-1208FS % HJSIII, 03.07.29 % Mike Pritts, 05.05.24 % sample 512 data points at 200Hz % Lab 7 - use channel zero for unfiltered square wave % Lab 7 - use channel one for filtered square wave % "chan0" = 512 data points on Ch 0 % "chan1" = 512 data points on Ch 1 % connect MATLAB object (ai) to ComputerBoards (mcc) device (1) % in 339 Reber, the PMD-1208FS boards are installed as mcc device 1 ai = analoginput( 'mcc', 1 ); % use channels 0 and 1 addchannel( ai, 0:1 ); set(ai, 'InputType', 'Differential'); % sampling rate and length of burst set( ai, 'SampleRate', 200 ) set( ai, 'SamplesPerTrigger', 512 ) % activate PMD-1208FS - NOTE: this does not actually start sampling start( ai ) % sample burst [ data, time, abstime, events ] = getdata( ai ); % organize data chan0 = data(:,1); chan1 = data(:,2); % plot subplot( 2, 1, 1 ) plot( time, chan0 ) xlabel( 'Time [sec]' ) ylabel( 'Channel 0 [V]' ) subplot( 2, 1, 2 ); plot( time, chan1 ); xlabel( 'Time [sec]' ) ylabel( 'Channel 1 [V]' ) % deactivate board stop(ai); % deletes board object, ai no longer usable delete(ai) clear ai