AnsweredAssumed Answered

MC9S08PA..Code for Delay routine

Question asked by Mohamed Elzayed on Apr 24, 2015
Latest reply on Apr 24, 2015 by Tony Papadimitriou



I am writing this piece of code in order to insert a delay in my execution cycle.


The code is the following:


DELAY:                STHX    DLY_A  ; (4)

LOOPOUT:          STX     DLY_B  ; (3)


                             DEC     DLY_B  ; (4)

                             BNE     LOOPIN ; (3)

                             DEC     DLY_A  ; (4)

                             BNE     LOOPOUT ;(3)



I am using code warrior 10.6


After starting the debug process. The communication with the micro-controller will stop after debugger will step in and is able to do few iterations .


PS: watchdog is deactivated.


Looks really weird.


Any help?


Any body has a better way to insert delay?


Many thanks