Skip to content

Commit

Permalink
adi:ad405x: Modified the AD405x MATLAB scripts
Browse files Browse the repository at this point in the history
1. Added the Rx System Object for AD4050
2. Modified the data capture script to include AD4050
3. Deleted the Rx.m script from the +AD405x folder

Signed-off-by: Anush Shetty <[email protected]>
  • Loading branch information
Shetty-Anush committed Oct 17, 2024
1 parent 590936d commit 9c3d7a1
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 3 deletions.
39 changes: 39 additions & 0 deletions +adi/+AD4050/Rx.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
classdef Rx < adi.common.Rx & adi.common.RxTx ...
& adi.AD405x.Base

% AD4050 Precision ADC Class
%
% adi.AD4050.Rx Receive data from the AD4050 ADC
% The adi.AD4050.Rx System object is a signal source that can receive
% data from the AD4050.
%
% `rx = adi.AD4050.Rx;`
% `rx = adi.AD4050.Rx('uri','serial:COM28,230400');`
%
% `AD4050 Datasheet <https://www.analog.com/media/en/technical-documentation/data-sheets/ad4050-ad4056.pdf>`_

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

properties (Hidden)
Timeout = Inf
kernelBuffersCount = 1
dataTypeStr = 'int32'
phyDevName = 'ad4050'
devName = 'ad4050'
end

methods
%% Constructor

function obj = Rx(Args)
arguments
Args.uri
end
coder.allowpcode('plain');
obj = [email protected]('devName', 'ad4050', 'phyDevName', 'ad4050', 'uri', Args.uri);
end

end
end
Empty file removed +adi/+AD405x/Rx.m
Empty file.
14 changes: 11 additions & 3 deletions examples/ad4052_DataCapture.m → examples/ad405x_DataCapture.m
Original file line number Diff line number Diff line change
@@ -1,11 +1,19 @@
%% Script for capturing and displaying a continuous set of samples from a
%% connected AD4052 board
%% connected AD405x board

ActiveDevice = "AD4052"; % Devices available are AD4052 and AD4050

% Instantiate the system object
rx = adi.AD4052.Rx('uri', 'serial:COM13,230400');
if ActiveDevice == "AD4052"
rx = adi.AD4052.Rx('uri', 'serial:COM28,230400');
elseif ActiveDevice == "AD4050"
rx = adi.AD4050.Rx('uri', 'serial:COM28,230400');
else
rx = adi.AD4052.Rx('uri', 'serial:COM28,230400');
end

rx.SamplesPerFrame = 400;
rx.EnabledChannels = [1];

rx.SampleRate = 62500; % In sample mode, the sampling rate can be as high as 1MSPS

% Capture data
Expand Down

0 comments on commit 9c3d7a1

Please sign in to comment.