+ Post New Thread
Results 1 to 9 of 9
  1. #1
    Newbie level 4
    Points: 75, Level: 1

    Join Date
    Apr 2018
    Location
    iran-tehran
    Posts
    7
    Helped
    0 / 0
    Points
    75
    Level
    1

    [moved] how to reset ATmega32 with code?

    how to reset ATmega32 with code?

  2. #2
    Super Moderator
    Points: 63,172, Level: 61
    Achievements:
    7 years registered
    Awards:
    Most Frequent Poster 3rd Helpful Member

    Join Date
    Apr 2014
    Posts
    12,915
    Helped
    2979 / 2979
    Points
    63,172
    Level
    61

    Re: [moved] how to reset ATmega32 with code?

    Hi,

    Please give useful informations: You ask for code, thus we need to know:
    * what programming language
    * what compiler

    *****
    Generally there are several options:
    * add external hardware to temporarily pull down the RESET line. (This may also reset external devices)
    * enable the watchdog and wait for the watchdog timeout ( this just resets the microcontroller)
    * jump to the reset vector location (this just restarts the software without resetting periferal registers)

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


    1 members found this post helpful.

    •   AltAdvertisment

        
       

  3. #3
    Newbie level 4
    Points: 75, Level: 1

    Join Date
    Apr 2018
    Location
    iran-tehran
    Posts
    7
    Helped
    0 / 0
    Points
    75
    Level
    1

    Re: [moved] how to reset ATmega32 with code?

    c language.
    with atmel studio app.
    but i cant use hardware for reset mcu!
    and my code have a few while(1)! so i cant use watchdog!



  4. #4
    Super Moderator
    Points: 63,172, Level: 61
    Achievements:
    7 years registered
    Awards:
    Most Frequent Poster 3rd Helpful Member

    Join Date
    Apr 2014
    Posts
    12,915
    Helped
    2979 / 2979
    Points
    63,172
    Level
    61

    Re: [moved] how to reset ATmega32 with code?

    Hi,

    my code have a few while(1)! so i cant use watchdog!
    You want to reset the microcontroller with code. A watchdog generates a true microcontroller reset. I don't see why this can't be used.
    I don't see what this has to do with while(1) loops.

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



    •   AltAdvertisment

        
       

  5. #5
    Super Moderator
    Points: 246,482, Level: 100
    Awards:
    1st Helpful Member

    Join Date
    Jan 2008
    Location
    Bochum, Germany
    Posts
    42,844
    Helped
    13040 / 13040
    Points
    246,482
    Level
    100

    Re: [moved] how to reset ATmega32 with code?

    AVR watchdog can be enabled at any time by control register. It's the preferred way to perform a programmed reset.



  6. #6
    Advanced Member level 5
    Points: 8,555, Level: 22
    Easyrider83's Avatar
    Join Date
    Oct 2011
    Location
    Tallinn, Estonia
    Posts
    1,525
    Helped
    348 / 348
    Points
    8,555
    Level
    22

    Re: [moved] how to reset ATmega32 with code?

    It is not preferred, it is only one way to do that :)
    Love me or hate me. All infractions will be ignored.



  7. #7
    Super Moderator
    Points: 246,482, Level: 100
    Awards:
    1st Helpful Member

    Join Date
    Jan 2008
    Location
    Bochum, Germany
    Posts
    42,844
    Helped
    13040 / 13040
    Points
    246,482
    Level
    100

    Re: [moved] how to reset ATmega32 with code?

    It is not preferred, it is only one way to do that :)
    Almost agreed. It's a more theoretical option to set all processor register to reset state and jump to reset vector.



  8. #8
    Super Moderator
    Points: 63,172, Level: 61
    Achievements:
    7 years registered
    Awards:
    Most Frequent Poster 3rd Helpful Member

    Join Date
    Apr 2014
    Posts
    12,915
    Helped
    2979 / 2979
    Points
    63,172
    Level
    61

    Re: [moved] how to reset ATmega32 with code?

    Hi,

    Almost agreed. It's a more theoretical option to set all processor register to reset state and jump to reset vector.
    If it's not possible to activate the RESET pin, then it's the only way for a true microcontroller RESET.
    Or is there any other solution (that I don't know yet)?

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



    •   AltAdvertisment

        
       

  9. #9
    Newbie level 4
    Points: 75, Level: 1

    Join Date
    Apr 2018
    Location
    iran-tehran
    Posts
    7
    Helped
    0 / 0
    Points
    75
    Level
    1

    Re: [moved] how to reset ATmega32 with code?

    WDRF!
    is this ur intention?



--[[ ]]--