* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
Download Microprocessor Engineering
Flip-flop (electronics) wikipedia , lookup
Phase-locked loop wikipedia , lookup
Josephson voltage standard wikipedia , lookup
Radio transmitter design wikipedia , lookup
Power MOSFET wikipedia , lookup
Immunity-aware programming wikipedia , lookup
Oscilloscope wikipedia , lookup
Serial digital interface wikipedia , lookup
Valve audio amplifier technical specification wikipedia , lookup
Time-to-digital converter wikipedia , lookup
Oscilloscope types wikipedia , lookup
Surge protector wikipedia , lookup
Oscilloscope history wikipedia , lookup
Transistor–transistor logic wikipedia , lookup
Resistive opto-isolator wikipedia , lookup
Valve RF amplifier wikipedia , lookup
Current mirror wikipedia , lookup
Operational amplifier wikipedia , lookup
Voltage regulator wikipedia , lookup
Power electronics wikipedia , lookup
Schmitt trigger wikipedia , lookup
Switched-mode power supply wikipedia , lookup
Television standards conversion wikipedia , lookup
Integrating ADC wikipedia , lookup
Rectiverter wikipedia , lookup
Analogue Input/Output Many sensors/transducers produce voltages representing physical data. To process transducer data in a computer requires conversion to digital form. Examples: reading temperature from a thermocouple processing speech from a microphone Many output devices require variable control, not just two digital logic levels To control these devices from a computer requires conversion from digital to analogue form. 5-1 Analogue Output Digital to Analogue Converter (DAC) DAC Characteristics = 1/2n where n is the number of bits – step size Max. digital output = 2n – 1 output voltage range – determined by reference voltage (Vref and AGND) Step size in volts = resolution x voltage range Max output voltage = (2n – 1)/ 2n x voltage range uni-polar / bipolar types slew rate – rate of change of output. interface – parallel (fast) or serial (slower but uses fewer connections) resolution 5-2 DAC principles – Example 4-bit DAC Sum currents with operational amplifier 1 d3 2R R Vref/2 Vo = - Vref(Rf/Rinput) 4R Vref/4 0 d2 8R Vref/8 + 1 d1 1 Vref 16R Vo Vo = -Vref(digital value/2n) Example: with 4-bit value = 1011 Vref/16 Vo = -Vref(d3/2 + d2/4 + d1/8 + d0/16) Vo = -Vref(1/2 + 1/8 + 1/16) d0 AGND Vo = -Vref(11/16) 5-3 Digital to Analogue conversion Previous design needs many different precise resistor values Resisters need to have a tolerance less than the resolution. E.g. 8-bit resolution = 1:28 = 1/256 = 0.00390625 resolution = 0.390625% Alternative is R-2R ladder arrangement R-2R ladder - only requires 2 different resistor values. 5-4 Analogue Input Main types (methods) of ADC approximation – good all-rounder Flash – fastest type Sigma-delta – good for audio Dual slope integrating – slow but high resolution with good noise immunity others – Sampling, ramp, charge balancing Successive Characteristics resolution conversion method conversion time input voltage range interface – parallel (fast) or serial(fewer connections) 5-5 Typical ADC Block diagram Interrupt request Conversion Control AN0 AN1 ANn M u t i p l e x e r Busy Start conversion Sample & Hold Converter VAREF Result Register VAGND Reference voltage 5-6 ADC – principle of operation 1. 2. 3. 4. 5. The voltage is presented to the ADC input. The ADC is sent a signal to start conversion While the conversion takes place the input voltage should remain stable. The ADC outputs a signal to indicate that it is busy doing the conversion and should not be disturbed. When the conversion is completed the ADC makes the result available and outputs a signal to indicate that the conversion has completed (e.g remove the busy signal) 5-7 Multiplexer To convert several analogue inputs 1. use an ADC for each input or … 2. use one ADC and switch the inputs through a multiplexer requires selection of input before each conversion is started short delay required before conversion started to allow switching to occur and signal to settle. 5-8 Sample and Hold Circuit Sample and Hold (S&H) while conversion takes place voltage must remain stable sample voltage – input connected to S&H voltage held on a capacitor sample time – charging time of capacitor input signal disconnected from S&H 5-9 Microchip PIC18F452 ADC 5-10 ADC Control Registers The ADC is configured and controlled through two Special File Registers, ADCON0 and ADCON1. Additionally the PIR1 contains the ADIF bit (Analogue to Digital Interrupt Flag) which is set when a conversion is complete. ADCON0 ADCON1 5-11 ADC Result Format The 10-bit result can be placed in ADRESH and ADRESL in one of two ways depending on the ADFM bit in ADCON0 With left justified an equivalent 8-bit ADC can be obtained by simply using ADRESH and ignoring ADRESL. 5-12