SX firmware to control 3 stepper motors

From Just in Time

Revision as of 18:42, 20 December 2006 by (talk)

Status so far:

  • 3D Bresenham line drawing algorithm has been programmed on-chip.
  • text parser has been implemented
  • serial port VP has been integrated
  • keyboard and switch driver has been implemented
  • "emergency stop" and end-keys are not implemented yet

You can view the source here.

So What Does It Do

The firmware assumes the following:

  • Three stepper motors connected to rc (x and y) and rb.4-7 (z)
  • Some serial communications device attached to ra.3 (SX sending) and rb.0 (SX receiving). The software is configurable to work either through a MAX232 ic or by connecting the pins directly to some rs-232 device. In the latter case, out- and input actions become active-low.

The firmware communicates through the serial port and assumes a 9600bps 8N1 connection (this is configurable, but must be tuned with the clock frequencies, because some some bitrates are not possible with some clock speeds).

At boot, the SX will send a welcome message and a prompt. The other end of the communciations line (the driver) is supposed to send ascii commands over the serial line, separated by newlines (ascii code 13). The SX will only accept commands when it has sent a prompt charachter ('>'). The driver should therefore always wait for a prompt before sending a command. Internally, there is one command buffer, so that the SX can execute one command and receive the next command at the same time.

The ultimate command is the 'move' command:

m shhhh,shhhh,shhhh

'm' denotes the 'move' command and directs the controller to perform a number of half-steps on each axis. 's' stands for an optional sign character, 'h' means an optional hex digit. Instead of comma's, any non-hex character can be used. There is no need for whitespace after the command, or in fact at any location at all.Examples of move commands are:

m   de,-10,-ff

Movement is specified in half-steps, relative to the current position.