Yahoo Groups archive

AVR-Chat

Index last updated: 2026-04-28 22:41 UTC

Thread

C version of AVR400?

C version of AVR400?

2009-11-23 by Marc R.J. Brevoort

Hello all,

For a small personal project I'm doing, I need
A/D conversion on an ATtiny2313. I ran into
Atmels AVR400 page ('Low cost A/D Converter')
and it seems good enough for my purposes.
However, as I'm working in C rather than .asm,
I was wondering if anyone has got a C version
of this code?

Thanks in advance,
Marc

Re: [AVR-Chat] C version of AVR400?

2009-11-24 by BobGardner@aol.com

Thats a really minimal a/d converter... its only 6 bits, doesnt have much range. If you had an 8 bit spi d/a converter you could use the analog comparator and have a nice accuate 8 bit successive approximation a/d with a real 0-5V range.
Show quoted textHide quoted text
-----Original Message-----
From: Marc R.J. Brevoort <mrjb@dnd.utwente.nl>
To: AVR-Chat@yahoogroups.com
Sent: Mon, Nov 23, 2009 10:03 am
Subject: [AVR-Chat] C version of AVR400?


Hello all,
For a small personal project I'm doing, I need
/D conversion on an ATtiny2313. I ran into
tmels AVR400 page ('Low cost A/D Converter')
nd it seems good enough for my purposes.
owever, as I'm working in C rather than .asm,
 was wondering if anyone has got a C version
f this code?
Thanks in advance,
arc

-----------------------------------
Yahoo! Groups Links
   Individual Email | Traditional
   http://docs.yahoo.com/info/terms/



[Non-text portions of this message have been removed]

Re: [AVR-Chat] C version of AVR400?

2009-11-27 by Marc R.J. Brevoort

On Mon, 23 Nov 2009, BobGardner@aol.com wrote:

> Thats a really minimal a/d converter...
> its only 6 bits, doesnt have much range.
> If you had an 8 bit spi d/a converter you
> could use the analog comparator and have
> a nice accuate 8 bit successive approximation
> a/d with a real 0-5V range.

That would mean ordering in DAC chips. But the
solution feels 'chunky'. Using a DAC chip just
so that I can do ADC using the analog comparator?
I'd rather just buy an ADC chip then. But if
I'm going to get additional components anyway,
it would make more sense to me to choose a
different AVR- one that already has an ADC
(or several) built-in.

Thanks for the suggestion, though.

Best,
Marc

Re: [AVR-Chat] C version of AVR400?

2009-11-27 by BobGardner@aol.com

I have also been in a situation where I needed to read a pot with modest requirements... something like reading a brightness pot and dimming a display using the color lookup table palette on a pc104 app. I actually have a program that will read a pot charging a cap on a regular old input pin. The cap charges thru the variable resistor. I assume it goes hi at the logic threshold voltage. Then you change it to an output and discharge the cap. I used log and exp and a bunch of fp because it was on a pc. I guess you could use fp on a big avr to prove the concept, the make a table of time to charge cap vs resistance. Something like vcap = 5v*(1-exp(t/tau) where tau is the pot R and the cap value. Need to solve for R given t. This is doable in c no prob. Lets keep working on it. Do you need more than 6 bits? 
Show quoted textHide quoted text
-----Original Message-----
From: Marc R.J. Brevoort <mrjb@dnd.utwente.nl>
To: AVR-Chat@yahoogroups.com
Sent: Fri, Nov 27, 2009 4:26 pm
Subject: Re: [AVR-Chat] C version of AVR400?


On Mon, 23 Nov 2009, BobGardner@aol.com wrote:
> Thats a really minimal a/d converter...
 its only 6 bits, doesnt have much range.
 If you had an 8 bit spi d/a converter you
 could use the analog comparator and have
 a nice accuate 8 bit successive approximation
 a/d with a real 0-5V range.
That would mean ordering in DAC chips. But the
olution feels 'chunky'. Using a DAC chip just
o that I can do ADC using the analog comparator?
'd rather just buy an ADC chip then. But if
'm going to get additional components anyway,
t would make more sense to me to choose a
ifferent AVR- one that already has an ADC
or several) built-in.
Thanks for the suggestion, though.
Best,
arc

-----------------------------------
Yahoo! Groups Links
   Individual Email | Traditional
   http://docs.yahoo.com/info/terms/



[Non-text portions of this message have been removed]

Re: [AVR-Chat] C version of AVR400?

2009-12-01 by Marc R.J. Brevoort

On Fri, 27 Nov 2009, BobGardner@aol.com wrote:

> Lets keep working on it. Do you need more than 6 bits?

I think I do. The values that I'm trying to read are
on a resistive keypad, and I've got at least 17
different resistance values to deal with. They're not
distributed in a completely linear fashion either,
so I'm guessing 6 bit is just a bit too close for
comfort.

So I've ordered in a few ATmega8s. 10-bit ADC will do
the trick for sure, and it'll save me the effort of
shoehorning the solution into an AVR that ultimately
doesn't fit the requirements all that well.

Best,
Marc

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.