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.

How to use watchdog with AT89S52 ????????

Status
Not open for further replies.

mrcube_ns

Advanced Member level 1
Joined
Apr 10, 2002
Messages
452
Helped
48
Reputation
96
Reaction score
34
Trophy points
1,308
Location
Europe
Activity points
3,813
sfr of 89s51

Hi friends,

I have to use WD on AT89s52 (programming in c (kei|)).

On atmel site I found some example but seams that doesn't work (well/at all).


How to do it?

Some code examples are welcome.

Thanks in advance!!!

Mr.Cube


Atmel example:
...
WDTPRG |= 0x07;/*2.275s @ FOSCA=11.059200 MHz */

/* watchdog start sequence */
WDTRST = 0x1E;
WDTRST = 0xE1;

while(1) /* end less */
{
/***********************************************
* PROGRAM *
************************************************/

/* watchdog reset sequence */
WDTRST=0x1E;
WDTRST=0xE1;
}
...
 

watchdog в at89s8253

**broken link removed**
 

watchdog timer in 89s52

hulahula thank you, but this example can be applied to AT89S8252, AT89S8253 or AT89S53 and maybe some other ones.

AT89SS52 doesn't have WMCON. Only register for WD that s52 have is WDTRST on address 0xA6 (see attach picture).

Thing that confusing me is that in atmel example (I downloaded example from atmel site and put core code in my first post) there is WDTPRG variable whish should be found on SFR address 0xA7 (regards to inc file), but in pdf manual that address EMPTY?!?!?!

So, someone have working sample for S52???


THANKS!!


Mr.Cube
 

at89s8252 watchdog timer example

After testing watchdog on AT89S52 I have some conclusions:
1. WD working on s52, with atmel example.
2. WDTPRG sfr doesn't exist in s52 (see picture in my previous post), so line
...
WDTPRG|=0x07;
...


do nothing, and WD reset mcu every ~15ms (XTAL = 11.0592) if you do not reset WD timer.

That's it. If you want to use WD on s52 you must reset WD timer very offen.

Thank you all.

Mr.Cube
 

atmel watchdog timer example program for 89s52

every thing written in datasheet clearly plzzzz let me know what issues u r facing
 
  • Like
Reactions: bconq

    bconq

    Points: 2
    Helpful Answer Positive Rating
using timer 2 in at89s52

ashad

Thanks for answer, what is problem:

1. Yes in datasheet they say that you start WD timer by entering E1h and 1Eh in WDTRST sfr. After that you have to reset WD timer in code with same values and same procedure.

2. See pic "WD on atmel mcu". They clearly say that this example is for AT89S52 among others.

Problem: S52 do not have WDTPRG sfr.

So line WDTPRG|=0x07; do nothing, becouse s52 do not have sfr on address A7h.

Cause: If you want to use WD on s52, you need to reset WD not longer then 15ms or your mcu will reset.

'Till now I always use AT89S8252 (when I need WD), and with this mcu WD story is totally different.

I usually use/need WD times with times of around 1 - 2 sec, which I cannot have with s52, OR I'M MAYBE WRONG?????

Any suggestions???

Best regards,

Mr.Cube
 

how to write/use watchdog in c program

i used 89S51 with watch dog timer .... it works fine, i used in Industrial project .... i did this project in mid of 2004, i am searching program (Coding) as soon i will find then i will send u
 

    mrcube_ns

    Points: 2
    Helpful Answer Positive Rating
delay at89s52

Hi all,

It's sems that nobody have solution for WD problem on AT89S52 (I need to be about 1sec long)?:cry::cry::cry::cry::cry::cry:


Best regards,

Mr.Cube
 

watchdog, 89s51

Story about WDT on S52 have end!!

This answer I got from Atmel support:

Hello Mr. Cube,

The AT89S52 device does not have the prescaler like the AT89S8252 so it
is impossible to time out at 1Sec. The AT89S52 WDT only times out at 16ms.

If you want to have 1sec timeout, please look at the AT89S8253 device
which has the prescaler like the AT89S8252 device. Datasheet is available
on our web site:

www.atmel.com/products/8051

Regards,

ATMEL 8051 Microcontroller Applications
USA


So thats it, 16ms and no more on s52.

Thanks everybody for answers.


Best regards,

MR.Cube
 

89s51 watchdog

I had to change my design one time because of this stupid feature of the 89S52, ths WDT has a maximum timeout of 16mS, instead i used 89C51RD2, which can have up to 2.09 Sec for a WDT timeout.
 

watchdog timer at89s52

So this means that every 15uS of my code I need to write:

WDTRST = 0x1E;
WDTRST = 0xE1;

Like
/*Part of my coding*/
WDTRST = 0x1E;
WDTRST = 0xE1;
/*Another part*/
WDTRST = 0x1E;
WDTRST = 0xE1;
.
.
.

I'm asking this because I'm using S52 to iterface one modem and a tracking system, so I have a delay code of about 15 seconds. How do I use watchdog in this case?
Can I write WDTRST = 0x1E; WDTRST = 0xE1; inside my delay loop and in another parts of my code?

Thanks =) :D
 

I have written the following code for Setting the WatchdogTimer in 89s52.

Case:1
START: MOV 8EH,#00H ;Enabling Auxillary Register

WDT: MOV WDTRST,#1EH
MOV WDTRST,#0E1H
RET
Error While compiling nd converting to HEX Code : Undefined Symbol "WDTRST".


Case:2
START: MOV 8EH,#00H ;Enabling Auxillary Register

WDT: MOV 0A6H,#1EH
MOV 0A6H,#0E1H
RET
Error While compiling nd converting to HEX Code : NON-EXISTENT INTERNAL RAM ADDRESS for the address 0A6H.

Wondering if the problem is with my compiler: 8051 Macro Assembler- version 4.05b.

Please Advise........
 

I am trying out with Watchdog and AT89S52


Code:
void main()
{
WDTRST = 0x1E;
WDTRST = 0xE1;
LED1 = ON;
while(runSec < 12);
LED1 = OFF;
while(1)
{
}
}

But this code is not working as even I am not feeding Watchdog again code goes to LED = OFF; instruction. Don't know whats wrong.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top