Cypress Developer CommunityTM

Summary: 28 Replies, Latest post by ryanDistek on 07 May 2015 03:35 PM PDT
User
32 posts

Hello,

I was wanting to set up an ADC to continue to read for about 48 MS. My ADC is running at 8Mhz, how many times would i need to read my adc? How long does it take for my adc to run?

User
9245 posts

A single conversion will take 160µs at 6.25ksps when clocking with 8MHz, so within 48ms you may get 300 ADC readings.

Bob

User
9245 posts

A little bit too few information: What kind of ADC? DelsSig, ADCInc) How many bits? what are the exact settings? As far as I remember there was a formula to calculate the conversion time for an ADC in the datasheet. Can you post your complete project, so that we all can have a look at all of your settings? To do so, use
Creator->File->Create Workspace Bundle (minimal)
and attach the resulting file.

Bob

User
32 posts

Thanks, I added my project so everyone can see my settings better

Attachments:
User
32 posts

Thanks, That example helped me understand how to use the formula bettr.

User
9245 posts

You are always welcome!

Bob

User
7646 posts

If you only need one reading ever 48 mS consider setting a timer

for 48 mS and issuing an interrupt at the end of the period to take

a reading. That way you don't eat up a lot of MIPS doing nothing but

reading an A/D and ignoring its results for the 48 mS period.

In fact only start the A/D at the end of the 48 mS period and take a

Regards, Dana.

User
32 posts

Does anyone know how I'd be able to figure out the conversion to get it as a voltage?

User
7646 posts

Your reference is set to Vdd/2 +/- Vdd/2.

Your converter is set to 8 bits, unsigned.

So Vx = ( AtoDcount value * 5V ) / 256

Regards, Dana.

User
32 posts

I may be wrong, but I'm under the assumption that the ADC has an interrupt. I am running this ADC fro 48ms which I do about 6 times. Is it possible to run something that happens every 2ms to interrupt the ADC? Like if I were to poll the status of a button.

User
7646 posts

ADCINC_1INT.asm this file has a place where user code can be entered

to be part of the ADC interrupt handler.

You could do an ISR on the button and simply call the stop / restart on the