diff --git a/+adi/+AD4000/Rx.m b/+adi/+AD4000/Rx.m new file mode 100644 index 0000000..1dc75fc --- /dev/null +++ b/+adi/+AD4000/Rx.m @@ -0,0 +1,21 @@ +classdef Rx < adi.AD400x.Base & matlabshared.libiio.base & adi.common.Attribute + % AD4000 Precision ADC Class + % adi.AD4000.Rx Receives data from the AD4000 ADC + % The adi.AD4000.Rx System object is a signal source that can receive + % data from the AD4000. + % + % rx = adi.AD4000.Rx; + % rx = adi.AD4000.Rx('uri','192.168.2.1'); + % + % AD4000 Datasheet + + methods + %% Constructor + function obj = Rx(varargin) + obj = obj@adi.AD400x.Base('ad4000', 'ad4000', 'int16', varargin{:}); + obj.enableExplicitPolling = false; + obj.EnabledChannels = 1; + obj.BufferTypeConversionEnable = true; + end + end +end diff --git a/+adi/+AD4001/Rx.m b/+adi/+AD4001/Rx.m new file mode 100644 index 0000000..06b2a14 --- /dev/null +++ b/+adi/+AD4001/Rx.m @@ -0,0 +1,21 @@ +classdef Rx < adi.AD400x.Base & matlabshared.libiio.base & adi.common.Attribute + % AD4001 Precision ADC Class + % adi.AD4001.Rx Receives data from the AD4001 ADC + % The adi.AD4001.Rx System object is a signal source that can receive + % data from the AD4001. + % + % rx = adi.AD4001.Rx; + % rx = adi.AD4001.Rx('uri','192.168.2.1'); + % + % AD4001 Datasheet + + methods + %% Constructor + function obj = Rx(varargin) + obj = obj@adi.AD400x.Base('ad4001', 'ad4001', 'int16', varargin{:}); + obj.enableExplicitPolling = false; + obj.EnabledChannels = 1; + obj.BufferTypeConversionEnable = true; + end + end +end diff --git a/+adi/+AD4002/Rx.m b/+adi/+AD4002/Rx.m new file mode 100644 index 0000000..40be46a --- /dev/null +++ b/+adi/+AD4002/Rx.m @@ -0,0 +1,21 @@ +classdef Rx < adi.AD400x.Base & matlabshared.libiio.base & adi.common.Attribute + % AD4002 Precision ADC Class + % adi.AD4002.Rx Receives data from the AD4002 ADC + % The adi.AD4002.Rx System object is a signal source that can receive + % data from the AD4002. + % + % rx = adi.AD4002.Rx; + % rx = adi.AD4002.Rx('uri','192.168.2.1'); + % + % AD4002 Datasheet + + methods + %% Constructor + function obj = Rx(varargin) + obj = obj@adi.AD400x.Base('ad4002', 'ad4002', 'int32', varargin{:}); + obj.enableExplicitPolling = false; + obj.EnabledChannels = 1; + obj.BufferTypeConversionEnable = true; + end + end +end diff --git a/+adi/+AD4003/Rx.m b/+adi/+AD4003/Rx.m new file mode 100644 index 0000000..93daf2b --- /dev/null +++ b/+adi/+AD4003/Rx.m @@ -0,0 +1,21 @@ +classdef Rx < adi.AD400x.Base & matlabshared.libiio.base & adi.common.Attribute + % AD4003 Precision ADC Class + % adi.AD4003.Rx Receives data from the AD4003 ADC + % The adi.AD4003.Rx System object is a signal source that can receive + % data from the AD4003. + % + % rx = adi.AD4003.Rx; + % rx = adi.AD4003.Rx('uri','192.168.2.1'); + % + % AD4003 Datasheet + + methods + %% Constructor + function obj = Rx(varargin) + obj = obj@adi.AD400x.Base('ad4003', 'ad4003', 'int32', varargin{:}); + obj.enableExplicitPolling = false; + obj.EnabledChannels = 1; + obj.BufferTypeConversionEnable = true; + end + end +end diff --git a/+adi/+AD4004/Rx.m b/+adi/+AD4004/Rx.m new file mode 100644 index 0000000..0039c5d --- /dev/null +++ b/+adi/+AD4004/Rx.m @@ -0,0 +1,21 @@ +classdef Rx < adi.AD400x.Base & matlabshared.libiio.base & adi.common.Attribute + % AD4004 Precision ADC Class + % adi.AD4004.Rx Receives data from the AD4004 ADC + % The adi.AD4004.Rx System object is a signal source that can receive + % data from the AD4004. + % + % rx = adi.AD4004.Rx; + % rx = adi.AD4004.Rx('uri','192.168.2.1'); + % + % AD4004 Datasheet + + methods + %% Constructor + function obj = Rx(varargin) + obj = obj@adi.AD400x.Base('ad4004', 'ad4004', 'int16', varargin{:}); + obj.enableExplicitPolling = false; + obj.EnabledChannels = 1; + obj.BufferTypeConversionEnable = true; + end + end +end diff --git a/+adi/+AD4005/Rx.m b/+adi/+AD4005/Rx.m new file mode 100644 index 0000000..90a055a --- /dev/null +++ b/+adi/+AD4005/Rx.m @@ -0,0 +1,21 @@ +classdef Rx < adi.AD400x.Base & matlabshared.libiio.base & adi.common.Attribute + % AD4005 Precision ADC Class + % adi.AD4005.Rx Receives data from the AD4005 ADC + % The adi.AD4005.Rx System object is a signal source that can receive + % data from the AD4005. + % + % rx = adi.AD4005.Rx; + % rx = adi.AD4005.Rx('uri','192.168.2.1'); + % + % AD4005 Datasheet + + methods + %% Constructor + function obj = Rx(varargin) + obj = obj@adi.AD400x.Base('ad4005', 'ad4005', 'int16', varargin{:}); + obj.enableExplicitPolling = false; + obj.EnabledChannels = 1; + obj.BufferTypeConversionEnable = true; + end + end +end diff --git a/+adi/+AD4006/Rx.m b/+adi/+AD4006/Rx.m new file mode 100644 index 0000000..8c64664 --- /dev/null +++ b/+adi/+AD4006/Rx.m @@ -0,0 +1,21 @@ +classdef Rx < adi.AD400x.Base & matlabshared.libiio.base & adi.common.Attribute + % AD4006 Precision ADC Class + % adi.AD4006.Rx Receives data from the AD4006 ADC + % The adi.AD4006.Rx System object is a signal source that can receive + % data from the AD4006. + % + % rx = adi.AD4006.Rx; + % rx = adi.AD4006.Rx('uri','192.168.2.1'); + % + % AD4006 Datasheet + + methods + %% Constructor + function obj = Rx(varargin) + obj = obj@adi.AD400x.Base('ad4006', 'ad4006', 'int32', varargin{:}); + obj.enableExplicitPolling = false; + obj.EnabledChannels = 1; + obj.BufferTypeConversionEnable = true; + end + end +end diff --git a/+adi/+AD4007/Rx.m b/+adi/+AD4007/Rx.m new file mode 100644 index 0000000..de1b9f7 --- /dev/null +++ b/+adi/+AD4007/Rx.m @@ -0,0 +1,21 @@ +classdef Rx < adi.AD400x.Base & matlabshared.libiio.base & adi.common.Attribute + % AD4007 Precision ADC Class + % adi.AD4007.Rx Receives data from the AD4007 ADC + % The adi.AD4007.Rx System object is a signal source that can receive + % data from the AD4007. + % + % rx = adi.AD4007.Rx; + % rx = adi.AD4007.Rx('uri','192.168.2.1'); + % + % AD4007 Datasheet + + methods + %% Constructor + function obj = Rx(varargin) + obj = obj@adi.AD400x.Base('ad4007', 'ad4007', 'int32', varargin{:}); + obj.enableExplicitPolling = false; + obj.EnabledChannels = 1; + obj.BufferTypeConversionEnable = true; + end + end +end diff --git a/+adi/+AD4008/Rx.m b/+adi/+AD4008/Rx.m new file mode 100644 index 0000000..d320d98 --- /dev/null +++ b/+adi/+AD4008/Rx.m @@ -0,0 +1,21 @@ +classdef Rx < adi.AD400x.Base & matlabshared.libiio.base & adi.common.Attribute + % AD4008 Precision ADC Class + % adi.AD4008.Rx Receives data from the AD4008 ADC + % The adi.AD4008.Rx System object is a signal source that can receive + % data from the AD4008. + % + % rx = adi.AD4008.Rx; + % rx = adi.AD4008.Rx('uri','192.168.2.1'); + % + % AD4008 Datasheet + + methods + %% Constructor + function obj = Rx(varargin) + obj = obj@adi.AD400x.Base('ad4008', 'ad4008', 'int16', varargin{:}); + obj.enableExplicitPolling = false; + obj.EnabledChannels = 1; + obj.BufferTypeConversionEnable = true; + end + end +end diff --git a/+adi/+AD400x/Base.m b/+adi/+AD400x/Base.m new file mode 100644 index 0000000..85e0a7c --- /dev/null +++ b/+adi/+AD400x/Base.m @@ -0,0 +1,115 @@ +classdef Base < adi.common.Rx & matlabshared.libiio.base & adi.common.Attribute + % AD400X is a family of precision ADCs with sample rates between 500 + % kSPS and 2 MSPS + % + % AD4000/AD4004/AD4008 are single-channel, 16-bit unsigned ADCs + % AD4001/AD4005 are single-channel, 16-bit signed ADCs + % AD4002/AD4006/AD4010 are single-channel, 18-bit unsigned ADCs + % AD4003/AD4007/AD4011 are single-channel, 18-bit signed ADCs + + properties (Nontunable) + % SamplesPerFrame Samples Per Frame + % Number of samples per frame, specified as an even positive + % integer. + SamplesPerFrame = 4096 + + % SampleRate Sample Rate + % Baseband sampling rate in Hz, specified as a scalar + % in samples per second. + SampleRate = '500000' + end + + properties (Dependent) + % Voltage + % ADC Voltage in mV + Voltage + + % VoltageScale Voltage Scale + % ADC Voltage scale. + VoltageScale + + % VoltageOffset Voltage Offset + % ADC Voltage offset. + VoltageOffset + end + + % Channel names + properties (Nontunable, Hidden, Constant) + channel_names = {'voltage0'} + end + + % isOutput + properties (Hidden, Nontunable, Access = protected) + isOutput = false + end + + properties (Nontunable, Hidden) + Timeout = Inf + kernelBuffersCount = 1 + dataTypeStr + phyDevName + devName + end + + properties (Nontunable, Hidden, Constant) + Type = 'Rx' + end + + properties (Hidden, Constant) + ComplexData = false + end + + methods + %% Constructor + function obj = Base(phydev, dev, dtype, varargin) + obj = obj@matlabshared.libiio.base(varargin{:}); + obj.phyDevName = phydev; + obj.devName = dev; + obj.dataTypeStr = dtype; + end + + %% Set SampleRate + function set.SampleRate(obj, value) + % Set device sampling rate + obj.SampleRate = value; + if obj.ConnectedToDevice + obj.setDeviceAttributeRAW('sampling_frequency', num2str(value)); + end + end + + %% Check Voltage + function rValue = get.Voltage(obj) + if obj.ConnectedToDevice + rValue = obj.getAttributeRAW('voltage0', 'raw', obj.isOutput); + else + rValue = NaN; + end + end + + %% Check Voltage Scale + function rValue = get.VoltageScale(obj) + if obj.ConnectedToDevice + rValue = obj.getAttributeDouble('voltage0', 'scale', obj.isOutput); + else + rValue = NaN; + end + end + + %% Check Voltage Offset + function rValue = get.VoltageOffset(obj) + if obj.ConnectedToDevice + rValue = obj.getAttributeDouble('voltage0', 'offset', obj.isOutput); + else + rValue = NaN; + end + end + end + + %% API Functions + methods (Hidden, Access = protected) + function setupInit(obj) + obj.setDeviceAttributeRAW('sampling_frequency', ... + num2str(obj.SampleRate)); + end + end +end diff --git a/+adi/+AD4010/Rx.m b/+adi/+AD4010/Rx.m new file mode 100644 index 0000000..d99c62c --- /dev/null +++ b/+adi/+AD4010/Rx.m @@ -0,0 +1,21 @@ +classdef Rx < adi.AD400x.Base & matlabshared.libiio.base & adi.common.Attribute + % AD4010 Precision ADC Class + % adi.AD4010.Rx Receives data from the AD4010 ADC + % The adi.AD4010.Rx System object is a signal source that can receive + % data from the AD4010. + % + % rx = adi.AD4010.Rx; + % rx = adi.AD4010.Rx('uri','192.168.2.1'); + % + % AD4010 Datasheet + + methods + %% Constructor + function obj = Rx(varargin) + obj = obj@adi.AD400x.Base('ad4010', 'ad4010', 'int32', varargin{:}); + obj.enableExplicitPolling = false; + obj.EnabledChannels = 1; + obj.BufferTypeConversionEnable = true; + end + end +end diff --git a/+adi/+AD4011/Rx.m b/+adi/+AD4011/Rx.m new file mode 100644 index 0000000..da21b86 --- /dev/null +++ b/+adi/+AD4011/Rx.m @@ -0,0 +1,21 @@ +classdef Rx < adi.AD400x.Base & matlabshared.libiio.base & adi.common.Attribute + % AD4011 Precision ADC Class + % adi.AD4011.Rx Receives data from the AD4011 ADC + % The adi.AD4011.Rx System object is a signal source that can receive + % data from the AD4011. + % + % rx = adi.AD4011.Rx; + % rx = adi.AD4011.Rx('uri','192.168.2.1'); + % + % AD4011 Datasheet + + methods + %% Constructor + function obj = Rx(varargin) + obj = obj@adi.AD400x.Base('ad4011', 'ad4011', 'int32', varargin{:}); + obj.enableExplicitPolling = false; + obj.EnabledChannels = 1; + obj.BufferTypeConversionEnable = true; + end + end +end diff --git a/+adi/+AD4020/Rx.m b/+adi/+AD4020/Rx.m index 0a904cc..d26f183 100644 --- a/+adi/+AD4020/Rx.m +++ b/+adi/+AD4020/Rx.m @@ -1,4 +1,4 @@ -classdef Rx < adi.common.Rx & matlabshared.libiio.base & adi.common.Attribute +classdef Rx < adi.AD400x.Base & matlabshared.libiio.base & adi.common.Attribute % AD4020 Precision ADC Class % adi.AD4020.Rx Receives data from the AD4020 ADC % The adi.AD4020.Rx System object is a signal source that can receive @@ -9,93 +9,13 @@ % % AD4020 Datasheet - properties (Nontunable) - % SamplesPerFrame Samples Per Frame - % Number of samples per frame, specified as an even positive - % integer. - SamplesPerFrame = 4096 - end - - properties (Dependent) - % Voltage - % ADC Voltage in mV - Voltage - - % VoltageScale Voltage Scale - % ADC Voltage scale. - VoltageScale - - % VoltageOffset Voltage Offset - % ADC Voltage offset. - VoltageOffset - end - - % Channel names - properties (Nontunable, Hidden, Constant) - channel_names = {'voltage0'} - end - - % isOutput - properties (Hidden, Nontunable, Access = protected) - isOutput = false - end - - properties (Nontunable, Hidden) - Timeout = Inf - kernelBuffersCount = 1 - dataTypeStr = 'int32' - phyDevName = 'ad4020' - devName = 'ad4020' - end - - properties (Nontunable, Hidden, Constant) - Type = 'Rx' - end - - properties (Hidden, Constant) - ComplexData = false - end - methods %% Constructor function obj = Rx(varargin) - obj = obj@matlabshared.libiio.base(varargin{:}); + obj = obj@adi.AD400x.Base('ad4020', 'ad4020', 'int32', varargin{:}); obj.enableExplicitPolling = false; obj.EnabledChannels = 1; obj.BufferTypeConversionEnable = true; end - - %% Check Voltage - function rValue = get.Voltage(obj) - if obj.ConnectedToDevice - rValue = obj.getAttributeRAW('voltage0', 'raw', obj.isOutput); - else - rValue = NaN; - end - end - - %% Check Voltage Scale - function rValue = get.VoltageScale(obj) - if obj.ConnectedToDevice - rValue = obj.getAttributeDouble('voltage0', 'scale', obj.isOutput); - else - rValue = NaN; - end - end - - %% Check Voltage Offset - function rValue = get.VoltageOffset(obj) - if obj.ConnectedToDevice - rValue = obj.getAttributeDouble('voltage0', 'offset', obj.isOutput); - else - rValue = NaN; - end - end - end - - %% API Functions - methods (Hidden, Access = protected) - function setupInit(~) - end end end diff --git a/+adi/+AD4021/Rx.m b/+adi/+AD4021/Rx.m new file mode 100644 index 0000000..b54e361 --- /dev/null +++ b/+adi/+AD4021/Rx.m @@ -0,0 +1,21 @@ +classdef Rx < adi.AD400x.Base & matlabshared.libiio.base & adi.common.Attribute + % AD4021 Precision ADC Class + % adi.AD4021.Rx Receives data from the AD4021 ADC + % The adi.AD4021.Rx System object is a signal source that can receive + % data from the AD4021. + % + % rx = adi.AD4021.Rx; + % rx = adi.AD4021.Rx('uri','192.168.2.1'); + % + % AD4021 Datasheet + + methods + %% Constructor + function obj = Rx(varargin) + obj = obj@adi.AD400x.Base('ad4021', 'ad4021', 'int32', varargin{:}); + obj.enableExplicitPolling = false; + obj.EnabledChannels = 1; + obj.BufferTypeConversionEnable = true; + end + end +end diff --git a/+adi/+AD4022/Rx.m b/+adi/+AD4022/Rx.m new file mode 100644 index 0000000..4a9a9a8 --- /dev/null +++ b/+adi/+AD4022/Rx.m @@ -0,0 +1,21 @@ +classdef Rx < adi.AD400x.Base & matlabshared.libiio.base & adi.common.Attribute + % AD4022 Precision ADC Class + % adi.AD4022.Rx Receives data from the AD4022 ADC + % The adi.AD4022.Rx System object is a signal source that can receive + % data from the AD4022. + % + % rx = adi.AD4022.Rx; + % rx = adi.AD4022.Rx('uri','192.168.2.1'); + % + % AD4022 Datasheet + + methods + %% Constructor + function obj = Rx(varargin) + obj = obj@adi.AD400x.Base('ad4022', 'ad4022', 'int32', varargin{:}); + obj.enableExplicitPolling = false; + obj.EnabledChannels = 1; + obj.BufferTypeConversionEnable = true; + end + end +end diff --git a/+adi/Contents.m b/+adi/Contents.m index 044e80c..68baec2 100644 --- a/+adi/Contents.m +++ b/+adi/Contents.m @@ -5,17 +5,30 @@ % % Parts % ----------------------- +% AD4000 - ADC +% AD4001 - ADC +% AD4002 - ADC +% AD4003 - ADC +% AD4004 - ADC +% AD4005 - ADC +% AD4006 - ADC +% AD4007 - ADC +% AD4008 - ADC +% AD4010 - ADC +% AD4011 - ADC +% AD4020 - ADC +% AD4021 - ADC +% AD4022 - ADC +% AD4030-24 - ADC +% AD4630-16 - ADC +% AD4630-24 - ADC +% AD4858 - ADC % AD7380 - ADC % AD7768 - ADC % AD7768-1 - ADC -% AD4030-24 - ADC -% AD4630-16 - ADC -% AD4630-24 - ADC -% AD4858 - ADC % AD2S1210 - Resolver-to-Digital Converter -% AD4020 - ADC % AD5760 - DAC % AD5780 - DAC % AD5781 - DAC % AD5790 - DAC -% AD5791 - DAC \ No newline at end of file +% AD5791 - DAC diff --git a/CI/doc/SysObjsProps.m b/CI/doc/SysObjsProps.m index c088b24..eb094cb 100644 --- a/CI/doc/SysObjsProps.m +++ b/CI/doc/SysObjsProps.m @@ -2,10 +2,23 @@ % This section lists the system object properties for devices and % evaluation boards supported by Precision Converter Toolbox. %%% Devices +% * AD4000 +% * AD4001 +% * AD4002 +% * AD4003 +% * AD4004 +% * AD4005 +% * AD4006 +% * AD4007 +% * AD4008 +% * AD4010 +% * AD4011 +% * AD4020 +% * AD4021 +% * AD4022 % * AD4630 % * AD4030 % * AD463x % * AD7768 % * AD7768 % * AD2S1210 -% * AD4020 diff --git a/CI/doc/genhtml.m b/CI/doc/genhtml.m index 77043be..912ba03 100644 --- a/CI/doc/genhtml.m +++ b/CI/doc/genhtml.m @@ -1,6 +1,6 @@ mfiledir = '..\..\+adi\'; docdir = '..\..\doc\'; -parts = {'AD4630','AD4030','AD463x','AD7768','AD4858','AD2S1210','AD4020'}; +parts = {'AD4630','AD4030','AD463x','AD7768','AD4858','AD2S1210','AD4000', 'AD4001', 'AD4002', 'AD4003', 'AD4004', 'AD4005', 'AD4006', 'AD4007', 'AD4008', 'AD4010', 'AD4011', 'AD4020', 'AD4021', 'AD4022'}; trx_files = {'Rx','Base','Tx'}; for ii = 1:numel(parts) for jj = 1:numel(trx_files) diff --git a/CI/gen_doc/docs/_pages/index.md b/CI/gen_doc/docs/_pages/index.md index 2b66df5..ae892ac 100644 --- a/CI/gen_doc/docs/_pages/index.md +++ b/CI/gen_doc/docs/_pages/index.md @@ -35,4 +35,17 @@ The following have device-specific implementations in MATLAB and Simulink. If a | AD4630-24 | Zedboard | Yes | No | ADI (2021b) | | AD4858 | Zedboard | Yes | No | ADI (2021b) | | AD2S1210 | Zedboard | Yes | No | ADI (2021b) | +| AD4000 | Zedboard | Yes | No | ADI (2021b) | +| AD4001 | Zedboard | Yes | No | ADI (2021b) | +| AD4002 | Zedboard | Yes | No | ADI (2021b) | +| AD4003 | Zedboard | Yes | No | ADI (2021b) | +| AD4004 | Zedboard | Yes | No | ADI (2021b) | +| AD4005 | Zedboard | Yes | No | ADI (2021b) | +| AD4006 | Zedboard | Yes | No | ADI (2021b) | +| AD4007 | Zedboard | Yes | No | ADI (2021b) | +| AD4008 | Zedboard | Yes | No | ADI (2021b) | +| AD4010 | Zedboard | Yes | No | ADI (2021b) | +| AD4011 | Zedboard | Yes | No | ADI (2021b) | | AD4020 | Zedboard | Yes | No | ADI (2021b) | +| AD4021 | Zedboard | Yes | No | ADI (2021b) | +| AD4022 | Zedboard | Yes | No | ADI (2021b) | diff --git a/CI/gen_doc/docs/gen_sysobj_doc.m b/CI/gen_doc/docs/gen_sysobj_doc.m index 3031e69..dac8620 100644 --- a/CI/gen_doc/docs/gen_sysobj_doc.m +++ b/CI/gen_doc/docs/gen_sysobj_doc.m @@ -15,7 +15,21 @@ , {'AD4630_24', {'Rx'}}... , {'AD4858', {'Rx'}}... , {'AD2S1210', {'Rx'}}... + , {'AD4000', {'Rx'}}... + , {'AD4001', {'Rx'}}... + , {'AD4002', {'Rx'}}... + , {'AD4003', {'Rx'}}... + , {'AD4004', {'Rx'}}... + , {'AD4005', {'Rx'}}... + , {'AD4006', {'Rx'}}... + , {'AD4007', {'Rx'}}... + , {'AD4008', {'Rx'}}... + , {'AD4009', {'Rx'}}... + , {'AD4010', {'Rx'}}... + , {'AD4011', {'Rx'}}... , {'AD4020', {'Rx'}}... + , {'AD4021', {'Rx'}}... + , {'AD4022', {'Rx'}}... , {'AD5760', {'Tx'}}... , {'AD5780', {'Tx'}}... , {'AD5781', {'Tx'}}... diff --git a/examples/ad4020_DataCapture.m b/examples/ad4020_DataCapture.m index 5e92fe9..6f4691d 100644 --- a/examples/ad4020_DataCapture.m +++ b/examples/ad4020_DataCapture.m @@ -6,8 +6,7 @@ % Connect to device and initialize data rx(); -% Retrieve ADC voltage, scale and offset -rx.Voltage(); +% Retrieve ADC scale and offset rx.VoltageScale(); rx.VoltageOffset();