ARM Getting Started Notes (5)

Publisher:自由探索Latest update time:2015-04-20 Source: eechinaKeywords:ARM Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere
 Analog Input

- A/D Conversion Experiment

I. Purpose

Through A/D conversion, the voltage value of the external analog input channel can be correctly read.

II. Experimental procedures and parameter settings

1> The connector option settings and startup code are the same as the previous experiment
2> C language code

#i nclude "AT91SAM7S64.h"
#i nclude "Board.h"
volatile unsigned int EXT_AD_Val[4]; //Define A/D conversion result value
int main(void)
{unsigned char i;
*AT91C_ADC_CR = AT91C_CKGR_MOSCEN; //Software reset of ADC, that is, clear all registers of ADC
*AT91C_PMC_SCER = AT91C_CKGR_MOSCEN; //Enable the processor clock of the system clock register
*AT91C_PMC_PCER = 1 91C_ID_ADC; //Enable ADC clock
*AT91C_PIOA_PDR = EXT_AD0 | EXT_AD1; //Disable the I/O port function of the pin and use it as analog input function
*AT91C_ADC_MR = 0x0f1f3f00; //Software start, 10-bit resolution, 128 division
*AT91C_ADC_CHER = 0x33; //Enable channels 0, 1, 4, 5
*AT91C_ADC_CHDR = 0xcc; //Disable channels 2, 3, 6, 7
*AT91C_ADC_IDR = 0xfffff; //Disable all ADC interrupts
while (1)
{ *AT91C_ADC_CR = 0x2; //Start conversion
while (1)
{ if ((*AT91C_ADC_SR) & 0x33) //Wait for conversion to end
  { EXT_AD_Val[0] = (*AT91C_ADC_CDR0) & 0x3ff; //Read 10-bit result value
   EXT_AD_Val[1] = (*AT91C_ADC_CDR1) & 0x3ff;
   EXT_AD_Val[2] = (*AT91C_ADC_CDR4) & 0x3ff;
   EXT_AD_Val[3] = (*AT91C_ADC_CDR5) & 0x3ff;
   for (i = 0; i
   break;
  }
}
}
}

3. Summary

Executing software reset of ADC will clear all ADC related registers, so it must be executed before setting ADC related registers.
Keywords:ARM Reference address:ARM Getting Started Notes (5)

Previous article:ARM Getting Started Notes (6)
Next article:ARM Getting Started Notes (4)

Recommended ReadingLatest update time:2024-11-16 23:42

Interpretation of ARM2440ddr.h file
After the board is powered on, it will start executing from here, mainly completing basic initialization, judging whether to start from NOR or NAND, and then moving the program to SDRAM. After the transfer is successful, it will jump to the main function for execution.   Let's start looking at its specific code no
[Microcontroller]
A design scheme of speaker-independent speech recognition system based on ARM processor
  0 Introduction   With the widespread application of high-tech in the military field, weapons and equipment are gradually developing towards high, precise and advanced directions. Traditional military training often fails to achieve the expected training effect due to long training time, high training costs and nar
[Microcontroller]
A design scheme of speaker-independent speech recognition system based on ARM processor
ARM7 2131 BEEP Program Analysis
ARM7 BEEP Program Analysis In the schematic diagram, we can see that the buzzer is connected to the P07 port, and the interface is short-circuited. #include "config.h" #define BEEP 1 7 // P0.7 controls the buzzer, low-level buzzer Includes a config.h header file, which mainly defines the data type, clock fr
[Microcontroller]
Wireless data transceiver system based on ARM and nRF905
The designed wireless data transceiver system is an important part of the wireless follow-up control system. It is mainly composed of nRF905 wireless transceiver module and LPC2148 ARM development board. It is used to realize wireless data transmission between the manual system and the follow-up system, effectively
[Microcontroller]
Wireless data transceiver system based on ARM and nRF905
ARM chip development learning (S5PV210) - icache, dcache introduction and how to turn on and off icache
What are icache and dcache? Cache is a high-speed cache memory, icache (instructions cache) is an instruction cache memory, and dcache (data cache) is a data cache memory. The basic rule of storage media is that the faster the read and write speed, the higher the price per unit storage capacity. In order to balance th
[Microcontroller]
Robot arm control system based on ARM core processor
In recent years, with the development of MEMS and related technologies, the field of micro-robotics has attracted more and more attention. However, due to the small size of the parts, the assembly of micro-robot components requires very high precision, and general assembly methods cannot meet the requirements. This
[Industrial Control]
Robot arm control system based on ARM core processor
Application of ARM core board in dynamic urine volume monitor
1.1 Project Introduction     Urine volume monitoring is an important part of detecting multiple indicators of patients. It is the most direct and sensitive physiological indicator reflecting the level of renal blood perfusion. For critically ill patients, urine volume can often indicate renal function disorders bef
[Medical Electronics]
Application of ARM core board in dynamic urine volume monitor
Introduction to ARM development software and practical tools
Introduction to arm development software and practical tools 1. Introduction to compiler 1. ADS1.2        ADS is ARM's integrated development environment software, and its functions are very powerful. Its predecessor is SDT, which is the development environment software of arm company a few years ago. At present, SD
[Microcontroller]
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

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号