AD/DA Converter National Instruments NI USB-6009 BME 1008 Introduction to Biomedical Engineering...

22
AD/DA Converter National Instruments NI USB-6009 BME 1008 Introduction to Biomedical Engineering FIU, Spring 2015 Feb 12 Lesson 4 - NI USB-6009. - Matlab structures and loops.

Transcript of AD/DA Converter National Instruments NI USB-6009 BME 1008 Introduction to Biomedical Engineering...

Page 1: AD/DA Converter National Instruments NI USB-6009 BME 1008 Introduction to Biomedical Engineering FIU, Spring 2015 Feb 12 Lesson 4 - NI USB-6009. - Matlab.

AD/DA ConverterNational Instruments NI USB-6009

BME 1008 Introduction to Biomedical EngineeringFIU, Spring 2015

Feb 12Lesson 4

- NI USB-6009.- Matlab structures and loops.

Page 2: AD/DA Converter National Instruments NI USB-6009 BME 1008 Introduction to Biomedical Engineering FIU, Spring 2015 Feb 12 Lesson 4 - NI USB-6009. - Matlab.

TestOn February 26, test from Matlab lessons 1, 2, 3 and 4.Notes and laptops not allowed during the test.21% of your grading.

To prepare for the test,study PowerPoints 1, 2, 3, 4 for the Matlab programming

(except the audio functions wavread, wavplay, and audioplayer);

PowerPoints 3 and 4 for the AD/DA conversion.

Page 3: AD/DA Converter National Instruments NI USB-6009 BME 1008 Introduction to Biomedical Engineering FIU, Spring 2015 Feb 12 Lesson 4 - NI USB-6009. - Matlab.

Analog to Digital Conversion

Digital Output Signal Analog Input Signal

Page 4: AD/DA Converter National Instruments NI USB-6009 BME 1008 Introduction to Biomedical Engineering FIU, Spring 2015 Feb 12 Lesson 4 - NI USB-6009. - Matlab.

Sampling Biological Analog Waveforms

Oximetrysampling rate 10-550 S/sS/s – Samples per second

Data Acquisition from an analog source is important in Biomedical Engineering

Functional MRI (FMRI), sampling rate 1-5 S/s

Page 5: AD/DA Converter National Instruments NI USB-6009 BME 1008 Introduction to Biomedical Engineering FIU, Spring 2015 Feb 12 Lesson 4 - NI USB-6009. - Matlab.

USB 6009 Analog-to-digital and digital-to-analog Converter

• Can receive voltage signal from -10V to 10V • Accuracy = 7.73mV • 14 bits resolution,• each sample is represented by 14 bits• Max sampling rate is 48 kS/s (48 kHz)• 1 kS/s = 1000 samples/second •Can output 5V signal

Page 6: AD/DA Converter National Instruments NI USB-6009 BME 1008 Introduction to Biomedical Engineering FIU, Spring 2015 Feb 12 Lesson 4 - NI USB-6009. - Matlab.

What’s in the box?

Page 7: AD/DA Converter National Instruments NI USB-6009 BME 1008 Introduction to Biomedical Engineering FIU, Spring 2015 Feb 12 Lesson 4 - NI USB-6009. - Matlab.

• OpAmp, microcontroller and a number of other electronic components are integrated circuits.

• Integrated Circuit (IC), chip, or a microchip - a set of electronic circuits on one small chip of semiconductor material.• usually crystal silicon, Si,

(not to be confused with the rubber-like silicone).

Page 8: AD/DA Converter National Instruments NI USB-6009 BME 1008 Introduction to Biomedical Engineering FIU, Spring 2015 Feb 12 Lesson 4 - NI USB-6009. - Matlab.
Page 9: AD/DA Converter National Instruments NI USB-6009 BME 1008 Introduction to Biomedical Engineering FIU, Spring 2015 Feb 12 Lesson 4 - NI USB-6009. - Matlab.
Page 10: AD/DA Converter National Instruments NI USB-6009 BME 1008 Introduction to Biomedical Engineering FIU, Spring 2015 Feb 12 Lesson 4 - NI USB-6009. - Matlab.
Page 11: AD/DA Converter National Instruments NI USB-6009 BME 1008 Introduction to Biomedical Engineering FIU, Spring 2015 Feb 12 Lesson 4 - NI USB-6009. - Matlab.
Page 12: AD/DA Converter National Instruments NI USB-6009 BME 1008 Introduction to Biomedical Engineering FIU, Spring 2015 Feb 12 Lesson 4 - NI USB-6009. - Matlab.
Page 13: AD/DA Converter National Instruments NI USB-6009 BME 1008 Introduction to Biomedical Engineering FIU, Spring 2015 Feb 12 Lesson 4 - NI USB-6009. - Matlab.
Page 14: AD/DA Converter National Instruments NI USB-6009 BME 1008 Introduction to Biomedical Engineering FIU, Spring 2015 Feb 12 Lesson 4 - NI USB-6009. - Matlab.

Successive approximation ADCSAR = successive approximation registerDAC = Digital-to-Analog converter

EOC = end of conversion

Digital Output Signal

Analog Input Signal

S/H = sample & hold

Discretized signal

Page 15: AD/DA Converter National Instruments NI USB-6009 BME 1008 Introduction to Biomedical Engineering FIU, Spring 2015 Feb 12 Lesson 4 - NI USB-6009. - Matlab.

Resolution of ADC ADC resolution is given by the number of bits, e.g. 3 bits2(# of bits) - the number of discrete voltage levels of ADC

Examples: ADC with a resolution of 3 bits

has 23 = 8 discrete levels (figure).

NI6009 has 14-bit resolution, and 214 = 16,384 discrete levels.

Page 16: AD/DA Converter National Instruments NI USB-6009 BME 1008 Introduction to Biomedical Engineering FIU, Spring 2015 Feb 12 Lesson 4 - NI USB-6009. - Matlab.
Page 17: AD/DA Converter National Instruments NI USB-6009 BME 1008 Introduction to Biomedical Engineering FIU, Spring 2015 Feb 12 Lesson 4 - NI USB-6009. - Matlab.
Page 18: AD/DA Converter National Instruments NI USB-6009 BME 1008 Introduction to Biomedical Engineering FIU, Spring 2015 Feb 12 Lesson 4 - NI USB-6009. - Matlab.

Matlab structures A structure allows to save multiple kinds of data under

a single variable.Example:

% Apostrophes (' ') indicate text string

>> s1.Name = 'Carlos'; >> s1.Age = 24;>> s1.Grades = [3.2 3.1 2.9]s1 = Name: 'Carlos' Age: 24

Grades: [3.2000 3.1000 2.9000]

Page 19: AD/DA Converter National Instruments NI USB-6009 BME 1008 Introduction to Biomedical Engineering FIU, Spring 2015 Feb 12 Lesson 4 - NI USB-6009. - Matlab.

Structure name fields values

s1 = Name: 'Carlos' %string value Age: 24 %scalar

Grades: [3.2000 3.1000 2.9000] %vector

To access an individual field:

>> s1.Gradesans =

3.2000 3.1000 2.9000

Page 20: AD/DA Converter National Instruments NI USB-6009 BME 1008 Introduction to Biomedical Engineering FIU, Spring 2015 Feb 12 Lesson 4 - NI USB-6009. - Matlab.

Matlab loop with FORfor

Repeat statements a specific number of times Syntaxfor variable = expression

statements end

Example : for n=1:4 %n = [1 2 3 4] v(n) = 10^(n-1) end

Page 21: AD/DA Converter National Instruments NI USB-6009 BME 1008 Introduction to Biomedical Engineering FIU, Spring 2015 Feb 12 Lesson 4 - NI USB-6009. - Matlab.

>> for n=1:4v(n) = 10^(n-1) % v(n) is the n-th element of

vend

v = 1

v = 1 10

v = 1 10 100

v = 1 10 100 1000

Page 22: AD/DA Converter National Instruments NI USB-6009 BME 1008 Introduction to Biomedical Engineering FIU, Spring 2015 Feb 12 Lesson 4 - NI USB-6009. - Matlab.

Quiz 6 - FOR loop

Calculate the sum 1/10 + 1/21 + 1/32 + ....1/98 + 1/109.

% Run Matlab script:s = 0;for n= 1:10

s = s + 1/n^(n-1)end

% Answer sum = 1.6285