Home/Support/Support Forum/Secondary WatchDig Timer (SWDT)
Welcome to Digi Forum, where you can ask questions and receive answers from other members of the community.

Secondary WatchDig Timer (SWDT)

0 votes
Hi Every one
What his wrong with this

Thank's

Marcus
//////////////////////////////////////////////////////////////////////////

#class auto

//Prototype
void Timer();

int count;

void main(void)

{
printf("begin test\n");

count = 0;

// Det PB.2 has an output
WrPortI(PBDDR, &PBDDRShadow, 4);

SetVectIntern(0x01,Timer);//Below

printf("Starting SWDT\n");

// init timer at 313 + 12 us tick timer interrupt
WrPortI(SWDTR, NULL, 10);


// hit crash here
WrPortI(WDTCR, NULL, 0x5F); // <<< hit crash here

printf("SWDT is running\n");

while(1)
{
if (count == 3)
{
count = 0; // reset count

// Toggle PB.2 each 1ms BitWrPortI(PBDR,&PBDRShadow,!BitRdPortI(PBDR,2),2);
}
}
}

#asm
Timer::
push af
push hl

; determine why the interrupt occurred and take appropriate action

ld hl, (count)
inc hl ; increment counter
ld (count), hl

ld a, 10 ; timeout period of 11/32kHz = 331us
ioi ld (SWDTR), a ; clear the interrupt request

pop hl
pop af

ipres
ret
#endasm
asked May 16, 2014 in Rabbit by aroct New to the Community (4 points)

Please log in or register to answer this question.

4 Answers

0 votes
What version of Dynamic C are you using?
What errors are you getting?
what are you trying to do?
answered May 16, 2014 by MargaretK Veteran of the Digi Community (545 points)
0 votes
What version of Dynamic C are you using?
>10.72

What errors are you getting?
>Nothing that I can see
>I can compile and run the firmware
>and it freeze when the SWDT is enabled


what are you trying to do?
>I try to use the secondary WatchDog Timer

Take a look in the source code. it's nicely documented

Best regards,

Marcus
answered May 16, 2014 by aroct New to the Community (4 points)
edited May 17, 2014 by aroct
0 votes
I ran this on an RCM6600 and it also crashed. I changed your line:
WrPortI(WDTCR, NULL, 0x5F); // <<< hit crash here
to
WrPortI(WDTCR, NULL, 0x5A);

and it appears to work
answered May 19, 2014 by MargaretK Veteran of the Digi Community (545 points)
0 votes
I am curious if the code change fixed your issue?
answered May 21, 2014 by MargaretK Veteran of the Digi Community (545 points)
...