Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

HOW TO FIND SAMPLING RATE OF ADC IN PIC?

Status
Not open for further replies.

chsp129

Junior Member level 3
Joined
Mar 29, 2010
Messages
25
Helped
1
Reputation
2
Reaction score
1
Trophy points
1,283
Location
hyd
Activity points
1,479
HI i am using p18f452 controller,in that i want to know what is the sampling rate of my ADC ..am using 16MHZ exteranal osillator..so can anyone please help me.

THANKS..
 

It depands on your A/D clock source which is software selectable via ADCON1 register. A/D conversion takes 12 TAD and TAD must be no less than 1.6 us. If you choose internal RC for the A/D clock source, TAD varies between 2 and 6 us. There is also acquisition time needed before the conversion begins.

See "17.2 Selecting the A/D Conversion Clock" section in the 18FXX2 datasheet.

I guess you can achieve something like 40 us with 32 TOSC setting, including the acquisition time.
 

Thanks for u r replay..
am using Fosc/4..i.e 4Tosc setting and am taking Vdd and Vss as refrence voltages..and i am not using the internal RC using 16MHZ external osillator .............so 12TAD in the sense it takes total 12*1.6=19.2microsec for convert the 10 bits..that is fine so can u tell me what is the sampling rate here and exactly what is the sampling rate..

THANKS/...
 

When using 16 MHz XTAL, TOSC is 6.25 x 10^-8 seconds, which is 0.0625 us. Your options for TAD are 2, 4, 8, 16, 32 and 64 TOSC, so you need 32 or 64 TOSC, since it means 2 or 4 us for TAD. Including an approximated acquisition time, the conversion takes no less than 40 us. It gives you approximately 25 kHz sampling rate.

Using the internal RC for the clock source for the A/D conversion is independant from the main clock source, which means you can use it even though you have an external XTAL. But it's slower.

If you want to test the conversion time (excluding the acquisition time), you can write a code in assembly. Save the timer value just before you start A/D conversion, then wait until it finishes its job either by polling the GO/DONE bit or using the A/D conversion interrupt. Then look at the new timer value and compare them.
 

Tagli said:
When using 16 MHz XTAL, TOSC is 6.25 x 10^-8 seconds, which is 0.0625 us. .

U r saying Fosc is 16 mhz and Tosc is 0.0625microsec..but i listen from some sources that Fosc is the 1/4th part of external frequency..i.e Fosc is 16/4=4, and tosc is 0.25 microsec..can u explain me which is correct and how...pls

THANKS
 

FOSC is the oscillator frequency, as "OSC" means oscillator. So, it's 16 MHz. And TOSC is the oscillator period, which is 0.0625 us.

But, for the program execution, the clock source is divided by 4 to generate 4 phases, which are named as Q1, Q2, Q3 and Q4. And instructions are executed in 4 phases, so TCY = 4 * TOSC. So, each instruction is executed in 0.25 us, except the ones that require 2 TCY.

But the formula for the calculation of the TAD in the datasheet uses TOSC, not TCY.
 
i use resonator 4MHZ in 16f877a and i want the highest frequency
but i dont know the table in data sheet he say for fosc/2 max device frqueny 1.25 khz what is that mean is that the max crystal allowed to me or what and how to acheive max sample rate
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top