Delay Loops
I am running an SX28 or SX18 with the 4mhz internal oscilator.· How do you figure out the delay values for an X amount of seconds or microseconds?· Could u post a code sample and formula.· I am not running SX/B,·one of the most innefficient·compilers i've seen, assembler rules!···
thanks,
kingneb
thanks,
kingneb
Comments
please have a look at www.sxlist.com/techref/piclist/codegen/delay.htm for a delay code generator.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Greetings from Germany,
G
mov m,#?
delay
decsz m ; m + 1
jmp delay ; 3*(m - 1)
by the formula:
x = (1/fclk)*(4m - 2) <==> m = (x*fclk + 2) / 4 .
If you keep fclk in MHz you will have x in usec. Keep in mind that m >= 1.
cheers,
Kenneth
Not everyone is the master assembly language programmer, that you are. BTW did you figure out how to make a delay yet ?
In SX/B I write "PAUSE x" where is x is the milliseconds to delay, or "PAUSEUS y" where y is the microseconds to delay.
Bean.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
"SX-Video·Module" Now available from Parallax for only $28.95
http://www.parallax.com/detail.asp?product_id=30012
Product web site: www.sxvm.com
Available now... SX-Video OSD module $59.95 www.sxvm.com
"Save your money. Pay with cash."
·
As to WHAT rules, you might want to heed the advice of someone that has a FINISHED product (grin) like Bean above. He has a product that has actually made it to market and presumably sells pretty well! Pretty impressive in my book!
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
John J. Couture
San Diego Miramar College
I think it's fair to conclude that inefficiency is under the direct control of the programmer -- no matter what programming tool in his/her hands.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax