Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Something to ask about WDTEN bit

Status
Not open for further replies.

maniac84

Full Member level 6
Joined
Mar 4, 2012
Messages
337
Helped
1
Reputation
2
Reaction score
1
Trophy points
1,298
Activity points
3,661
Hi guys... currently studying about WDTEN bit on my PIC18F25K50.
From the data sheet, it is written:
WDTEN<1:0>:Watchdog Timer Enable bits
11= WDT enabled in hardware; SWDTEN bit disabled
10= WDT controlled by the SWDTEN bit

But I saw from sample coding, they write:
WDTEN=ON or WDTEN=SWON
What is the difference of ON and SWON?
Does ON equals to 11, and SWON equals to 10?
Which one should I use?

- - - Updated - - -

And I want to know exactly, what is hardware enabled watch dog and software enabled watch dog? Can't really find it in Google..
 

hello,

Code:
11= WDT enabled in hardware; SWDTEN bit disabled
you activated WDT in hardware, and you must handle the watchdog (Clear WDT in your application in a certain time)
else you will go to Reset

Code:
10= WDT controlled by the SWDTEN bit
In your application , you have the choice to handle or not the watchdog

so, if your choice ...
 

hello,

Code:
11= WDT enabled in hardware; SWDTEN bit disabled
you activated WDT in hardware, and you must handle the watchdog (Clear WDT in your application in a certain time)
else you will go to Reset

Code:
10= WDT controlled by the SWDTEN bit
In your application , you have the choice to handle or not the watchdog

so, if your choice ...

How do you enable watch dog in hardware?
And How do you enable watch dog in software?
 

i don't know this PIC ...
see configuration bits for hardware WDT enable
and datasheet ..
 

i don't know this PIC ...
see configuration bits for hardware WDT enable
and datasheet ..

Do you know what is the difference of hardware enabled watch dog and software enabled watch dog? I don't know use which one..
 

SWDTEN: Software Enable or Disable the Watchdog Timer bit,
1 = WDT is turned on,
0 = WDT is turned off (Reset value),
This bit has no effect unless the Configuration bit, WDTEN<1:0>, is set to 10b (SWDTEN enabled).
 

SWDTEN: Software Enable or Disable the Watchdog Timer bit,
1 = WDT is turned on,
0 = WDT is turned off (Reset value),
This bit has no effect unless the Configuration bit, WDTEN<1:0>, is set to 10b (SWDTEN enabled).

But I need to know what is the difference of hardware enabled watch dog and software enabled watch dog first? I don't know use which one..
 

That depends on your job what to use SWDT or HWDT.
For an example when you are aspecting a signal from hardware within the time use HWDT,
And Second You have initiated some software task with in some time use SWDT
 

on datasheet see schematic WDT Block Diagram
you can see a OR gate with
2 entries : WDTEN and SWDTEN, and the OR output gives -> Enable WDT signal to INTRC control

WDTEN is definied into Confiig2H register
1= WDT enable
0=WDT disable (control placed on SWDTEN bit)

SWDTEN bit is defined in WDTCON register
SWDTEN=1 Watchdoc timer is ON
SWDTEN=0 watchdog timer is OFF

so you can play with this ... depend of what do you want to do with your software application !
 

Attachments

  • WDT_diagram.jpg
    WDT_diagram.jpg
    28.4 KB · Views: 76

Actually, my application is for transmit and receive data communication between pic and pc by using USB-HID.
Which watch dog should I use?
Can I consider signal from pc is hardware side so I should use hardware watch dog?
 

You can considere a maximum of silence duration : no exchange of data between the 2 equipements
ito survey your application.. no link with watchdog..

Watchdog is used only to survey the duration of a main looop in your program..
if you don't clear the watchdog in this loop => reset !
With this way, your program can be OK, but not the data exchange..

With dialogque between 2 PLC , we use a "bit de vie" as watchdog
The first PLC set a bit into the second PLC
the second PLC must reset this bit and send back to the first PLC
After a maximum delai , the first PLC test if the bit is cleared or not to declare
link is OK or not.

Are you using an exchange data protocole bewteen PIC and PC ?
 

You can considere a maximum of silence duration : no exchange of data between the 2 equipements
ito survey your application.. no link with watchdog..

Watchdog is used only to survey the duration of a main looop in your program..
if you don't clear the watchdog in this loop => reset !
With this way, your program can be OK, but not the data exchange..

With dialogque between 2 PLC , we use a "bit de vie" as watchdog
The first PLC set a bit into the second PLC
the second PLC must reset this bit and send back to the first PLC
After a maximum delai , the first PLC test if the bit is cleared or not to declare
link is OK or not.

Are you using an exchange data protocole bewteen PIC and PC ?

Yes. It is some protocols. Don't know why, after running sometimes, the USB communication hangs. Hang in the sense that, when PC send data to PIC, there's no respond from PIC. So, I'm considering to use a watch dog. Just don't know use hardware watch dog or software watch dog.
 

so
WDTEN is definied into Confiig2H register
WDT enable=1
set your value of timer watchdog into CONFIG2H
watchdog postcaler select bits
see previous diagram !

and use clrwdt in your main loop...
if your PIC application is blocked into a loop
you will have a reset after WDT timer elapsed..
 

so
WDTEN is definied into Confiig2H register
WDT enable=1
set your value of timer watchdog into CONFIG2H
watchdog postcaler select bits
see previous diagram !

and use clrwdt in your main loop...
if your PIC application is blocked into a loop
you will have a reset after WDT timer elapsed..

What you are talking about is software WDT. So, you think I should use software WDT?
Hang for how long then only it will reset? Is this time configurable?
 

all is explained by the WDT block diagram..
2 possibility

WDTEN =1 in Config2H , so you are obliged to treat the watchdog :clear WDT into yourall program or RESET will occurs.
WDTEN=0 in config2H
no watchdog by default..
but if you set SWDTEN in WDTCON register
you can apply watchdog to survey the duration of a part of your program..
it is the main difference !




so, last decision to use this mode or other , and when to apply is yours !


Is this time configurable?
see post #14
set your value of timer watchdog into CONFIG2H

to do that , you must know what do you expect to get by your software
and know also what is the max duration of the part of software to survey..

Wathdog will ofen not solve bloclking problem into a loop, because RESET is the worst solution.
example , if you are always waiting a charactere comming from an RX UART...
it is better to use timer (and interrupt) to allow a maximum time for a
task wich can block the program in an infinite loop
 
Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top