ADC application elements in C8051F020

Publisher:心怀梦想Latest update time:2006-12-04 Source: 互联网Keywords:A/D Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

C8051F020 (referred to as F020) is a mixed-signal SOC 8-bit microcontroller launched by Cygnal Company of Texas, USA. It belongs to the F02x sub-series in the C8051F series. Its performance-price ratio is extremely competitive in current application fields. F020 has 8-channel 12-bit A/D conversion (referred to as ADC) interface and 8-channel 8-bit in-circuit programmable (ISP) ADC circuit. There are 15 special function registers (referred to as SFR) on the chip related to the control of the ADC. They are :

AMUX0SL——AMUX0 channel selection register, reset value is 00000000;

MAX0CF——AMUX0 configuration register, reset value is 00000000;

ADC0CF——ADC0 configuration register, the reset value is 11111000;

ADC0CN——ADC0 control register, the reset value is 00000000;

ADC0H——ADC0 data word MSB register, the reset value is 00000000;

ADC0L——ADC0 data word LSB register, the reset value is 00000000;

ADC0GTH——ADC0 lower limit data high byte register, the reset value is 11111111;

ADC0GTL——ADC0 lower limit data low byte register, the reset value is 11111111;

ADC0LTH——ADC0 upper limit data high byte register, the reset value is 00000000;

ADC0LTL——ADC0 upper limit data low byte register, the reset value is 00000000;

AMX1SL——AMUX1 channel selection register, the reset value is 00000000;

ADC1CN——ADC1 control register, the reset value is 00000000;

ADC1CF——ADC1 configuration register, the reset value is 11111000;

ADC1——ADC1 data word register, the reset value is 00000000;

REF0CN——Reference voltage control register, reset value is 00000000.

ADC is an important function of a mixed-signal controller. If you want to be proficient in application programming, you must have a clearer overall understanding of its related elements.

1 ADC accuracy and channels

F020 is packaged in TQFP100. The chip has 8 pins (pins 18 to 25) dedicated to analog input and is the input terminal of 8-channel 12-bit ADC. The conversion accuracy of each 12-bit channel is its own ±1LSB (lowest bit). In fact, there is only one 12-bit Successive Approximation Register (SAR) ADC, and between it and each input there is a multiplexer with 9-channel inputs (configurable analog multiplexer AMUX). The 9th channel of AMUX is connected to the temperature sensor. In F020, the 12-bit ADC is called ADC0, and the 8-channel 8-bit in-system programmable (ISP) ADC circuit is called ADC1. Its 8 external pins are multiplexed with the P1 port, and the on-chip structure is similar to ADC0, except that the number of conversion bits is 8 bits, and the conversion accuracy is 8 bits ±1LSB.

Each pair of ADC0 ports can be programmed to be individually single-ended or differential. The port pairing for differential input is 0-1, 2-3, 4-5, 6-7. This setting is determined by the lower 4 bits of the channel selection register AMUX0SL and the lower 4 bits of the channel configuration register AMUX0CF. In AMX0CF, bits 3 to 0 each correspond to 2 pin channels. Bit value = 0, indicates an independent single-ended input (reset values ​​are all single-ended inputs); bit value = 1, indicates a differential input pair. When differential input is selected for AMX0CF, it is only valid when selecting even-numbered (including 0) channels in AMUX0SL (Note: When the lower 4 bits of AMUX0SL are 1xxx, the temperature sensor is selected regardless of the value of the lower 4 bits of AMX0CF).

When bit 3 of REF0CN is set to "1", the temperature sensor is allowed to be used; when set to "0", the output of the temperature sensor is in a high-impedance state. The value of the temperature sensor can be used to correct the nonlinearity of the parameters or to record and adjust temperature-related data.

2 ADC rate and startup

The speed of the ADC in the C8051F series microcontroller can be programmed, but at least 16 system clocks are used. Generally, a tracking/hold capture time of 3 system clocks (>1.5 μs ) is automatically added before conversion. The method of setting the ADC rate in F020 is through bits 7~3 of the configuration register ADCxCF (x is 0 or 1), and its reset value is 11111 (bits 7~3=SYSCLK/CLK SAR-1).

Generally, the ADC must be in tracking mode before starting. If bit 6 of the control register ADCxCN is "0", it will always be in tracking mode (at this time, starting the 4 startup modes can be 3 system clocks faster than tracking startup); if it is " 1", there are 4 tracking start methods to choose from, that is, assigning values ​​to bits 3~2 in ADCxCN: 00 is tracking when writing 1 to ADBUSY (software command); 01 is timer 3 overflow tracking; 10 is the rising edge of CNVSTR Tracking (external signal); 11 is timer 2 overflow tracking.

At reset, Bit 7 of ADCxCN is 0 and is in the shutdown state. At the end of each conversion, bit 5 of ADCxCN is "1", and the falling edge of bit 4 (busy flag) triggers a structural interrupt. These status bits can also be queried by software.

3 ADC reference and gain

The F020 has a 1.2V, 15×10 -6/℃ bandgap voltage reference generator and a twice-gain output buffer on-chip. The 2.4V reference voltage (VREF) can be connected to ADC0, ADC1 and DAC through external pins. The external load capacity of VREF is 200 μA (it is recommended to connect a load resistor to ground when driving an external load). When the ADC uses bias, bit 1 in the reference source control register REFcCN must be set to "1"; if "0", the internal bias is turned off. At this time, the external reference voltage can be used through the VREF pin (pin 12). The external reference voltage must be less than VAV±0.3V (and greater than 1V). When neither ADC nor DAC is used, bit 0 of REFxCN can be set to "0" to put the buffer amplifier in power saving mode (the output is in a high impedance state).

When bit 4 of REF0CN is set to "0", ADC0 is biased with VREF, and when it is "1", DAC0 output bias is used; when bit 3 of REF0CN is set to "0", ADC1 is biased with VREF, which is "1" When, use AV+bias.

In the ADC circuit of F020, there is an internal amplifier (PGA) with programmable gain behind the input multiplexer AMUX. This is particularly useful when there is a large difference in the input voltage signal range between analog channels, or when a signal with a large DC offset needs to be amplified (in differential input mode, DAC can be used to provide DC offset). The setting method is to configure bits 2~0 in ADCxCF (000 corresponds to the PGA gain of 1; 001 corresponds to 2; 010 corresponds to 4; 011 corresponds to 8; 10x corresponds to 16, 11x corresponds to 0.5). The gain here also works on the temperature sensor signal. When the gain is 1, VTEMP=0.002 86(V/℃)(TEMPC) ℃+0.776V.

4 ADC data and control

Corresponding to single-ended input, the ADC result data word format is: 0V——0000, VREF——0FFF or FFF0.

Corresponding to differential input, the ADC result data word format is 2's complement: VREF——07FF, 0——0000, -VREF——F800 or 8000.

Setting Bit 0 of ADCxCN to "0" causes the result to be right-justified; setting "1" to "1" causes the result to be left-justified. When input is differential, the extra high bits produced by right justification are sign extension bits.

The C8051F series microcontroller also has a data-related window interrupt generator or programmable window detector, also called the ADC upper (lower) limit data register ADC0G (L) TH (L), which monitors a key voltage in the background. When the conversion data is within (or outside) the specified window, apply for a conversion end interrupt to the controller. When it is required to interrupt within the window, the upper limit register LT is loaded with the high-order window number, and the lower limit register GT is loaded with the low-order window number; if it is required to interrupt outside the window, the lower limit register GT is loaded with the high-order window number, and the upper limit register GT is loaded with the high-order window number. The lower limit number of windows loaded into LT.

When reset, the status of the ADC part is: the internal voltage reference buffer is closed, the internal bias voltage is closed, the internal sensor is closed, the ADC is disabled, the conversion result data register is right-aligned, the 12-bit ports are all single-ended inputs, and the port points to AIN0, SAR Convert 33 system clocks, the internal amplifier gain is 1, the lower limit data register is FFFFH, and the upper limit data register is 0000H.

Based on various factors related to ADC in F020, in order to correctly apply the ADC function, you should program in the following order: Set reference voltage>Set to allow ADC>Set tracking (starting) mode>Set data alignment>Configure channel>Select channel>Settings Convert clock and gain > Set window detection upper and lower limits > Start conversion. The sequence of operating SFR (taking 12 bits as an example) is: REF0CH>ADC0CN>AMX0C>AMUX0SL>ADC0CF>ADC0GTH>ADC0GTL>ADC0LTH>
ADC0LTL>ADC0CN or other startup methods.

Keywords:A/D Reference address:ADC application elements in C8051F020

Previous article:Intelligent temperature control meter with communication port based on 89C52 microcontroller
Next article:ADC application elements in C8051F020

Recommended ReadingLatest update time:2024-11-16 17:53

TMS320F240 on-chip PWM realizes D/A expansion function
  TMS320F240 (referred to as F240) is a high-speed, highly integrated, low-cost microcontroller with very powerful functions. The fly in the ointment is that although the F240 chip itself integrates many advanced peripherals required for digital control systems, including A/D conversion and other functions, it does no
[Embedded]
Application of Data Acquisition Based on Least Squares Method of A/D Conversion
introduction In the process of industrial wastewater treatment, it is often necessary to monitor the COD value of wastewater. The data monitored by the on-site monitoring instruments are output through various analog signals. These analog signals must be converted into digital signals through A/D converters bef
[Analog Electronics]
ROHM develops 32-bit D/A converter IC for high-quality audio equipment
ROHM develops 32-bit D/A converter IC "BD34352EKV" for high-quality audio equipment ROHM adds new DAC chips for high-end models to its lineup ROHM, a world-renowned semiconductor manufacturer (headquartered in Kyoto, Japan), has launched the BD34352EKV, a 32-bit D/A converter IC (hereinafte
[Analog Electronics]
ROHM develops 32-bit D/A converter IC for high-quality audio equipment
A4988 stepper driver design based on RAMPS 3D printer kit
I like modularity, so I built the electronics using 2 separate homemade boards: the main control board and the motor board. The main control board of the robot is based on the Arduino Pro Mini. I chose this board because it is small, cheap and has an Atmega32u4 chip. Two 16-bit hardware timers are needed for the man
[Embedded]
A4988 stepper driver design based on RAMPS 3D printer kit
D/A converter and single chip microcomputer interface circuit diagram
D/A converter and single-chip microcomputer interface circuit diagram (single buffer working mode) Applicable to systems with only one analog output or several analog outputs but no synchronization is required. The chip in the circuit is DAC0832
[Microcontroller]
D/A converter and single chip microcomputer interface circuit diagram
Adopt ARM high resolution piezoelectric ceramic D/A circuit design
  According to the demand of piezoelectric ceramic micro-displacement device for driving power supply, a scheme of piezoelectric driving power supply system was designed. The scheme first introduced the digital circuit part and analog circuit part in the power supply system, and analyzed and improved the accuracy and
[Microcontroller]
Adopt ARM high resolution piezoelectric ceramic D/A circuit design
Loongson 3A5000 domestic processor successfully used in 3D printing system
 According to news on April 27, the domestic chip company Loongson Zhongke officially announced that the Loongson 3A5000 and the 3D printing system of Beijing Tier Times Technology Co., Ltd. (hereinafter referred to as "Tier Times") have completed product compatibility and adaptation work, marking the completion of th
[Embedded]
Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
Change More Related Popular Components
Guess you like

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号