A/D conversion application of s3c2440

Source: Internet
Author: User

10 location CMOS ADC (modulo/digital converter) is a 8-channel analog input device recovery. The analog input signal converts a 10-bit binary digital code, A/D change. Also known as the analog-to-digital conversion. The analog signal is converted to USD

Digital signals that can be processed by the computer.

For s3c2440. Achieving A/D conversion is simple, the main thing is the ADC control register Adccon and ADC conversion data register ADCDAT0. Low 10 bits of register ADCDAT0 to store A/D conversion

After the data. The 15th bit of register Adccon is used to identify whether a/D conversion is complete.

The 14th bit is used to enable the Prescaler to be enabled. The 6th to 13th bits are stored in the Prescaler value, because the A/D conversion speed cannot be too fast,

Therefore, it is sufficient to get the correct A/D conversion speed through the prescaler processing ability.

watermark/2/text/ahr0cdovl2jsb2cuy3nkbi5uzxqvwhnjs2vybmvs/font/5a6l5l2t/fontsize/400/fill/i0jbqkfcma==/ Dissolve/70/gravity/southeast ">

If we want to get A/D conversion frequency of 1MHz, then the value of the prescaler should be 49. The 3rd-to 5th-bit represents the channel selection for A/D conversion.

The 2nd bit is a standby mode capable of achieving A/D conversion. The 1th bit is used to read

Enable the start of A/D conversion.

The No. 0 bit is used to open a/D conversion when the 1th bit is zeroed.

The individual ADC operation is very easy, and the configuration of one bit of the polling register is changed to indicate that the sample has been completed:

int READADC (int8u channel) {channel&= 7;radccon = (1<<14) | ( 49<<6) | (channel<<3);              Set Prescaler and A/D channel radccon|=0x1;                                      Start A/D conversion while (Radccon & 0x1) ostimedly (1);                                                Verify that the A/D conversion is started while (!) ( Radccon & 0x8000)) ostimedly (1);                                                Wait for the A/D conversion to end return ((int) rADCDAT0 & 0x3ff);      Read A/D conversion data}

In a multitasking environment, a shorter ostimedly can be added after the while loop.


There is no analog sensor that can be rotated with a screwdriver PR2 the visible collection data changes with rotation. In this case the collection of data displayed on the LCD, only through the serial port print it.



Detailed code can clone from my github.



References:

blog.csdn.net/zhaocj/article/details/5495730

s3c2440 Documentation







Copyright notice: This article blog original article. Blogs, without consent, may not be reproduced.

A/D conversion application of s3c2440

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.