two questions about ADC in AT90CAN128

Go To Last Post
3 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hello,

1. Are there any problems if the ADEN bit and the ADSC bit are set to one at the same time, say
ADCSRA = 0xC0?

2. Do you suggest to use the interrupt ADIF for real time applications if a conversion finishes?

Thank you

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I set the enable during power on initialization, and I set the start convert every time I take a reading. I dont use a/d interrupt... just wait for conversion complete... about 125usec...

Imagecraft compiler user

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hello,

There is no problem to set the ADEN and ADSC at once. However you'll probably want to throw away that first conversion, and maybe the one after it too.

If you use the ADIF interrupt or not is up to you. If you need the sampling done at a consistent rate then it might be better to use the interrupt.

But really you'll have to dictate if you use it or not. If you just take one reading and don't do anything while waiting for the reading, there would be no point in using it. Or if the update rate is slow you can just do a conversion, do a bunch of stuff, then take the reading. Again it depends how you are using the ADC...

-Colin