ECT 357 Ch 10 Analog to Digital COnversion. Today’s Quote: It’s better to die with a good name...

8
ECT 357 ECT 357 Ch 10 Analog to Digital Ch 10 Analog to Digital COnversion COnversion

Transcript of ECT 357 Ch 10 Analog to Digital COnversion. Today’s Quote: It’s better to die with a good name...

Page 1: ECT 357 Ch 10 Analog to Digital COnversion. Today’s Quote: It’s better to die with a good name than to live with a bad one. It’s better to die with a.

ECT 357ECT 357

Ch 10 Analog to Digital Ch 10 Analog to Digital COnversionCOnversion

Page 2: ECT 357 Ch 10 Analog to Digital COnversion. Today’s Quote: It’s better to die with a good name than to live with a bad one. It’s better to die with a.

Today’s Quote:Today’s Quote:

It’s better to die with a It’s better to die with a good name than to live good name than to live with a bad one.with a bad one.

A good name is better than precious A good name is better than precious ointment.ointment.

Ecclesiastes 7:1Ecclesiastes 7:1

Page 3: ECT 357 Ch 10 Analog to Digital COnversion. Today’s Quote: It’s better to die with a good name than to live with a bad one. It’s better to die with a.

Analog to Digital Converter Analog to Digital Converter TypesTypes

• Sigma DeltaSigma Delta

• IncrementalIncremental

• Successive ApproximationSuccessive Approximation

• FlashFlash

Page 4: ECT 357 Ch 10 Analog to Digital COnversion. Today’s Quote: It’s better to die with a good name than to live with a bad one. It’s better to die with a.

PIC18F452 ADC OverviewPIC18F452 ADC Overview

• 10 bit resolution10 bit resolution

• 2 output formats (ADRESH,ADRESL)2 output formats (ADRESH,ADRESL)

• 15 port configurations15 port configurations

• Internal/external referenceInternal/external reference

• Interrupt optionInterrupt option

• Clock optionsClock options

Page 5: ECT 357 Ch 10 Analog to Digital COnversion. Today’s Quote: It’s better to die with a good name than to live with a bad one. It’s better to die with a.

ADC UsesADC Uses

• Analog InputAnalog Input

• Control LoopsControl Loops

• PID ControlPID Control

• External InterfacesExternal Interfaces

Page 6: ECT 357 Ch 10 Analog to Digital COnversion. Today’s Quote: It’s better to die with a good name than to live with a bad one. It’s better to die with a.

ADC I/O pinsADC I/O pins

• Port A 0-3, Port A 5, Port E 0-2Port A 0-3, Port A 5, Port E 0-2

• Port Configuration determined by Port Configuration determined by PCFG bits in ADCON1PCFG bits in ADCON1

• Selects internal or external voltage Selects internal or external voltage referencereference

• Selects digital input or analog input Selects digital input or analog input for each pinfor each pin

Page 7: ECT 357 Ch 10 Analog to Digital COnversion. Today’s Quote: It’s better to die with a good name than to live with a bad one. It’s better to die with a.

ADC CharacteristicsADC Characteristics

• ADC conversion time ADC conversion time (50kHz<X<625kHz)(50kHz<X<625kHz)

• Minimum sample time (15 usec)Minimum sample time (15 usec)

• Conversion time (12xADC clock Conversion time (12xADC clock period)period)

Page 8: ECT 357 Ch 10 Analog to Digital COnversion. Today’s Quote: It’s better to die with a good name than to live with a bad one. It’s better to die with a.

ADC Initialization and ADC Initialization and OperationOperation

• Setup ADCON0Setup ADCON0

• Setup ADCON1Setup ADCON1

• Select ChannelSelect Channel

• Wait 15 usec for holding cap Wait 15 usec for holding cap

• Set GO_DONE bit in ADCON0Set GO_DONE bit in ADCON0

• Wait for GO_DONE to clearWait for GO_DONE to clear

• Get data out of ADRESH and ADRESLGet data out of ADRESH and ADRESL