Code to drive a CNC machine via a PC LPT port lookalike 25 pin 'D', experiment in 'PC/Mach3' replacement. Designed to compile and run on mbed LPC1768, Freescale KL25Z and Freescale KL46Z. Proved on LPC1768 and KL25Z, problem with serial port on KL46Z. Reads subset of 'G Codes' through usb/serial port and drives 3 stepper/servo drives for X, Y and Z, also similar Step/Dir outputs for spindle motor control. Emulates PC LPT, outputs 'charge pump', proved driving Seig KX3 CNC mill

Dependencies:   MODSERIAL mbed

Revision:
3:7aaf0072cc22
Parent:
2:b3c668ec43ac
diff -r b3c668ec43ac -r 7aaf0072cc22 lissajous.cpp
--- a/lissajous.cpp	Thu Feb 20 09:27:18 2014 +0000
+++ b/lissajous.cpp	Fri Mar 14 14:14:55 2014 +0000
@@ -16,8 +16,8 @@
 */
 //bool    liss_active = false;    //  global flag used to prevent running more than once at a time
 
-void    lissajous   (double feed_rate)  {
-    const double    PI          = 4.0 * atan(1.0),  //3.142ish but more accurate
+void    lissajous   (fl_typ feed_rate)  {
+    const fl_typ    PI          = 4.0 * atan(1.0),  //3.142ish but more accurate
                     Deg2Rad     = PI / 180.0, //  degrees to radian conversion factor
                     MaxX            = 40.0,     // Plot size X to move +/- MaxX
                     MaxY            = 25.0,     // Plot size Y to move +/- MaxY
@@ -26,12 +26,12 @@
                     FreqRatio       = 0.255;
     const int       StepsPerRevX    = 100,
                     NumofXCycles    = 16;
-    const double    AngleStepX  = (2.0 * PI / StepsPerRevX),
+    const fl_typ    AngleStepX  = (2.0 * PI / StepsPerRevX),
                     AngleStepY  = AngleStepX * FreqRatio;
 
 //void    lissajous   (void const * arg_string)  {
     struct  pirbufgrain Coords;
-    double  AngleX = StartAngDegX * Deg2Rad,
+    fl_typ  AngleX = StartAngDegX * Deg2Rad,
             AngleY = StartAngDegY * Deg2Rad;
             
 //    pc.printf("In lissajous func, Loading Lissajous\r\n");