Shop OBEX P1 Docs P2 Docs Learn Events
Another (simple) 3-axis controller for SX28 — Parallax Forums

Another (simple) 3-axis controller for SX28

spiffspiff Posts: 15
edited 2007-11-14 01:03 in General Discussion
Now that Polywogs has released his source for a--quite extensive--3-axis controller (see this thread), I thought it would be time for me to publish mine as well smile.gif

The code attached is a relatively simple controller for 3 stepper motors. It implements linear movements only (straight lines). The SX code listens to an RS232 line for commands of the form
m <hex_x>, <hex_y>, <hex_z>

and acts accordingly. While idle, the controller will scan a keyboard matrix, so that the motors can be manually controlled as well. While moving, three keys/switches (say 'start position detection', 'end position detection' and 'emergency stop') will be scanned continuously.

A more elaborate explanation is here

Electronics-wise, with a lot of help, I have this working with three attached steppers. Only, I very much lack the mechanics skills to create an actual CNC device out of this, so this project is currently 'paused'.

Please feel free to use this source-code any way you like.

Post Edited (spiff) : 11/13/2007 12:06:43 AM GMT

Comments

  • BeanBean Posts: 8,129
    edited 2007-11-13 12:34
    Spiff,
    Nice code. If I had time I would like to convert it to SX/B. Have you tried the SX/B compiler ?

    Bean

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    www.iElectronicDesigns.com

    ·
  • spiffspiff Posts: 15
    edited 2007-11-13 22:59
    Bean,

    Thanks for the feedback. I started this as pure assembly because I had big plans with the ram/program space and wanted total control over the available bytes. The intention was to cram other VPs in the same space and I wasn't sure it would all fit if I moved to SX/B. Additionally I'm not sure I could have fitted the bresenham line drawing algorithm in an ISR at 4Mhz if it were written in SX/B.

    But since SX/B may not be as heavy-weight as other Basic variants, there is a good chance that it still fits...

    Is it the Bresenham algorithm that you would like an SX/B variant of, or just the main (non-ISR) code?
  • PolywogsPolywogs Posts: 28
    edited 2007-11-14 01:03
    ···· I'll post my other projects for 3 axis controls so we can compare notes. There are many variations and my first ten involved the parallel port and SX28 then moved up to serial and SX48. The Cordic method for SINE was developed for the shear speed of moving through an arc. I have to admit that since developing a flow chart method of timing my subroutines cascading the scan from bottom to top and maintaining a watch for comms status every scan, buffering arc points will work pretty good for steppers.

    ··· Nothing like the first time·for a·rush! Right?
Sign In or Register to comment.