Teach you how to read the timing diagram of the microcontroller peripheral A/D converter ADC0804

Publisher:SereneNatureLatest update time:2018-11-19 Keywords:MCU Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

As shown in the figure, this is a type of single-chip AD converter:


ADC0804 is a monolithic integrated A/D converter. It uses a 20-pin integrated chip with CMOS technology, a resolution of 8 bits, a conversion time of 100µs, and an input voltage range of 0 to 5V. The chip has a three-state output data latch that can be directly connected to the data bus.


1.jpg 


The names and functions of each pin are as follows:


VIN(+), VIN(-) - two analog signal input terminals, used to receive unipolar, bipolar and differential input signals.


DB7~DB0——Digital signal output port with three-state characteristics.


AGND——Analog signal ground.


DGND——digital signal ground.


CLK——Clock signal input terminal.


CLKR - The external resistor end of the internal clock generator, which cooperates with the CLK end to generate clock pulses by the chip itself, and its frequency is 1/(1.1RC).


CS#---Chip select signal input terminal, low level is valid. Once CS# is valid, it indicates that the A/D converter is selected and can start working.


WR#---Write signal input, low level starts A/D conversion.


RD#---Read signal input, low level output terminal is valid.


INTR#---A/D conversion end signal, low level is valid to indicate that the conversion is completed.


VREF/2---Reference level input, determines the quantization unit.


VCC---Chip power 5V input.


Opening the data sheet of ADC0804, we can see the following typical circuit connection:


2.png


We can draw it using simulation software:

3.png


Next, let's analyze how the above figure works:


①The chip select terminal CS of ADC0804 is connected to the Q7 output terminal of U2 latch. We can control CS by controlling the latch. The reason for this connection is that the TX-1C experimental board has too many peripheral expansions and there are no extra I/O ports to independently control the CS terminal of ADC0804, so U2 is selected.


② VIN(+) is connected to the middle sliding end of the potentiometer, and VIN(-) is grounded, because these two ends can input differential voltage, that is, it can measure the voltage between VIN(+) and VIN(-). When VIN(-) is grounded, the voltage at the VIN(+) end is the analog input voltage of ADC0804. A 10kΩ resistor is connected in series between VIN(+) and the potentiometer to limit the current flowing into the VIN(+) end to prevent the A/D chip from being burned out due to excessive current. When the ADIN pin is shorted with a shorting cap, the middle sliding end of the potentiometer is connected to VIN(+) through resistor R12. At this time, when the potentiometer knob is adjusted, the voltage at the middle sliding end changes from 0 to VCC, and then the digital output end of ADC0804 also changes from 0x00 to 0xFF.


③ The resistor and capacitor form an RC oscillator circuit between CLKR, CLR and GND to provide the pulses required for the ADC0804 to work. The frequency of the pulse is 1/(1.1RC). According to the chip manual, R is 10kΩ and C is 150pF. In order to reduce the number of components and facilitate welding on the TX-1C experimental board, C uses a 104 magnetic chip capacitor. When designing your own circuit, you can choose a 150pF capacitor, otherwise it will affect the A/D conversion rate.


④ Use two 1kΩ resistors to divide the VREF/2 terminal to get the VCC/2 voltage, that is, 2.5V, which is used as the internal reference voltage when the A/D chip is working.


⑤WR# and RD# are connected to the P3.6 and P3.7 pins of the microcontroller respectively, and the digital output terminal is connected to the P1 port of the microcontroller.


⑥ Connect AGND and DGND to the GND of the experimental board at the same time. When we design products, if we use A/D and D/A, these chips generally provide independent analog ground (AGND) and digital ground (DGND) pins. In order to achieve high accuracy and good stability, it is best to connect the analog ground and digital ground of all devices separately, and finally connect the analog ground and digital ground at only one point.


⑦ INTR# pin is not connected. The interrupt method is not used to read A/D data on the TX-1C experimental board, so this pin can be disconnected. When operating a digital chip, its operation timing diagram must be analyzed first. Figure 4.4.6 is the start conversion timing diagram of ADC0804.


ADC0804 conversion timing diagram:


From the analysis of Figure 4.4.6, we can see that CS is low first, and then WR# is set low. After at least tW(WR#)L time, WR# is pulled high, and then the A/D converter is started. After (1 to 8 A/D clock cycles + internal TC) time, the analog/digital conversion is completed, and the conversion result is stored in the data latch. At the same time, INTR automatically becomes low, notifying the microcontroller that the conversion has ended. The size of the several times is explained in the chip manual.


When I write a microcontroller program to start A/D conversion, I have to follow the above timing. Since the TX-1C experimental board does not use interrupts to read A/D data, we wait for a while after starting A/D conversion, and then directly read the A/D digital output port. After reading, start an A/D conversion, and so on. Figure 4.4.7 is the timing diagram of ADC0804 reading data.


4.png


From the above figure, we can see that CS is low first, then WR# is set low, and after at least tW(WR#)L time, WR# is pulled high, and then the A/D converter is started, and after (1 to 8 A/D clock cycles + internal TC) time, the analog/digital conversion is completed, and the conversion result is stored in the data latch. At the same time, INTR automatically becomes low, notifying the microcontroller that the conversion has ended. The size of the several times is explained in the chip manual.


When I write a microcontroller program to start A/D conversion, I have to follow the above timing. Since the TX-1C experimental board does not use interrupts to read A/D data, we wait for a while after starting the A/D conversion, and then directly read the A/D digital output port. After reading, start an A/D conversion, and so on. The figure below is the timing diagram of ADC0804 reading data.


5.png

From the above figure, we can see that when INTR# becomes a low level, CS# is set low first. After RD# is set low for at least tACC time, the data on the digital output port reaches a stable state. At this time, the digital signal can be obtained by directly reading the data on the digital output port. After reading the data, RD# is immediately pulled high, and then CS# is pulled high. INTR# changes automatically. When RD# is set low for tR1 time, INTR# is automatically pulled high, and we do not need to intervene manually.


Figure 4.4.6 and Figure 4.4.7 are the timing diagrams of ADC0804 starting conversion and reading data. This is the timing diagram of starting once and reading data once. When we want to convert continuously and read data continuously, is it necessary to set CS# low and then high every time? Because CS# is the chip select signal, setting it low means that the chip can be operated or is in a normal working state. So when writing the program, just set CS# low at the beginning, and then when you want to start the conversion and read the data, you only need to operate WR# and RD#.


Keywords:MCU Reference address:Teach you how to read the timing diagram of the microcontroller peripheral A/D converter ADC0804

Previous article:51 MCU stack
Next article:The process of microcontroller executing program, deepen the understanding of 51 microcontroller instructions

Recommended ReadingLatest update time:2024-11-24 11:30

A Brief Discussion on the Ethernet Access Solution of Single Chip Microcomputer
There are many types of single-chip microcomputers, from low-end to high-end, there are 8-bit single-chip microcomputers represented by 51 single-chip microcomputers and 32-bit single-chip microcomputers represented by ARM. The methods of implementing network interfaces for single-chip microcomputers of different grade
[Microcontroller]
A Brief Discussion on the Ethernet Access Solution of Single Chip Microcomputer
Calculation Method of Single Chip Microcomputer Delay Assembly Language
We use assembly language to write a program for the microcontroller to delay 10ms (using MCS-51 with a 12MHz crystal oscillator). We can write the following program to achieve this:   MOV R5,#5 ①    D1: MOV R6,#4 ②    D2: MOV R7,#248 ③             DJNZ R7,$ ④             DJNZ R6,D2 ⑤         DJNZ
[Microcontroller]
51 single chip perpetual calendar
I worked on this small project for 5 days and I feel a sense of accomplishment. Thanks to the seniors for their suggestions. 12864 LCD, DS12C887 clock chip, DS18B20 temperature sensor... #define uchar unsigned char #define uint unsigned int uint temp; float f_temp; sbit Ds=P2^2; sbit Dula=P2^6; sbit Wela=P2^7;
[Microcontroller]
A method of constructing a high-precision PWM 12-bit D/A based on a single-chip microcomputer
In transmitters and controllers made with single-chip microcomputers, when a 1-5V or 4-20mA DC signal needs to be output, a dedicated D/A chip is usually used, usually one chip per channel. When the accuracy of the output signal is higher, the number of bits of the D/A chip will also increase accordingly. In indus
[Microcontroller]
A method of constructing a high-precision PWM 12-bit D/A based on a single-chip microcomputer
A Brief Discussion on the Interrupt Sources of 51 Core MCU
The most basic interrupt source requests of the 51 kernel are external interrupts, timer interrupts and serial port interrupts, which are also the most commonly used by learners and developers. Of course, there are other interrupt sources, such as ADC, SPI, PWM, etc. Taking external interrupt 0 as an example, the comm
[Microcontroller]
A Brief Discussion on the Interrupt Sources of 51 Core MCU
Design of wireless charger based on MSP430 microcontroller
   introduction   At present, the charging of portable electronic devices such as mobile phones, MP3 and laptops mainly adopts the traditional charging method of connecting one end to the AC power supply and the other end to the portable electronic device rechargeable battery. This method has many disadvantages, such
[Power Management]
Design of wireless charger based on MSP430 microcontroller
Internal hardware resources of PIC microcontroller 16F84
The source program example of the PIC16F84 microcontroller lighting up a light-emitting diode introduced by the author in the previous issue is to illustrate the basic format of the specific application of the PIC microcontroller 16F84. Now we already know that for the microcontroller to work, we need to compile the
[Microcontroller]
Internal hardware resources of PIC microcontroller 16F84
Latest Microcontroller Articles
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号