You are on page 1of 12

ADC, DAC, Sensor and Actuator Interfacing

Chapter 6

Objectives
Upon completion of this chapter, you will be able to:
Explain the ADC programming in C Explain the DAC interfacing, Sensor and Actuator interfacing. Discuss and apply the sensor and actuator system interfacing.

Introduction to ADC
Analog-to-Digital Converter (ADC) Widely used in data acquisition (DAQ)

Introduction to ADC (contd)


Sensor: To convert physical quantity to electrical signal (in current or voltage)
i.e. Temperature, pressure, humidity, velocity, sound, etc.

ADC Resolution
n-bit 8 10 12 No. of steps 28 = 256 210 = 1024 212 = 4096 Step size (mV) 5/256 = 19.53mV 5/1024 = 4.88mV 5/4096 = 1.2mV

Assuming VREF = 5V

PIC18F4580 ADC Features

PIC18F4580 ADC Features (contd)


It has 11 analog input channels (AN0 AN10) 10-bit ADC Converted values are stored in ADRESH:ADRESL registers

ADC: Important Registers


A/D Control Register 0 (ADCON0)
Controls the operation of the A/D module

A/D Control Register 1 (ADCON1)


Configures the functions of the port pins

A/D Control Register 2 (ADCON2)


Configures the A/D clock source, programmed acquisition time and justification

A/D Control Register 0 (ADCON0)

A/D Control Register 1 (ADCON1)

PCFG3:PCFG0 = 0000, AN10 AN0 as analog input PCFG3:PCFG0 = 1111, AN10 AN0 as digital I/O

* Did you notice ADCON1 = 0x7F setting during lab session?

A/D Control Register 2 (ADCON2)

Performing A/D Conversion


To be continued

You might also like