EmbeddedRelated.com
Forums

10-Bit ATD -- ATDDR0

Started by "matthias.hildebrand" February 9, 2008
Hey all,

I have a question concernig the 10-bit ATD conversion.
Until today I used the 8-bit conversion without having problems. For a
higher accuracy I want to use the 10 bit conversion now. I had a look
on the registers. The data is stored right justified and unsigned. Is
the only difference setting the SREM bit to low?
How can I convert the value? Before I stored the low register
(ATD0DR0L) as an integer value. Can I just add the to
registers(ATD0DR0L+ATD0DR0H) up and store it as an interger? Or do I
have to multiply the high register with 256(ATD0DR0L+ATD0DR0H*256)?

Thanks for your help
Cheers
Matthias
Hi,
If you define:
#define _IO_BASE 0
#define _LP(off) *(unsigned short volatile *)(_IO_BASE + off)
#define ATD0DR0 _LP(0x90)
then you can read a 16bit word at once, as the result of 10 bit conversion.
No further calculations needed.
Regards,
Ioan

matthias.hildebrand wrote:
>
> Hey all,
>
> I have a question concernig the 10-bit ATD conversion.
> Until today I used the 8-bit conversion without having problems. For a
> higher accuracy I want to use the 10 bit conversion now. I had a look
> on the registers. The data is stored right justified and unsigned. Is
> the only difference setting the SREM bit to low?
> How can I convert the value? Before I stored the low register
> (ATD0DR0L) as an integer value. Can I just add the to
> registers(ATD0DR0L+ATD0DR0H) up and store it as an interger? Or do I
> have to multiply the high register with 256(ATD0DR0L+ATD0DR0H*256)?
>
> Thanks for your help
> Cheers
> Matthias
>
>
Thanks a lot. It works very well!
--- In 6..., Petrescu wrote:
>
> Hi,
> If you define:
> #define _IO_BASE 0
> #define _LP(off) *(unsigned short volatile *)(_IO_BASE + off)
> #define ATD0DR0 _LP(0x90)
> then you can read a 16bit word at once, as the result of 10 bit
conversion.
> No further calculations needed.
> Regards,
> Ioan
>
> matthias.hildebrand wrote:
> >
> > Hey all,
> >
> > I have a question concernig the 10-bit ATD conversion.
> > Until today I used the 8-bit conversion without having problems. For a
> > higher accuracy I want to use the 10 bit conversion now. I had a look
> > on the registers. The data is stored right justified and unsigned. Is
> > the only difference setting the SREM bit to low?
> > How can I convert the value? Before I stored the low register
> > (ATD0DR0L) as an integer value. Can I just add the to
> > registers(ATD0DR0L+ATD0DR0H) up and store it as an interger? Or do I
> > have to multiply the high register with 256(ATD0DR0L+ATD0DR0H*256)?
> >
> > Thanks for your help
> > Cheers
> > Matthias
> >
>