Hi
I met a problem about COP caused a reset when using real time debugging simulator mode(HC08 CW 5.1V). But it is no problem when programming to Flash type MCU.
This COP reset period = (2^18 – 2^4) ICLK = 262128* 1/50K = 5243mS=5.2s. So in theory, this COP should be not caused reset.
My code as follows.
main:
_Startup:
MOV #%00010000,CONFIG1 ;COP TIME = 2^18-2^4=262128*0.02ms(1/50K)
; =5243ms=5.2s
MOV #%10000001,CONFIG2
MOV #%11111111,DDRD ;SET PTD0~7 is output
IO_1:
feed_watchdog
JSR LED
BRA IO_1
LED:
BSET 3,PTD
BSR DELAY025S
BCLR 3,PTD
BSR DELAY025S
RTS
;************************************************
; DELAY 0.25S
;================================================
DELAY025S:
PSHA
PSHH
PSHX
LDX #$40
STX ,X
LDA #7
DA1_025:
STHX $00F1
DB1_025:
DC1_025:
DEC $00F1
BNE DC1_025
DEC $00F2
BNE DB1_025
DECA
BNE DA1_025
PULX
PULH
PULA
RTS