SX firmware to control 3 stepper motors
From Just in Time
Revision as of 00:47, 9 December 2006 by Danny
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 not been 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. The ultimate command is the 'move' command:
'm' denotes the 'move' command and directs the controller to move 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.
Movement is relative to the current position. In fact, the controller does not maintain an absolute position at all, except in a very limited way to keep the 'state' of the stepper motors. Examples of move commands are:
m0,ff,c0 m1fX2fX3f m de,-10,-ff mde-10-ff