Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
74 changes: 74 additions & 0 deletions +adi/+AD4113/Rx.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
classdef Rx < adi.common.Rx & matlabshared.libiio.base & adi.common.Attribute
% AD4113 Precision ADC Class
%
% adi.AD4113.Rx Receives data from the AD4113 ADC
% The adi.AD4113.Rx System object is a signal source that can receive
% data from the AD4113.
%
% `rx = adi.AD4113.Rx;`
% `rx = adi.AD4113.Rx('serial:COM59,230400');`
%
% `AD4113 Datasheet <https://www.analog.com/media/en/technical-documentation/data-sheets/ad4113.pdf>`_

properties (Nontunable)
% SamplesPerFrame Samples Per Frame
% Number of samples per frame, specified as an even positive
% integer.
SamplesPerFrame = 400
end

% Channel names
properties (Nontunable, Hidden, Constant)
channel_names = { ...
'voltage0', 'voltage1', 'voltage2', 'voltage3', ...
'voltage4', 'voltage5', 'voltage6', 'voltage7', ...
'voltage8', 'voltage9', 'voltage10', 'voltage11', ...
'voltage12', 'voltage13', 'voltage14', 'voltage15'}
end

% isOutput
properties (Hidden, Nontunable, Access = protected)
isOutput = false
end

properties (Nontunable, Hidden)
Timeout = Inf
kernelBuffersCount = 1
dataTypeStr = 'int32'
phyDevName = 'ad4113'
devName = 'ad4113'
end

properties (Nontunable, Hidden, Constant)
Type = 'Rx'
end

properties (Hidden, Constant)
ComplexData = false
end

methods

%% Constructor
function obj = Rx(varargin)
% Initialize the Rx object
obj = obj@matlabshared.libiio.base(varargin{:});
obj.enableExplicitPolling = false;
obj.EnabledChannels = 1;
obj.BufferTypeConversionEnable = true;
end
end

%% API Functions
methods (Hidden, Access = protected)

function setupInit(obj)
% Write all attributes to device once connected through set
% methods
% Do writes directly to hardware without using set methods.
% This is required since Simulink support doesn't support
% modification to nontunable variables at SetupImpl

end
end
end
1 change: 1 addition & 0 deletions +adi/Contents.m
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
% <a href="matlab:help adi.AD4052 ">AD4052</a> - ADC
% <a href="matlab:help adi.AD4060 ">AD4060</a> - ADC
% <a href="matlab:help adi.AD4062 ">AD4062</a> - ADC
% <a href="matlab:help adi.AD4113 ">AD4113</a> - ADC
% <a href="matlab:help adi.AD4630_16 ">AD4630-16</a> - ADC
% <a href="matlab:help adi.AD4630_24 ">AD4630-24</a> - ADC
% <a href="matlab:help adi.AD4692 ">AD4692</a> - ADC
Expand Down
1 change: 1 addition & 0 deletions CI/gen_doc/docs/_pages/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ The following have device-specific implementations in MATLAB and Simulink. If a
| AD4021 | Zedboard | Yes | No | ADI (2021b) |
| AD4022 | Zedboard | Yes | No | ADI (2021b) |
| AD4080 | Zedboard | Yes | No | ADI (2021b) |
| AD4113 | Zedboard | Yes | No | ADI (2021b) |
| AD4170 | Zedboard | Yes | No | ADI (2021b) |
| AD4190 | Zedboard | Yes | No | ADI (2021b) |
| AD4692 | Zedboard | Yes | No | ADI (2021b) |
Expand Down
1 change: 1 addition & 0 deletions CI/gen_doc/docs/gen_sysobj_doc.m
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
, {'AD4022', {'Rx'}}...
, {'AD4060', {'Rx'}}...
, {'AD4062', {'Rx'}}...
, {'AD4113', {'Rx'}}...
, {'AD4170', {'Rx'}}...
, {'AD4190', {'Rx'}}...
, {'AD4692', {'Rx'}}...
Expand Down
1 change: 1 addition & 0 deletions docs/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ The following have device-specific implementations in MATLAB and Simulink. In ge
"AD4052", "SDP-K1", "Yes", "No", "ADI (2021b)"
"AD4060", "SDP-K1", "Yes", "No", "ADI (2021b)"
"AD4062", "SDP-K1", "Yes", "No", "ADI (2021b)"
"AD4113", "SDP-K1", "Yes", "No", "ADI (2021b)"
"AD4170", "SDP-K1", "Yes", "No", "ADI (2021b)"
"AD7190", "SDP-K1", "Yes", "No", "ADI (2021b)"
"AD7192", "SDP-K1", "Yes", "No", "ADI (2021b)"
Expand Down
22 changes: 22 additions & 0 deletions examples/ad4113_DataCapture.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
%% Script for capturing and displaying a continuous set of samples from a
%% connected AD4113 board

% Instantiate the system object
rx = adi.AD4113.Rx();
rx.uri = 'serial:COM35,230400,8n1n';
rx.SamplesPerFrame = 400;
rx.EnabledChannels = [1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16];

% Capture data
data = rx();

enabledChannels = size(data,2);
figure(1);
for i = 1:enabledChannels
subplot(enabledChannels, 1, i);
plot(data(1:rx.SamplesPerFrame, i));
title("Channel " + num2str(rx.EnabledChannels(i)));
end

% Delete the system object
release(rx);
Loading