Skip to content

Commit 2348b08

Browse files
SwaroopPKADISaikiranGudla
authored andcommitted
adi:ad4062:Added Matlab Support for AD4062
Signed-off-by: Swaroop PrakashKumar <Swaroop.PrakashKumar@analog.com>
1 parent dce3b98 commit 2348b08

File tree

5 files changed

+65
-0
lines changed

5 files changed

+65
-0
lines changed

+adi/+AD4062/Rx.m

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
classdef Rx < adi.common.Rx & adi.common.RxTx ...
2+
& adi.AD405x.Base
3+
4+
% AD4062 Precision ADC Class
5+
%
6+
% adi.AD4062.Rx Receive data from the AD4062 ADC
7+
% The adi.AD4062.Rx System object is a signal source that can receive
8+
% data from the AD4062.
9+
%
10+
% `rx = adi.AD4062.Rx;`
11+
% `rx = adi.AD4062.Rx('uri','serial:COM5,230400');`
12+
%
13+
% `AD4062 Datasheet <http://www.analog.com/media/en/technical-documentation/data-sheets/AD4062.pdf>`_
14+
15+
properties (Nontunable, Hidden, Constant)
16+
Type = 'Rx'
17+
end
18+
19+
properties (Hidden)
20+
Timeout = Inf
21+
kernelBuffersCount = 1
22+
dataTypeStr = 'int32'
23+
phyDevName = 'ad4062'
24+
devName = 'ad4062'
25+
end
26+
27+
methods
28+
%% Constructor
29+
30+
function obj = Rx(Args)
31+
arguments
32+
Args.uri
33+
end
34+
coder.allowpcode('plain');
35+
obj = obj@adi.AD405x.Base('devName', 'ad4062', 'phyDevName', 'ad4062', 'uri', Args.uri);
36+
end
37+
38+
end
39+
end

+adi/Contents.m

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
% <a href="matlab:help adi.AD4050 ">AD4050</a> - ADC
2424
% <a href="matlab:help adi.AD4052 ">AD4052</a> - ADC
2525
% <a href="matlab:help adi.AD4060 ">AD4060</a> - ADC
26+
% <a href="matlab:help adi.AD4062 ">AD4062</a> - ADC
2627
% <a href="matlab:help adi.AD4630_16 ">AD4630-16</a> - ADC
2728
% <a href="matlab:help adi.AD4630_24 ">AD4630-24</a> - ADC
2829
% <a href="matlab:help adi.AD4170 ">AD4170</a> - ADC

CI/gen_doc/docs/gen_sysobj_doc.m

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
, {'AD4021', {'Rx'}}...
3838
, {'AD4022', {'Rx'}}...
3939
, {'AD4060', {'Rx'}}...
40+
, {'AD4062', {'Rx'}}...
4041
, {'AD4170', {'Rx'}}...
4142
, {'AD4190', {'Rx'}}...
4243
, {'AD5760', {'Tx'}}...

docs/source/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ The following have device-specific implementations in MATLAB and Simulink. In ge
7676
"AD4050", "SDP-K1", "Yes", "No", "ADI (2021b)"
7777
"AD4052", "SDP-K1", "Yes", "No", "ADI (2021b)"
7878
"AD4060", "SDP-K1", "Yes", "No", "ADI (2021b)"
79+
"AD4062", "SDP-K1", "Yes", "No", "ADI (2021b)"
7980
"AD4170", "SDP-K1", "Yes", "No", "ADI (2021b)"
8081
"AD7190", "SDP-K1", "Yes", "No", "ADI (2021b)"
8182
"AD7192", "SDP-K1", "Yes", "No", "ADI (2021b)"

examples/ad4062_DataCapture.m

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
%% Script for capturing and displaying a continuous set of samples from a
2+
%% connected AD4062 board
3+
4+
% Instantiate the system object
5+
rx = adi.AD4062.Rx('uri', 'serial:COM8,230400');
6+
rx.SamplesPerFrame = 400;
7+
rx.EnabledChannels = [1];
8+
9+
rx.SampleRate = 62500; % In sample mode, the sampling rate can be as high as 140KSPS
10+
11+
% Capture data
12+
data = rx();
13+
14+
enabledChannels = size(data, 2);
15+
figure(1);
16+
for i = 1:enabledChannels
17+
subplot(enabledChannels, 1, i);
18+
plot(data(1:rx.SamplesPerFrame, i));
19+
title("Channel " + num2str(rx.EnabledChannels(i)));
20+
end
21+
22+
% Delete the system object
23+
release(rx);

0 commit comments

Comments
 (0)