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..
 

paulfjujo

Advanced Member level 4
Joined
Jun 9, 2008
Messages
1,454
Helped
295
Reputation
590
Reaction score
278
Trophy points
1,363
Location
France 01800
Activity points
10,295
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 ...
 

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
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?
 

paulfjujo

Advanced Member level 4
Joined
Jun 9, 2008
Messages
1,454
Helped
295
Reputation
590
Reaction score
278
Trophy points
1,363
Location
France 01800
Activity points
10,295
i don't know this PIC ...
see configuration bits for hardware WDT enable
and datasheet ..
 

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
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..
 

deepeshmishra

Member level 2
Joined
Feb 3, 2010
Messages
49
Helped
4
Reputation
8
Reaction score
4
Trophy points
1,288
Location
india
Activity points
1,531
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).
 

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
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..
 

deepeshmishra

Member level 2
Joined
Feb 3, 2010
Messages
49
Helped
4
Reputation
8
Reaction score
4
Trophy points
1,288
Location
india
Activity points
1,531
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
 

paulfjujo

Advanced Member level 4
Joined
Jun 9, 2008
Messages
1,454
Helped
295
Reputation
590
Reaction score
278
Trophy points
1,363
Location
France 01800
Activity points
10,295
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: 17

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
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?
 

paulfjujo

Advanced Member level 4
Joined
Jun 9, 2008
Messages
1,454
Helped
295
Reputation
590
Reaction score
278
Trophy points
1,363
Location
France 01800
Activity points
10,295
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 ?
 

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
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.
 

paulfjujo

Advanced Member level 4
Joined
Jun 9, 2008
Messages
1,454
Helped
295
Reputation
590
Reaction score
278
Trophy points
1,363
Location
France 01800
Activity points
10,295
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..
 

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
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?
 

paulfjujo

Advanced Member level 4
Joined
Jun 9, 2008
Messages
1,454
Helped
295
Reputation
590
Reaction score
278
Trophy points
1,363
Location
France 01800
Activity points
10,295
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.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top