| ??? 05/22/03 07:11 Read: times |
#46344 - RE: variable hw delays Responding to: ???'s previous message |
luigi grimaldi wrote:
------------------------------- is it poss to write a variable length delay using parameter passing (ie registers) in asm, ive come up with this bit of code but something tells me it could be done better, regs set for 5milisecond delay with 12mhz clock, or maybe this is it? org 0H mov sp,#5FH mov tmod,#10H mov tcon,#00H mov R0,#0ECH mov R1,#077H delay: mov TH1,R0 mov TL1,R1 setb TR1 loop: jnb TF1,loop clr TR1 clr TF1 jmp delay end ;no need to use r1,r2 as TH1,TL1 can be used to pass delay. you can load them directly like mov TH1,#high(0ffffh-<delay in us>); mov TH1,#low(0ffffh-<delay in us>); call delay new delay routine will be delay: setb TR1 loop: jnb TF1,loop clr TR1 clr TF1 ret abhishek |
| Topic | Author | Date |
| variable hw delays | 01/01/70 00:00 | |
| RE: variable hw delays | 01/01/70 00:00 | |
RE: variable hw delays | 01/01/70 00:00 |



