1 more thing to think about. Homing. when the pic is reset or on startup, you need to home the drives of course. I would do this by jumping to my "home routine" first and wait for a button press from 1 of the 4 on the jog stick. Now if you have home switches installed, you can just run a loop to send pulses at a fixed rate and check for the switch after each pulse. then when all axis are on switches set current pos to zero and goto main.
if you don't have switches, maybe do something like hold 1 switch for confirmation and hold 1 of the remaining switches for each axis to travel in the direction of home. when you are where you want to be, release both then press 1 again to confirm that axis. do this for each axis.
You main loop will just have to get A/D values(all 3) and check for timer overflow. and if you have limit switches, watch for them here also.
Bookmarks