From 8cc099828cd28eb1405ff7af6f78dd2fe8a56feb Mon Sep 17 00:00:00 2001 From: Disha D Date: Wed, 31 Jul 2024 17:56:29 +0530 Subject: [PATCH] adi:ad719x: Add AD719x Support 1. Added drivers for Ad7190/2/3/4 and 5 2. Added example script for data capture 3. Updated index.rst and contents.m Signed-off-by: Disha D --- +adi/+AD7190/Rx.m | 24 ++++++++++++++++++++++++ +adi/+AD7192/Rx.m | 24 ++++++++++++++++++++++++ +adi/+AD7193/Rx.m | 26 ++++++++++++++++++++++++++ +adi/+AD7194/Rx.m | 24 ++++++++++++++++++++++++ +adi/+AD7195/Rx.m | 24 ++++++++++++++++++++++++ +adi/Contents.m | 1 - docs/source/index.rst | 6 +++++- examples/ad719x_DataCapture.m | 24 ++++++++++++++++++++++++ 8 files changed, 151 insertions(+), 2 deletions(-) create mode 100644 +adi/+AD7190/Rx.m create mode 100644 +adi/+AD7192/Rx.m create mode 100644 +adi/+AD7193/Rx.m create mode 100644 +adi/+AD7194/Rx.m create mode 100644 +adi/+AD7195/Rx.m create mode 100644 examples/ad719x_DataCapture.m diff --git a/+adi/+AD7190/Rx.m b/+adi/+AD7190/Rx.m new file mode 100644 index 0000000..4352afb --- /dev/null +++ b/+adi/+AD7190/Rx.m @@ -0,0 +1,24 @@ +classdef Rx < adi.common.Rx & adi.common.RxTx ... + & adi.AD719x.Base + % AD7190 Precision ADC Class + % adi.AD7190.Rx Receives data from the AD7190 ADC + % The adi.AD7190.Rx System object is a signal source that can receive + % data from the AD7190. + % + % `rx = adi.AD7190.Rx;` + % `rx = adi.AD7190.Rx('serial:COM18,230400');` + % + % `AD7190 DataSheet`_ + + properties (Nontunable, Hidden) + channel_names = {'voltage0', 'voltage1','voltage2','voltage3'}; + end + + methods + %% Constructor + function obj = Rx(varargin) + obj = obj@adi.AD719x.Base('ad7190','ad7190',varargin{:}); + end + end + + end \ No newline at end of file diff --git a/+adi/+AD7192/Rx.m b/+adi/+AD7192/Rx.m new file mode 100644 index 0000000..42febd4 --- /dev/null +++ b/+adi/+AD7192/Rx.m @@ -0,0 +1,24 @@ +classdef Rx < adi.common.Rx & adi.common.RxTx ... + & adi.AD719x.Base + % AD7192 Precision ADC Class + % adi.AD7192.Rx Receives data from the AD7192 ADC + % The adi.AD7192.Rx System object is a signal source that can receive + % data from the AD7192. + % + % `rx = adi.AD7192.Rx;` + % `rx = adi.AD7192.Rx('serial:COM18,230400');` + % + % `AD7192 DataSheet`_ + + properties (Nontunable, Hidden) + channel_names = {'voltage0', 'voltage1','voltage2','voltage3'}; + end + + methods + %% Constructor + function obj = Rx(varargin) + obj = obj@adi.AD719x.Base('ad7192','ad7192',varargin{:}); + end + end + + end \ No newline at end of file diff --git a/+adi/+AD7193/Rx.m b/+adi/+AD7193/Rx.m new file mode 100644 index 0000000..a0ce0e4 --- /dev/null +++ b/+adi/+AD7193/Rx.m @@ -0,0 +1,26 @@ +classdef Rx < adi.common.Rx & adi.common.RxTx ... + & adi.AD719x.Base + % AD7193 Precision ADC Class + % adi.AD7193.Rx Receives data from the AD7193 ADC + % The adi.AD7193.Rx System object is a signal source that can receive + % data from the AD7193. + % + % `rx = adi.AD7193.Rx;` + % `rx = adi.AD7193.Rx('serial:COM18,230400');` + % + % `AD7193 Datasheet `_ + + properties (Nontunable, Hidden) + channel_names = {'voltage0', 'voltage1','voltage2','voltage3','voltage4','voltage5','voltage6','voltage7'}; + end + + methods + %% Constructor + function obj = Rx(varargin) + obj = obj@adi.AD719x.Base('ad7193','ad7193',varargin{:}); + end + end + + end + + \ No newline at end of file diff --git a/+adi/+AD7194/Rx.m b/+adi/+AD7194/Rx.m new file mode 100644 index 0000000..45b0ab8 --- /dev/null +++ b/+adi/+AD7194/Rx.m @@ -0,0 +1,24 @@ +classdef Rx < adi.common.Rx & adi.common.RxTx ... + & adi.AD719x.Base + % AD7194 Precision ADC Class + % adi.AD7194.Rx Receives data from the AD7194 ADC + % The adi.AD7194.Rx System object is a signal source that can receive + % data from the AD7194. + % + % `rx = adi.AD7194.Rx;` + % `rx = adi.AD7194.Rx('serial:COM18,230400');` + % + % `AD7194 Datasheet `_ + + properties (Nontunable, Hidden) + channel_names = {'voltage0', 'voltage1','voltage2','voltage3','voltage4','voltage5','voltage6','voltage7','voltage8','voltage9','voltage10','voltage11','voltage12','voltage13','voltage14','voltage15'}; + end + + methods + %% Constructor + function obj = Rx(varargin) + obj = obj@adi.AD719x.Base('ad7194','ad7194',varargin{:}); + end + end + + end \ No newline at end of file diff --git a/+adi/+AD7195/Rx.m b/+adi/+AD7195/Rx.m new file mode 100644 index 0000000..a7c4e53 --- /dev/null +++ b/+adi/+AD7195/Rx.m @@ -0,0 +1,24 @@ +classdef Rx < adi.common.Rx & adi.common.RxTx ... + & adi.AD719x.Base + % AD7195 Precision ADC Class + % adi.AD7195.Rx Receives data from the AD7195 ADC + % The adi.AD7195.Rx System object is a signal source that can receive + % data from the AD7195. + % + % `rx = adi.AD7195.Rx;` + % `rx = adi.AD7195.Rx('serial:COM18,230400');` + % + % `AD7195 Datasheet `_ + + properties (Nontunable, Hidden) + channel_names = {'voltage0', 'voltage1','voltage2','voltage3'}; + end + + methods + %% Constructor + function obj = Rx(varargin) + obj = obj@adi.AD719x.Base('ad7195','ad7195',varargin{:}); + end + end + + end \ No newline at end of file diff --git a/+adi/Contents.m b/+adi/Contents.m index e912239..c2d5536 100644 --- a/+adi/Contents.m +++ b/+adi/Contents.m @@ -34,4 +34,3 @@ % AD5791 - DAC % AD7124_4 - ADC % AD7124_8 - ADC -% AD7124_8 - ADC diff --git a/docs/source/index.rst b/docs/source/index.rst index 2b2fcb8..fdd4066 100644 --- a/docs/source/index.rst +++ b/docs/source/index.rst @@ -59,4 +59,8 @@ The following have device-specific implementations in MATLAB and Simulink. In ge "AD7124-8", "Zedboard", "Yes", "No", "ADI (2021b)" "AD4052", "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)" + "AD7193", "SDP-K1", "Yes", "No", "ADI (2021b)" + "AD7194", "SDP-K1", "Yes", "No", "ADI (2021b)" + "AD7195", "SDP-K1", "Yes", "No", "ADI (2021b)" \ No newline at end of file diff --git a/examples/ad719x_DataCapture.m b/examples/ad719x_DataCapture.m new file mode 100644 index 0000000..f04d0cf --- /dev/null +++ b/examples/ad719x_DataCapture.m @@ -0,0 +1,24 @@ +%% Script for capturing and displaying a continuous set of samples from a +%% connected AD719x board + +% Instantiate the system object +rx = adi.AD7193.Rx(); +rx.uri = 'serial:COM12,230400,8n1n'; + +% Samples per frame cannot exceed 500 if all 16 channels need to be captured on ad7194 +rx.SamplesPerFrame = 400; +rx.EnabledChannels = [1]; + +% 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); \ No newline at end of file