avr questions: adc free running & USART

Status
Not open for further replies.

m2babaey

Junior Member level 2
Joined
Oct 18, 2012
Messages
21
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,445
Hi
I have 8 analog channels in atmega128 to read. I want to read these values and send them to master when requested (using RS485 4-wire and MODBUS protocol) part of my circuit is attached


I think I have to wait for a call from master in my code (I am going to use codevisionAVR); so I'd like to set my ADC settings to work in free running mode and the analog values be ready when ever I need to read them and send to master.

But from datasheet, it seems that the channel ADC is working on, should be set in ADMUX register, so it seems free running mode will convert only 1 channel input, I have 8!
I'm afraid I go for reading analog values and get a call from master at the same time and miss that!
Any comments/suggestions?
This is my first code for USART

How I should get notified the master is sending a request to check if it's sending my address, in C++ for AVR?
Thank you in advance for your help
 

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…