文档库 最新最全的文档下载
当前位置:文档库 › adc0832

adc0832

adc0832
adc0832

ADC0831/ADC0832/ADC0834/ADC0838

8-Bit Serial I/O A/D Converters with Multiplexer

Options

General Description

The ADC0831series are8-bit successive approximation A/D converters with a serial I/O and configurable input multiplex-ers with up to8channels.The serial I/O is configured to comply with the NSC MICROWIRE?serial data exchange standard for easy interface to the COPS?family of proces-sors,and can interface with standard shift registers orμPs. The2-,4-or8-channel multiplexers are software configured for single-ended or differential inputs as well as channel as-signment.

The differential analog voltage input allows increasing the common-mode rejection and offsetting the analog zero input voltage value.In addition,the voltage reference input can be adjusted to allow encoding any smaller analog voltage span to the full8bits of resolution.

Features

n NSC MICROWIRE compatible—direct interface to COPS family processors

n Easy interface to all microprocessors,or operates “stand-alone”n Operates ratiometrically or with5V DC voltage reference

n No zero or full-scale adjust required

n2-,4-or8-channel multiplexer options with address logic n Shunt regulator allows operation with high voltage supplies

n0V to5V input range with single5V power supply

n Remote operation with serial digital data link

n TTL/MOS input/output compatible

n0.3"standard width,8-,14-or20-pin DIP package

n20Pin Molded Chip Carrier Package(ADC0838only)

n Surface-Mount Package

Key Specifications

n Resolution8Bits n Total Unadjusted Error±1?2LSB and±1LSB n Single Supply5V DC n Low Power15mW n Conversion Time32μs

Typical Application

TRI-STATE?is a registered trademark of National Semiconductor Corporation. COPS?and MICROWIRE?are trademarks of National Semiconductor Corporation.DS005583-1 August1999ADC0831/ADC0832/ADC0834/ADC0838

8-Bit

Serial

I/O

A/D

Converters

with

Multiplexer

Options

?1999National Semiconductor Corporation https://www.wendangku.net/doc/9910668555.html,

Connection Diagrams

ADC0838

8-Channel Mux

Small Outline/Dual-In-Line Package

(WM and N)DS005583-8Top View

ADC08344-Channel MUX Small Outline/Dual-In-Line Package

(WM and N)DS005583-30COM internally connected to A GND

Top View

Top View

ADC08322-Channel MUX Dual-In-Line Package (N)

DS005583-31

COM internally connected to GND.V REF internally connected to V CC .Top View

Top View ADC08322-Channel MUX

Small Outline Package (WM)DS005583-41

Top View

ADC0831Single

Differential Input

Dual-In-Line Package (N)DS005583-32

Top View

ADC0831Single Differential Input Small Outline Package (WM)

DS005583-42

Top View

ADC08388-Channel MUX

Molded Chip Carrier (PCC)

Package (V)DS005583-33

https://www.wendangku.net/doc/9910668555.html, 2

Ordering Information

Part Number Analog Input Total Package Temperature

Channels Unadjusted Error Range

ADC0831CCN1±1Molded(N)0?C to+70?C

ADC0831CCWM SO(M)0?C to+70?C

ADC0832CIWM2±1SO(M)?40?C to+85?C

ADC0832CCN Molded(N)0?C to+70?C

ADC0832CCWM SO(M)0?C to+70?C

ADC0834BCN4±1?2Molded(N)0?C to+70?C

ADC0834CCN±1Molded(N)0?C to+70?C

ADC0834CCWM SO(M)0?C to+70?C

ADC0838BCV8±1?2PCC(V)0?C to+70?C

ADC0838CCV±1PCC(V)0?C to+70?C

ADC0838CCN Molded(N)0?C to+70?C

ADC0838CIWM SO(M)?40?C to+85?C

ADC0838CCWM SO(M)0?C to+70?C

See NS Package Number M14B,M20B,N08E,N14A,N20A or V20A

3

https://www.wendangku.net/doc/9910668555.html,

Absolute Maximum Ratings

(Notes1,2)

If Military/Aerospace specified devices are required, please contact the National Semiconductor Sales Office/ Distributors for availability and specifications.

Current into V+(Note3)15mA Supply Voltage,V CC(Note3) 6.5V Voltage

Logic Inputs?0.3V to V CC+0.3V Analog Inputs?0.3V to V CC+0.3V Input Current per Pin(Note4)±5mA Package±20mA Storage Temperature?65?C to+150?C Package Dissipation

at T A=25?C(Board Mount)0.8W Lead Temperature(Soldering10sec.)

Dual-In-Line Package(Plastic)260?C Molded Chip Carrier Package

Vapor Phase(60sec.)215?C Infrared(15sec.)220?C ESD Susceptibility(Note5)2000V Operating Ratings(Notes1,2)

Supply Voltage,V CC 4.5V DC to6.3V DC Temperature Range T MIN≤T A≤T MAX ADC0832/8CIWM?40?C to+85?C ADC0834BCN,

ADC0838BCV,

ADC0831/2/4/8CCN,

ADC0838CCV,

ADC0831/2/4/8CCWM0?C to+70?C

Converter and Multiplexer Electrical Characteristics The following specifications apply for V CC=V+=V REF=5V,V REF≤V CC+0.1V,T A=T j=25?C,and f CLK=250kHz unless otherwise specified.Boldface limits apply from T MIN to T MAX.

Parameter Conditions CIWM Devices BCV,CCV,CCWM,BCN

and CCN Devices

Typ Tested Design Typ Tested Design Units (Note12)Limit Limit(Note12)Limit Limit

(Note13)(Note14)(Note13)(Note14)

CONVERTER AND MULTIPLEXER CHARACTERISTICS

Total Unadjusted Error V REF=5.00V

ADC0838BCV(Note6)±1?2±1?2

ADC0834BCN±1?2±1?2LSB

(Max) ADC0838CCV±1±1

ADC0831/2/4/8CCN±1±1

ADC0831/2/4/8CCWM±1±1

ADC0832/8CIWM±1

Minimum Reference 3.5 1.3 3.5 1.3 1.3k?Input Resistance(Note7)

Maximum Reference 3.5 5.9 3.5 5.4 5.9k?Input Resistance(Note7)

Maximum Common-Mode

Input Range(Note8)

V CC+0.05V CC+0.05V CC+0.05V

Minimum Common-Mode

Input Range(Note8)

GND?0.05GND?0.05GND?0.05V DC Common-Mode Error±1/16±1?4±1/16±1?4±1?4LSB Change in zero15mA into V+

error from V CC=5V V CC=N.C.

to internal zener V REF=5V

operation(Note3)111LSB V Z,internal MIN15mA into V+ 6.3 6.3 6.3

diode breakdown MAX8.58.58.5V (at V+)(Note3)

Power Supply Sensitivity V CC=5V±5%±1/16±1?4±1?4±1/16±1?4±1?4LSB

I OFF,Off Channel Leakage On Channel=5V,?0.2?0.2?1μA

Current(Note9)Off Channel=0V?1

On Channel=0V,+0.2+0.2+1μA

Off Channel=5V+1

https://www.wendangku.net/doc/9910668555.html,4

Converter and Multiplexer Electrical Characteristics The following specifications apply for V CC=V+=V REF=5V,V REF≤V CC+0.1V,T A=T j=25?C,and f CLK=250kHz unless otherwise specified.Boldface limits apply from T MIN to T MAX.(Continued)

Parameter Conditions CIWM Devices BCV,CCV,CCWM,BCN

and CCN Devices

Typ Tested Design Typ Tested Design Units (Note12)Limit Limit(Note12)Limit Limit

(Note13)(Note14)(Note13)(Note14)

CONVERTER AND MULTIPLEXER CHARACTERISTICS

I ON,On Channel Leakage On Channel=0V,?0.2?0.2?1μA Current(Note9)Off Channel=5V?1

On Channel=5V,+0.2+0.2+1μA

Off Channel=0V+1

DIGITAL AND DC CHARACTERISTICS

V IN(1),Logical“1”Input V CC=5.25V 2.0 2.0 2.0V Voltage(Min)

V IN(0),Logical“0”Input V CC=4.75V0.80.80.8V Voltage(Max)

I IN(1),Logical“1”Input V IN=5.0V0.00510.00511μA Current(Max)

I IN(0),Logical“0”Input V IN=0V?0.005?1?0.005?1?1μA Current(Max)

V OUT(1),Logical“1”Output V CC=4.75V

Voltage(Min)I OUT=?360μA 2.4 2.4 2.4V

I OUT=?10μA 4.5 4.5 4.5V

V OUT(0),Logical“0”Output V CC=4.75V0.40.40.4V Voltage(Max)I OUT=1.6mA

I OUT,TRI-STATE Output V OUT=0V?0.1?3?0.1?3?3μA Current(Max)V OUT=5V0.130.1+3+3μA

I SOURCE,Output Source V OUT=0V?14?6.5?14?7.5?6.5mA Current(Min)

I SINK,Output Sink Current(Min)V OUT=V CC168.0169.08.0mA

I CC,Supply Current(Max)

ADC0831,ADC0834,0.9 2.50.9 2.5 2.5mA ADC0838

ADC0832Includes Ladder 2.3 6.5 2.3 6.5 6.5mA

Current

AC Characteristics

The following specifications apply for V CC=5V,t r=t f=20ns and25?C unless otherwise specified.

Typ Tested Design Limit Parameter Conditions(Note12)Limit Limit Units

(Note13)(Note14)

f CLK,Clock Frequency Min10kHz

Max400kHz

t C,Conversion Time Not including MUX Addressing Time81/f CLK Clock Duty Cycle Min40% (Note10)Max60%

t SET-UP,CS Falling Edge or250ns Data Input Valid to CLK

Rising Edge

t HOLD,Data Input Valid90ns after CLK Rising Edge

https://www.wendangku.net/doc/9910668555.html,

5

AC Characteristics

(Continued)

The following specifications apply for V CC =5V,t r =t f =20ns and 25?C unless otherwise specified.

Typ

Tested Design Limit Parameter

Conditions (Note 12)Limit Limit Units (Note 13)(Note 14)t pd1,t pd0—CLK Falling

C L =100pF Edge to Output Data Valid

Data MSB First 6501500ns (Note 11)

Data LSB First 250600ns t 1H ,t 0H ,—Rising Edge of

C L =10pF,R L =10k 125250ns CS to Data Output and

(see TRI-STATE ?Test Circuits)SARS Hi–Z

C L =100pf,R L =2k 500ns C IN ,Capacitance of Logic

5pF Input

C OUT ,Capacitance of Logic

5pF

Outputs

Note 1:Absolute Maximum Ratings indicate limits beyond which damage to the device may occur.DC and AC electrical specifications do not apply when operating the device beyond its specified operating conditions.

Note 2:All voltages are measured with respect to the ground plugs.

Note 3:Internal zener diodes (6.3to 8.5V)are connected from V+to GND and V CC to GND.The zener at V+can operate as a shunt regulator and is connected to V CC via a conventional diode.Since the zener voltage equals the A/D’s breakdown voltage,the diode insures that V CC will be below breakdown when the device is powered from V+.Functionality is therefore guaranteed for V+operation even though the resultant voltage at V CC may exceed the specified Absolute Max of 6.5V.It is recommended that a resistor be used to limit the max current into V+.(See Figure 3in Functional Description Section 6.0)

Note 4:When the input voltage (V IN )at any pin exceeds the power supply rails (V IN V +)the absolute value of current at that pin should be limited to 5mA or less.The 20mA package input current limits the number of pins that can exceed the power supply boundaries with a 5mA current limit to four.Note 5:Human body model,100pF discharged through a 1.5k ?resistor.

Note 6:Total unadjusted error includes offset,full-scale,linearity,and multiplexer errors.

Note 7:Cannot be tested for ADC0832.

Note 8:For V IN (?)≥V IN (+)the digital output code will be 00000000.Two on-chip diodes are tied to each analog input (see Block Diagram)which will forward conduct for analog input voltages one diode drop below ground or one diode drop greater than the V CC supply.Be careful,during testing at low V CC levels (4.5V),as high level analog inputs (5V)can cause this input diode to conduct —especially at elevated temperatures,and cause errors for analog inputs near full-scale.The spec allows 50mV forward bias of either diode.This means that as long as the analog V IN or V REF does not exceed the supply voltage by more than 50mV,the output code will be correct.To achieve an absolute 0V DC to 5V DC input voltage range will therefore require a minimum supply voltage of 4.950V DC over temperature varia-tions,initial tolerance and loading.

Note 9:Leakage current is measured with the clock not switching.

Note 10:A 40%to 60%clock duty cycle range insures proper operation at all clock frequencies.In the case that an available clock has a duty cycle outside of these limits,the minimum,time the clock is high or the minimum time the clock is low must be at least 1μs.The maximum time the clock can be high is 60μs.The clock can be stopped when low so long as the analog input voltage remains stable.

Note 11:Since data,MSB first,is the output of the comparator used in the successive approximation loop,an additional delay is built in (see Block Diagram)to allow for comparator response time.

Note 12:Typicals are at 25?C and represent most likely parametric norm.

Note 13:Tested limits are guaranteed to National’s AOQL (Average Outgoing Quality Level).

Note 14:Guaranteed but not 100%production tested.These limits are not used to calculate outgoing quality levels.Typical Performance Characteristics

Unadjusted Offset Error

vs V REF Voltage DS005583-43Linearity Error vs V REF

Voltage DS005583-44

Linearity Error vs

Temperature

DS005583-45

https://www.wendangku.net/doc/9910668555.html, 6

Typical Performance Characteristics

(Continued)Leakage Current Test Circuit

Linearity Error vs f CLK DS005583-46

Power Supply Current vs Temperature (ADC0838,

ADC0831,ADC0834)

DS005583-47

Note:For ADC0832add I REF .

Output Current vs

Temperature DS005583-48

Power Supply Current

vs f CLK

DS005583-29

DS005583-3

https://www.wendangku.net/doc/9910668555.html,

7

TRI-STATE Test Circuits

and Waveforms

Timing Diagrams

t 1H DS005583-49

t 0H

DS005583-50

t 1H DS005583-51t 0H

DS005583-52

Data Input Timing DS005583-24Data Output Timing

DS005583-25

ADC0831Start Conversion Timing

DS005583-26

https://www.wendangku.net/doc/9910668555.html, 8

Timing Diagrams(Continued)

ADC0831Timing

DS005583-27

*LSB first output not available on ADC0831.

ADC0832Timing

DS005583-28

ADC0834Timing

DS005583-5

9

https://www.wendangku.net/doc/9910668555.html,

Timing Diagrams (Continued)

A D C 0838T i m i n g D S 005583-6*M a k e s u r e c l o c k e d g e #18c l o c k s i n t h e L S

B b e f o r e S E i s t a k e n l o w

https://www.wendangku.net/doc/9910668555.html, 10

ADC0838Functional Block Diagram

D S 005583-7*S o m e o f t h e s e f u n c t i o n s /p i n s a r e n o t a v a i l a b l e w i t h o t h e r o p t i o n s .N o t e 1:F o r t h e A D C 0834,D 1i s i n p u t d i r e c t l y t o t h e D i n p u t o f S

E L E C T 1.S E L E C T 0i s f o r c e d t o a “1”.

F o r t h e A D C 0832,D I i s i n p u t d i r e c t l y t o t h e D I i n p u t o f O D D /S I

G N .S E L E C T 0i s f o r c e d t o a “0”a n d S E L E C T 1i s f o r c e d t o a “1”.

https://www.wendangku.net/doc/9910668555.html, 11

Functional Description 1.0

MULTIPLEXER ADDRESSING

The design of these converters utilizes a sample-data com-parator structure which provides for a differential analog in-put to be converted by a successive approximation routine. The actual voltage converted is always the difference be-tween an assigned“+”input terminal and a“?”input terminal. The polarity of each input terminal of the pair being con-verted indicates which line the converter expects to be the most positive.If the assigned“+”input is less than the“?”in-put the converter responds with an all zeros output code.

A unique input multiplexing scheme has been utilized to pro-vide multiple analog channels with software-configurable single-ended,differential,or a new pseudo-differential option which will convert the difference between the voltage at any analog input and a common terminal.The analog signal con-ditioning required in transducer-based data acquisition sys-tems is significantly simplified with this type of input flexibility. One converter package can now handle ground referenced inputs and true differential inputs as well as signals with some arbitrary reference voltage.

A particular input configuration is assigned during the MUX addressing sequence,prior to the start of a conversion.The MUX address selects which of the analog inputs are to be enabled and whether this input is single-ended or differential.In the differential case,it also assigns the polarity of the channels.Differential inputs are restricted to adjacent chan-nel pairs.For example channel0and channel1may be se-lected as a different pair but channel0or1cannot act differ-entially with any other channel.In addition to selecting differential mode the sign may also be selected.Channel0 may be selected as the positive input and channel1as the negative input or vice versa.This programmability is best il-lustrated by the MUX addressing codes shown in the follow-ing tables for the various product options.

The MUX address is shifted into the converter via the DI line. Because the ADC0831contains only one differential input channel with a fixed polarity assignment,it does not require addressing.

The common input line on the ADC0838can be used as a pseudo-differential input.In this mode,the voltage on this pin is treated as the“?”input for any of the other input channels. This voltage does not have to be analog ground;it can be any reference potential which is common to all of the inputs. This feature is most useful in single-supply application where the analog circuitry may be biased up to a potential other than ground and the output signals are all referred to this potential.

TABLE1.Multiplexer/Package Options

Part Number of Analog Channels Number of

Number Single-Ended Differential Package Pins

ADC0831118

ADC0832218

ADC08344214

ADC08388420 https://www.wendangku.net/doc/9910668555.html,12

Functional Description(Continued)

TABLE2.MUX Addressing:ADC0838

Single-Ended MUX Mode

MUX Address Analog Single-Ended Channel#

SGL/ODD/SELECT01234567COM

DIF SIGN10

1000+?

1001+?

1010+?

1011+?

1100+?

1101+?

1110+?

1111+?

TABLE3.MUX Addressing:ADC0838

Differential MUX Mode

MUX Address Analog Differential Channel-Pair#

SGL/ODD/SELECT0123

DIF SIGN1001234567

0000+?

0001+?

0010+?

0011+?

0100?+

0101?+

0110?+

0111?+

TABLE4.MUX Addressing:ADC0834

Single-Ended MUX Mode

MUX Address Channel#

SGL/ODD/SELECT

DIF SIGN10123

100+

101+

110+

111+

COM is internally tied to A GND

TABLE5.MUX Addressing:ADC0834

Differential MUX Mode

MUX Address Channel#

SGL/ODD/SELECT

DIF SIGN10123

000+?

001+?

010?+

011?+

13

https://www.wendangku.net/doc/9910668555.html,

Functional Description(Continued)

TABLE6.MUX Addressing:ADC0832

Single-Ended MUX Mode

MUX Address Channel#

SGL/ODD/01

DIF SIGN

10+

11+

COM is internally tied to A GND

TABLE7.MUX Addressing:ADC0832

Differential MUX Mode

MUX Address Channel#

SGL/ODD/01

DIF SIGN

00+?

01?+

Since the input configuration is under software control,it can be modified,as required,at each conversion.A channel can be treated as a single-ended,ground referenced input for one conversion;then it can be reconfigured as part of a dif-ferential channel for another conversion.Figure1illustrates the input flexibility which can be achieved.

The analog input voltages for each channel can range from 50mV below ground to50mV above V CC(typically5V)with-out degrading conversion accuracy.

2.0THE DIGITAL INTERFACE

A most important characteristic of these converters is their serial data link with the controlling https://www.wendangku.net/doc/9910668555.html,ing a serial communication format offers two very significant system im-provements;it allows more function to be included in the converter package with no increase in package size and it can eliminate the transmission of low level analog signals by locating the converter right at the analog sensor;transmitting highly noise immune digital data back to the host processor. To understand the operation of these converters it is best to refer to the Timing Diagrams and Functional Block Diagram and to follow a complete conversion sequence.For clarity a separate diagram is shown of each device.

1.A conversion is initiated by first pulling the CS(chip select) line low.This line must be held low for the entire conversion. The converter is now waiting for a start bit and its MUX as-signment word.

2.A clock is then generated by the processor(if not provided continuously)and output to the A/D clock input.

https://www.wendangku.net/doc/9910668555.html,14

Functional Description

(Continued)

3.On each rising edge of the clock the status of the data in

(DI)line is clocked into the MUX address shift register.The

start bit is the first logic “1”that appears on this line (all lead-

ing zeros are ignored).Following the start bit the converter

expects the next 2to 4bits to be the MUX assignment word.

4.When the start bit has been shifted into the start location

of the MUX register,the input channel has been assigned

and a conversion is about to begin.An interval of 1?2clock pe-

riod (where nothing happens)is automatically inserted to al-

low the selected MUX channel to settle.The SAR status line

goes high at this time to signal that a conversion is now in

progress and the DI line is disabled (it no longer accepts

data).

5.The data out (DO)line now comes out of TRI-STATE and

provides a leading zero for this one clock period of MUX set-

tling time.

6.When the conversion begins,the output of the SAR com-

parator,which indicates whether the analog input is greater

than (high)or less than (low)each successive voltage from

the internal resistor ladder,appears at the DO line on each

falling edge of the clock.This data is the result of the conver-

sion being shifted out (with the MSB coming first)and can be

read by the processor immediately.7.After 8clock periods the conversion is completed.The SAR status line returns low to indicate this 1?2clock cycle later.8.If the programmer prefers,the data can be provided in an LSB first format [this makes use of the shift enable (SE)con-trol line].All 8bits of the result are stored in an output shift register.On devices which do not include the SE control line,the data,LSB first,is automatically shifted out the DO line,after the MSB first data stream.The DO line then goes low and stays low until CS is returned high.On the ADC0838the SE line is brought out and if held high,the value of the LSB remains valid on the DO line.When SE is forced low,the data is then clocked out LSB first.The ADC0831is an excep-tion in that its data is only output in MSB first format.9.All internal registers are cleared when the CS line is high.If another conversion is desired,CS must make a high to low transition followed by address information.The DI and DO lines can be tied together and controlled through a bidirectional processor I/O bit with one wire.This is possible because the DI input is only “looked-at”during the MUX addressing interval while the DO line is still in a high impedance state.

8Single-Ended DS005583-53

8Pseudo-Differential

DS005583-54

4Differential DS005583-55

Mixed Mode

DS005583-56

FIGURE 1.Analog Input Multiplexer Options for the ADC0838

https://www.wendangku.net/doc/9910668555.html,

15

Functional Description

(Continued)

3.0

REFERENCE CONSIDERATIONS The voltage applied to the reference input to these convert-

ers defines the voltage span of the analog input (the differ-

ence between V IN(MAX)and V IN(MIN))over which the 256

possible output codes apply.The devices can be used in ei-

ther ratiometric applications or in systems requiring absolute

accuracy.The reference pin must be connected to a voltage

source capable of driving the reference input resistance of

typically 3.5k ?.This pin is the top of a resistor divider string

used for the successive approximation conversion.

In a ratiometric system,the analog input voltage is propor-

tional to the voltage used for the A/D reference.This voltage

is typically the system power supply,so the V REF pin can be

tied to V CC (done internally on the ADC0832).This technique

relaxes the stability requirements of the system reference as

the analog input and A/D reference move together maintain-

ing the same output code for a given input condition.For absolute accuracy,where the analog input varies be-tween very specific voltage limits,the reference pin can be biased with a time and temperature stable voltage source.The LM385and LM336reference diodes are good low cur-rent devices to use with these converters.The maximum value of the reference is limited to the V CC supply voltage.The minimum value,however,can be quite small (see Typical Performance Characteristics)to allow di-rect conversions of transducer outputs providing less than a 5V output span.Particular care must be taken with regard to noise pickup,circuit layout and system error voltage sources when operating with a reduced span due to the increased sensitivity of the converter (1LSB equals V REF /256).

4.0THE ANALOG INPUTS

The most important feature of these converters is that they

can be located right at the analog signal source and through

just a few wires can communicate with a controlling proces-

sor with a highly noise immune serial bit stream.This in itself

greatly minimizes circuitry to maintain analog signal accu-

racy which otherwise is most susceptible to noise pickup.

However,a few words are in order with regard to the analog

inputs should the input be noisy to begin with or possibly

riding on a large common-mode voltage.

The differential input of these converters actually reduces

the effects of common-mode input noise,a signal common

to both selected “+”and “?”inputs for a conversion (60Hz is

most typical).The time interval between sampling the “+”in-

put and then the “?”input is 1?2of a clock period.The change

in the common-mode voltage during this short time interval

can cause conversion errors.For a sinusoidal

common-mode signal this error is:where f CM is the frequency of the common-mode signal,

V PEAK is its peak voltage value and f CLK ,is the A/D clock frequency.For a 60Hz common-mode signal to generate a 1?4LSB error (≈5mV)with the converter running at 250kHz,its peak value would have to be 6.63V which would be larger than allowed as it exceeds the maximum analog input limits.Due to the sampling nature of the analog inputs short spikes of current enter the “+”input and exit the “?”input at the clock edges during the actual conversion.These currents decay rapidly and do not cause errors as the internal com-parator is strobed at the end of a clock period.Bypass ca-pacitors at the inputs will average these currents and cause an effective DC current to flow through the output resistance of the analog signal source.Bypass capacitors should not be used if the source resistance is greater than 1k ?.This source resistance limitation is important with regard to the DC leakage currents of input multiplexer as well.The

worst-case leakage current of ±1μA over temperature will

create a 1mV input error with a 1k ?source resistance.An

op amp RC active low pass filter can provide both imped-

ance buffering and noise filtering should a high impedance

signal source be required.

DS005583-57a)Ratiometric DS005583-58

b)Absolute with a reduced Span

FIGURE 2.Reference Examples

https://www.wendangku.net/doc/9910668555.html, 16

Functional Description(Continued) 5.0

OPTIONAL ADJUSTMENTS

5.1Zero Error

The zero of the A/D does not require adjustment.If the mini-mum analog input voltage value,V IN(MIN),is not ground a zero offset can be done.The converter can be made to out-put00000000digital code for this minimum input voltage by biasing any V IN(?)input at this V IN(MIN)value.This utilizes the differential mode operation of the A/D.

The zero error of the A/D converter relates to the location of the first riser of the transfer function and can be measured by grounding the V IN(?)input and applying a small magnitude positive voltage to the V IN(+)input.Zero error is the differ-ence between the actual DC input voltage which is neces-

sary to just cause an output digital code transition from0000 0000to00000001and the ideal1?2LSB value(1?2LSB=9.8 mV for V REF=5.000V DC).

5.2Full-Scale

The full-scale adjustment can be made by applying a differ-ential input voltage which is11?2LSB down from the desired analog full-scale voltage range and then adjusting the mag-nitude of the V REF input(or V CC for the ADC0832)for a digi-tal output code which is just changing from11111110to1111 1111.

5.3Adjusting for an Arbitrary Analog Input Voltage Range

If the analog zero voltage of the A/D is shifted away from ground(for example,to accommodate an analog input signal which does not go to ground),this new zero reference should be properly adjusted first.A V IN(+)voltage which equals this desired zero reference plus1?2LSB(where the LSB is calculated for the desired analog span,using1LSB= analog span/256)is applied to selected“+”input and the zero reference voltage at the corresponding“?”input should then be adjusted to just obtain the00HEX to01HEX code tran-sition.

The full-scale adjustment should be made[with the proper V IN(?)voltage applied]by forcing a voltage to the V IN(+)in-put which is given by:

where:

V MAX=the high end of the analog input range

and

V MIN=the low end(the offset zero)of the analog range.

(Both are ground referenced.)

The V REF(or V CC)voltage is then adjusted to provide a code change from FE HEX to FF HEX.This completes the adjust-ment procedure.

6.0POWER SUPPLY

A unique feature of the ADC0838and ADC0834is the inclu-sion of a zener diode connected from the V+terminal to ground which also connects to the V CC terminal(which is the actual converter supply)through a silicon diode,as shown in Figure3.(Note3)

This zener is intended for use as a shunt voltage regulator to

eliminate the need for any additional regulating components.

This is most desirable if the converter is to be remotely lo-

cated from the system power source.Figure4and Figure5il-

lustrate two useful applications of this on-board zener when

an external transistor can be afforded.

An important use of the interconnecting diode between V+

and V CC is shown in Figure6and Figure7.Here,this diode

is used as a rectifier to allow the V CC supply for the converter

to be derived from the clock.The low current requirements of

the A/D and the relatively high clock frequencies used(typi-

cally in the range of10k–400kHz)allows using the small

value filter capacitor shown to keep the ripple on the V CC line

to well under1?4of an LSB.The shunt zener regulator can

also be used in this mode.This requires a clock voltage

swing which is in excess of V Z.A current limit for the zener is

needed,either built into the clock generator or a resistor can

be used from the CLK pin to the V+pin.

DS005583-11

FIGURE3.An On-Chip Shunt Regulator Diode

https://www.wendangku.net/doc/9910668555.html, 17

Applications DS005583-12

FIGURE

4.Operating with a Temperature

Compensated Reference

DS005583-34

FIGURE https://www.wendangku.net/doc/9910668555.html,ing the A/D as

the System Supply Regulator DS005583-35

*4.5V ≤V CC ≤6.3V FIGURE 6.Generating V CC from the Converter Clock

DS005583-36*4.5V ≤V CC ≤6.3V

FIGURE 7.Remote Sensing —

Clock and Power on 1Wire

Digital Link and Sample Controlling Software for the

Serially Oriented COP420and the Bit Programmable I/O INS8048

DS005583-13

https://www.wendangku.net/doc/9910668555.html, 18

Applications(Continued) COP

CODING EXAMPLE

Mnemonic Instruction

LEI ENABLES SIO’s INPUT AND OUTPUT SC C=1

OGI G0=0(CS=0)

CLR A CLEARS ACCUMULATOR

AISC1LOADS ACCUMULATOR WITH1

XAS EXCHANGES SIO WITH

ACCUMULATOR

AND STARTS SK CLOCK

LDD LOADS MUX ADDRESS FROM RAM

INTO ACCUMULATOR

NOP—

XAS LOADS MUX ADDRESS FROM

ACCUMULATOR TO SIO REGISTER

8INSTRUCTIONS

XAS READS HIGH ORDER NIBBLE(4BITS)

INTO ACCUMULATOR

XIS PUTS HIGH ORDER NIBBLE INTO RAM CLR A CLEARS ACCUMULATOR

RC C=0

XAS READS LOW ORDER NIBBLE INTO

ACCUMULATOR AND STOPS SK

XIS PUTS LOW ORDER NIBBLE INTO RAM OGI G0=1(CS=1)

LEI DISABLES SIO’s INPUT AND OUTPUT

8048CODING EXAMPLE

Mnemonic Instruction START:ANL P1,

#0F7H

;SELECT A/D(CS=0)

MOV B,#5;BIT COUNTER←5

MOV A,

#ADDR

;A←MUX ADDRESS LOOP1:RRC A;CY←ADDRESS BIT

JC ONE;TEST BIT

;BIT=0

ZERO:ANL P1,

#0FEH

;DI←0

JMP CONT;CONTINUE

;BIT=1

ONE:ORL P1,#1;DI←1

CONT:CALL PULSE;PULSE SK0→1→0

DJNZ B,LOOP

1

;CONTINUE UNTIL

DONE

CALL PULSE;EXTRA CLOCK FOR

SYNC

MOV B,#8;BIT COUNTER←8 LOOP2:CALL PULSE;PULSE SK0→1→0

IN A,P1;CY←DO

RRC A

RRC A

MOV A,C;A←RESULT

RLC A;A(0)←BIT AND SHIFT

MOV C,A;C←RESULT

DJNZ B,LOOP

2

;CONTINUE UNTIL

DONE

RETR

;PULSE SUBROUTINE PULSE:ORL P1,#04;SK←1

NOP;DELAY

ANL P1,

#0FBH

;SK←0

RET

https://www.wendangku.net/doc/9910668555.html, 19

Applications(Continued)

A“Stand-Alone”Hook-Up for ADC0838Evaluation

DS005583-59

*Pinouts shown for ADC0838.

For all other products tie to

pin functions as shown.

Low-Cost Remote Temperature Sensor

DS005583-60

https://www.wendangku.net/doc/9910668555.html,20

基于51单片机的ADC0832数字电压表(仿真+程序)

仿真图: /*********************************包含头文件********************************/ #include #include /*********************************端口定义**********************************/ sbit CS = P3^5; sbit Clk = P3^3; sbit DATI = P3^4; sbit DATO = P3^4; sbit P20=P2^0 ; /*******************************定义全局变量********************************/ unsigned char dat = 0x00; //AD值 unsigned char count = 0x00; //定时器计数 unsigned char CH; //通道变量 unsigned char dis[] = {0x00, 0x00, 0x00}; //显示数值 /*******************************共阳LED段码表*******************************/ unsigned char code tab[]={0xc0,0xf9,0xa4,0xb0,0x99,0x92,0x82,0xf8,0x80,0x90}; char code tablewe[]={ 0xfd,0xfb,0xf7,0xef,0xdf,0xfe }; /**************************************************************************** 函数功能:AD转换子程序 入口参数:CH 出口参数:dat ****************************************************************************/ unsigned char adc0832(unsigned char CH) {

AD转换器ADC0832程序

#include #include #define uchar unsigned char #define uint unsigned int sbit cs=P1^0; sbit clk=P1^3; sbit di=P1^4; sbit DO=P1^5; uint adval; uchar temp; uchar tab[]={0xc0,0xf9,0xa4,0xb0,0x99,0x92,0x82,0xf8,0x80,0x90,0x88,0x83,0xc6,0xa1,0x86,0x8e}; void delayms(uint ms) { uchar j; while(ms--) { for(j=0;j<120;j++); } } void ADC_start() { cs=1; _nop_(); clk=0; _nop_(); cs=0; _nop_(); di=1; _nop_(); clk=1; _nop_(); di=0; _nop_(); clk=0; _nop_(); } void ADC_read(uint ch) { uchar i; ADC_start(); if(ch==0) { clk=0; di=1; _nop_(); _nop_(); clk=1; _nop_();

_nop_(); clk=0; _nop_(); di=0; _nop_(); _nop_(); clk=1; _nop_(); _nop_(); } else { clk=0; di=1; _nop_(); _nop_(); clk=1; _nop_(); _nop_(); clk=0; _nop_(); di=1; _nop_(); _nop_(); clk=1; _nop_(); _nop_(); } clk=1; _nop_(); clk=0; for(i=0;i<8;i++) { di=1; if(DO) { temp=(temp|0x01); } else { temp=(temp&0xfe); } clk=0; _nop_(); clk=1; temp=temp<<1; } adval=temp;

51单片机驱动ADC0832模数转换程序lcd1602显示

51单片机驱动ADC0832模数转换程序 -lcd1602显示 /*这个芯应用不多*/ #include ; #define uchar unsigned char #define uint unsigned int uchar Chan0Value,Chan1Value; sbit RS=P1^0; //1602各控制脚 sbit RW=P1^1; sbit EN=P1^2; sbit Cs0832= P2^0; //0832各控制脚 sbit Clk0832= P3^6; sbit Di0832= P3^7; sbit Do0832= P3^7; void delay1ms(unsigned int ms)//延时1毫秒(不够精确的) { int i,j; for(i=0;i;>;i; }

for(i=0;i<8;i++) //从低到高取一次数 { if(Do0832) Dat2|=0x01<

基于单片机的数字电压表制作——ADC0832模数转换应用程序(C语言)

基于单片机的数字电压表制作——ADC0832模数转换应用程序(C语言) 主要部件:AT89S51 ADC0832 八段数码管 关键字:ADC0832程序C语言数字电压表 本文所描述的数字电压表是利用ADC0832模数转换芯片完成的。该芯片能将0~5V的模拟电压量转换为0~255级的数字量,所以本文描述的数字电压表的量程为0~5V。 说实在话,量程只有5V的电压表没有什么实际的意义,而且也没有人无聊到自己会去做一个没有意义的电压表。但是通过这个简易电压表的制作你可以对模数转换芯片有一定的了解,对以后做真正有用的电路打下基础。而且,对于那些做毕业设计的同学也是一种参考。这也就是本文的意义所在。 ADC0832的资料百度一下可以找到一大堆,我就不在这里赘述了。这里只给出连接图。 以下是程序部分: 该程序是本人自编的,经测试可用,但不保证程序的可靠性及稳定性。若有转载请标明出处。 如果有同学将本程序烧写到单片机里却不能正常工作的,请注意以下三点: 1、是否将端口重新定义。每个单片机开发板的引脚连接都是不一样的,若不加修改直接把程序烧写到单片机里,那是绝对不能正常工作的。 2、是否正确选择通道值。ADC0832有两个模拟输入端口(也就是我说的通道),你要先弄清楚你用的

是那个通道,并在main函数中设置相应的通道值(以CH命名的那个变量)。本程序默认使用0通道,如果0通道不行就改成1通道,反正不是0通道就是1通道。 3、如果你做的电压表在保证电路连接正确且没有以上两点问题的情况下,还是不能正常工作,请将程序中的“if (adval == test)”这一行删掉。其实这一点我个人也不清楚到底有没有问题。我有两个单片机开发板,其中一个必须要把那一行删掉才能工作。这说明ADC0832读出的前8位与后8位数值不一样(确切的说应该是后8位反转的数值),这有悖于ADC0832的原理。我不知道到底是硬件还是软件出了问题,特此把这种现象标明。若有哪位同学知道其原因的还请多多指教。 /***********************************************************************************/ /*简易数字电压表制作——ADC0832模数转换应用程序(C语言版)*/ /*目标器件:AT89S51 */ /*晶 振:12.000MHZ */ /*编译环境:Keil uVision2 V2.12 */ /***********************************************************************************/ /*********************************包含头文件********************************/ #include #include /*********************************端口定义**********************************/ sbit CS = P3^5; sbit Clk = P3^4; sbit DATI = P3^3; sbit DATO = P3^3; /*******************************定义全局变量********************************/ unsigned char dat = 0x00; //AD值 unsigned char count = 0x00; //定时器计数 unsigned char CH; //通道变量

实验十ADC0832数模转换的显示

实验报告十 实验名称:ADC0832数模转换的显示 目的:ADC0832是8脚双列直插式双通道A/D转换器,能分别对两路模拟信号实现模—数转换,可以用在单端输入方式和差分方式下工作。ADC0832采用串行通信方式,通过DI 数据输入端进行通道选择、数据采集及数据传送。8位的分辨率(最高分辨可达256级),可以适应一般的模拟量转换要求。其内部电源输入与参考电压的复用,使得芯片的模拟电压输入在0~5V之间。具有双数据输出可作为数据校验,以减少数据误差,转换速度快且稳定性能强。独立的芯片使能输入,使多器件挂接和处理器控制变的更加方便。 ADC0832的工作原理: 正常情况下ADC0832 与单片机的接口应为4条数据线,分别是CS、CLK、DO、DI。但由于DO端与DI端在通信时并未同时使用并与单片机的接口是双向的,所以在I/O口资源紧张时可以将DO和DI并联在一根数据线上使用。当ADC0832未工作时其CS输入端应为高电平,此时芯片禁用,CLK 和DO/DI 的电平可任意。当要进行A/D转换时,须先将CS使能端置于低电平并且保持低电平直到转换完全结束。此时芯片开始转换工作,同时由处理器向芯片时钟(CLK)输入端输入时钟脉冲,DO/DI端则使用DI端输入通道功能选择的数据信号。在第一个时钟脉冲的下沉之前DI端必须是高电平,表示启始信号。在第二、三个脉冲下沉之前DI端应输入两位数据用于选择通道功能。 通道地址通道 工作方式说明 SGL/DIF ODD/SIGN 0 1 0 0 + - 差分方式 0 1 - + 1 0 + 单端输入方式 1 1 + 表1:通道地址设置表 如表1所示,当此两位数据为“1”、“0”时,只对CH0 进行单通道转换。当2位数据为“1”、“1”时,只对CH1进行单通道转换。当两位数据为“0”、“0”时,将CH0作为正输入端IN+,CH1作为负输入端IN-进行输入。当两位数据为“0”、“1”时,将CH0作为负输入端IN-,CH1 作为正输入端IN+进行输入。到第三个脉冲的下降之后DI端的输入电平就失去输入作用,此后DO/DI端则开始利用数据输出DO进行转换数据的读取。从第4个脉冲下降沿开始由DO端输出转换数据最高位Data7,随后每一个脉冲的下降沿DO端输出下一位数据。直到第11个脉冲时发出最低位数据Data0,一个字节的数据输出完成。也正是从此位开始输出下一个相反字节的数据,即从第11个字节的下降沿输出Data0。随后输出8位数据,到第19 个脉冲时数据输出完成,也标志着一次A/D 转换的结束。最后将CS置高电平禁用芯片,直接将转换后的数据进行处理就可以了。时序说明请参照图4。

ADC0832

https://www.wendangku.net/doc/9910668555.html, 电子技术—创造独立资源! AD转换芯片ADC0832的应用 https://www.wendangku.net/doc/9910668555.html, 原创(本文曾刊载于《电子制作》第 142期) V2.0 2007.2.11 目录 1. 概要 (1) 1.1 简介 (1) 1.2 接口示意图 (1) 1.3 芯片接口说明 (1) 2. 单片机对ADC0832的控制原理 (2) 2.1 ADC0832与单片机的接口电路 (2) 3. ADC0832芯片接口程序的编写 (4) 3.1 ADC0832数据读取程序流程 (4) 3.2 ADC0832芯片接口程序[汇编] (4) 版本信息 (6)

https://www.wendangku.net/doc/9910668555.html, 原创 1. 概要 1.1 简介 ADC0832是美国国家半导体公司生产的一种8位分辨率、双通道A/D转换芯片。由于它体积小,兼容性强,性价比高而深受单片机爱好者及企业欢迎,其目前已经有很高的普及率。学习并使用 ADC0832可是使我们了解A/D转换器的原理,有助于我们单片机技术水平的提高。 ADC0832具有以下特点: 8位分辨率; 双通道A/D转换; 输入输出电平与TTL/CMOS相兼容; 5V电源供电时输入电压在0~5V之间; 工作频率为250KHZ,转换时间为32μS; 一般功耗仅为15mW; 8P、14P—DIP(双列直插)、PICC多种封装; 商用级芯片温宽为0°C to +70°C? ,工业级芯片温宽为40°C to +85°C; 1.2 接口示意图 1.3 芯片接口说明 CS_ 片选使能,低电平芯片使能。 CH0 模拟输入通道0,或作为IN+/-使用。 CH1 模拟输入通道1,或作为IN+/-使用。 GND 芯片参考0电位(地)。 DI 数据信号输入,选择通道控制。 DO 数据信号输出,转换数据输出。 CLK 芯片时钟输入。 Vcc/REF 电源输入及参考电压输入(复用)。

ADC0832应用

ADC0832应用 这一课我们来学习ADC0832芯片的应用。模-数(AD)和数-模(DA)转换是模拟电路和数字电路进行沟通的渠道,从前面的课程我们知道,数字电路里,电平只有高和低两种状态,比如5V和0V,对应着1和0;模拟电路里,电平则理论上有无数个状态,比如0V、0.1V、0.2V…等等。如何将模拟电平值在数字电路里表达出来呢?这就需要AD转换过程,同理的,也有DA转换过程。这一课,我们就利用实验板上的ADC0832芯片来实AD转换这一过程。ADC0832是美国国家半导体公司生产的一种8位分辨率、双通道A/D转换芯片。由于它体积小,兼容性强,性价比高而深受单片机爱好者及企业欢迎,其目前已经有很高的普及率。学习并使用ADC0832可是使我们了解A/D转换器的原理,有助于我们单片机技术水平的提高。ADC0832具有以下特点:● 8位分辨率;● 双通道A/D转换;● 输入输出电平与TTL/CMOS相兼容;● 5V电源供电时输入电压在0~5V之间;● 工作频率为250KHZ,转换时间为32μS;● 一般功耗仅为15mW;● 8P、14P—DIP(双列直插)、PICC多种封装;● 商用级芯片温宽为0°C to +70°C?,工业级芯片温宽为40℃ to +85℃ 下面看看它的引脚及功能。

图一ADC0832为8位分辨率A/D转换芯片,其最高分辨可达256级,可以适应一般的模拟量转换要求。其内部电源输入与参考电压的复用,使得芯片的模拟电压输入在0~5V之间。芯片转换时间仅为32μS,据有双数据输出可作为数据校验,以减少数据误差,转换速度快且稳定性能强。独立的芯片使能输入,使多器件挂接和处理器控制变的更加方便。通过DI数据输入端,可以轻易的实现通道功能的选择。正常情况下ADC0832与单片机的接口应为4条数据线,分别是CS、CLK、DO、DI。但由于DO端与DI端在通信时并未同时有效并与单片机的接口是双向的,所以电路设计时可以将DO和DI并联在一根数据线上使用。我们看看在实验板上它是怎么连接的。

adc0832数字电压表(程序+仿真图)

adc0832数字电压表(程序+仿真图)

仿真图: /*********************************包含头文件********************************/ #include #include /*********************************端口定义**********************************/ sbit CS = P3^5;

sbit Clk = P3^3; sbit DATI = P3^4; sbit DATO = P3^4; sbit P20=P2^0 ; /*******************************定义全局变量********************************/ unsigned char dat = 0x00; //AD值 unsigned char count = 0x00; //定时器计数 unsigned char CH; //通道变量 unsigned char dis[] = {0x00, 0x00, 0x00}; //显示数值 /*******************************共阳LED 段码表*******************************/

unsigned char code tab[]={0xc0,0xf9,0xa4,0xb0,0x99,0x92,0x82,0xf8, 0x80,0x90}; char code tablewe[]={ 0xfd,0xfb,0xf7,0xef,0xdf,0xfe }; /**************************************** ************************************ 函数功能:AD转换子程序 入口参数:CH 出口参数:dat ***************************************** ***********************************/ unsigned char adc0832(unsigned char CH) {

ADC0832中文数据手册

A/D转换芯片ADC0832的应用 2005年10月11日 ADC0832是美国国家半导体公司生产的一种8位分辨率、双通道A/D转换芯片。由于它体积小,兼容性强,性价比高而深受单片机爱好者及企业欢迎,其目前已经有很高的普及率。学习并使用ADC0832可是使我们了解A/D转换器的原理,有助于我们单片机技术水平的提高。 ADC0832具有以下特点: ·8位分辨率; ·双通道A/D转换; ·输入输出电平与TTL/CMOS相兼容; ·5V电源供电时输入电压在0~5V之间; ·工作频率为250KHZ,转换时间为32μS; ·一般功耗仅为15mW; ·8P、14P—DIP(双列直插)、PICC多种封装; ·商用级芯片温宽为0°C to +70°C,工业级芯片温宽为?40°C to +85°C; 芯片顶视图:(图1、图2) 图1图2

芯片接口说明: · CS_ 片选使能,低电平芯片使能。 · CH0 模拟输入通道0,或作为IN+/-使用。 · CH1 模拟输入通道1,或作为IN+/-使用。 · GND 芯片参考0电位(地)。 · DI 数据信号输入,选择通道控制。 · DO 数据信号输出,转换数据输出。 · CLK 芯片时钟输入。 · Vcc/REF 电源输入及参考电压输入(复用)。 ADC0832与单片机的接口电路: 图3 w w w .t a i -y a n .c o m /b b s 电子工程技术论坛: IC资料查询网站:电子器件采购平台:https://www.wendangku.net/doc/9910668555.html, https://www.wendangku.net/doc/9910668555.html, https://www.wendangku.net/doc/9910668555.html,/bbs

ADC0832为8位分辨率A/D 转换芯片,其最高分辨可达256级,可以适应 一般的模拟量转换要求。其内部电源输入与参考电压的复用,使得芯片的模拟电压输入在0~5V 之间。芯片转换时间仅为32μS ,据有双数据输出可作为数据校验,以减少数据误差,转换速度快且稳定性能强。独立的芯片使能输入,使多器件挂接和处理器控制变的更加方便。通过DI 数据输入端,可以轻易的实现通道功能的选择。 单片机对ADC0832的控制原理: 正常情况下ADC0832与单片机的接口应为4条数据线,分别是CS 、CLK 、DO 、DI 。但由于DO 端与DI 端在通信时并未同时有效并与单片机的接口是双向的,所以电路设计时可以将DO 和DI 并联在一根数据线上使用。(见图3) 当ADC0832未工作时其CS 输入端应为高电平,此时芯片禁用,CLK 和DO/DI 的电平可任意。当要进行A/D 转换时,须先将CS 使能端置于低电平并且保持低电平直到转换完全结束。此时芯片开始转换工作,同时由处理器向芯片时钟输入端CLK 输入时钟脉冲,DO/DI 端则使用DI 端输入通道功能选择的数据信号。在第1个时钟脉冲的下沉之前DI 端必须是高电平,表示启始信号。在第2、3个脉冲下沉之前DI 端应输入2位数据用于选择通道功能,其功能项见表1。 表1 w w w .t a i -y a n .c o m /b b s 电子工程技术论坛: IC资料查询网站:电子器件采购平台:https://www.wendangku.net/doc/9910668555.html, https://www.wendangku.net/doc/9910668555.html, https://www.wendangku.net/doc/9910668555.html,/bbs

ADC0832驱动子程序

1.A D C0832驱动子程序#include #include //常用汇编指令引用。 unsigned char tab[]={0xc0,0xf9,0xa4,0xb0,0x99,0x92,0x83,0xf8,0x80,0x98}; //共阳代码 //接口电路 sbit AD0832_CS = P3^5 ; //片选信号 sbit AD0832_CLK = P3^6; //时钟接口 sbit AD0832_DI = P3^7; //数据接口 void main( void) { unsigned char i=0 , x =0 , y = 0 ; unsigned int temp=0; while(1) { //时钟12Mhz,整个转换时间为224us //使用芯片准备(参考PDF时序图) AD0832_CLK = 0 ; //时钟置低平 AD0832_DI = 1 ; //开始信号为高电平 AD0832_CS = 0 ; //片选信号置低,启动AD转换芯片 //输入开始信号(构成一个正脉冲) _nop_(); AD0832_CLK = 1 ; //时钟上升沿,输入开始信号 _nop_(); AD0832_CLK = 0 ; //时钟下降沿

//模拟信号输入模式选择(1:单模信号,0:双模差分信号) AD0832_DI = 1 ; _nop_(); AD0832_CLK = 1 ; //时钟上升沿,输入开始信号 _nop_(); AD0832_CLK = 0 ; //时钟下降沿 //模拟信号输入通道选择(1:通道CH1,0:通道CH0) AD0832_DI = 0 ; //选择通道0 _nop_(); AD0832_CLK = 1 ; //时钟上升沿,输入开始信号 _nop_(); AD0832_CLK = 0 ; //时钟下降沿 /////////////////////////////////////////// AD0832_DI = 1 ; //数据线置高,准备接收数据 for(i = 0 ; i<8 ; i++) //从高位移入数据 { AD0832_CLK = 1 ; _nop_(); AD0832_CLK = 0 ; //时钟下降沿,AD0832输出数据,高位(MSB)先x = x<<1; //数据左移位,补0 if(AD0832_DI ==1) x = x | 0x01; //如果数据为“1”,移入1, } //如果数据为“0”,移入0, for(i = 0 ; i<8 ; i++) //从低位移入数据

单片机和ADC0832的AD模数转换

单片机和ADC0832的AD模数转换 在工业控制和智能化仪表中,通常由微型计算机进行实时控制及实时数据处理。计算机所加工的信息总是数字量,而被控制或被测量的有关参量往往是连续变化的模拟量,如温度、速度、压力等等,与此对应的电信号是模拟信号。模拟量的存储和处理比较困难,不适合作为远距离传输且易受干扰。在一般的工业应用系统中传感器把非电量的模拟信号变成与之对应的模拟信号,然后经模拟(Analog)到数字(Digital)转换电路将模拟信号转成对应的数字信号送微机处理。这就是一个完整的信号链,模拟到数字的转换过程就是我们经常接触到的ADC(Analog to Digital Convert)电路。 模-数转换(ADC)简介 模-数转换原理 ADC的转换原理根据ADC的电路形式有所不同。ADC电路通常由两部分组成,它们是:采样、保持电路和量化、编码电路。其中量化、编码电路是最核心的部件,任何ADC转换电路都必须包含这种电路。ADC电路的形式很多,通常可以并为两类:间接法:它是将采样-保持的模拟信号先转换成与模拟量成正比的时间或频率,然后再把它转换为数字量。这种通常是采用时钟脉冲计数器,它又被称为计数器式。它的工作特点是:工作速度低,转换精度高,抗干扰能力强。 直接法:通过基准电压与采样-保持信号进行比较,从而转换为数字量。它的工作特点是:工作速度高,转换精度容易保证。 模—数转换的过程有四个阶段,即采样、保持、量化和编码。 采样是将连续时间信号变成离散时间信号的过程。经过采样,时间连续、数 值连续的模拟信号就变成了时间离散、数值连续的信号,称为采样信号。采样电路相当于一个模拟开关,模拟开关周期性地工作。理论上,每个周期内,模拟开关的闭合时间趋近于0。在模拟开关闭合的时刻(采样时刻),我们就“采”到模拟信号的一个“样本”。 量化是将连续数值信号变成离散数值信号的过程。理论上,经过量化,我们 就可以将时间离散、数值连续的采样信号变成时间离散、数值离散的数字信号。 我们知道,在电路中,数字量通常用二进制代码表示。因此,量化电路的后 面有一个编码电路,将数字信号的数值转换成二进制代码。 然而,量化和编码总是需要一定时间才能完成,所以,量化电路的前面还要 有一个保持电路。保持是将时间离散、数值连续的信号变成时间连续、数值离散信号的过程。在量化和编码期间,保持电路相当于一个恒压源,它将采样时刻的信号电压“保持”在量化器的输入端。虽然逻辑上保持器是一个独立的单元,但是,工程上保持器总是与采样器做在一起。两者合称采样保持器。 八位串行A/D转换器ADC0832简介 — ADC0832 是美国国家半导体公司生产的一种8 位分辨率、双通道A/D转换芯片。由于它体积小,兼容性强,性价比高而深受单片机爱好者及企业欢迎,其目前已经有很高的普及率。ADC083X是市面上常见的串行模—数转换器件系列。ADC0831、ADC0832、ADC0834、ADC0838是具有多路转换开关的8位串行I/O模—数转换器,转换速度较高(转换时间32uS),单电源供电,功耗低(15mW),适用于各种便携式智能仪表。本章以ADC0832为例,介绍其使用方法。

单片机驱动ADC0832模数转换程序

单片机驱动ADC0832模数转换程序 ADC0832是美国国家半导体公司生产的一种8位分辨率、双通道A/D转换芯片。 ADC0832具有以下特点: 8位分辨率; 双通道A/D转换; 输入输出电平与TTL/CMOS相兼容; 5V电源供电时输入电压在0~5V之间; 工作频率为250KHZ,转换时间为32μS; 一般功耗仅为15mW; 8P、14P—DIP(双列直插)、PICC多种封装; 商用级芯片温宽为0°C to +70°C?,工业级芯片温宽为40℃ to +85℃ 模数转换芯片是用来模拟信号转为数字信号以便电脑处理的,可以用来对传感器的数据进行收集分析。本来想买ADC0809的,它可以对8个模拟量进行采集,假如是一个脚用三个压力传感器,那就正好够用了。这个ADC0832是跟单片机开发板一个淘宝店买的,因为那个淘宝店没有ADC0809。网上搜了个ADC0832的转换函数,拼了个程序在开发板的四位数码管上显示转换过来的数据,要注意的是那个显示函数是调一次只显示四位数码

管的一位的,所以不能转换显示转换显示这样,要转换,显示一次二次三次四次,转换,显示一次二次三次四次 这样。ADC0832引脚及代码如下:(一晚没睡,等下准备回家过清明扫墓去。归去来兮!问西楼禁烟何处好?绿 野晴天道。马穿杨柳嘶,人倚秋千笑,探莺花总教春醉倒。)

//头文件: #include ; #include ;

//变量定义: unsigned char ly_dis[4]; //定义显示缓冲区 code unsigned char table[]={0xc0,0xf9,0xa4,0xb0,0x99,0x92,0x82,0xf8, 0x80,0x90};//表:共阳数码管 0-9 unsigned char l_posit=0; //显示位置 //引脚定义: sbit SMG_q = P3^4; //定义数码管阳级控制脚(千位)sbit SMG_b = P3^5; //定义数码管阳级控制脚(百位)sbit SMG_s = P3^7; //定义数码管阳级控制脚(十位)sbit SMG_g = P3^6; //定义数码管阳级控制脚(个位) sbit CS = P0^5; sbit Clk = P0^6; sbit DATI = P0^4; sbit DATO = P0^4; unsigned char dat = 0x00; //AD值 unsigned char count = 0x00;

ADC0832驱动程序

#include #include #define uchar unsigned char sbit AD_clk=P3^4; sbit AD_cs=P3^5; sbit AD_do=P3^3; sbit AD_di=P3^3; void delay(unsigned int ms) { unsigned int i ,j; for(i=ms;i>0;i--) for(j=110;j>0;j--); } uchar AD(bit dao) { uchar i; uchar ad0,ad1; ad_change: ad0=0x00; ad1=0x00; AD_cs=0; _nop_(); AD_clk=0; _nop_(); AD_di=1; _nop_(); AD_clk=1; //1 //单通道0~10. 1~11 双通道0+~00 。0—~01 AD_clk=0; //1.5 AD_di=1; //选择dif AD_clk=1; //2 _nop_(); AD_clk=0; //2.5 AD_di=dao; //选择ood //通道选择完毕 AD_clk=1; //3 _nop_(); AD_clk=0; //3.5 _nop_(); // AD_di=1;

for(i=8;i>0;i--) { AD_clk=1; //4 ad0<<=1; AD_clk=0; //4.5 if(AD_do) ad0|=0x01; else ad0|=0x00; } for(i=8;i>0;i--) { ad1>>=1; //从低位向高位读取八位AD值 if(AD_do) ad1|=0x80; else ad1|=0x00; AD_clk=1; _nop_(); AD_clk=0; } if(ad0!=ad1) goto ad_change; else { AD_cs=1; AD_do=1; AD_clk=1; return ad0; } } void main() { uchar a; delay(2000); while(1) { a=AD(0); P2=a; delay(200); }

ADC0832的应用电路与源程序

A D C0832具有以下特点: ·8位分辨率; ·双通道A/D转换; ·输入输出电平与T T L/C M O S相兼容; ·5V电源供电时输入电压在0~5V之间; ·工作频率为250K H Z,转换时间为32μS; ·一般功耗仅为15m W; ·8P、14P—D I P(双列直插)、P I C C多种封装; ·商用级芯片温宽为0°C t o+70°C,工业级芯片温宽为?40°C t o+85°C; A D C0832芯片接口说明: ·C S_片选使能,低电平芯片使能。 ·C H0模拟输入通道0,或作为I N+/-使用。 ·C H1模拟输入通道1,或作为I N+/-使用。 ·G N D芯片参考0电位(地)。 ·D I数据信号输入,选择通道控制。 ·D O数据信号输出,转换数据输出。 ·C L K芯片时钟输入。 ·V c c/R E F电源输入及参考电压输入(复用)。 A D C0832为8位分辨率A/D转换芯片,其最高分辨可达256级,可以适应一般的模拟量转换要求。其内部电源输入与参考电压的复用,使得芯片的模拟电压输入在0~5V之间。芯片转换时间仅为32μS,据有双数据输出可作为数据校验,以减少数据误差,转换速度快且稳定性能强。独立的芯片

使能输入,使多器件挂接和处理器控制变的更加方便。通过D I数据输入端,可以轻易的实现通道功能的选择。 单片机对A D C0832的控制原理: 正常情况下A D C0832与单片机的接口应为4条数据线,分别是C S、C L K、D O、D I。但由于D O端与D I端在通信时并未同时有效并与单片机的接口是双向的,所以电路设计时可以将D O和D I并联在一根数据线上使用。当A D C0832未工作时其C S输入端应为高电平,此时芯片禁用,C L K和D O/D I 的电平可任意。当要进行A/D转换时,须先将C S使能端置于低电平并且保持低电平直到转换完全结束。此时芯片开始转换工作,同时由处理器向芯片时钟输入端C L K输入时钟脉冲,D O/D I端则使用D I端输入通道功能选择的数据信号。在第1个时钟脉冲的下沉之前D I端必须是高电平,表示启始信号。在第2、3个脉冲下沉之前D I端应输入2位数据用于选择通道功能,其功能项见下图。 当此2位数据为“1”、“0”时,只对C H0进行单通道转换。当2位数据为“1”、“1”时,只对C H1进行单通道转换。当2位数据为“0”、“0”时,将C H0作为正输入端I N+,C H1作为负输入端I N-进行输入。当2位数据为“0”、“1”时,将C H0作为负输入端I N-,C H1作为正输入端I N+进行输入。到第3个脉冲的下沉之后D I端的输入电平就失去输入作用,此后D O/D I端则开始利用数据输出D O进行转换数据的读取。从第4个脉冲下沉开始由D O端输出转换数据最高位D ATA7,随后每一个脉冲下沉D O端输出下一位数据。直到第11个脉冲时发出最低位数据D ATA0,一个字节的数据输出完成。也正是从此位开始输出下一个相反字节的数据,即从第11个字节的下沉输出D AT D0。随后输出8位数据,到第19个脉冲时数据输出完成,也标志着一次A/D转换的结束。最后将C S置高电平禁用芯片,直接将转换后的数据进行处理就可以了。 A D C0832具体时序图如下:

ADC0832程序完整版 源码+Proteus仿真

前段时间一直在为ADC0832的程序感到疑惑,从网上找了很多的代码,用Proteus仿真,最后都出现了一些奇怪的问题,有的根本没法读取数据,有的数据有错误。 当参考电压为5V时,如果把输入电压从0一直调到5V,读取的数据应该是从0到255,2.5V时应该是128。但是我发现一些源码在输入0~2.5V时读取出来的是0~255,到2.5V时读取的数据为0,从2.5到5V,读出的值又从0增加到255,始终不正确。今天下午特地查阅的ADC0832英文原版的DataSheet,又参考了一篇中文文档,终于写出了其完整的程序,并且先后读取了MSB FIRST DATA和LSB FIRST DATA,进行比较,如果两个数据相等,返回读取的数据,否则返回0,这样可以避免读取发生错误,更稳定可靠。并通过了Proteus 仿真。 下图是ADC0832的时序图: 其中T-SetUp为250ns,由于使用的是51单片机,晶振11.0592MHz,机器周期比这个值大,可以不考虑,但为了防止出现异常,还是延时了两个机器周期。注意在第11个时钟下降沿之后,DO上的电平既是MSB FIRST 输出的最后一位,又是LSB FIRST输出的第一位。以下是读取ADC0832的代码。 [cpp] view plaincopysbit CS_0832 = P1^0; sbit CLK_0832 = P1^1; sbit DO_0832 = P1^2; // DI、DO不同时有效,可共用一个接口 sbit DI_0832 = P1^2; extern void _nop_ ( void ); #define pulse0832() _nop_();_nop_();CLK_0832=1;_nop_();_nop_();CLK_0832=0 //把模拟电压值转换成8位二进制数并返回 unsigned char read0832()

ADC0832程序完整版 源码

ADC0832程序完整版源码+Proteus仿真 来源:互联网作者: 前段时间一直在为ADC0832的程序感到疑惑,从网上找了很多的代码,用Proteus 仿真,最后都出现了一些奇怪的问题,有的根本没法读取数据,有的数据有错误。 当参考电压为5V时,如果把输入电压从0一直调到5V,读取的数据应该是从0到255,2.5V时应该是128。但是我发现一些源码在输入0~2.5V时读取出来的是0~255,到2.5V时读取的数据为0,从2.5到5V,读出的值又从0增加到255,始终不正确。今天下午特地查阅的ADC0832英文原版的DataSheet,又参考了一篇中文文档,终于写出了其完整的程序,并且先后读取了MSB FIRST DATA和LSB FIRST DATA,进行比较,如果两个数据相等,返回读取的数据,否则返回0,这样可以避免读取发生错误,更稳定可靠。并通过了Proteus仿真。 下图是ADC0832的时序图: 其中T-SetUp为250ns,由于使用的是51单片机,晶振11.0592MHz,机器周期比这个值大,可以不考虑,但为了防止出现异常,还是延时了两个机器周期。注意在第11个时钟下降沿之后,DO上的电平既是MSB FIRST输出的最后一位,又是LSB FIRST 输出的第一位。以下是读取ADC0832的代码。 [cpp] view plaincopysbit CS_0832 = P1^0; sbit CLK_0832 = P1^1; sbit DO_0832 = P1^2; // DI、DO不同时有效,可共用一个接口

sbit DI_0832 = P1^2; extern void _nop_ ( void ); #define pulse0832() _nop_();_nop_();CLK_0832=1;_nop_();_nop_();CLK_0832=0 //把模拟电压值转换成8位二进制数并返回 unsigned char read0832() { unsigned char i, ch = 0, ch1 = 0; CS_0832=0; // 片选,DO为高阻态 DI_0832=1; // 此处暂停T-SetUp: 250ns (由pulse0832完成) pulse0832(); // 第一个脉冲,起始位,DI置高 DI_0832=1; pulse0832(); // 第二个脉冲,DI=1表示双通道单极性输入DI_0832=1; pulse0832(); // 第三个脉冲,DI=1表示选择通道1(CH2) // 51单片机为准双向IO口:应先写入1再读取 DI_0832=1; // MSB FIRST DATA for(i = 0; i < 8; ++i) { pulse0832(); ch<<= 1; if(DO_0832==1) ch |= 0x01; }

adc0832模块程序

/* ADC0832差分00工作方式*/ #include #include"adc0832.h" #include"1602.h" sbit ADC_CS =P2^0; sbit ADC_CLK=P2^1; sbit ADC_DO =P2^2; sbit ADC_DI =P2^3; unsigned char adval; unsigned char ReadADC(void) //把模拟电压值转换成8位二进制数并返回{ unsigned char i,ch,bb,cc,dd; ch=0; ADC_CS=0; ADC_DO=0;//片选,DO为高阻态 for(i=0;i<10;i++) {;} ADC_CLK=0; delay(2); ADC_DI=1; ADC_CLK=1; delay(2); //第一个脉冲,起始位 ADC_CLK=0; delay(2); ADC_DI=1; ADC_CLK=1; delay(2); //第二个脉冲,DI=1表示双通道单极性输入 ADC_CLK=0; delay(2); ADC_DI=1; ADC_CLK=1; delay(2); //第三个脉冲,DI=1表示选择通道1(CH2) ADC_DI=0; ADC_DO=1;//DI转为高阻态,DO脱离高阻态为输出数据作准备 ADC_CLK=1; delay(2); ADC_CLK=0; delay(2);//经实验,这里加一个脉冲AD便能正确读出数据, //不加的话读出的数据少一位(最低位d0读不出?

for(i=0;i<8;i++) { ADC_CLK=1; delay(2); ADC_CLK=0; delay(2); ch=(ch<<1)|ADC_DO;//在每个脉冲的下降沿DO输出一位数据,最终ch为8位二进制数 } ADC_CS=1;//取消片选,一个转换周期结束 adval=ch; returnadval; }

相关文档