Why Another Set of Macros?
The needs to create a set of macro commands helps in controller software interface with high-level PC programs.
Working with a CNC machine there are two aspects that must be considered.
The first is the computer-side management software and the second is the controller-side management software. Maybe is a bit confusing the fact that usually we consider firmware everything that comes on Arduino board except out sketch. In this case it is not completely true. As a matter of fact, a so-defined firmware software is only the skeleton of the firmware: Arduino boot loader is the shell that hosts our program sketch.
If we use the micro controller board as a stand-alone system to do some kind of task i.e. visual interaction, sensor monitoring etc. what we are doing with our sketch is to create the firmware for the micro controller, not the program as we intend as application software.
In other words, all the tasks that Arduino must do with the controller board - motor movement control, motor speed, axis positioning, heating control, data storage etc. - are to be considered low-level tasks.
Thus our CNC software (that runs on the PC) must "speak" in some way to the controller - we can consider it an intelligent controller - through more complex commands i.e. "move X-axis to this coordinates..." regardless that the cooler fan must start because the controller is heating or that the sliding plane of an axis has reached one of its limits.
In this controller I avoided as possible mathematics, due to the slow speed of the microcontroller. In theory it is possible to charge also this task to the micro controller adding a math co-processor, but the things become too complex and working in conjunction with a PC it results useless.
Considering the reduced program memory on micro controllers, there is also the fact that this solution is a good way to work with the higher efficiency possible with the smallest as possible memory usage.
Controller Commands and Macros
The first step in developing the controller software was to define a set of commands, then I adopted the EEPRom for permanent storage of commands, configuration parameters, calibration and strings.
Conducting the first experiments I saw also that a lot of cases needs repetitive sequences of commands, i.e. to draw a graphic primitive, a circle, a pre-defined working plane position and more. To dramatically reduce the number of instructions the CNC software must send to the controller I use at least half of the eeprom memory space to store sequences of commands directly on the controller board. This solution is helpful also to solve PC programs interfacing to gain a high compatibility with CNC programs.
