[Solved] MCUSR reset register on AtMega

Please add any feature requests for Flowcode version 7 here

Moderator: Benj

Post Reply
EtsDriver
Posts: 444
Joined: Tue Apr 15, 2014 4:19 pm
Location: Kajaani, Finland
Has thanked: 345 times
Been thanked: 227 times
Contact:

[Solved] MCUSR reset register on AtMega

Post by EtsDriver »

A option to get MCUSR register value into flowcode variable before its reset by c-code would be nice. This way program could detect the Brown-Out and restart some other chips that might have locked up...
Ill just keep the good work up!

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: MCUSR register on AtMega

Post by Benj »

Hello,

This should be possible by doing the following.

1) create a global byte variable named ResetType.
2) Add a C code icon to the start of your program containing the following code.

Code: Select all

FCV_RESETTYPE = MCUSR;
3) Check the bits of the ResetType variable for the various reset conditions you need to check for.

Post Reply