
To transfer the data from the CF card to MATLAB workspace, first
right click on target PC in xPC Explorer and select it as default. Type
the following commands (it will be advantageous to save these lines
of code as a MATLAB script file)
% Create file system object
fsys = xpctarget.fs
% Open file on the target file system
h = fsys.fopen(‘DATA.DAT’)
% Read the data from the target file into a MATLAB variable. Note
that
% this data will still be represented in xPC Target file
% format (i.e. not bytes)
data = fsys.fread(h);
% Close file on file system
fsys.fclose(h);
% Call READXPCFILE to convert the data from xPC Target
% file format to bytes for use in MATLAB
new_data = readxpcfile(data);
At this point the data is saved in “new_data” as a matrix in the MATLAB workspace. The first column is
data from the pulse generator, second column is data from the Diamond MM board and third column is
the time at which the samples were saved. You can get these signal names by simply typing
>> new_data
Next, you will learn how to have the xPC scope running on the host
computer. This enables you to get away with no monitor connected
to the PC104 board. To do this, change the xPC Scope type to Host.
Build and download the file to your xPC target; then start the
program. Go to xPC Explorer and expand the tree underneath the
experiment that has been downloaded to the target PC. Under “xPC
Scopes” you should see an option listed as “Host Scope(s)”. Right
click on it and select “View Scopes”. A new window will appear
displaying the waveform and they should look the same as the ones
you are viewing on the monitor.
From point onwards, you are strongly encouraged to use host scope
mode as much as possible since this reduces the requirement of a
monitor.
Questions
Q9 For Experiment 1.4 a and 1.4 b report maximum sample time supported by diamond MM boards. Do
you think this limitation in sample time can cause bandwidth limitations?
Q10 Mention A/D and D/A capabilities of Diamond boards.
Komentáře k této Příručce