Code covered by the BSD License  

Highlights from
MATLAB Support Package for Velleman PCSGU250 Oscilloscope + Function Generator

MATLAB Support Package for Velleman PCSGU250 Oscilloscope + Function Generator



25 Jul 2011 (Updated )

MATLAB library for controlling a Velleman PCSGU250 scope and generator

% seeGeneratorOutput
% Before running this function, connect the function generator to channel 1
% of the scope using a coaxial cable.
% This function creates a half wave rectified sine wave lib file and plots
% it. It then starts up the scope and function generator on the PCSGU250,
% gets data (which should be the function generator output), and plots it
% on the same plot. This should match up (roughly) with the original lib
% file plot.
% This function is a good example of how to set up the PCSGU250, collect
% data, and disconnect automatically in one package.

%   MATLAB Support Package for Velleman PCSGU250
%   Version 1.0
%   Copyright 2011 The MathWorks, Inc.

function seeGeneratorOutput
lab = vellscope.pclab;

%hide the GUI

%create a half-wave rectified sine, plot it in red, and save it to a lib file
i = linspace(0,2*pi,3096);
waveform = sin(i).*(i<pi);

% set up function generator;
lab.FgenAmplitude = 2;
lab.FgenSource = 'library';
lab.FgenLibFile = 'halfsine';

% set up scope
lab.Trigger = 'on';
lab.TriggerLevel = 124;

% match frequency and time scale to see 1 peroid
lab.FgenFrequency = 20;
lab.TimePerDiv = '2ms';

%start scope and generator

%pause to let everything catch up

%read data from the scope
data = lab.readChannel(1);

%plot data starting from trigger point (1000)
hold on;
hold off;



Contact us