The S3C2440A has an internal 10-bit analog-to-digital converter (ADC) with 8 analog signal inputs.
The registers used are:
ADCCON: used to select channel, set frequency, start conversion, and end mark
ADC frequency = PCLK/(ADCCON[13:6]+1)
ADCDATn: used to read the conversion result of ADC channel n: ADCDATn[9:0]
The following is an experimental program for ADC channel 0:
//********************************************************************
#define adc_frequency 2000000
void Main(void)
{
int i;
...Hardware initialization...
Uart_Printf("ADC experiment nn");
rADCCON = 1<<3 | (PCLK/adc_frequency - 1)<<6 | 1<<14 ; //Select channel 1, set ADC frequency, the frequency is valid
while(1)
{
rADCCON|=0x1; //Start ADC
while(!(rADCCON & 0x8000)); //Wait for the conversion to complete
Uart_Printf("AIN1: %dn",rADCDAT0&0x3FF); //Output the conversion result
Delay(1000); //Delay for 1 second
}
}
//***********************************************************************
The results are as follows:
Previous article:2440 Bare Metal Programming 8 UART Universal Asynchronous Receiver and Transmitter
Next article:2440 bare metal programming six real-time clock
- Popular Resources
- Popular amplifiers
- Learn ARM development(16)
- Learn ARM development(17)
- Learn ARM development(18)
- Embedded system debugging simulation tool
- A small question that has been bothering me recently has finally been solved~~
- Learn ARM development (1)
- Learn ARM development (2)
- Learn ARM development (4)
- Learn ARM development (6)
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- LED chemical incompatibility test to see which chemicals LEDs can be used with
- Application of ARM9 hardware coprocessor on WinCE embedded motherboard
- What are the key points for selecting rotor flowmeter?
- LM317 high power charger circuit
- A brief analysis of Embest's application and development of embedded medical devices
- Single-phase RC protection circuit
- stm32 PVD programmable voltage monitor
- Introduction and measurement of edge trigger and level trigger of 51 single chip microcomputer
- Improved design of Linux system software shell protection technology
- What to do if the ABB robot protection device stops
- Detailed explanation of intelligent car body perception system
- How to solve the problem that the servo drive is not enabled
- Why does the servo drive not power on?
- What point should I connect to when the servo is turned on?
- How to turn on the internal enable of Panasonic servo drive?
- What is the rigidity setting of Panasonic servo drive?
- How to change the inertia ratio of Panasonic servo drive
- What is the inertia ratio of the servo motor?
- Is it better for the motor to have a large or small moment of inertia?
- What is the difference between low inertia and high inertia of servo motors?
- Shouldn't the positive and negative power supplies of the op amp be connected in series to have a reference point?
- Request expert explanation
- The output waveform of the Siler oscillator is asymmetrical up and down?
- Can pure software development be transferred to embedded software development?
- GD32L233C-START Evaluation——02_1. Build development environment and simple debugging
- The Painful Experience of DSP Connecting to Emulator
- C2000 floating point calculation notes - differences between CPU and CLA and error handling techniques
- When Kicad moves a line individually, the line is actually disconnected when moving. How to solve this problem?
- EEWORLD University ---- Theoretical basis of IoT terminal development
- About the serial port problem of MSP430F5529 microcontroller