Pages: [1]   Go Down
Author Topic: Hanging mCU  (Read 575 times)
0 Members and 1 Guest are viewing this topic.
DELHI
Offline Offline
God Member
*****
Karma: 8
Posts: 962
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I wanna try simple code on arduino UNO. The watchDOg timer program.

I wanna know how to do it:

I wanna hang cpu for 1min by that time i wanna check whether the watchdog timer can take care of hanged cpu issue.

please let me know how to do it.
If any code please share it here.
Is it possible to do it:
Logged

AMPS

United Kingdom
Offline Offline
Tesla Member
***
Karma: 227
Posts: 6639
Hofstadter's Law: It always takes longer than you expect, even when you take into account Hofstadter's Law.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

The maximum timeout for the watchdog timer is about 8 seconds.
Logged

Formal verification of safety-critical software, software development, and electronic design and prototyping. See http://www.eschertech.com. Please do not ask for unpaid help via PM, use the forum.

UK
Offline Offline
Shannon Member
****
Karma: 223
Posts: 12630
-
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

If you want your sketch to trigger the watchdog then you just need to enable the watchdog and then not reset it. It would be helpful if you designed your sketch to do something obvious when it resets so that you can tell when the reset has occurred, such as flashing the onboard LED in a recognisable pattern.
Logged

I only provide help via the forum - please do not contact me for private consultancy.

DELHI
Offline Offline
God Member
*****
Karma: 8
Posts: 962
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Since i am new to this can some one share me the COde for doing this...


How to make CPU hangs for Ever , i wanna test these . I wanna test fro some abnormal condtion..Please help me out

If some one share me the code it will be helpfull.
Logged

AMPS

Left Coast, CA (USA)
Offline Offline
Brattain Member
*****
Karma: 362
Posts: 17306
Measurement changes behavior
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Since i am new to this can some one share me the COde for doing this...


How to make CPU hangs for Ever , i wanna test these . I wanna test fro some abnormal condtion..Please help me out

If some one share me the code it will be helpfull.

Hang forever is easy:

Code:
while(1) {}

Lefty
Logged

Global Moderator
Melbourne, Australia
Offline Offline
Brattain Member
*****
Karma: 511
Posts: 19306
Lua rocks!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

How to make CPU hangs for Ever , i wanna test these .

Hang forever? Get some liquorice and pretend it is a CPU.

Come on, man. What is your project? You want to get a processor and have it hang forever? To what purpose?
Logged

http://www.gammon.com.au/electronics

Please post technical questions on the forum - not to me by personal message. Thanks a lot.

Offline Offline
Edison Member
*
Karma: 116
Posts: 2205
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
How to make CPU hangs for Ever , i wanna test these . I wanna test fro some abnormal condtion..

Code:
while (1) continue;
does it.

You may also output the POR status on some pins so you know why the mcu was reset.
Logged

UK
Offline Offline
Shannon Member
****
Karma: 223
Posts: 12630
-
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Since i am new to this can some one share me the COde for doing this...

Since you're new to this, why don't you just try writing some code and try it for yourself? There's nothing complex or difficult in what you're trying to do and plenty of other people have already done the same thing so I'm sure Google will turn up loads of examples for you to follow. The fact that you're new to Arduino doesn't absolve you from the need to do things for yourself.
Logged

I only provide help via the forum - please do not contact me for private consultancy.

UK
Offline Offline
Faraday Member
**
Karma: 17
Posts: 2884
Gorm deficient
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
I wanna
@OP, is it really too much trouble to type two "t"s and a space?
Logged

Per Arduino ad Astra

Pages: [1]   Go Up
Jump to: