Code covered by the BSD License  

Highlights from
xPC Target Delay Timer Block

image thumbnail

xPC Target Delay Timer Block

by

 

02 Dec 2008 (Updated )

Describes a block that can be used to delay execution of an xPC Target application.

xpcDelayTimerTestResults.m
% Note: Before running this script, build xpcDelayTimerTest.mdl.
tg=xpc;

% Run test model (No delay).
tg.setparam(4,0)
+tg;
pause(2);

% Plot Time Delay Test Results.
figure(1);
subplot(3,1,1);
stem(tg.TimeLog,tg.TETLog*1e6,'*');
ylabel('TET ( {\mu}s)');
title('Delay Timer Test Results (No Delay)')
subplot(3,1,2);
stem(tg.TimeLog,tg.OutputLog(:,1),'*');
ylabel('Trigger');
subplot(3,1,3);
plot(tg.TimeLog,tg.OutputLog(:,2),'-');
ylabel('Counter');
xlabel('Time (s)');

% Run test model (100us delay).
tg.setparam(4,100e-6)
+tg;
pause(2);

% Plot Time Delay Test Results.
figure(2);
subplot(3,1,1);
stem(tg.TimeLog,tg.TETLog*1e6,'*');
ylabel('TET ( {\mu}s)');
title('Delay Timer Test Results (100{\mu}s Delay)')
subplot(3,1,2);
stem(tg.TimeLog,tg.OutputLog(:,1),'*');
ylabel('Trigger');
subplot(3,1,3);
plot(tg.TimeLog,tg.OutputLog(:,2),'-');
ylabel('Counter');
xlabel('Time (s)');

% Run test model (300us delay).
tg.setparam(4,300e-6)
+tg;
pause(2);

% Plot Time Delay Test Results.
figure(3);
subplot(3,1,1);
stem(tg.TimeLog,tg.TETLog*1e6,'*');
ylabel('TET ( {\mu}s)');
title('Delay Timer Test Results (300{\mu}s Delay)')
subplot(3,1,2);
stem(tg.TimeLog,tg.OutputLog(:,1),'*');
ylabel('Trigger');
subplot(3,1,3);
plot(tg.TimeLog,tg.OutputLog(:,2),'-');
ylabel('Counter');
xlabel('Time (s)');

Contact us