This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

P89C66x PCA Watchdog Timer

I'm using Philips P89C664 which includes watchdog timer on the PCA Module 4.
P89C664 is running with 10.000MHz oscillator in 6 clock mode.
I use µVision V2.40 with C51 V7.09.

In Power-Up Initialization PCA is configured as follows:

CMOD    = 0x02;  //PCA Input Internal clock, fOSC/2 in 6 clock mode.
CCAP2H  = 0x80;  //PWM mit 50%/50% Duty cycle.
CCAPM2  = 0x42;  //Activate PCA Module 2 with PWM-Output on CEX2 (P1.5) -> PWM with approx. 19.5 kHz.
CCON    = 0x40;  //PCA Counter Run.
CCAPM4  = 0x08;  //Activate PCA Module 4 with Watchdog Timer, period approx. 13.2ms.
CCAP4L  = 0xFF;  //With clearing the bit ECOM4 (Disabling comparator in PCA Module 4).
CCAP4H  = 0xFF;  //With setting the bit ECOM4 (Enabling comparator in PCA Module 4).
CMOD   |= 0x40;  //Setting bit Watchdog Timer Enable.
Bios_delay_250ms();

Following shows the compiler output of subroutines in BIOS.LST:
             ; FUNCTION Bios_delay_5ms (BEGIN)
;---- Variable 'uc_ticks1' assigned to Register 'R7' ----
0000 7F33              MOV     R7,#033H
;---- Variable 'uc_ticks2' assigned to Register 'R6' ----
0002 7E11              MOV     R6,#011H
0004         ?C0004:
0004 DFFE              DJNZ    R7,?C0004
0006 DEFC              DJNZ    R6,?C0004
0008 22                RET
             ; FUNCTION Bios_delay_5ms (END)

             ; FUNCTION Bios_delay_250ms (BEGIN)
;---- Variable 'uc_hilfsvar' assigned to Register 'R5' ----
0000 7D32              MOV     R5,#032H
0002         ?C0010:
0002 120000      R     LCALL   Bios_delay_5ms
0005 E4                CLR     A
0006 F5EE              MOV     CCAP4L,A
0008 85F9FE            MOV     CCAP4H,CH         <--- Simulator Breakpoint here
000B DDF5              DJNZ    R5,?C0010
000D 22                RET
             ; FUNCTION Bios_delay_250ms (END)

Why does the watchdog kick off and reset occurs while processing the function Bios_delay_250ms()?

After stopping at breakpoint in simulator with value of R5=0x1C (therefore being executed 191817 cycles or 115.09ms), i watch following details:
PCA Timer CH/CL: 0xC802
CCAP4: 0x6600

After executing the next instruction MOV CCAP4H,CH i expect the value of CCAP4 should be 0xC800.
So, if i press Button F11 (single step), watchdog timer reset occurs... WHY?

I have no interrupts ever initialized or activated, e.g. bit EA is always still cleared!
I expect, that watchdog timer reset only occurs when matching CH/CL with CCAP4.
I know, writing in CCAP4L clears also the bit ECOM4 (Disabling comparator in PCA Module 4).
I know, writing in CCAP4H sets also the bit ECOM4 (Enabling comparator in PCA Module 4).

Am I missing something? Any other tricks to getting a safely hold off the watchdog reset?

Thanks,
Martin Macher

0