Wednesday 28 March 2018

Centroid's macro language

There's a reasonably comprehensive manual for the "M Series" operating system, currently covering "CNC11" ie version 11v3.16. They haven't round to issuing an update for CNC12 but it sounds as if the changes are fairly trivial. Would be nice if they got around to the update....

In order to implement my clever(?) plan to automatically select the correct gear range for the next anticipated spindle speed, I need to be able to read and manipulate various variables such as the demanded spindle speed (as set by the "S" command such as "S3000" for 3000rpm), the current gear ratio etc.

The macro language, like the "PLC" language appears to be of Centroid's devising. It bears some resemblance to the likes of Fanuc / Fadal / Okuma etc but none of those flavours are quite the same as Centroid's.

Section 13 of the manual covers M codes (macros) and there is other pertinent stuff in chapters 14 (many of the common parameters are listed and described there), chapter 11 (variables and "advanced macro statements") and chapter 12 (G codes).

As ever, there are quite a few gaps but of course the author(s) knew what they were talking about even if the reader may not. 

  • There are myriad variations on the "spindle speed" eg demand, actual, limited, overridden etc etc. Which one do you want? And it depends which side of the various reduction gears you are on. Again, the coders knew what they meant.
  • How do you specify the variable you want to access from within a macro? The various industry standard syntaxes don't seem to be followed.
  • There seems to be a difference in what you are able to implement inside a "custom macro" and a normal "macro". That needs to be figured out.
  • There seems to be no means of displaying messages during execution. For debugging, it would be handy to be able to see the values of variables, using something like "print (to display), "output" etc but there's no mention anywhere. Seems I will have to write to a data file instead.
Some simple tests so far:

This is a simple macro that sets the spindle speed at 500rpm, enables the spindle, captures the value of variable #4119 (the demand speed set by the "S" command) and stores it as variable #100, then changes the speed to 500rpm (it doesn't need to issue an M03 as the motor is already running), then finally opens the data file "muzzer.dat" and writes the values of #100, #101, #4119 and #25009 to it.


S500

#100 = #4119
M03
G4 P1
S400
#101 = #4119
G4 P1
M121 "c:\cncm\muzzer.dat"
M123 P#100; #100
M123 P#101; #101
M123 P#4119; #25009


The output (the contents of the file muzzer.dat) is very simple:


 500.000 #100

 400.000 #101
 400.000 #4119
 400.000 #25009


It's a start.

NB: note that the M123 command appends the new data and it also creates the file if it doesn't yet exist. You can delete the contents and save if you want to start again.

No comments:

Post a Comment

Final assembly and test of the spindle nose adaptor - RESULT!!

After the recent distraction caused by the 3D scanner, resurrecting the 3D printer and buggering about with the throttle bodies for my Honda...