??? 08/07/06 09:11 Read: times |
#121783 - I found this on the web. Responding to: ???'s previous message |
/* This is a simple delay based on a busy loop */ /* with a 22.1184 MHz crystal, the delay lasts */ /* for approximately 1 ms times the number passed */ /* Of course, it will take longer if there are */ /* interrupts occuring... */ void delay_ms(unsigned char ms) { //real Milli Seconds ms; _asm mov r0, dpl 00001$: mov r1, #230 00002$: nop nop nop nop nop nop djnz r1, 00002$ djnz r0, 00001$ ret _endasm; } I found this some time ago. I don't remeber the orginal auther but, it has served me will. I used it with SDCC and With Dunfield C. As you can see it inline asm. The only real way to make sure it's accurate. Please note what it says about interrupts. Hope this helps. |