View previous topic :: View next topic |
Author |
Message |
Linuxbuilders
Joined: 20 Mar 2010 Posts: 193 Location: Auckland NZ
|
do not reset outputs after reset |
Posted: Wed Jun 13, 2012 1:16 am |
|
|
Hi,
I wonder if there is anyway to keep outputs in the same state as before reset when I reset the pic?
Thnx _________________ Help "d" others and then you shell receive some help from "d" others. |
|
|
RF_Developer
Joined: 07 Feb 2011 Posts: 839
|
|
Posted: Wed Jun 13, 2012 1:33 am |
|
|
Without external hardware latches, no there isn't. During hardware reset all IO become inputs, and need to be set to outputs by code.
Its good practice to use pull-ups or -downs as appropiate (historically it was pull-ups) on all outputs that have to have a defined state during reset/start-up. That's not the same as keeping the last state they had, which requires hardware latches.
Whether warm restarts, in other words resets triggered from code, do the same is another issue. Generally warm starts are much shorter than hardware resets, as the PIC doesn't have to wait for things like the oscillator to start and stabilise.
My main question is: why do you want to hold output states over resets? Do you really need to reset? Is this the best system solution to the problem? What, in fact, is the problem you are trying to solve?
RF Developer |
|
|
Linuxbuilders
Joined: 20 Mar 2010 Posts: 193 Location: Auckland NZ
|
|
Posted: Wed Jun 13, 2012 2:15 am |
|
|
thnx mate,
it is simple, I want to have a choice and if my hardware is running big few KW motor it is not very healthy to reset outputs in case of WDT kicking on. Thnx for the answer, helped a lot. _________________ Help "d" others and then you shell receive some help from "d" others. |
|
|
RF_Developer
Joined: 07 Feb 2011 Posts: 839
|
|
Posted: Wed Jun 13, 2012 2:44 am |
|
|
If your watchdog timed out and reset the processor, which would have to be an extreme and unlikely event due to serious failure of the PIC, I'd expect everything to shutdown to a safe state: i.e. all motor drives shut off, all brakes engaged, alarm lights etc on. These are the sorts of "defined states" i'd ensure in reset.
Otherwise I'd want the PIC to be controlling that sort of hardware at all times, therefore it must not reset and you should make sure your hardware and software ensures it stays running!
All this is simply good engineering practice and is not something specific to PICs.
RF Developer |
|
|
|