Try this.
Code:asm DelayCycles macro ncy ; ncy can be from 1 up to 256 local n n set (ncy) ; assign ncy value to label n while n > 2 ; inserts goto $+1 while n > 2 goto $+1 ; burn 2 cycles n set n - 2 ; n = n - 2 endw ; handle left-overs while n > 0 ; 1 nop for odd numbers nop ; burn 1 cycle n set n - 1 ; n = n - 1 endw endm endasm Main: HIGH 0 @ DelayCycles 1 ; adds 1 nop LOW 0 @ DelayCycles 5 ; adds 2 x goto $+1 and 1 x nop GOTO Main
Bookmarks