ADC DAC Sensor and Actuator Interfacing Chapter 6
- Slides: 37
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 (cont’d) • Sensor: To convert physical quantity to electrical signal (in current or voltage) – i. e. Temperature, pressure, humidity, velocity, sound, etc.
ADC Resolution n-bit No. of steps Step size (m. V) 8 28 = 256 5/256 = 19. 53 m. V 10 210 = 1024 5/1024 = 4. 88 m. V 12 212 = 4096 5/4096 = 1. 2 m. V Assuming VREF = 5 V
PIC 18 F 4580 ADC Features
PIC 18 F 4580 ADC Features (cont’d) • It has 11 analog input channels (AN 0 – AN 10) • 10 -bit ADC • Converted values are stored in ADRESH: ADRESL registers
ADC: Important Registers • A/D Control Register 0 (ADCON 0) – Controls the operation of the A/D module • A/D Control Register 1 (ADCON 1) – Configures the functions of the port pins • A/D Control Register 2 (ADCON 2) – Configures the A/D clock source, programmed acquisition time and justification
A/D Control Register 0 (ADCON 0)
A/D Control Register 1 (ADCON 1) PCFG 3: PCFG 0 = 0000, AN 10 – AN 0 as analog input PCFG 3: PCFG 0 = 1111, AN 10 – AN 0 as digital I/O * Did you notice ADCON 1 = 0 x 7 F setting during lab session?
A/D Control Register 2 (ADCON 2)
ADC Reference Voltage (Vref) • Vref: Input voltage used for the reference voltage • The voltage connected to this pin , with the resolution of the ADC chip, dictate the step size • Example: If we need the analog input to be 0 to 4 volts, Vref is connected to 4 volts • Digital data output: 8 -bit (D 0 -D 7), 10 -bit (D 0 -D 9)
ADC Reference Voltage (Vref) (Cont’d) Vref (V) Vin (V) Step size (m. V) 5. 00 4. 096 0 to 5 0 to 4. 096 5/1024 = 4. 88 4. 096/1024 = 4 3. 0 2. 56 2. 048 0 to 3 0 to 2. 56 0 to 2. 048 3/1024 = 2. 93 2. 56/1024 = 2. 5 2. 048/1024 = 2 Vref Relation to Vin Range for an 10 -bit ADC
ADC Digital Data Output Dout = Vin / Step Size Analog Input Voltage Digital data output (in decimal): 8 -bit (D 0 -D 7)= 256 10 -bit (D 0 -D 9) = 1024 Example: Vref = 2. 56, Vin = 1. 7 V. Calculate the Do-D 9 output? Solution: Step Size = 2. 56/1024 = 2. 5 m. V Dout = 1. 7/2. 5 m. V = 680 (Decimal) D 0 -D 9 = 101000
Parallel versus Serial ADC
PIC 18 F 4580 ADC Features
PIC 18 F 4580 ADC Features (cont’d) • It has 11 analog input channels (AN 0 – AN 10) • 10 -bit ADC • Converted values are stored in ADRESH: ADRESL registers
ADC: Important Registers • A/D Control Register 0 (ADCON 0) – Controls the operation of the A/D module • A/D Control Register 1 (ADCON 1) – Configures the functions of the port pins • A/D Control Register 2 (ADCON 2) – Configures the A/D clock source, programmed acquisition time and justification
A/D Control Register 0 (ADCON 0) Example: Different from the Book! ADCON 0 = 00101001
A/D Control Register 1 (ADCON 1) * Different from the Book!
ADC PCFGs Example: ADCON 1 = 00001110 * Different from the Book!
A/D Control Register 2 (ADCON 2) Example: ADCON 2 = 10000110 * Different from the Book!
ADC ADFM Bit and ADRESx Registers
Example 1 For a PIC 18 -based system, we have Vref = Vdd = 5 V. Find a) The step size and b) The ADCON 1 value if we need 3 channels. a) The step size = 5/1024 = 4, 8 m. V b) ADCON 1 = 00001100
ADC Conversion Time • Define in term of Tad (Conversion time per bit) • To calculate: FOSC/2, FOSC/4, FOSC/8, FOSC/16, FOSC/32 or FOSC/64
Steps in Programming the ADC using Pooling TURN ON the ADC module (BSF ADCON 0, ADON) Make the ADC channel pin as input pin Select voltage reference and ADC channel Select the conversion speed Wait for the required acquisition time Activate the start conversion bit of GO/DONE Wait for the conversion to be completed by pooling the end-of-conversion GO/DONE bit After the GO/DONE bit has gone LOW, read the ADRESL and ADRESH register
Example 2 Void main (void) { TRISC=0; TRISD=0; TRISAbits. TRISA 0=1; //RA 0 = analog input ADCON 0=0 x 81; ADCCON 1=0 x. CE; } While(1) { DELAY(1); // give A/D chaneel time to sample ADCONbits. GO=1; //start converting While (ADCONbits. DONE==1); PORTC=ADRESL; //display low byte PORTD=ADRESH; //display high byte DELAY(250) }
Programming ADC using Interrupts Interrupt Flag Bit Register Enable Bit Register ADIF (ADC) ADIF PIR 1 ADIE PIE 1 ADC Interrupt Flag Bits and Associated Registers * Please see Program 13 -2 page 514
#pragma code hipro. Int=0 x 0008; { Void isr(); } #pragma code #pragma interrupt isr Void isr(void) { if (PIRIbits. ADIF==1) AD_isr(): } Void main (void) { TRISC=0; TRISD=0; TRISAbits. TRISA 0=0; ADCON 0=0 x 81; ADCCON 1=0 x. CE; PIR 1 bits. ADIF=0; PIE 1 bits. ADIE=1; INTCONbits. PEIE=1; INTCONbits. GIE=1; { Delay(1); ADCONbits. GO=1; } } void AD_isr(void) {PORTC=ADRESL; PORTD=ADRESH; Delay(250); PIR 1 bits. ADIF=0; } Example 3 //right justify, AN 0=analog //clear interrupt flag //enable A/D interrupt //enable peripheral interrupt //enable all interrupt globally //start converting //A/D ISR
Introduction to DAC • Covert digital pulses to analog pulses • DAC 0808 chip: Use R/2 R method, 8 -bit DAC Block Diagram
DAC Application
DAC 0808 • The digital inputs are converted to current (Iout) • Connecting a resistor to the Iout pin, we convert the result to voltage This will course inaccuracy because the Resistance will affect the reading Iout = Iref (D 7/2 + D 6/4 + D 5/8 + D 4/16 + D 3/32 + D 2/64 + D 1/128 + D 0/256) Iref = Generally set to 2. 0 m. A
PIC 18 Connection to DAC 0808 and Op-Amp Example: Binary input: 1001 Iout = 2 m. A (153/256) = 1. 195 m. A and Vout = 1. 195 m. A x 5 K = 5. 975 V
ADC Sensor Interfacing Gas Sensor Temperature Sensor Sonar Sensor Humidity Sensor
ADC Sensor Interfacing (Cont’d) Characteristic: 1) 2) 3) 4) Precision integrated-circuit Output voltage is linearly proportional to the Celcius Requires no external calibration (Internally calibration) Output: 10 m. V for each degree
ADC Sensor Interfacing (Cont’d) To overcome any fluctuations in power supply. * Please see Program 13 -4 page 524
“Things are only impossible until they're not” End of Chapter
- Adc interfacing with 8255
- Adc dac interfacing with 8051
- Adc and dac interfacing with 8051
- Berkeley
- Adc 0808 interfacing with 8086
- Actuator vs sensor
- Actuator sensor interface
- Pengertian adc dan dac
- Interfacing adc with 8086
- Adc 8051
- Mems magnetic actuator
- Auma sa07.6 wiring diagram
- Aircraft hydraulic system components
- Linear actuator frc
- Kmz10b
- Is actuator input or output
- Pre crash safety toyota
- Flow control valve symbol
- Hard drive voice coil
- Diagram step pneumatik
- Hense systemtechnik
- Electrostatic actuator
- Katup or
- Actuator
- Sliding doors remake
- Gambar double acting cylinder
- Gambar double acting cylinder
- "actuator"
- Lcd and keyboard interfacing
- Peripheral and interfacing
- Microprocessor and interfacing darshan pdf
- Microprocessor and interfacing tutorial
- Gabor c. temes
- Lsb and msb in binary
- Tzclock
- Binary weighted resistor dac
- Binary weighted resistor dac
- Mousai msd192 dac