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

How could I make a adjustable delay function in "micro-second" level

Hello Every :

I use AT89C52 and 11.059MHz oscillator.
1 instuction takes about 1 micro-second.(10^-6 sec.)

I write a delay function in *.asm.

It works well , but I want it adjustable.
I want to delay according to the parameter I pass.My goal is to modify delay time for some protocol time slot testing.

I found it some how difficult to achieve.
Because the basic instruction , for example : _nop_ , take 1 micro-second.
I can't add more decision. It will takes more time.

How could I implement such kind of delay?
Please give me a hand , thanks a lot~~

Parents
  • OK - So, I used standard macros to create the same thing...

    NAME	NOPS
    
    ?PR?NOPS?NOPS	SEGMENT CODE
    	RSEG	?PR?NOPS?NOPS
    
    NUMNOPS	EQU	200
    
    MakeNOP MACRO X
    	PUBLIC	NOPS_&X
    	NOPS_&X:	NOP
    	ENDM
    
    NOP_LIST:
    REPT	NUMNOPS
    	MakeNOP %(NUMNOPS - ($ - NOP_LIST))
    	ENDM
    
    	RET
    	END
    

    Jon

Reply
  • OK - So, I used standard macros to create the same thing...

    NAME	NOPS
    
    ?PR?NOPS?NOPS	SEGMENT CODE
    	RSEG	?PR?NOPS?NOPS
    
    NUMNOPS	EQU	200
    
    MakeNOP MACRO X
    	PUBLIC	NOPS_&X
    	NOPS_&X:	NOP
    	ENDM
    
    NOP_LIST:
    REPT	NUMNOPS
    	MakeNOP %(NUMNOPS - ($ - NOP_LIST))
    	ENDM
    
    	RET
    	END
    

    Jon

Children
No data