Linear freq to delay tables for stepper contol

fred9

New Member
Ive been struggling with linear speed stepper contol for a while, the PWM is too fast and the math for real time delay (pauseus)/freq conversion is too hard (for me) and slow. So I hand generated 100 point and 200 point conversion look-up tables that some here may find (very :)) usefull. The tables presented here are for use on 32mhz 28X2 for stepper clock frequencies from 10 to 1000hz and are very fast. They would be scaleable for other pic fequencies, I couldnt find tables anywhere on the net.

I started with a 200 point table, but found after much frustration, that the Put and Get commands (to store the table in the 1024 byte scratchpad mem) operate with a byte location increment even with a word location address. You can use a word size location offset, but data access after the offset is only 256 . The pauseus values are words, so 200 word values wont work with Get/Put (400 bytes) hence the 100 point table, which works a treat.

The bas example is for a 32mhz 28X2 pic slave receiving speed commands via an I2C master (100 point). Since I can only upload 2 files, the second one is a 200 point table in TXT format ready for copy/paste.

The table values are split into low/hi bytes , Put/Get didnt seem to like word data.

The tables are from slow to fast. ie the 1st address gets 10hz, the last (approx, scaleable) 1khz (zero pauseus delay in this example). Freq lookup are byte values from 200 to 0, or 100 to 0.

I have the tables in excel format for further work if anyones interested, but I dont think I can upload that.
 

Attachments

Last edited:
Top