Sign in

username:

password:



Not a member?

Search avrclub



Search tips

Subscribe to avrclub



avrclub by Keywords

AT90S2313 | AT90S8515 | ATMega | ATmega128 | ECL | FETS | IAR | Keyboard | LCD | STK50 | TMOS | UART

Ads

Discussion Groups

See Also

DSPFPGAElectronics

Discussion Groups | AVRclub | [AVR club] Timer Interrupt creates problem

Atmel AVR Microcontroller discussion group.

[AVR club] Timer Interrupt creates problem - "Prashant D. Kharade" - Dec 9 1:30:13 2008

Hello,=0D
=0D
=0D
=0D
I am a new to Embedded world. I have chosen AVR series to work=0D
=0D
I am doing a Datalogger project.=0D
=0D
=0D
=0D
Facing a problem during the execution. =0D
=0D
I am sequentially switching the relays, measuring the ADC count & sending t=
o UART for checking purpose.=0D
=0D
I have tried my best & step by step as suggested, but still there is proble=
m.=0D
=0D
=0D
=0D
Problem : The ADC count calculation goes wrong if Timer interrupt is used.=
=0D
=0D
If Timer interrupt is not used, then ADC counts for all 24 c=
hannels are send correctly by UART via serial port.=0D
=0D
If Timer code is added, the channel1 always shows count=
=3D1, & randomly 2 channels shows wrong ADC count.=0D
=0D
=0D
=0D
Project details : 24 channel Data logger for battery system using Atmega128=
.=0D
=0D
=0D
=0D
a. 20 Batteries are connected in series to a Charger.=0D
=0D
b. We have to measure voltage of 20 batteries, current passing through t=
he battery & temperature of pilot battery.=0D
=0D
c. 2 spare channels. So 20voltage, 1 current & 1 temp. Channels.=0D
=0D
d. Relays are driven via ULN2803. Relays are connected in 8row & 3 column=
s.=0D
=0D
e. 8 rows are connected to portA & 3 columns are connected to PC4, PC5, =
& PC6.=0D
=0D
f. Voltages are switched via RL1 to RL20 & fed to ADC0. (ADC1 & sign bi=
t are not used.)=0D
=0D
g. Current is given to ADC3 via RL21. Temp. Is given to ADC2.(Measured by=
3 wire RTD).=0D
=0D
h. Max232 is used for external world communication.=0D
=0D
=0D
=0D
Software : =0D
=0D
=0D
=0D
a. AVRStudio =E2=80=93 4.13=0D
=0D
b. AVR GCC - -20070525=0D
=0D
c. For UART library of Peter Fleurry is used.=0D
=0D
=0D
=0D
Attachment : =0D
=0D
a. Circuit diagram (3 pages)=0D
=0D
b. Code in zip file.=0D
=0D
=0D
=0D
What code is doing :=0D
=0D
=0D
=0D
1. Switches on Relays 1 to 24 sequentially.=0D
=0D
2. Measure voltages appearing at ADC channels in for of ADC counts.=0D
=0D
3. Sending it the counts to UART.=0D
=0D
4. Timer interrupt used to calculate RTC in future. Presently switches on=
& off LED at one second. So interrupt at one second.=0D
=0D
5. If timer interrupt is bypassed all ADC counts are send to serial port =
correctly.=0D
=0D
6. If Timer is used ch1 always gives false ADC count reading & other any =
2 channels randomly gives wrong ADC count.=0D
=0D
=0D
=0D
I have tried my best. Did various permutations & combinations.=0D
=0D
Initially ADC was used under program control, now I have used ADC under ADC=
interrupt mode.=0D
=0D
=0D
=0D
Please help.=0D
=0D
=0D
=0D
Best regards=0D
=0D
Prashant D. Kharade=0D
=0D
Pune. India.=0D
=0D
Phone +91 9881739315=0D
=0D
=0D
=0D
=0D
=0D
=0D
=0D
=0D
=0D
From: a...@atmel.com [mailto:a...@atmel.com] =0D
Sent: 08 December 2008 19:05=0D
To: Prashant D. Kharade=0D
Subject: (ATTicket:525645) Support Form: Timer Interrupt creats problem=0D
=0D
=0D
=0D
Dear Customer,=0D
=0D
As we do not have the source code with us, we are unable to test it here. I=
n the request, what do you mean by "We are switching 24 relays & get the da=
ta." and "If we remove the interrupt all 24 counts from 24 relays are absol=
utely perfect", are you trying to get any data from the relay?=0D
=0D
We recommend to refer the device datasheet under table "ADC Conversion Time=
" in page number 235 for more details about conversion time require for ADC=
result, in the mean time if any interrupt occurs then there is a possibili=
ty for getting random values as result.=0D
=0D
We request you to try the ADC task separately first to identify any problem=
in it. If it works perfect then try the switching of relays individually. =
When both the functions works fine try to include timer counter interrupt o=
f glowing an LED. By this step by step procedures we can identify where the=
issue arrises.=0D
=0D
Even after implementing all the above mentioned instructions, if the proble=
m still persists then feel free to contact us with setup details, reference=
voltage configured, minimal running code and fuse settings.=0D
=0D
=0D
Best Regards,=0D
Srinivasan Mariappan=0D
Atmel Technical Support Team=0D
=0D
---------------------------------------------------------------------=0D
Please help us improve by rating your experience of our support on this req=
uest:=0D
http://support.atmel.no/srv.htm?sid=3D1&hc=3DK1ynnhLQsQjKhV3=0D
---------------------------------------------------------------------=0D
Support and FAQ: http://support.atmel.no/=0D
Distributors: http://www.atmel.com/dyn/general/contact.asp=0D
Atmel AVR: http://www.atmel.com/AVR/=0D
Discussion Forum: http://www.avrfreaks.net/phorum/=0D
=0D
---------------------------------------------------------------------=0D
Participate in the 2008 Atmel Customer Satisfaction Survey:=0D
http://www.atmel.com/quality_customer_survey_08/=0D
---------------------------------------------------------------------=0D
=0D
=0D
=0D
Family : AVR=C2=AE 8-Bit RISC =0D
OtherPartNumber : =0D
Part_no : ATmega128=0D
Name : Prashant=0D
Title : Engg=0D
Company : Ador Powertron Ltd.=0D
City : Pune=0D
Street : 51 DII block MIDC=0D
State : Maharashtra=0D
Country : India=0D
Postal_Code : 411027=0D
Phone : --91-9881739315=0D
Fax : =0D
Site : www.adorpowertron.com=0D
Email : p...@adorpower.com=0D
Problem : Timer Interrupt creats problem=0D
Details : We are designing a datalogger of 24 channels. We are switching 2=
4 relays & get the data. In Timer compare interrupt we are just switching o=
n/pff LED. But if the timer compare interrupt code is added the ADC counts =
are randomly varying. If we remove the interrupt all 24 counts from 24 rela=
ys are absolutely perfect. I tried 2 options. ADC under program control & A=
DC under interrupt control.But still no improvement. How can you give suppo=
rt & help. Best regards Prashant D. Kharade Ador Powertron Ltd. Pune India=
=0D
=0D
No virus found in this incoming message.=0D
Checked by AVG - http://www.avg.com=0D
Version: 8.0.176 / Virus Database: 270.9.15/1838 - Release Date: 08-12-2008=
18:16=0D
=0D
[Non-text portions of this message have been removed]
------------------------------------



(You need to be a member of avrclub -- send a blank email to avrclub-subscribe@yahoogroups.com )


Re: [AVR club] Timer Interrupt creates problem - Kishor Soni - Dec 9 1:38:07 2008

it is simple. disable timer during ADC conversion is going on.

--- On Tue, 12/9/08, Prashant D. Kharade wrote:
From: Prashant D. Kharade
Subject: [AVR club] Timer Interrupt creates problem
To: a...@yahoogroups.com
Date: Tuesday, December 9, 2008, 10:28 AM

=20=20=20=20
Hello,

=20

I am a new to Embedded world. I have chosen AVR series to work

I am doing a Datalogger project.

=20

Facing a problem during the execution.=20

I am sequentially switching the relays, measuring the ADC count & sending t=
o UART for checking purpose.

I have tried my best & step by step as suggested, but still there is proble=
m.

=20

Problem : The ADC count calculation goes wrong if Timer interrupt is used.

If Timer interrupt is not used, then ADC counts for all 24 c=
hannels are send correctly by UART via serial port.

If Timer code is added, the channel1 always shows count=
=3D1, & randomly 2 channels shows wrong ADC count.

=20

Project details : 24 channel Data logger for battery system using Atmega128=
..

=20

a. 20 Batteries are connected in series to a Charger.

b. We have to measure voltage of 20 batteries, current passing through t=
he battery & temperature of pilot battery.

c. 2 spare channels. So 20voltage, 1 current & 1 temp. Channels.

d. Relays are driven via ULN2803. Relays are connected in 8row & 3 column=
s.

e. 8 rows are connected to portA & 3 columns are connected to PC4, PC5, =
& PC6.

f. Voltages are switched via RL1 to RL20 & fed to ADC0. (ADC1 & sign bi=
t are not used.)

g. Current is given to ADC3 via RL21. Temp. Is given to ADC2.(Measured by=
3 wire RTD).

h. Max232 is used for external world communication.

=20

Software :=20

=20

a. AVRStudio =96 4.13

b. AVR GCC - -20070525

c. For UART library of Peter Fleurry is used.

=20

Attachment :=20

a. Circuit diagram (3 pages)

b. Code in zip file.

=20

What code is doing :

=20

1. Switches on Relays 1 to 24 sequentially.

2. Measure voltages appearing at ADC channels in for of ADC counts.

3. Sending it the counts to UART.

4. Timer interrupt used to calculate RTC in future. Presently switches on=
& off LED at one second. So interrupt at one second.

5. If timer interrupt is bypassed all ADC counts are send to serial port =
correctly.

6. If Timer is used ch1 always gives false ADC count reading & other any =
2 channels randomly gives wrong ADC count.

=20

I have tried my best. Did various permutations & combinations.

Initially ADC was used under program control, now I have used ADC under ADC=
interrupt mode.

=20

Please help.

=20

Best regards

Prashant D. Kharade

Pune. India.

Phone +91 9881739315

=20

=20

=20

=20

From: a...@atmel.com [mailto:a...@atmel.com]=20
Sent: 08 December 2008 19:05
To: Prashant D. Kharade
Subject: (ATTicket:525645) Support Form: Timer Interrupt creats problem

=20

Dear Customer,

As we do not have the source code with us, we are unable to test it here. I=
n the request, what do you mean by "We are switching 24 relays & get the da=
ta." and "If we remove the interrupt all 24 counts from 24 relays are absol=
utely perfect", are you trying to get any data from the relay?

We recommend to refer the device datasheet under table "ADC Conversion Time=
" in page number 235 for more details about conversion time require for ADC=
result, in the mean time if any interrupt occurs then there is a possibili=
ty for getting random values as result.

We request you to try the ADC task separately first to identify any problem=
in it. If it works perfect then try the switching of relays individually. =
When both the functions works fine try to include timer counter interrupt o=
f glowing an LED. By this step by step procedures we can identify where the=
issue arrises.

Even after implementing all the above mentioned instructions, if the proble=
m still persists then feel free to contact us with setup details, reference=
voltage configured, minimal running code and fuse settings.

Best Regards,
Srinivasan Mariappan
Atmel Technical Support Team

------------ --------- --------- --------- --------- --------- -
Please help us improve by rating your experience of our support on this req=
uest:
http://support. atmel.no/ srv.htm?sid=3D 1&hc=3DK1ynnhLQsQj KhV3
------------ --------- --------- --------- --------- --------- -
Support and FAQ: http://support. atmel.no/
Distributors: http://www.atmel. com/dyn/general/ contact.asp
Atmel AVR: http://www.atmel. com/AVR/
Discussion Forum: http://www.avrfreak s.net/phorum/

------------ --------- --------- --------- --------- --------- -
Participate in the 2008 Atmel Customer Satisfaction Survey:
http://www.atmel. com/quality_ customer_ survey_08/
------------ --------- --------- --------- --------- --------- -

=20

Family : AVR=AE 8-Bit RISC=20
OtherPartNumber :=20
Part_no : ATmega128
Name : Prashant
Title : Engg
Company : Ador Powertron Ltd.
City : Pune
Street : 51 DII block MIDC
State : Maharashtra
Country : India
Postal_Code : 411027
Phone : --91-9881739315
Fax :=20
Site : www.adorpowertron. com
Email : pdkharade@adorpower .com
Problem : Timer Interrupt creats problem
Details : We are designing a datalogger of 24 channels. We are switching 2=
4 relays & get the data. In Timer compare interrupt we are just switching o=
n/pff LED. But if the timer compare interrupt code is added the ADC counts =
are randomly varying. If we remove the interrupt all 24 counts from 24 rela=
ys are absolutely perfect. I tried 2 options. ADC under program control & A=
DC under interrupt control.But still no improvement. How can you give suppo=
rt & help. Best regards Prashant D. Kharade Ador Powertron Ltd. Pune India

No virus found in this incoming message.
Checked by AVG - http://www.avg. com
Version: 8.0.176 / Virus Database: 270.9.15/1838 - Release Date: 08-12-2008=
18:16

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

=20=20=20=20=20=20

=20=20=20=20
=20=20=20=20
=09
=09=20
=09
=09

=09
=09
=09
=20=20=20=20=20=20

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



(You need to be a member of avrclub -- send a blank email to avrclub-subscribe@yahoogroups.com )

RE: [AVR club] Timer Interrupt creates problem - "Prashant D. Kharade" - Dec 9 7:56:21 2008

Thanks Kishor Soni.
I have already put cli() instruction at start of ADC start & sei() at the e=
nd.

But still the problem comes. I am not able to identify.

Regards

Prashant D. Kharade

-----Original Message-----
From: a...@yahoogroups.com [mailto:a...@yahoogroups.com] On Behalf Of=
Kishor Soni
Sent: 09 December 2008 12:08
To: a...@yahoogroups.com
Subject: Re: [AVR club] Timer Interrupt creates problem

it is simple. disable timer during ADC conversion is going on.

--- On Tue, 12/9/08, Prashant D. Kharade wrote:
From: Prashant D. Kharade
Subject: [AVR club] Timer Interrupt creates problem
To: a...@yahoogroups.com
Date: Tuesday, December 9, 2008, 10:28 AM

=20=20=20=20
Hello,

=20

I am a new to Embedded world. I have chosen AVR series to work

I am doing a Datalogger project.

=20

Facing a problem during the execution.=20

I am sequentially switching the relays, measuring the ADC count & sending t=
o UART for checking purpose.

I have tried my best & step by step as suggested, but still there is proble=
m.

=20

Problem : The ADC count calculation goes wrong if Timer interrupt is used.

If Timer interrupt is not used, then ADC counts for all 24 c=
hannels are send correctly by UART via serial port.

If Timer code is added, the channel1 always shows count=
=3D1, & randomly 2 channels shows wrong ADC count.

=20

Project details : 24 channel Data logger for battery system using Atmega128=
..

=20

a. 20 Batteries are connected in series to a Charger.

b. We have to measure voltage of 20 batteries, current passing through t=
he battery & temperature of pilot battery.

c. 2 spare channels. So 20voltage, 1 current & 1 temp. Channels.

d. Relays are driven via ULN2803. Relays are connected in 8row & 3 column=
s.

e. 8 rows are connected to portA & 3 columns are connected to PC4, PC5, =
& PC6.

f. Voltages are switched via RL1 to RL20 & fed to ADC0. (ADC1 & sign bi=
t are not used.)

g. Current is given to ADC3 via RL21. Temp. Is given to ADC2.(Measured by=
3 wire RTD).

h. Max232 is used for external world communication.

=20

Software :=20

=20

a. AVRStudio =96 4.13

b. AVR GCC - -20070525

c. For UART library of Peter Fleurry is used.

=20

Attachment :=20

a. Circuit diagram (3 pages)

b. Code in zip file.

=20

What code is doing :

=20

1. Switches on Relays 1 to 24 sequentially.

2. Measure voltages appearing at ADC channels in for of ADC counts.

3. Sending it the counts to UART.

4. Timer interrupt used to calculate RTC in future. Presently switches on=
& off LED at one second. So interrupt at one second.

5. If timer interrupt is bypassed all ADC counts are send to serial port =
correctly.

6. If Timer is used ch1 always gives false ADC count reading & other any =
2 channels randomly gives wrong ADC count.

=20

I have tried my best. Did various permutations & combinations.

Initially ADC was used under program control, now I have used ADC under ADC=
interrupt mode.

=20

Please help.

=20

Best regards

Prashant D. Kharade

Pune. India.

Phone +91 9881739315

=20

=20

=20

=20

From: a...@atmel.com [mailto:a...@atmel.com]=20
Sent: 08 December 2008 19:05
To: Prashant D. Kharade
Subject: (ATTicket:525645) Support Form: Timer Interrupt creats problem

=20

Dear Customer,

As we do not have the source code with us, we are unable to test it here. I=
n the request, what do you mean by "We are switching 24 relays & get the da=
ta." and "If we remove the interrupt all 24 counts from 24 relays are absol=
utely perfect", are you trying to get any data from the relay?

We recommend to refer the device datasheet under table "ADC Conversion Time=
" in page number 235 for more details about conversion time require for ADC=
result, in the mean time if any interrupt occurs then there is a possibili=
ty for getting random values as result.

We request you to try the ADC task separately first to identify any problem=
in it. If it works perfect then try the switching of relays individually. =
When both the functions works fine try to include timer counter interrupt o=
f glowing an LED. By this step by step procedures we can identify where the=
issue arrises.

Even after implementing all the above mentioned instructions, if the proble=
m still persists then feel free to contact us with setup details, reference=
voltage configured, minimal running code and fuse settings.

Best Regards,
Srinivasan Mariappan
Atmel Technical Support Team

------------ --------- --------- --------- --------- --------- -
Please help us improve by rating your experience of our support on this req=
uest:
http://support. atmel.no/ srv.htm?sid=3D 1&hc=3DK1ynnhLQsQj KhV3
------------ --------- --------- --------- --------- --------- -
Support and FAQ: http://support. atmel.no/
Distributors: http://www.atmel. com/dyn/general/ contact.asp
Atmel AVR: http://www.atmel. com/AVR/
Discussion Forum: http://www.avrfreak s.net/phorum/

------------ --------- --------- --------- --------- --------- -
Participate in the 2008 Atmel Customer Satisfaction Survey:
http://www.atmel. com/quality_ customer_ survey_08/
------------ --------- --------- --------- --------- --------- -

=20

Family : AVR=AE 8-Bit RISC=20
OtherPartNumber :=20
Part_no : ATmega128
Name : Prashant
Title : Engg
Company : Ador Powertron Ltd.
City : Pune
Street : 51 DII block MIDC
State : Maharashtra
Country : India
Postal_Code : 411027
Phone : --91-9881739315
Fax :=20
Site : www.adorpowertron. com
Email : pdkharade@adorpower .com
Problem : Timer Interrupt creats problem
Details : We are designing a datalogger of 24 channels. We are switching 2=
4 relays & get the data. In Timer compare interrupt we are just switching o=
n/pff LED. But if the timer compare interrupt code is added the ADC counts =
are randomly varying. If we remove the interrupt all 24 counts from 24 rela=
ys are absolutely perfect. I tried 2 options. ADC under program control & A=
DC under interrupt control.But still no improvement. How can you give suppo=
rt & help. Best regards Prashant D. Kharade Ador Powertron Ltd. Pune India

------------------------------------



(You need to be a member of avrclub -- send a blank email to avrclub-subscribe@yahoogroups.com )

Re: [AVR club] Timer Interrupt creates problem - Adam Aliyya Machfud - Dec 9 10:51:15 2008

Dear Prashant,

Hmm you should put :
TCCR3B=3D0x00; // to stop Timer-3 for example, before start ADC
and put :
TCCR3B=3D0x03; // to start again Timer-3, with frequency of 125 kHz (see=
ATmega128 datasheet)
-> TCCR =3D Timer and Counter Control Register

cmiiw
-Adam

________________________________
From: Prashant D. Kharade
To: a...@yahoogroups.com
Sent: Tuesday, December 9, 2008 2:55:50 PM
Subject: RE: [AVR club] Timer Interrupt creates problem

Thanks Kishor Soni.
I have already put cli() instruction at start of ADC start & sei() at the e=
nd.

But still the problem comes. I am not able to identify.

Regards

Prashant D. Kharade

-----Original Message-----
From: a...@yahoogroups.com [mailto:avrclub@yahoogroups..com] On Behalf O=
f Kishor Soni
Sent: 09 December 2008 12:08
To: a...@yahoogroups.com
Subject: Re: [AVR club] Timer Interrupt creates problem

it is simple. disable timer during ADC conversion is going on.

--- On Tue, 12/9/08, Prashant D. Kharade wrote:
From: Prashant D. Kharade
Subject: [AVR club] Timer Interrupt creates problem
To: a...@yahoogroups.com
Date: Tuesday, December 9, 2008, 10:28 AM

=20=20=20=20
Hello,

I am a new to Embedded world. I have chosen AVR series to work

I am doing a Datalogger project.

Facing a problem during the execution.=20

I am sequentially switching the relays, measuring the ADC count & sending t=
o UART for checking purpose.

I have tried my best & step by step as suggested, but still there is proble=
m..

Problem : The ADC count calculation goes wrong if Timer interrupt is used.

If Timer interrupt is not used, then ADC counts for all 24 c=
hannels are send correctly by UART via serial port.

If Timer code is added, the channel1 always shows count=
=3D1, & randomly 2 channels shows wrong ADC count.

Project details : 24 channel Data logger for battery system using Atmega128=
..

a. 20 Batteries are connected in series to a Charger.

b. We have to measure voltage of 20 batteries, current passing through t=
he battery & temperature of pilot battery.

c. 2 spare channels. So 20voltage, 1 current & 1 temp. Channels.

d. Relays are driven via ULN2803. Relays are connected in 8row & 3 column=
s.

e. 8 rows are connected to portA & 3 columns are connected to PC4, PC5, =
& PC6.

f. Voltages are switched via RL1 to RL20 & fed to ADC0. (ADC1 & sign bi=
t are not used.)

g. Current is given to ADC3 via RL21. Temp. Is given to ADC2.(Measured by=
3 wire RTD).

h. Max232 is used for external world communication.

Software :=20

a. AVRStudio =96 4.13

b. AVR GCC - -20070525

c. For UART library of Peter Fleurry is used.

Attachment :=20

a. Circuit diagram (3 pages)

b. Code in zip file.

What code is doing :

1. Switches on Relays 1 to 24 sequentially.

2. Measure voltages appearing at ADC channels in for of ADC counts.

3. Sending it the counts to UART.

4. Timer interrupt used to calculate RTC in future. Presently switches on=
& off LED at one second. So interrupt at one second.

5. If timer interrupt is bypassed all ADC counts are send to serial port =
correctly.

6. If Timer is used ch1 always gives false ADC count reading & other any =
2 channels randomly gives wrong ADC count..

I have tried my best. Did various permutations & combinations.

Initially ADC was used under program control, now I have used ADC under ADC=
interrupt mode.

Please help.

Best regards

Prashant D. Kharade

Pune. India.

Phone +91 9881739315

From: a...@atmel.com [mailto:a...@atmel.com]=20
Sent: 08 December 2008 19:05
To: Prashant D. Kharade
Subject: (ATTicket:525645) Support Form: Timer Interrupt creats problem

Dear Customer,

As we do not have the source code with us, we are unable to test it here. I=
n the request, what do you mean by "We are switching 24 relays & get the da=
ta." and "If we remove the interrupt all 24 counts from 24 relays are absol=
utely perfect", are you trying to get any data from the relay?

We recommend to refer the device datasheet under table "ADC Conversion Time=
" in page number 235 for more details about conversion time require for ADC=
result, in the mean time if any interrupt occurs then there is a possibili=
ty for getting random values as result.

We request you to try the ADC task separately first to identify any problem=
in it. If it works perfect then try the switching of relays individually. =
When both the functions works fine try to include timer counter interrupt o=
f glowing an LED. By this step by step procedures we can identify where the=
issue arrises.

Even after implementing all the above mentioned instructions, if the proble=
m still persists then feel free to contact us with setup details, reference=
voltage configured, minimal running code and fuse settings.

Best Regards,
Srinivasan Mariappan
Atmel Technical Support Team

------------ --------- --------- --------- --------- --------- -
Please help us improve by rating your experience of our support on this req=
uest:
http://support. atmel.no/ srv.htm?sid=3D 1&hc=3DK1ynnhLQsQj KhV3
------------ --------- --------- --------- --------- --------- -
Support and FAQ: http://support. atmel.no/
Distributors: http://www.atmel. com/dyn/general/ contact.asp
Atmel AVR: http://www..atmel. com/AVR/
Discussion Forum: http://www.avrfreak s.net/phorum/

------------ --------- --------- --------- --------- --------- -
Participate in the 2008 Atmel Customer Satisfaction Survey:
http://www.atmel. com/quality_ customer_ survey_08/
------------ --------- --------- --------- --------- --------- -

Family : AVR=AE 8-Bit RISC=20
OtherPartNumber :=20
Part_no : ATmega128
Name : Prashant
Title : Engg
Company : Ador Powertron Ltd.
City : Pune
Street : 51 DII block MIDC
State : Maharashtra
Country : India
Postal_Code : 411027
Phone : --91-9881739315
Fax :=20
Site : www.adorpowertron. com
Email : pdkharade@adorpower .com
Problem : Timer Interrupt creats problem
Details : We are designing a datalogger of 24 channels. We are switchin=
g 24 relays & get the data. In Timer compare interrupt we are just switchin=
g on/pff LED. But if the timer compare interrupt code is added the ADC coun=
ts are randomly varying. If we remove the interrupt all 24 counts from 24 r=
elays are absolutely perfect. I tried 2 options. ADC under program control =
& ADC under interrupt control.But still no improvement. How can you give su=
pport & help. Best regards Prashant D. Kharade Ador Powertron Ltd. Pune Ind=
ia

------------------------------------

______________________________
controlSUITE™ software. Comprehensive. Intuitive. Optimized.
Real-world software for real-time control. Details Here!



(You need to be a member of avrclub -- send a blank email to avrclub-subscribe@yahoogroups.com )

RE: [AVR club] Timer Interrupt creates problem - "Prashant D. Kharade" - Dec 9 23:19:30 2008

Dear Adam,

Thanks. But I have two doubts / problems

1. If I disable timer I will not able to count timer ticks or rather I will=
miss timer tick count. Which I am supposed to do. At each second, I have t=
o increment timer counts. If it matches particular time, then again I have =
to do data logging in Timer based datalogging. If I disable timer, then tim=
ing calculations will be wrong.

2. Why ADC count calculation (stored in global variables) shall change, if =
timer interrupt occurs. They must be stored on stack & retrieved back as pe=
r theory.

Please help.

Regards

Prashant

-----Original Message-----
From: a...@yahoogroups.com [mailto:a...@yahoogroups.com] On Behalf Of=
Adam Aliyya Machfud
Sent: 09 December 2008 20:23
To: a...@yahoogroups.com
Subject: Re: [AVR club] Timer Interrupt creates problem

Dear Prashant,

Hmm you should put :
TCCR3B=3D0x00; // to stop Timer-3 for example, before start ADC
and put :
TCCR3B=3D0x03; // to start again Timer-3, with frequency of 125 kHz (see=
ATmega128 datasheet)
-> TCCR =3D Timer and Counter Control Register

cmiiw
-Adam

________________________________
From: Prashant D. Kharade
To: a...@yahoogroups.com
Sent: Tuesday, December 9, 2008 2:55:50 PM
Subject: RE: [AVR club] Timer Interrupt creates problem

Thanks Kishor Soni.
I have already put cli() instruction at start of ADC start & sei() at the e=
nd.

But still the problem comes. I am not able to identify.

Regards

Prashant D. Kharade

-----Original Message-----
From: a...@yahoogroups.com [mailto:avrclub@yahoogroups..com] On Behalf O=
f Kishor Soni
Sent: 09 December 2008 12:08
To: a...@yahoogroups.com
Subject: Re: [AVR club] Timer Interrupt creates problem

it is simple. disable timer during ADC conversion is going on.

--- On Tue, 12/9/08, Prashant D. Kharade wrote:
From: Prashant D. Kharade
Subject: [AVR club] Timer Interrupt creates problem
To: a...@yahoogroups.com
Date: Tuesday, December 9, 2008, 10:28 AM

=20=20=20=20
Hello,

I am a new to Embedded world. I have chosen AVR series to work

I am doing a Datalogger project.

Facing a problem during the execution.=20

I am sequentially switching the relays, measuring the ADC count & sending t=
o UART for checking purpose.

I have tried my best & step by step as suggested, but still there is proble=
m..

Problem : The ADC count calculation goes wrong if Timer interrupt is used.

If Timer interrupt is not used, then ADC counts for all 24 c=
hannels are send correctly by UART via serial port.

If Timer code is added, the channel1 always shows count=
=3D1, & randomly 2 channels shows wrong ADC count.

Project details : 24 channel Data logger for battery system using Atmega128=
..

a. 20 Batteries are connected in series to a Charger.

b. We have to measure voltage of 20 batteries, current passing through t=
he battery & temperature of pilot battery.

c. 2 spare channels. So 20voltage, 1 current & 1 temp. Channels.

d. Relays are driven via ULN2803. Relays are connected in 8row & 3 column=
s.

e. 8 rows are connected to portA & 3 columns are connected to PC4, PC5, =
& PC6.

f. Voltages are switched via RL1 to RL20 & fed to ADC0. (ADC1 & sign bi=
t are not used.)

g. Current is given to ADC3 via RL21. Temp. Is given to ADC2.(Measured by=
3 wire RTD).

h. Max232 is used for external world communication.

Software :=20

a. AVRStudio =96 4.13

b. AVR GCC - -20070525

c. For UART library of Peter Fleurry is used.

Attachment :=20

a. Circuit diagram (3 pages)

b. Code in zip file.

What code is doing :

1. Switches on Relays 1 to 24 sequentially.

2. Measure voltages appearing at ADC channels in for of ADC counts.

3. Sending it the counts to UART.

4. Timer interrupt used to calculate RTC in future. Presently switches on=
& off LED at one second. So interrupt at one second.

5. If timer interrupt is bypassed all ADC counts are send to serial port =
correctly.

6. If Timer is used ch1 always gives false ADC count reading & other any =
2 channels randomly gives wrong ADC count..

I have tried my best. Did various permutations & combinations.

Initially ADC was used under program control, now I have used ADC under ADC=
interrupt mode.

Please help.

Best regards

Prashant D. Kharade

Pune. India.

Phone +91 9881739315

From: a...@atmel.com [mailto:a...@atmel.com]=20
Sent: 08 December 2008 19:05
To: Prashant D. Kharade
Subject: (ATTicket:525645) Support Form: Timer Interrupt creats problem

Dear Customer,

As we do not have the source code with us, we are unable to test it here. I=
n the request, what do you mean by "We are switching 24 relays & get the da=
ta." and "If we remove the interrupt all 24 counts from 24 relays are absol=
utely perfect", are you trying to get any data from the relay?

We recommend to refer the device datasheet under table "ADC Conversion Time=
" in page number 235 for more details about conversion time require for ADC=
result, in the mean time if any interrupt occurs then there is a possibili=
ty for getting random values as result.

We request you to try the ADC task separately first to identify any problem=
in it. If it works perfect then try the switching of relays individually. =
When both the functions works fine try to include timer counter interrupt o=
f glowing an LED. By this step by step procedures we can identify where the=
issue arrises.

Even after implementing all the above mentioned instructions, if the proble=
m still persists then feel free to contact us with setup details, reference=
voltage configured, minimal running code and fuse settings.

Best Regards,
Srinivasan Mariappan
Atmel Technical Support Team

------------ --------- --------- --------- --------- --------- -
Please help us improve by rating your experience of our support on this req=
uest:
http://support. atmel.no/ srv.htm?sid=3D 1&hc=3DK1ynnhLQsQj KhV3
------------ --------- --------- --------- --------- --------- -
Support and FAQ: http://support. atmel.no/
Distributors: http://www.atmel. com/dyn/general/ contact.asp
Atmel AVR: http://www..atmel. com/AVR/
Discussion Forum: http://www.avrfreak s.net/phorum/

------------ --------- --------- --------- --------- --------- -
Participate in the 2008 Atmel Customer Satisfaction Survey:
http://www.atmel. com/quality_ customer_ survey_08/
------------ --------- --------- --------- --------- --------- -

Family : AVR=AE 8-Bit RISC=20
OtherPartNumber :=20
Part_no : ATmega128
Name : Prashant
Title : Engg
Company : Ador Powertron Ltd.
City : Pune
Street : 51 DII block MIDC
State : Maharashtra
Country : India
Postal_Code : 411027
Phone : --91-9881739315
Fax :=20
Site : www.adorpowertron. com
Email : pdkharade@adorpower .com
Problem : Timer Interrupt creats problem
Details : We are designing a datalogger of 24 channels. We are switchin=
g 24 relays & get the data. In Timer compare interrupt we are just switchin=
g on/pff LED. But if the timer compare interrupt code is added the ADC coun=
ts are randomly varying. If we remove the interrupt all 24 counts from 24 r=
elays are absolutely perfect. I tried 2 options. ADC under program control =
& ADC under interrupt control.But still no improvement. How can you give su=
pport & help. Best regards Prashant D. Kharade Ador Powertron Ltd. Pune Ind=
ia

------------------------------------



(You need to be a member of avrclub -- send a blank email to avrclub-subscribe@yahoogroups.com )

RE: [AVR club] Timer Interrupt creates problem - Kishor Soni - Dec 10 1:21:49 2008

OK,
If you need logging the data every second, then divide timer service into 5=
00mS (half second).
arrange a flag for task indication.
for ex. a bit indicates task, then 0 =3D count timer value, 1 =3D read ADC =
value.
toggle the bit with every 500 mS timer call

Kishor Soni
--- On Tue, 12/9/08, Prashant D. Kharade wrote:
From: Prashant D. Kharade
Subject: RE: [AVR club] Timer Interrupt creates problem
To: a...@yahoogroups.com
Date: Tuesday, December 9, 2008, 1:25 PM

Thanks Kishor Soni.
I have already put cli() instruction at start of ADC start & sei() at the
end.

But still the problem comes. I am not able to identify.

Regards

Prashant D. Kharade

-----Original Message-----
From: a...@yahoogroups.com [mailto:a...@yahoogroups.com] On Behalf Of
Kishor Soni
Sent: 09 December 2008 12:08
To: a...@yahoogroups.com
Subject: Re: [AVR club] Timer Interrupt creates problem

it is simple. disable timer during ADC conversion is going on.

--- On Tue, 12/9/08, Prashant D. Kharade wrote:
From: Prashant D. Kharade
Subject: [AVR club] Timer Interrupt creates problem
To: a...@yahoogroups.com
Date: Tuesday, December 9, 2008, 10:28 AM

=20=20=20=20
Hello,

=20

I am a new to Embedded world. I have chosen AVR series to work

I am doing a Datalogger project.

=20

Facing a problem during the execution.=20

I am sequentially switching the relays, measuring the ADC count & sending
to UART for checking purpose.

I have tried my best & step by step as suggested, but still there is
problem.

=20

Problem : The ADC count calculation goes wrong if Timer interrupt is used.

If Timer interrupt is not used, then ADC counts for all 24
channels are send correctly by UART via serial port.

If Timer code is added, the channel1 always shows count=
=3D1,
& randomly 2 channels shows wrong ADC count.

=20

Project details : 24 channel Data logger for battery system using Atmega128=
...

=20

a. 20 Batteries are connected in series to a Charger.

b. We have to measure voltage of 20 batteries, current passing through t=
he
battery & temperature of pilot battery.

c. 2 spare channels. So 20voltage, 1 current & 1 temp. Channels.

d. Relays are driven via ULN2803. Relays are connected in 8row & 3
columns.

e. 8 rows are connected to portA & 3 columns are connected to PC4, PC5,
& PC6.

f. Voltages are switched via RL1 to RL20 & fed to ADC0. (ADC1 &
sign bit are not used.)

g. Current is given to ADC3 via RL21. Temp. Is given to ADC2.(Measured by=
3
wire RTD).

h. Max232 is used for external world communication.

=20

Software :=20

=20

a. AVRStudio =96 4.13

b. AVR GCC - -20070525

c. For UART library of Peter Fleurry is used.

=20

Attachment :=20

a. Circuit diagram (3 pages)

b. Code in zip file.

=20

What code is doing :

=20

1. Switches on Relays 1 to 24 sequentially.

2. Measure voltages appearing at ADC channels in for of ADC counts.

3. Sending it the counts to UART.

4. Timer interrupt used to calculate RTC in future. Presently switches on
& off LED at one second. So interrupt at one second.

5. If timer interrupt is bypassed all ADC counts are send to serial port
correctly.

6. If Timer is used ch1 always gives false ADC count reading & other any
2 channels randomly gives wrong ADC count.

=20

I have tried my best. Did various permutations & combinations.

Initially ADC was used under program control, now I have used ADC under ADC
interrupt mode.

=20

Please help.

=20

Best regards

Prashant D. Kharade

Pune. India.

Phone +91 9881739315

=20

=20

=20

=20

From: a...@atmel.com [mailto:a...@atmel.com]=20
Sent: 08 December 2008 19:05
To: Prashant D. Kharade
Subject: (ATTicket:525645) Support Form: Timer Interrupt creats problem

=20

Dear Customer,

As we do not have the source code with us, we are unable to test it here. I=
n
the request, what do you mean by "We are switching 24 relays & get the
data." and "If we remove the interrupt all 24 counts from 24 relays
are absolutely perfect", are you trying to get any data from the relay?

We recommend to refer the device datasheet under table "ADC Conversion
Time" in page number 235 for more details about conversion time require for
ADC result, in the mean time if any interrupt occurs then there is a possib=
ility
for getting random values as result.

We request you to try the ADC task separately first to identify any problem=
in
it. If it works perfect then try the switching of relays individually. When=
both
the functions works fine try to include timer counter interrupt of glowing =
an
LED. By this step by step procedures we can identify where the issue arrise=
s.

Even after implementing all the above mentioned instructions, if the proble=
m
still persists then feel free to contact us with setup details, reference
voltage configured, minimal running code and fuse settings.

Best Regards,
Srinivasan Mariappan
Atmel Technical Support Team

------------ --------- --------- --------- --------- --------- -
Please help us improve by rating your experience of our support on this
request:
http://support. atmel.no/ srv.htm?sid=3D 1&hc=3DK1ynnhLQsQj KhV3
------------ --------- --------- --------- --------- --------- -
Support and FAQ: http://support. atmel.no/
Distributors: http://www.atmel. com/dyn/general/ contact.asp
Atmel AVR: http://www.atmel. com/AVR/
Discussion Forum: http://www.avrfreak s.net/phorum/

------------ --------- --------- --------- --------- --------- -
Participate in the 2008 Atmel Customer Satisfaction Survey:
http://www.atmel. com/quality_ customer_ survey_08/
------------ --------- --------- --------- --------- --------- -

=20

Family : AVR=AE 8-Bit RISC=20
OtherPartNumber :=20
Part_no : ATmega128
Name : Prashant
Title : Engg
Company : Ador Powertron Ltd.
City : Pune
Street : 51 DII block MIDC
State : Maharashtra
Country : India
Postal_Code : 411027
Phone : --91-9881739315
Fax :=20
Site : www.adorpowertron. com
Email : pdkharade@adorpower .com
Problem : Timer Interrupt creats problem
Details : We are designing a datalogger of 24 channels. We are switching 2=
4
relays & get the data. In Timer compare interrupt we are just switching
on/pff LED. But if the timer compare interrupt code is added the ADC counts=
are
randomly varying. If we remove the interrupt all 24 counts from 24 relays a=
re
absolutely perfect. I tried 2 options. ADC under program control & ADC unde=
r
interrupt control.But still no improvement. How can you give support & help=
..
Best regards Prashant D. Kharade Ador Powertron Ltd. Pune India

------------------------------------



(You need to be a member of avrclub -- send a blank email to avrclub-subscribe@yahoogroups.com )

RE: [AVR club] Timer Interrupt creates problem - "Prashant D. Kharade" - Dec 10 9:52:06 2008

Dear Kishor,

I am little confused with your explanation.
Datalogger is time based or event based.

1. Event based - Signal will come remotely to indicate start datalogging.
2. Time based - User can give fixed time, like 1sec, 30sec, 1min, 10 min. T=
hen after each 10sec or set time datalogging shall be done.

Now I am testing in event based.
When I am giving external command, some channel reads wrong because, Timer =
interrupt is working.
I am measuring time at resolution of 1sec. The moment it goes to timer inte=
rrupt, the ongoing ADC reading goes wrong.=20

Why this is happening? How to overcome this ?

Regards

Prashant
p...@adorpower.com
-----Original Message-----
From: a...@yahoogroups.com [mailto:a...@yahoogroups.com] On Behalf Of=
Kishor Soni
Sent: 10 December 2008 11:52
To: a...@yahoogroups.com
Subject: RE: [AVR club] Timer Interrupt creates problem

OK,
If you need logging the data every second, then divide timer service into 5=
00mS (half second).
arrange a flag for task indication.
for ex. a bit indicates task, then 0 =3D count timer value, 1 =3D read ADC =
value.
toggle the bit with every 500 mS timer call

Kishor Soni
--- On Tue, 12/9/08, Prashant D. Kharade wrote:
From: Prashant D. Kharade
Subject: RE: [AVR club] Timer Interrupt creates problem
To: a...@yahoogroups.com
Date: Tuesday, December 9, 2008, 1:25 PM

Thanks Kishor Soni.
I have already put cli() instruction at start of ADC start & sei() at the
end.

But still the problem comes. I am not able to identify.

Regards

Prashant D. Kharade

-----Original Message-----
From: a...@yahoogroups.com [mailto:a...@yahoogroups.com] On Behalf Of
Kishor Soni
Sent: 09 December 2008 12:08
To: a...@yahoogroups.com
Subject: Re: [AVR club] Timer Interrupt creates problem

it is simple. disable timer during ADC conversion is going on.

--- On Tue, 12/9/08, Prashant D. Kharade wrote:
From: Prashant D. Kharade
Subject: [AVR club] Timer Interrupt creates problem
To: a...@yahoogroups.com
Date: Tuesday, December 9, 2008, 10:28 AM

=20=20=20=20
Hello,

=20

I am a new to Embedded world. I have chosen AVR series to work

I am doing a Datalogger project.

=20

Facing a problem during the execution.=20

I am sequentially switching the relays, measuring the ADC count & sending
to UART for checking purpose.

I have tried my best & step by step as suggested, but still there is
problem.

=20

Problem : The ADC count calculation goes wrong if Timer interrupt is used.

If Timer interrupt is not used, then ADC counts for all 24
channels are send correctly by UART via serial port.

If Timer code is added, the channel1 always shows count=
=3D1,
& randomly 2 channels shows wrong ADC count.

=20

Project details : 24 channel Data logger for battery system using Atmega128=
...

=20

a. 20 Batteries are connected in series to a Charger.

b. We have to measure voltage of 20 batteries, current passing through t=
he
battery & temperature of pilot battery.

c. 2 spare channels. So 20voltage, 1 current & 1 temp. Channels.

d. Relays are driven via ULN2803. Relays are connected in 8row & 3
columns.

e. 8 rows are connected to portA & 3 columns are connected to PC4, PC5,
& PC6.

f. Voltages are switched via RL1 to RL20 & fed to ADC0. (ADC1 &
sign bit are not used.)

g. Current is given to ADC3 via RL21. Temp. Is given to ADC2.(Measured by=
3
wire RTD).

h. Max232 is used for external world communication.

=20

Software :=20

=20

a. AVRStudio =96 4.13

b. AVR GCC - -20070525

c. For UART library of Peter Fleurry is used.

=20

Attachment :=20

a. Circuit diagram (3 pages)

b. Code in zip file.

=20

What code is doing :

=20

1. Switches on Relays 1 to 24 sequentially.

2. Measure voltages appearing at ADC channels in for of ADC counts.

3. Sending it the counts to UART.

4. Timer interrupt used to calculate RTC in future. Presently switches on
& off LED at one second. So interrupt at one second.

5. If timer interrupt is bypassed all ADC counts are send to serial port
correctly.

6. If Timer is used ch1 always gives false ADC count reading & other any
2 channels randomly gives wrong ADC count.

=20

I have tried my best. Did various permutations & combinations.

Initially ADC was used under program control, now I have used ADC under ADC
interrupt mode.

=20

Please help.

=20

Best regards

Prashant D. Kharade

Pune. India.

Phone +91 9881739315

=20

=20

=20

=20

From: a...@atmel.com [mailto:a...@atmel.com]=20
Sent: 08 December 2008 19:05
To: Prashant D. Kharade
Subject: (ATTicket:525645) Support Form: Timer Interrupt creats problem

=20

Dear Customer,

As we do not have the source code with us, we are unable to test it here. I=
n
the request, what do you mean by "We are switching 24 relays & get the
data." and "If we remove the interrupt all 24 counts from 24 relays
are absolutely perfect", are you trying to get any data from the relay?

We recommend to refer the device datasheet under table "ADC Conversion
Time" in page number 235 for more details about conversion time require for
ADC result, in the mean time if any interrupt occurs then there is a possib=
ility
for getting random values as result.

We request you to try the ADC task separately first to identify any problem=
in
it. If it works perfect then try the switching of relays individually. When=
both
the functions works fine try to include timer counter interrupt of glowing =
an
LED. By this step by step procedures we can identify where the issue arrise=
s.

Even after implementing all the above mentioned instructions, if the proble=
m
still persists then feel free to contact us with setup details, reference
voltage configured, minimal running code and fuse settings.

Best Regards,
Srinivasan Mariappan
Atmel Technical Support Team

------------ --------- --------- --------- --------- --------- -
Please help us improve by rating your experience of our support on this
request:
http://support. atmel.no/ srv.htm?sid=3D 1&hc=3DK1ynnhLQsQj KhV3
------------ --------- --------- --------- --------- --------- -
Support and FAQ: http://support. atmel.no/
Distributors: http://www.atmel. com/dyn/general/ contact.asp
Atmel AVR: http://www.atmel. com/AVR/
Discussion Forum: http://www.avrfreak s.net/phorum/

------------ --------- --------- --------- --------- --------- -
Participate in the 2008 Atmel Customer Satisfaction Survey:
http://www.atmel. com/quality_ customer_ survey_08/
------------ --------- --------- --------- --------- --------- -

=20

Family : AVR=AE 8-Bit RISC=20
OtherPartNumber :=20
Part_no : ATmega128
Name : Prashant
Title : Engg
Company : Ador Powertron Ltd.
City : Pune
Street : 51 DII block MIDC
State : Maharashtra
Country : India
Postal_Code : 411027
Phone : --91-9881739315
Fax :=20
Site : www.adorpowertron. com
Email : pdkharade@adorpower .com
Problem : Timer Interrupt creats problem
Details : We are designing a datalogger of 24 channels. We are switching 2=
4
relays & get the data. In Timer compare interrupt we are just switching
on/pff LED. But if the timer compare interrupt code is added the ADC counts=
are
randomly varying. If we remove the interrupt all 24 counts from 24 relays a=
re
absolutely perfect. I tried 2 options. ADC under program control & ADC unde=
r
interrupt control.But still no improvement. How can you give support & help=
..
Best regards Prashant D. Kharade Ador Powertron Ltd. Pune India

------------------------------------



(You need to be a member of avrclub -- send a blank email to avrclub-subscribe@yahoogroups.com )

Re: [AVR club] Timer Interrupt creates problem - Jim Bacon - Dec 10 13:45:00 2008

Where is this documented?
I had roughly the same set of problems with my project, and stopping
timer interrupts during ADC measurements seems to have fixed them.
However, I can't find references to the issues.

Anyway ... thanks for the input!

Prashant D. Kharade wrote:
> Dear Kishor,
>
> I am little confused with your explanation.
> Datalogger is time based or event based.
>
> 1. Event based - Signal will come remotely to indicate start datalogging.
> 2. Time based - User can give fixed time, like 1sec, 30sec, 1min, 10 min. Then after each 10sec or set time datalogging shall be done.
>
> Now I am testing in event based.
> When I am giving external command, some channel reads wrong because, Timer interrupt is working.
> I am measuring time at resolution of 1sec. The moment it goes to timer interrupt, the ongoing ADC reading goes wrong.
>
> Why this is happening? How to overcome this ?
>
> Regards
>
> Prashant
> p...@adorpower.com
> -----Original Message-----
> From: a...@yahoogroups.com [mailto:a...@yahoogroups.com] On Behalf Of Kishor Soni
> Sent: 10 December 2008 11:52
> To: a...@yahoogroups.com
> Subject: RE: [AVR club] Timer Interrupt creates problem
>
> OK,
> If you need logging the data every second, then divide timer service into 500mS (half second).
> arrange a flag for task indication.
> for ex. a bit indicates task, then 0 = count timer value, 1 = read ADC value.
> toggle the bit with every 500 mS timer call
>
> Kishor Soni
> --- On Tue, 12/9/08, Prashant D. Kharade wrote:
> From: Prashant D. Kharade
> Subject: RE: [AVR club] Timer Interrupt creates problem
> To: a...@yahoogroups.com
> Date: Tuesday, December 9, 2008, 1:25 PM
>
> Thanks Kishor Soni.
> I have already put cli() instruction at start of ADC start & sei() at the
> end.
>
> But still the problem comes. I am not able to identify.
>
> Regards
>
> Prashant D. Kharade
>
> -----Original Message-----
> From: a...@yahoogroups.com [mailto:a...@yahoogroups.com] On Behalf Of
> Kishor Soni
> Sent: 09 December 2008 12:08
> To: a...@yahoogroups.com
> Subject: Re: [AVR club] Timer Interrupt creates problem
>
> it is simple. disable timer during ADC conversion is going on.
>
> --- On Tue, 12/9/08, Prashant D. Kharade wrote:
> From: Prashant D. Kharade
> Subject: [AVR club] Timer Interrupt creates problem
> To: a...@yahoogroups.com
> Date: Tuesday, December 9, 2008, 10:28 AM
>
> Hello,
>
>
>
> I am a new to Embedded world. I have chosen AVR series to work
>
> I am doing a Datalogger project.
>
>
>
> Facing a problem during the execution.
>
> I am sequentially switching the relays, measuring the ADC count & sending
> to UART for checking purpose.
>
> I have tried my best & step by step as suggested, but still there is
> problem.
>
>
>
> Problem : The ADC count calculation goes wrong if Timer interrupt is used.
>
> If Timer interrupt is not used, then ADC counts for all 24
> channels are send correctly by UART via serial port.
>
> If Timer code is added, the channel1 always shows count=1,
> & randomly 2 channels shows wrong ADC count.
>
>
>
> Project details : 24 channel Data logger for battery system using Atmega128...
>
>
>
> a. 20 Batteries are connected in series to a Charger.
>
> b. We have to measure voltage of 20 batteries, current passing through the
> battery & temperature of pilot battery.
>
> c. 2 spare channels. So 20voltage, 1 current & 1 temp. Channels.
>
> d. Relays are driven via ULN2803. Relays are connected in 8row & 3
> columns.
>
> e. 8 rows are connected to portA & 3 columns are connected to PC4, PC5,
> & PC6.
>
> f. Voltages are switched via RL1 to RL20 & fed to ADC0. (ADC1 &
> sign bit are not used.)
>
> g. Current is given to ADC3 via RL21. Temp. Is given to ADC2.(Measured by 3
> wire RTD).
>
> h. Max232 is used for external world communication.
>
>
>
> Software :
>
>
>
> a. AVRStudio – 4.13
>
> b. AVR GCC - -20070525
>
> c. For UART library of Peter Fleurry is used.
>
>
>
> Attachment :
>
> a. Circuit diagram (3 pages)
>
> b. Code in zip file.
>
>
>
> What code is doing :
>
>
>
> 1. Switches on Relays 1 to 24 sequentially.
>
> 2. Measure voltages appearing at ADC channels in for of ADC counts.
>
> 3. Sending it the counts to UART.
>
> 4. Timer interrupt used to calculate RTC in future. Presently switches on
> & off LED at one second. So interrupt at one second.
>
> 5. If timer interrupt is bypassed all ADC counts are send to serial port
> correctly.
>
> 6. If Timer is used ch1 always gives false ADC count reading & other any
> 2 channels randomly gives wrong ADC count.
>
>
>
> I have tried my best. Did various permutations & combinations.
>
> Initially ADC was used under program control, now I have used ADC under ADC
> interrupt mode.
>
>
>
> Please help.
>
>
>
> Best regards
>
> Prashant D. Kharade
>
> Pune. India.
>
> Phone +91 9881739315
>
>
>
>
>
>
>
>
>
> From: a...@atmel.com [mailto:a...@atmel.com]
> Sent: 08 December 2008 19:05
> To: Prashant D. Kharade
> Subject: (ATTicket:525645) Support Form: Timer Interrupt creats problem
>
>
>
> Dear Customer,
>
> As we do not have the source code with us, we are unable to test it here. In
> the request, what do you mean by "We are switching 24 relays & get the
> data." and "If we remove the interrupt all 24 counts from 24 relays
> are absolutely perfect", are you trying to get any data from the relay?
>
> We recommend to refer the device datasheet under table "ADC Conversion
> Time" in page number 235 for more details about conversion time require for
> ADC result, in the mean time if any interrupt occurs then there is a possibility
> for getting random values as result.
>
> We request you to try the ADC task separately first to identify any problem in
> it. If it works perfect then try the switching of relays individually. When both
> the functions works fine try to include timer counter interrupt of glowing an
> LED. By this step by step procedures we can identify where the issue arrises.
>
> Even after implementing all the above mentioned instructions, if the problem
> still persists then feel free to contact us with setup details, reference
> voltage configured, minimal running code and fuse settings.
> Best Regards,
> Srinivasan Mariappan
> Atmel Technical Support Team
>
> ------------ --------- --------- --------- --------- --------- -
> Please help us improve by rating your experience of our support on this
> request:
> http://support. atmel.no/ srv.htm?sid= 1&hc=K1ynnhLQsQj KhV3
> ------------ --------- --------- --------- --------- --------- -
> Support and FAQ: http://support. atmel.no/
> Distributors: http://www.atmel. com/dyn/general/ contact.asp
> Atmel AVR: http://www.atmel. com/AVR/
> Discussion Forum: http://www.avrfreak s.net/phorum/
>
> ------------ --------- --------- --------- --------- --------- -
> Participate in the 2008 Atmel Customer Satisfaction Survey:
> http://www.atmel. com/quality_ customer_ survey_08/
> ------------ --------- --------- --------- --------- --------- -
>
>
>
> Family : AVR® 8-Bit RISC
> OtherPartNumber :
> Part_no : ATmega128
> Name : Prashant
> Title : Engg
> Company : Ador Powertron Ltd.
> City : Pune
> Street : 51 DII block MIDC
> State : Maharashtra
> Country : India
> Postal_Code : 411027
> Phone : --91-9881739315
> Fax :
> Site : www.adorpowertron. com
> Email : pdkharade@adorpower .com
> Problem : Timer Interrupt creats problem
> Details : We are designing a datalogger of 24 channels. We are switching 24
> relays & get the data. In Timer compare interrupt we are just switching
> on/pff LED. But if the timer compare interrupt code is added the ADC counts are
> randomly varying. If we remove the interrupt all 24 counts from 24 relays are
> absolutely perfect. I tried 2 options. ADC under program control & ADC under
> interrupt control.But still no improvement. How can you give support & help..
> Best regards Prashant D. Kharade Ador Powertron Ltd. Pune India
> ------------------------------------

______________________________
controlSUITE™ software. Comprehensive. Intuitive. Optimized.
Real-world software for real-time control. Details Here!



(You need to be a member of avrclub -- send a blank email to avrclub-subscribe@yahoogroups.com )

RE: [AVR club] Timer Interrupt creates problem - Kishor Soni - Dec 11 1:48:24 2008

Then you tell me what is you want to do exactly.=20
can you sand me block diagram or flow chart ?

Kishor Soni

--- On Wed, 12/10/08, Prashant D. Kharade wrote:
From: Prashant D. Kharade
Subject: RE: [AVR club] Timer Interrupt creates problem
To: a...@yahoogroups.com
Date: Wednesday, December 10, 2008, 2:29 PM

Dear Kishor,

I am little confused with your explanation.
Datalogger is time based or event based.

1. Event based - Signal will come remotely to indicate start datalogging.
2. Time based - User can give fixed time, like 1sec, 30sec, 1min, 10 min. T=
hen
after each 10sec or set time datalogging shall be done.

Now I am testing in event based.
When I am giving external command, some channel reads wrong because, Timer
interrupt is working.
I am measuring time at resolution of 1sec. The moment it goes to timer
interrupt, the ongoing ADC reading goes wrong.=20

Why this is happening? How to overcome this ?

Regards

Prashant
p...@adorpower.com
-----Original Message-----
From: a...@yahoogroups.com [mailto:a...@yahoogroups.com] On Behalf Of
Kishor Soni
Sent: 10 December 2008 11:52
To: a...@yahoogroups.com
Subject: RE: [AVR club] Timer Interrupt creates problem

OK,
If you need logging the data every second, then divide timer service into 5=
00mS
(half second).
arrange a flag for task indication.
for ex. a bit indicates task, then 0 =3D count timer value, 1 =3D read ADC =
value.
toggle the bit with every 500 mS timer call

Kishor Soni
--- On Tue, 12/9/08, Prashant D. Kharade wrote:
From: Prashant D. Kharade
Subject: RE: [AVR club] Timer Interrupt creates problem
To: a...@yahoogroups.com
Date: Tuesday, December 9, 2008, 1:25 PM

Thanks Kishor Soni.
I have already put cli() instruction at start of ADC start & sei() at the
end.

But still the problem comes. I am not able to identify.

Regards

Prashant D. Kharade

-----Original Message-----
From: a...@yahoogroups.com [mailto:a...@yahoogroups.com] On Behalf Of
Kishor Soni
Sent: 09 December 2008 12:08
To: a...@yahoogroups.com
Subject: Re: [AVR club] Timer Interrupt creates problem

it is simple. disable timer during ADC conversion is going on.

--- On Tue, 12/9/08, Prashant D. Kharade wrote:
From: Prashant D. Kharade
Subject: [AVR club] Timer Interrupt creates problem
To: a...@yahoogroups.com
Date: Tuesday, December 9, 2008, 10:28 AM

=20=20=20=20
Hello,

=20

I am a new to Embedded world. I have chosen AVR series to work

I am doing a Datalogger project.

=20

Facing a problem during the execution.=20

I am sequentially switching the relays, measuring the ADC count & sending
to UART for checking purpose.

I have tried my best & step by step as suggested, but still there is
problem.

=20

Problem : The ADC count calculation goes wrong if Timer interrupt is used.

If Timer interrupt is not used, then ADC counts for all 24
channels are send correctly by UART via serial port.

If Timer code is added, the channel1 always shows count=
=3D1,
& randomly 2 channels shows wrong ADC count.

=20

Project details : 24 channel Data logger for battery system using Atmega128=
....

=20

a. 20 Batteries are connected in series to a Charger.

b. We have to measure voltage of 20 batteries, current passing through t=
he
battery & temperature of pilot battery.

c. 2 spare channels. So 20voltage, 1 current & 1 temp. Channels.

d. Relays are driven via ULN2803. Relays are connected in 8row & 3
columns.

e. 8 rows are connected to portA & 3 columns are connected to PC4, PC5,
& PC6.

f. Voltages are switched via RL1 to RL20 & fed to ADC0. (ADC1 &
sign bit are not used.)

g. Current is given to ADC3 via RL21. Temp. Is given to ADC2.(Measured by=
3
wire RTD).

h. Max232 is used for external world communication.

=20

Software :=20

=20

a. AVRStudio =96 4.13

b. AVR GCC - -20070525

c. For UART library of Peter Fleurry is used.

=20

Attachment :=20

a. Circuit diagram (3 pages)

b. Code in zip file.

=20

What code is doing :

=20

1. Switches on Relays 1 to 24 sequentially.

2. Measure voltages appearing at ADC channels in for of ADC counts.

3. Sending it the counts to UART.

4. Timer interrupt used to calculate RTC in future. Presently switches on
& off LED at one second. So interrupt at one second.

5. If timer interrupt is bypassed all ADC counts are send to serial port
correctly.

6. If Timer is used ch1 always gives false ADC count reading & other any
2 channels randomly gives wrong ADC count.

=20

I have tried my best. Did various permutations & combinations.

Initially ADC was used under program control, now I have used ADC under ADC
interrupt mode.

=20

Please help.

=20

Best regards

Prashant D. Kharade

Pune. India.

Phone +91 9881739315

=20

=20

=20

=20

From: a...@atmel.com [mailto:a...@atmel.com]=20
Sent: 08 December 2008 19:05
To: Prashant D. Kharade
Subject: (ATTicket:525645) Support Form: Timer Interrupt creats problem

=20

Dear Customer,

As we do not have the source code with us, we are unable to test it here. I=
n
the request, what do you mean by "We are switching 24 relays & get the
data." and "If we remove the interrupt all 24 counts from 24 relays
are absolutely perfect", are you trying to get any data from the relay?

We recommend to refer the device datasheet under table "ADC Conversion
Time" in page number 235 for more details about conversion time require
for
ADC result, in the mean time if any interrupt occurs then there is a
possibility
for getting random values as result.

We request you to try the ADC task separately first to identify any problem=
in
it. If it works perfect then try the switching of relays individually. When
both
the functions works fine try to include timer counter interrupt of glowing =
an
LED. By this step by step procedures we can identify where the issue arrise=
s.

Even after implementing all the above mentioned instructions, if the proble=
m
still persists then feel free to contact us with setup details, reference
voltage configured, minimal running code and fuse settings.

Best Regards,
Srinivasan Mariappan
Atmel Technical Support Team

------------ --------- --------- --------- --------- --------- -
Please help us improve by rating your experience of our support on this
request:
http://support. atmel.no/ srv.htm?sid=3D 1&hc=3DK1ynnhLQsQj KhV3
------------ --------- --------- --------- --------- --------- -
Support and FAQ: http://support. atmel.no/
Distributors: http://www.atmel. com/dyn/general/ contact.asp
Atmel AVR: http://www.atmel. com/AVR/
Discussion Forum: http://www.avrfreak s.net/phorum/

------------ --------- --------- --------- --------- --------- -
Participate in the 2008 Atmel Customer Satisfaction Survey:
http://www.atmel. com/quality_ customer_ survey_08/
------------ --------- --------- --------- --------- --------- -

=20

Family : AVR=AE 8-Bit RISC=20
OtherPartNumber :=20
Part_no : ATmega128
Name : Prashant
Title : Engg
Company : Ador Powertron Ltd.
City : Pune
Street : 51 DII block MIDC
State : Maharashtra
Country : India
Postal_Code : 411027
Phone : --91-9881739315
Fax :=20
Site : www.adorpowertron. com
Email : pdkharade@adorpower .com
Problem : Timer Interrupt creats problem
Details : We are designing a datalogger of 24 channels. We are switching 2=
4
relays & get the data. In Timer compare interrupt we are just switching
on/pff LED. But if the timer compare interrupt code is added the ADC counts=
are
randomly varying. If we remove the interrupt all 24 counts from 24 relays a=
re
absolutely perfect. I tried 2 options. ADC under program control & ADC
under
interrupt control.But still no improvement. How can you give support &
help..
Best regards Prashant D. Kharade Ador Powertron Ltd. Pune India

------------------------------------



(You need to be a member of avrclub -- send a blank email to avrclub-subscribe@yahoogroups.com )

RE: [AVR club] Timer Interrupt creates problem - "Prashant D. Kharade" - Dec 13 3:29:00 2008

Hi, thanks for the input.

=20

Attached is =91C=92 code.

=20

I have total 24 relays to shift & measure voltage appearing.

Datalgooer is connected to Battery string. Battery is connected to a thyris=
tor charger panel.

So there is lot of ripple.=20

So I had plan to measure each channel for 50 times & take the average.

For current measurement, 75mV amplifier is connected. It has huge ripple. S=
o I have to wait for 400ms, then take the 50 samples & average it.

So for current channel, there is additional delay.

=20

For testing purpose, I am sending the ADC counts to PC via UART.

=20

I am sequentially switching the relays, measuring the ADC count & sending t=
o UART for checking purpose.

I have tried my best & step by step as suggested, but still there is proble=
m.

=20

Problem : The ADC count calculation goes wrong if Timer interrupt is used.

If Timer interrupt is not used, then ADC counts for all 24 c=
hannels are send correctly by UART via serial port.

If Timer code is added, the channel1 always shows count=
=3D1, & randomly 2 channels shows wrong ADC count.

=20

Project details : 24 channel Data logger for battery system using Atmega128=
.

=20

a. 20 Batteries are connected in series to a Charger.

b. We have to measure voltage of 20 batteries, current passing through t=
he battery & temperature of pilot battery.

c. 2 spare channels. So 20voltage, 1 current & 1 temp. Channels.

d. Relays are driven via ULN2803. Relays are connected in 8row & 3 column=
s.

e. 8 rows are connected to portA & 3 columns are connected to PC4, PC5, =
& PC6.

f. Voltages are switched via RL1 to RL20 & fed to ADC0. (ADC1 & sign bi=
t are not used.)

g. Current is given to ADC3 via RL21. Temp. Is given to ADC2.(Measured by=
3 wire RTD).

h. Max232 is used for external world communication.

=20

Software :=20

=20

a. AVRStudio =96 4.14.589

b. AVR GCC - -20070525

c. For UART library of Peter Fleurry is used.

=20

Attachment :=20

a. Code c file.

=20

What code is doing :

=20

1. Switches on Relays 1 to 24 sequentially.

2. Measure voltages appearing at ADC channels in for of ADC counts.

3. Sending it the counts to UART.

4. Timer interrupt used to calculate RTC in future. Presently switches on=
& off LED at one second. So interrupt at one second.

5. If timer interrupt is bypassed all ADC counts are send to serial port =
correctly.

6. If Timer is used ch1 always gives false ADC count reading & other any =
2 channels randomly gives wrong ADC count.

=20

I have tried my best. Did various permutations & combinations.

Initially ADC was used under program control, now I have used ADC under ADC=
interrupt mode.

=20

Please help.

=20

Best regards

Prashant D. Kharade

Pune. India.

Phone +91 9881739315

=20

=20

From: Ivan Gomez [mailto:i...@yahoo.com]=20
Sent: 10 December 2008 23:50
To: Prashant D. Kharade
Subject: Re: [AVR club] Timer Interrupt creates problem

=20

Hi Prashant,

=20

I think that the problem you are facing is because when you are making a co=
nversion with the ADC an interruptiom comes from the timer.

=20

So I sugest the following solution for the "Event Based" datalogger you are=
using:

=20

1. When you send the command to read data from the batteries, the first thi=
ng you have to do is read the register of the counter that is used to gener=
ate the interrupt to turn on/off the led.

=20

2. You need to know how many clock cycles the ADC needs to make a conversio=
n.

=20

3. So having the value of the register of the counter and the number of cyc=
les needed by the ADC you can decide to start the ADC conversion or wait un=
til the next timer interrupt occurs and then start the ACD conversion.

=20

I don't know if you got the idea, but here I will show you and example. Sup=
pose the interrupt occurs when the counter reaches the value 0xAA (just an =
example).

So the value 0xAA (170 in decimal) is proportional to 1 second.

Now suppose the time the ADC needs to make a conversion is 100 ms (I know i=
t is faster but this is just an example). 100 ms would be equivalent to hav=
e a counter value of 0x11 (17 in decimal)

So, if you read the value of the counter and it is grater than 0x99 (170 - =
17 =3D 153 in decimal), you will need to wait until the timer interruption =
occurs, and after that you will be able to start the ADC conversion. Else i=
f the value of the counter is less than 0x98 (152) you can start the conver=
sion right now.

=20

Hope this solve your problem.

=20

Another question that i have is that when you are sending the information t=
rough the UART, are you making conversions with the ADC??

=20

Regards.

=20

Ivan Gomez

=20
=20

=20

________________________________

From: Prashant D. Kharade
To: a...@yahoogroups.com
Sent: Wednesday, December 10, 2008 2:59:00 AM
Subject: RE: [AVR club] Timer Interrupt creates problem

Dear Kishor,

I am little confused with your explanation.
Datalogger is time based or event based.

1. Event based - Signal will come remotely to indicate start datalogging.
2. Time based - User can give fixed time, like 1sec, 30sec, 1min, 10 min. T=
hen after each 10sec or set time datalogging shall be done.

Now I am testing in event based.
When I am giving external command, some channel reads wrong because, Timer =
interrupt is working.
I am measuring time at resolution of 1sec. The moment it goes to timer inte=
rrupt, the ongoing ADC reading goes wrong.=20

Why this is happening? How to overcome this ?

Regards

Prashant
p...@adorpower.com
-----Original Message-----
From: a...@yahoogroups.com [mailto:a...@yahoogroups.com] On Behalf Of=
Kishor Soni
Sent: 10 December 2008 11:52
To: a...@yahoogroups.com
Subject: RE: [AVR club] Timer Interrupt creates problem

OK,
If you need logging the data every second, then divide timer service into 5=
00mS (half second).
arrange a flag for task indication.
for ex. a bit indicates task, then 0 =3D count timer value, 1 =3D read ADC =
value.
toggle the bit with every 500 mS timer call

Kishor Soni
--- On Tue, 12/9/08, Prashant D. Kharade wrote:
From: Prashant D. Kharade
Subject: RE: [AVR club] Timer Interrupt creates problem
To: a...@yahoogroups.com
Date: Tuesday, December 9, 2008, 1:25 PM

Thanks Kishor Soni.
I have already put cli() instruction at start of ADC start & sei() at the
end.

But still the problem comes. I am not able to identify.

Regards

Prashant D. Kharade

-----Original Message-----
From: a...@yahoogroups.com [mailto:a...@yahoogroups.com] On Behalf Of
Kishor Soni
Sent: 09 December 2008 12:08
To: a...@yahoogroups.com
Subject: Re: [AVR club] Timer Interrupt creates problem

it is simple. disable timer during ADC conversion is going on.

--- On Tue, 12/9/08, Prashant D. Kharade wrote:
From: Prashant D. Kharade
Subject: [AVR club] Timer Interrupt creates problem
To: a...@yahoogroups.com
Date: Tuesday, December 9, 2008, 10:28 AM

=20=20=20=20
Hello,

I am a new to Embedded world. I have chosen AVR series to work

I am doing a Datalogger project.

Facing a problem during the execution.=20

I am sequentially switching the relays, measuring the ADC count & sending
to UART for checking purpose.

I have tried my best & step by step as suggested, but still there is
problem.

Problem : The ADC count calculation goes wrong if Timer interrupt is used.

If Timer interrupt is not used, then ADC counts for all 24
channels are send correctly by UART via serial port.

If Timer code is added, the channel1 always shows count=
=3D1,
& randomly 2 channels shows wrong ADC count.

Project details : 24 channel Data logger for battery system using Atmega128=
...

a. 20 Batteries are connected in series to a Charger.

b. We have to measure voltage of 20 batteries, current passing through t=
he
battery & temperature of pilot battery.

c. 2 spare channels. So 20voltage, 1 current & 1 temp. Channels.

d. Relays are driven via ULN2803. Relays are connected in 8row & 3
columns.

e. 8 rows are connected to portA & 3 columns are connected to PC4, PC5,
& PC6.

f. Voltages are switched via RL1 to RL20 & fed to ADC0. (ADC1 &
sign bit are not used.)

g. Current is given to ADC3 via RL21. Temp. Is given to ADC2.(Measured by =
3
wire RTD).

h. Max232 is used for external world communication.

Software :=20

a. AVRStudio =96 4.13

b. AVR GCC - -20070525

c. For UART library of Peter Fleurry is used.

Attachment :=20

a. Circuit diagram (3 pages)

b. Code in zip file.

What code is doing :

1. Switches on Relays 1 to 24 sequentially.

2. Measure voltages appearing at ADC channels in for of ADC counts.

3. Sending it the counts to UART.

4. Timer interrupt used to calculate RTC in future. Presently switches on
& off LED at one second. So interrupt at one second.

5. If timer interrupt is bypassed all ADC counts are send to serial port
correctly.

6. If Timer is used ch1 always gives false ADC count reading & other any
2 channels randomly gives wrong ADC count.

I have tried my best. Did various permutations & combinations.

Initially ADC was used under program control, now I have used ADC under ADC
interrupt mode.

Please help.

Best regards

Prashant D. Kharade

Pune. India.

Phone +91 9881739315

From: a...@atmel.com [mailto:a...@atmel.com]=20
Sent: 08 December 2008 19:05
To: Prashant D. Kharade
Subject: (ATTicket:525645) Support Form: Timer Interrupt creats problem

Dear Customer,

As we do not have the source code with us, we are unable to test it here. I=
n
the request, what do you mean by "We are switching 24 relays & get the
data." and "If we remove the interrupt all 24 counts from 24 relays
are absolutely perfect", are you trying to get any data from the relay?

We recommend to refer the device datasheet under table "ADC Conversion
Time" in page number 235 for more details about conversion time require for
ADC result, in the mean time if any interrupt occurs then there is a possib=
ility
for getting random values as result.

We request you to try the ADC task separately first to identify any problem=
in
it. If it works perfect then try the switching of relays individually. When=
both
the functions works fine try to include timer counter interrupt of glowing =
an
LED. By this step by step procedures we can identify where the issue arrise=
s.

Even after implementing all the above mentioned instructions, if the proble=
m
still persists then feel free to contact us with setup details, reference
voltage configured, minimal running code and fuse settings.

Best Regards,
Srinivasan Mariappan
Atmel Technical Support Team

------------ --------- --------- --------- --------- --------- -
Please help us improve by rating your experience of our support on this
request:
http://support . atmel.no/ srv.htm?sid=3D 1&hc=3DK1ynnhLQ=
sQj KhV3
------------ --------- --------- --------- --------- --------- -
Support and FAQ: http://support . atmel.no/
Distributors: http://www.atmel . com/dyn/general/ conta=
ct.asp
Atmel AVR: http://www.atmel . com/AVR/
Discussion Forum: http://www.avrfreak s.net/phorum/

------------ --------- --------- --------- --------- --------- -
Participate in the 2008 Atmel Customer Satisfaction Survey:
http://www.atmel . com/quality_ customer_ survey_08/
------------ --------- --------- --------- --------- --------- -

Family : AVR=AE 8-Bit RISC=20
OtherPartNumber :=20
Part_no : ATmega128
Name : Prashant
Title : Engg
Company : Ador Powertron Ltd.
City : Pune
Street : 51 DII block MIDC
State : Maharashtra
Country : India
Postal_Code : 411027
Phone : --91-9881739315
Fax :=20
Site : www.adorpowertron. com
Email : pdkharade@adorpower .com
Problem : Timer Interrupt creats problem
Details : We are designing a datalogger of 24 channels. We are switchin=
g 24
relays & get the data. In Timer compare interrupt we are just switching
on/pff LED. But if the timer compare interrupt code is added the ADC counts=
are
randomly varying. If we remove the interrupt all 24 counts from 24 relays a=
re
absolutely perfect. I tried 2 options. ADC under program control & ADC unde=
r
interrupt control.But still no improvement. How can you give support & help=
..
Best regards Prashant D. Kharade Ador Powertron Ltd. Pune India

------------------------------------



(You need to be a member of avrclub -- send a blank email to avrclub-subscribe@yahoogroups.com )