MC9S08PA..Code for Delay routine

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

MC9S08PA..Code for Delay routine

818件の閲覧回数
mikee_
Contributor I


Hello,

 

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)

LOOPIN:    

                             DEC     DLY_B  ; (4)

                             BNE     LOOPIN ; (3)

                             DEC     DLY_A  ; (4)

                             BNE     LOOPOUT ;(3)

                             RTS

 

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

ラベル(1)
0 件の賞賛
返信
1 返信

650件の閲覧回数
tonyp
Senior Contributor II

Hard to tell what's wrong without more complete code.  For example, where are DLY_A and DLY_B variables located?

BTW, here's a sample delay routine to give you an idea (but for ASM8 assembler)

0 件の賞賛
返信