diff --git a/+adi/+AD3552R/Base.m b/+adi/+AD3552R/Base.m index a3ca618..2604a01 100755 --- a/+adi/+AD3552R/Base.m +++ b/+adi/+AD3552R/Base.m @@ -35,18 +35,20 @@ ComplexData = false; end - properties (Nontunable) + properties % InputSource % Lists all the available input sources of the DAC. % Options are: 'adc_input', 'dma_input', 'ramp_input'. - InputSource = 'adc_input'; + % Example: InputSource = 'dma_input'; + InputSource = 'dma_input'; end - properties (Nontunable) + properties % OutputRange % Lists all the available voltage ranges of the output signal. % Options are: '0/2.5V', '0/5V', '0/10V', '-5/+5V', '-10/+10V'. - InputSource = '-10/+10V'; + % Example: OutputRange = '-10/+10V'; + OutputRange = '-10/+10V'; end properties diff --git a/+adi/+AD3552R/Tx.m b/+adi/+AD3552R/Tx.m index a689b98..10e62d3 100755 --- a/+adi/+AD3552R/Tx.m +++ b/+adi/+AD3552R/Tx.m @@ -31,10 +31,11 @@ channel_names = {'voltage0', 'voltage1'}; end - properties (Nontunable) + properties % StreamStatus % Describes the status of the data streaming. % Options are: 'start_stream_synced', 'start_stream', 'stop_stream'. + % Example: StreamStatus = 'stop_stream'; StreamStatus = 'stop_stream'; end diff --git a/pcx_examples/streaming/cn0585_fmcz/CN0585_streaming.m b/pcx_examples/streaming/cn0585_fmcz/CN0585_streaming.m new file mode 100644 index 0000000..a9d9e81 --- /dev/null +++ b/pcx_examples/streaming/cn0585_fmcz/CN0585_streaming.m @@ -0,0 +1,74 @@ +% CN0585 Streaming example + +board_ip = 'local_board_ip'; +uri = cat(2, 'ip:', board_ip); + +% Describe the devices + +cn0585_device_rx = adi.CN0585.Rx('uri',uri); +cn0585_device_tx0 = adi.CN0585.Tx0('uri',uri); +cn0585_device_tx1 = adi.CN0585.Tx1('uri',uri); + +cn0585_device_tx0.EnableCyclicBuffers = true; +cn0585_device_tx1.EnableCyclicBuffers = true; + +cn0585_device_rx.BufferTypeConversionEnable = true; + +% Enable the channels to write data to (options are 1, 2 ) + +cn0585_device_tx0.EnabledChannels = [1, 2]; +cn0585_device_tx1.EnabledChannels = [1, 2]; + +% Enable the channels to read data from (options are 1, 2, 3 ,4 ) + +cn0585_device_rx.EnabledChannels = [1, 2, 3, 4]; + +% Generate the sinewave signal + +amplitude = 2 ^ 15; +sampFreq = cn0585_device_tx0.SamplingRate; +toneFreq = 1e3; +N = sampFreq / toneFreq; +x = linspace(-pi, pi, N).'; +sine_wave = amplitude * sin(x); + +% Continuously load data in the buffer and configure the GPIOs state +% (SetupInit Base file) +% DAC1 has to be updated and started first and then DAC0 in order to have syncronized data between devices + +cn0585_device_tx1([sine_wave, sine_wave]); +cn0585_device_tx0([sine_wave, sine_wave]); + +% Stream status available options: "start_stream_synced", "start_stream", "stop_stream" + +cn0585_device_tx1.StreamStatus = 'start_stream'; +cn0585_device_tx0.StreamStatus = 'start_stream'; + +% The data will be stored inside "data" variable + +data = cn0585_device_rx(); + +title('ADAQ23876 Channels'); +subplot(4, 1, 1); +plot(data(:, 1)); +ylabel('Channel A'); +subplot(4, 1, 2); +plot(data(:, 2)); +ylabel('Channel B'); +subplot(4, 1, 3); +plot(data(:, 3)); +ylabel('Channel C'); +subplot(4, 1, 4); +plot(data(:, 4)); +ylabel('Channel D'); +xlabel('Number of samples'); + +% Release the device + +cn0585_device_tx1.StreamStatus = 'stop_stream'; +cn0585_device_tx0.StreamStatus = 'stop_stream'; + +cn0585_device_tx1.release(); +cn0585_device_tx0.release(); + +cn0585_device_rx.release(); diff --git a/pcx_examples/streaming/cn0585_fmcz/CN0585_streaming_test.m b/pcx_examples/streaming/cn0585_fmcz/CN0585_streaming_axi4lite_read_write.m similarity index 71% rename from pcx_examples/streaming/cn0585_fmcz/CN0585_streaming_test.m rename to pcx_examples/streaming/cn0585_fmcz/CN0585_streaming_axi4lite_read_write.m index be3a47b..935eaa0 100755 --- a/pcx_examples/streaming/cn0585_fmcz/CN0585_streaming_test.m +++ b/pcx_examples/streaming/cn0585_fmcz/CN0585_streaming_axi4lite_read_write.m @@ -1,42 +1,42 @@ -%CN0585 Streaming example +% CN0585 Streaming example for AXI4 Lite register read/write board_ip = 'local_board_ip'; +uri = cat(2, 'ip:', board_ip); % Describe the devices -cn0585_device_rx = adi.CN0585.Rx('uri', cat(2, 'ip:', board_ip)); -cn0585_device_tx0 = adi.CN0585.Tx0('uri', cat(2, 'ip:', board_ip)); -cn0585_device_tx1 = adi.CN0585.Tx1('uri', cat(2, 'ip:', board_ip)); +cn0585_device_rx = adi.CN0585.Rx('uri',uri); +cn0585_device_tx0 = adi.CN0585.Tx0('uri',uri); +cn0585_device_tx1 = adi.CN0585.Tx1('uri',uri); cn0585_device_tx0.EnableCyclicBuffers = true; cn0585_device_tx1.EnableCyclicBuffers = true; cn0585_device_rx.BufferTypeConversionEnable = true; -% enable the channels we want to write data to (options are 1, 2 ) +% Enable the channels to write data to (options are 1, 2) cn0585_device_tx0.EnabledChannels = [1, 2]; cn0585_device_tx1.EnabledChannels = [1, 2]; -% enable the channels we want to read data from (options are 1, 2, 3 ,4 ) +% Enable the channels to read data from (options are 1, 2, 3 ,4) cn0585_device_rx.EnabledChannels = [1, 2, 3, 4]; write_reg = soc.libiio.aximm.WriteHost(devName = 'mwipcore0:mmwr-channel0', IPAddress = board_ip); % MathWorks IP Core Write channel read_reg = soc.libiio.aximm.WriteHost(devName = 'mwipcore0:mmrd-channel1', IPAddress = board_ip); % MathWorks IP Core Read channel -% available options:'adc_input', 'dma_input', 'ramp_input' +% Input source available options: 'adc_input', 'dma_input', 'ramp_input' cn0585_device_tx0.InputSource = 'dma_input'; cn0585_device_tx1.InputSource = 'dma_input'; -% available options: '0/2.5V', '0/5V', '0/10V', '-5/+5V', '-10/+10V' +% Output range available options: '0/2.5V', '0/5V', '0/10V', '-5/+5V', '-10/+10V' cn0585_device_tx0.OutputRange = '-10/+10V'; cn0585_device_tx1.OutputRange = '-10/+10V'; - -% generate the sine wave signal +% Generate the sinewave signal amplitude = 2 ^ 15; sampFreq = cn0585_device_tx0.SamplingRate; @@ -45,19 +45,19 @@ x = linspace(-pi, pi, N).'; sine_wave = amplitude * sin(x); -% continuously load data in the buffer and configure the GPIOs state +% Continuously load data in the buffer and configure the GPIOs state % (SetupInit Base file) % DAC1 has to be updated and started first and then DAC0 in order to have syncronized data between devices cn0585_device_tx1([sine_wave, sine_wave]); cn0585_device_tx0([sine_wave, sine_wave]); -% available options: "start_stream_synced", "start_stream", "stop_stream" +% Stream status available options: "start_stream_synced", "start_stream", "stop_stream" cn0585_device_tx1.StreamStatus = 'start_stream'; cn0585_device_tx0.StreamStatus = 'start_stream'; -% the data will be contained inside "data" variable +% The data will be stored inside "data" variable data = cn0585_device_rx(); @@ -85,7 +85,7 @@ ylabel('Channel D'); xlabel('Number of samples'); -% release the device +% Release the device cn0585_device_tx1.StreamStatus = 'stop_stream'; cn0585_device_tx0.StreamStatus = 'stop_stream';