JL8-COP caused a reset when using real time debugging simulator mode

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

JL8-COP caused a reset when using real time debugging simulator mode

Jump to solution
1,091 Views
Lais
Contributor I
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
Labels (1)
Tags (1)
0 Kudos
1 Solution
396 Views
CompilerGuru
NXP Employee
NXP Employee
The provided code is not actually setting the H register ever.
Could that be the cause for different behavior?

Note that
LDX #$40
does only set the X and not the H register.
(the H could be set by a LDHX #$40 or by a CLRH)

Also
        STX       ,X        

is a bit strange, not sure what the purpose is, or should that be a CLRH?

Daniel
 

View solution in original post

0 Kudos
1 Reply
397 Views
CompilerGuru
NXP Employee
NXP Employee
The provided code is not actually setting the H register ever.
Could that be the cause for different behavior?

Note that
LDX #$40
does only set the X and not the H register.
(the H could be set by a LDHX #$40 or by a CLRH)

Also
        STX       ,X        

is a bit strange, not sure what the purpose is, or should that be a CLRH?

Daniel
 

0 Kudos