Professional Documents
Culture Documents
Data Acq System
Data Acq System
Electrical Symbol
ADC Registers
ADC Programming Steps
• Step 1: Configuring the ADC Power and ADC Port Pin Select the pin
function (PINSEL)
It is a set of registers that we can use to indicate exactly which function we would
like each pin to perform.
For example: If ADC0.1 is used for your application then corresponding Pin no.
and port pin is 13 and P0.28 respectively. To activate port pin as ADC input
PINSEL0 must be used. (PINSEL0 = 0x01000000)
• STEP2:Configure ADC (AD0CR / AD1CR)
To configure the A/D Converter, need to pass a specific 32-bit value to the
appropriate ADCR. This 'control register' manages the configuration of A/D
converter
Format of ADC Control Register
•
SEL: Channel Selection Bits
To select ADC0 Channel 1 (ADC0.1) set the appropriate bit in SEL.
SEL = 0000 0010
CLKDIV: ADC Clock selection
For example: Fosc = 12 MHz
PLL: M=5 and P =2 (Set by startups)
CCLK = Fosc X M = 12MHz x 5 = 60 MHz
PCLK = Fosc/4 = 15 MHz by setting VPBDIV = 0x00 (Default Value)
ADC Clock = PCLK/ (CLKDIV Value + 1) (Max. 4.5 MHz)
Desired ADC Clock is 3.0 MHz
Therefore
CLKDIV = (PCLK/ADC Clock) – 1
CLKDIV = (15x106 / 3x 106 ) – 1
CLKDIV = (4)10 = (0000 0100)2
CLKS :
These three bits are used to indicate the range of values used when converting
analog data. You can set the 'precision' of the results from 3-bits (values from 0-7)
up to 10-bits (values from 0-1023), depending on your requirements. To get the
maximum 10-bit 'range', we would provide the following value to the CLKS field:
CLKS = 000
PDN : Since we want to convert data right away, we could tell the ADC to go out
of power-down mode (its default value) by setting this bit to 1
START: To start the ADC conversion immediately
START = 0x001
STEP 3: READING THE STATUS OF A/D CONVERSION
The A/D Status register allows checking the status of all A/D channels
simultaneously. The DONE and OVERRUN flags appearing in the ADDRn
register for each A/D channel are mirrored in ADSTAT. The interrupt flag (the
logical OR of all DONE flags) is also found in ADSTAT.
STEP 4: READING THE CONVERSION RESULTS
Each ADC channel has its own dedicated data register (ADDR0..7) that we canuse
to 'read' the results of the analog to digital conversion, as well to check whether
the current conversion is complete or not. Also there is global data register which
will give the result of latest channel A/D conversion. The 32-bit value has the
following format:
A/D Channel Data Register (ADDR0 to ADDR7)
Output:-
Conclusion:-Thus, ADC is been programmed using ARM Technology. And we have
studied Data acquisition and analysis using PC.