[Newbie] ADC and PWM running simultaniously on Atmel Attiny15

Hello to all of You,

Being completely new to AVR's and still studying their "anatomy" and reading about them I have a question that could probably be solved by an experiment but at this moment a real life experiment like this is beyond my capabilities and I am a bit nervous to find the answer because it is important for a plan I have in my head :-). I hope You might be able to give me the answer. At the moment I am just making some led's blink and extending the luxury of the blink program (first step from now: use timer) but later on I want to make a program that reads the value of an analogue signal and then (a.o.) "translates" this value into the duty-cycle of the build-in PWM of the device. For this I would put the ADC into free running mode. In some tutorial (unfortunately I have no idea where it was) I read that one should not change the level on an output pin while an AD-conversion is taking place because it might ruin the outcome of that conversion. In the datasheet I have not read this but they do describe that the ADC can be used while everything else in the chip is "silent" to cancel noise from the measurement. The accuracy is not very important for my plan. But it is important that the i/o pin is being changed constantly by the PWM-unit, and the ADC should keep on running. By now You will have guessed what the question is: Was the information I read correct or is it just a matter of a slightly decreased accuracy to have both systems (=ADC and PWM) running simultaneously?

Thank You very much in advance! Yours sincerely, Rene

Reply to
Rene
Loading thread data ...

This isn't characterized. What I suggest you do is write some software to capture from the ADC into RAM. Tie the ADC input to a fixed voltage. Run this software once with the PWM operating, and once without. Look at the distribution of the ADC output values, and compare.

I have a project that uses ATmega169, which also has the ADC sleep mode. I did some tests with and without sleep mode and observed no statistically significant difference in the noise when using sleep mode vs. leaving the core running full-tilt.

Reply to
larwe

Just do it.... you may get the odd error in the ADC but it doesn't matter in this application... You could save the ADC values in an 8 byte fifo, average them ( sum and divide by 8) and use that for the pwm. Where it might matter is if you were making a data logger to record accurately the ADC values...

Reply to
TT_Man

"Rene" schreef in bericht news: snipped-for-privacy@edutel.nl...

Many thanks for the replies! I am sorry for my late reply.

Yours sincerely, Rene

Reply to
Rene

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.