+ Post New Thread
Page 2 of 2 FirstFirst 1 2
Results 21 to 26 of 26
  1. #21
    Advanced Member level 4
    Points: 12,297, Level: 26
    Achievements:
    Created Blog entry 7 years registered
    thannara123's Avatar
    Join Date
    Jan 2010
    Location
    Nedumkandam, India, India
    Posts
    1,428
    Helped
    117 / 117
    Points
    12,297
    Level
    26
    Blog Entries
    2

    Re: Atmega8 crashes when ADC value reads at a fast rate

    The Atmega8 crashes when ADC value reads at a fast rate the problem was the ISR.
    I excluded the code belongs to intrupt vector and runs it without error .
    Can i avoid this error ? if yes how ?
    The purpose of the Intrupt using here is the LCD data will be display the data every 2 minutes.
    Last edited by thannara123; 25th May 2018 at 17:24.
    I Respect You



    •   AltAdvertisment

        
       

  2. #22
    Super Moderator
    Points: 64,830, Level: 62
    Achievements:
    7 years registered
    Awards:
    Most Frequent Poster 3rd Helpful Member

    Join Date
    Apr 2014
    Posts
    13,161
    Helped
    3040 / 3040
    Points
    64,830
    Level
    62

    Re: Atmega8 crashes when ADC value reads at a fast rate

    Hi,

    The Atmega8 crashes when ADC value reads at a fast rate the problem was the ISR.
    What are you talking about? I canīt find an ISR in your code.

    Klaus
    Please donīt contact me via PM, because there is no time to respond to them. No friend requests. Thank you.



    •   AltAdvertisment

        
       

  3. #23
    Advanced Member level 4
    Points: 12,297, Level: 26
    Achievements:
    Created Blog entry 7 years registered
    thannara123's Avatar
    Join Date
    Jan 2010
    Location
    Nedumkandam, India, India
    Posts
    1,428
    Helped
    117 / 117
    Points
    12,297
    Level
    26
    Blog Entries
    2

    Re: Atmega8 crashes when ADC value reads at a fast rate

    Quote Originally Posted by KlausST View Post
    Hi,


    What are you talking about? I canīt find an ISR in your code.

    Klaus
    Code:
    ISR(TIMER1_COMPA_vect)
    {   DELAY_ms(200);
    	  sec_cnt++;
    	if(sec_cnt ==10)
    	{  
    		LCD_Clear();
    		DELAY_ms(50);
    	    lcd_name_display();
    		sec_cnt = 0; 
    		//LCD_Init(2,16);
    		LCD_Clear();
    		data_value();	   
    						
    	}	
    	DELAY_ms(50);
    }
    I Respect You



    •   AltAdvertisment

        
       

  4. #24
    Advanced Member level 5
    Points: 36,970, Level: 47

    Join Date
    Mar 2008
    Location
    USA
    Posts
    5,950
    Helped
    1725 / 1725
    Points
    36,970
    Level
    47

    Re: Atmega8 crashes when ADC value reads at a fast rate

    This thread looks pretty jumbled but I'll ask a couple of
    thought questions.

    If this is a SAR scheme using controller code, is the input
    sampled and held? Trying to do successive approximation
    when the input is changing can break the seeking loop
    if input change invalidates higher order bit decisions already
    made.

    Is AC waveform violating any input pin constraints? Such
    as swinging well below ground? Does the input common
    mode happen to change with the input signal frequency,
    or input amplitude change?



  5. #25
    Super Moderator
    Points: 64,830, Level: 62
    Achievements:
    7 years registered
    Awards:
    Most Frequent Poster 3rd Helpful Member

    Join Date
    Apr 2014
    Posts
    13,161
    Helped
    3040 / 3040
    Points
    64,830
    Level
    62

    Re: Atmega8 crashes when ADC value reads at a fast rate

    Hi,

    I assume you never showed this piece of code.
    Nor did you show the Timer0 setup nor the interrupt setup.
    So the complete thred was rather useless in my eyes. A waste of time.

    Klaus
    Please donīt contact me via PM, because there is no time to respond to them. No friend requests. Thank you.



    •   AltAdvertisment

        
       

  6. #26
    Super Moderator
    Points: 27,654, Level: 40
    andre_teprom's Avatar
    Join Date
    Nov 2006
    Location
    Brazil
    Posts
    8,253
    Helped
    1045 / 1045
    Points
    27,654
    Level
    40
    Blog Entries
    5

    Re: Atmega8 crashes when ADC value reads at a fast rate

    @thannara123; This was the first time that the ISR handler appeared here, indeed just at the 2nd page of this thread; considering that the title of this thread refers to this exact routine, seems like a sloppiness on your side to give an essential information just at the post #23. Now, looking at the code, it is clear the reason, you are adding the infamous delay there, but you were warned many times to avoid that, along many other good practices you got along other threads. I would expect you put in practice at least part of what was told. It is a little demotivating to repeat the same tips at new code you paste here.

    As for the code itself, start a new one, use the interrupt timer just to provide a precise clock which will give you the exact timing for all procedures, and call them at specific time slices. Sometimes it is better to get rid of something that is essentially wrong rather than try to fix it.

    - - - Updated - - -

    Agreeing with Klaus's opinion, this thread was a waste of time so far and given the diagnosis of terminal illness of your code, this thread will be closed in the hope that next time you put in practice at least part of what has already been already recommended.
    --------------------------------------------------------------------------------------------------
    Part of the world that you live in, You are the part that you're giving ( Renaissance )


    1 members found this post helpful.

--[[ ]]--