ADC0832 is an 8-bit resolution, dual-channel A/D conversion chip produced by National Semiconductor Corporation
. It is popular among microcontroller enthusiasts and enterprises due to its small size, strong compatibility and high cost performance
. It has a high penetration rate. Learning and using ADC0832 can help us understand the principle of A/D converter
and help improve our microcontroller technology level.
adc0832 C Program
//============================================
//2005-03-28...2005-03-29
//C51 program source file of ADC0834 module
//File Name=ADC083X.c
//#include
#include "DELAY_S.h"
#include "ADC083X.h"
//Predefine external global variables
//***********************************************************
//Serial number:
// HD_ADC083X_S01
//Function:
// Port initialization
//Input:
// None
//Output:
// None
//********************************************************
void adc083x_init(void)
{
SET_ADC083X_CS;
SET_ADC083X_DO;
CLR_ADC083X_CLK;
#if TYPE_VAL >=ADC0832
SET_ADC083X_DI;
#endif
#if TYPE_VAL >=ADC0834
SET_ADC083X_SARS;
#endif
}
//*******************************************************
//Serial number:
// HD_ADC083X_S02
//Function:
// Read out AD data byte
//Input:
// chanel channel number and single-ended or double-ended setting selection, its value is limited by type value!
// That is, the valid value is select to take the lowest 4, 3, 2 bits or not use
// For specific values, please refer to the pdf document!
//Output:
// Result byte of AD conversion
//********************************************************
uchar adc083x_do_one_change(uchar chanel)
{
uchar data ad_val;
uchar data i;
//Initialization before conversion
SET_ADC083X_CS;
CLR_ADC083X_CLK;
SET_ADC083X_DO;
CLR_ADC083X_CS;
//SARS pins can be unused when not necessary to save pin resources!
#if (TYPE_VAL==ADC0838)
//chanel_.3 .2 .1 .0 =0000 channel 0+_channel 1-,
=001 channel 2+_channel 3-,(dual-ended mode)
// SGL/DIF ODD/SIGN SELECT SELECT =0010 channel 4+_channel 5-,
=011 channel 6+_channel 7-,(dual-ended mode)
// =0100 channel 0-_channel 1+,
=0101 channel 2-_channel 3+,(dual-ended mode)
// =0110 channel 4-_channel 5+,
=0111 channel 6-_channel 7+,(dual-ended mode)
// =1000 channel 0+, =1001
channel 2+,(single-ended mode)
// =1010 channel 4+, =1011
channel 6+,(single-ended mode)
// =1100 channel 1+, =1101
channel 3+, (single-ended mode)
// =1110 channel 5+, =1111
channel 7+, (single-ended mode)
//Pin /SE can be grounded and its output delay function of controlling the response byte is not used!
chanel |=0x10; //附加起始位
for(i=0; i<5; i++)
{
if( (chanel &0x10)!=0)
{
SET_ADC083X_DI;
}
else
{
CLR_ADC083X_DI;
}
SET_ADC083X_CLK;
CLR_ADC083X_CLK;
chanel <<=1;
}
#elif (TYPE_VAL==ADC0834)
//chanel_.2.1.0 =000 Channel 0+_Channel 1-, =001 Channel 2+
_Channel 3-, (dual-ended mode)
// SGL/DIF ODD/SIGN SELECT =010 Channel 0-_Channel 1+, =011 Channel 2-
_Channel 3+, (dual-ended mode)
// =100 Channel 0+, =101 Channel 2+,
(single-ended mode)
// =110 Channel 1+, =111 Channel 3+,
(single-ended mode)
chanel |=0x08; //附加起始位
for(i=0; i<4; i++)
{
if( (chanel &0x08)!=0)
{
SET_ADC083X_DI;
}
else
{
CLR_ADC083X_DI;
}
SET_ADC083X_CLK;
CLR_ADC083X_CLK;
chanel <<=1;
}
#elif (TYPE_VAL==ADC0832)
//chanel_.1.0 =00 channel 0+_channel 1-, =01 channel 0-_channel
1+, (dual-ended mode)
// SGL/DIF ODD/SIGN =10 channel 0+, =11 channel 1+,
(single-ended mode)
chanel |=0x04; //附加起始位
for(i=0; i<3; i++)
{
if( (chanel &0x04)!=0)
{
SET_ADC083X_DI;
}
else
{
CLR_ADC083X_DI;
}
SET_ADC083X_CLK;
CLR_ADC083X_CLK;
chanel <<=1;
}
#else //Default is ADC0831
SET_ADC083X_CLK;
CLR_ADC083X_CLK;
#endif
SET_ADC083X_CLK; //Conversion bit before data reception
CLR_ADC083X_CLK;
for(ad_val=0, i=0; i<8; i++)
{
ad_val <<=1;
SET_ADC083X_CLK;
ad_val +=(JUDGE_ADC083X_DO ==1? 1:0);
CLR_ADC083X_CLK;
}
//For non-ADC0831 models, the subsequent waveforms are not used!
SET_ADC083X_CS;
return(ad_val);
}
//===================================
//End Of File
ADC0832 is an 8-bit resolution A/D conversion chip with a maximum resolution of 256 levels, which can meet
general analog conversion requirements. The multiplexing of its internal power input and reference voltage makes the analog
voltage input of the chip between 0 and 5V. The chip conversion time is only 32μS. It has dual data outputs that can be used as data
verification to reduce data errors. It has fast conversion speed and strong stability. Independent chip enable input makes multi-device connection and processor control more convenient. Through the DI data input terminal, the channel function selection
can be easily realized .
Previous article:Energy-efficient stepper motor driver solutions for office automation equipment applications
Next article:AD9851 schematic diagram and pin functions
- Popular Resources
- Popular amplifiers
- USB Type-C® and USB Power Delivery: Designed for extended power range and battery-powered systems
- ROHM develops the second generation of MUS-IC™ series audio DAC chips suitable for high-resolution audio playback
- ADALM2000 Experiment: Transformer-Coupled Amplifier
- High signal-to-noise ratio MEMS microphone drives artificial intelligence interaction
- Advantages of using a differential-to-single-ended RF amplifier in a transmit signal chain design
- ON Semiconductor CEO Appears at Munich Electronica Show and Launches Treo Platform
- ON Semiconductor Launches Industry-Leading Analog and Mixed-Signal Platform
- Analog Devices ADAQ7767-1 μModule DAQ Solution for Rapid Development of Precision Data Acquisition Systems Now Available at Mouser
- Domestic high-precision, high-speed ADC chips are on the rise
- Intel promotes AI with multi-dimensional efforts in technology, application, and ecology
- ChinaJoy Qualcomm Snapdragon Theme Pavilion takes you to experience the new changes in digital entertainment in the 5G era
- Infineon's latest generation IGBT technology platform enables precise control of speed and position
- Two test methods for LED lighting life
- Don't Let Lightning Induced Surges Scare You
- Application of brushless motor controller ML4425/4426
- Easy identification of LED power supply quality
- World's first integrated photovoltaic solar system completed in Israel
- Sliding window mean filter for avr microcontroller AD conversion
- What does call mean in the detailed explanation of ABB robot programming instructions?
- STMicroelectronics discloses its 2027-2028 financial model and path to achieve its 2030 goals
- 2024 China Automotive Charging and Battery Swapping Ecosystem Conference held in Taiyuan
- State-owned enterprises team up to invest in solid-state battery giant
- The evolution of electronic and electrical architecture is accelerating
- The first! National Automotive Chip Quality Inspection Center established
- BYD releases self-developed automotive chip using 4nm process, with a running score of up to 1.15 million
- GEODNET launches GEO-PULSE, a car GPS navigation device
- Should Chinese car companies develop their own high-computing chips?
- Infineon and Siemens combine embedded automotive software platform with microcontrollers to provide the necessary functions for next-generation SDVs
- Continental launches invisible biometric sensor display to monitor passengers' vital signs
- Practical Information 2 - Performance Comparison between CDMA2000 1X and GPRS
- 【FAQ】RISC-V Safe Place|Microchip Security Solutions Series Seminar No. 4
- A very cool PCB package 3D library
- 【Development and application based on NUCLEO-F746ZG motor】1. Development board introduction
- Temperature inspection instrument
- Teaching requirements for the course "Analog Circuit Design" for the major of electronic information engineering
- Development of a portable low-frequency amplitude-frequency characteristic tester
- MSP432 learning notes: import of environment configuration library functions
- Is anyone interested in this building automation sensor module?
- God help me