Code: Select all
#155 = FIX[6*9/13]*10+[6*9]%13
#100 = 0
M225 #100 "The calculated value in 155 is %f" #155
Moderator: cnckeith
Code: Select all
#155 = FIX[6*9/13]*10+[6*9]%13
#100 = 0
M225 #100 "The calculated value in 155 is %f" #155
Thanks. I saw similar but couldnt work out the format.cncsnw wrote: ↑Mon Jun 24, 2024 11:28 pm For each numeric value you want to substitute (each variable following the quoted string), you need to include a "%f" token in the quoted string. The "%f" gets replaced with the numeric value.
Code: Select all
#155 = FIX[6*9/13]*10+[6*9]%13 #100 = 0 M225 #100 "The calculated value in 155 is %f" #155
Thanks. That gets defined in the .src or M6 Macro file itself?
Thanks. Ill try that again. Im sure I had tried it before and didnt get output.
Hi, tried this. No outputs turn on. Any ideas?
Code: Select all
;------------------------------------------------------------------------------
; Filename: mfunc6.mac
; Description: Tool Change Macro
; Notes:
; Requires: CNC12 V5.04
; Revision Date: 14 JUN 2023
; Please see TB300 or the following link for tips on writing custom macros.
; https://www.centroidcnc.com/centroid_diy/downloads/acorn_documentation/centroid_cnc_macro_programming.pdf
;------------------------------------------------------------------------------
; Parameters:
; #9011 = Probe Input
; #9044 = TT Input
; #9160 = Enhanced ATC Features (Bins)
; #9161 = Maximum Tool Bins
; #9431 = 0 : Hole Style Holder
; 1 : Fork Style Holder
; #9432 = 0 : Fixed TT Position
; 1 : Surface Plate
; 2 : Tool Library
; #9433 = Surface Plate WCS Part 0
; #9830 = ATC Type, 0 = None, 1 = Carousel, 7 = RackMount
;
; System Variables:
; #4003 = Positioning Mode (G90/G91)
; #4120 = Requested Tool
;
; PLC Variables:
; ToolUnclampedState_M IS MEM12 (#70012)
; SpindleOrientedState_M IS MEM13 (#70013)
; SpindleZeroSpeedState_M IS MEM14 (#70014)
; AirPressureLow_M IS MEM15 (#70015)
; ToolChangeComplete_M IS MEM52 (#70052)
; AtPutbackLocation_M IS MEM59 (#70059)
; AtRequestedToolLocation_M IS MEM64 (#70064)
; CarouselInState_M IS MEM74 (#70074)
; CarouselOutState_M IS MEM75 (#70075)
; PutBackPosition_W IS W50 (#96050)
;
; User Variables:
; #101 = Saved Positioning Mode (G90/G91)
; #106 = Tool Touch Height
; #107 = New Tool Request Bin Location
;
; Return Points:
; G28 = Used For ToolCheck Position / M25 Home Positions
; G30 = Used for Z Height Flyover
; G30 P3 = X,Y,Z TT Location
;
; tt_check_configuration.cnc:
; #33001 = Tool Touch Input (Value from P11 or P44)
; #33002 = Fast Probe Rate
; #33003 = Slow Probe Rate
;------------------------------------------------------------------------------
IF #50001 ;Prevent lookahead from parsing past here
IF #4201 || #4202 THEN GOTO 1000 ;Skip macro if graphing or searching
IF #9006 == 0 THEN GOTO 950 ;Perform Default Macro if ATC not Installed
IF #9830 == 1 THEN GOTO 600 ;Jump to Carousel Section of Macro
IF #4120 == #9976 THEN GOTO 1000 ;Skip macro if requested tool is in spindle
IF #9160 > 0 THEN #107 = #[#4120 + 17000] ELSE #107 = #4120
IF #107 > #9161 THEN GOTO 800 ;Error Tool Change on Invalid Tool
;==============================================================================
;==============================================================================
; Carousel Tool Change Program Starts
;==============================================================================
N600
#101 = #4003 ;Save Positioning Mode
M109 /1/2 ;Disable Overrides
M5 ;Disable Spindle
M9 ;Disable Coolant
M107 ;Send PLC Tool Number
G4 P.25
G30 G91 Z0 ;Move Z to tool change position
G90
M94 /7 ;Request Tool Change
M101 /70014 ;Ensure Spindle at Zero Speed
;IF !#70013 THEN M19 ;Orient Spindle
;M101 /70013 ;Confirm Spindle Oriented
M101 /50037 ;Drawbar air pressure above 120psi
IF #96050 == 0 THEN GOTO 650 ;Skip putback
;------------------------------------------------------------------------------
; Carousel Tool Putback Section
;------------------------------------------------------------------------------
;M101 /70013 ;Confirm Spindle Oriented
M101 /70059 ;Wait for carousel at Putback Position
G4 P.25
;Move Carousel in and Unclamp Tool
M101 /70059 ;Ensure carousel at Putback Position
M94 /62 ;Request Carousel in
M100 /70074 ;Wait for Carousel In
G4 P.5 ;Carousel debounce
M100 /70074 ;Wait for Carousel In
G4 P1.5
M101 /50037 ;Drawbar air pressure above 120psi
M15 ;Unclamp Tool
M101 / 50044 ;Check if drawbar is unclamped
;------------------------------------------------------------------------------
; Carousel Tool New Tool Section
;------------------------------------------------------------------------------
N650
M101 /50037 ;Drawbar air pressure above 120psi
G4 P1
G53 Z0 ;Raise head to Clearance
M94 /40 ;Set PutBackComplete
M101 /70064 ;Wait for carousel at Requested Tool Position
M95 /40
;IF !#70012 THEN M101 /70013 ;Confirm Spindle Oriented if not Unclamped
M94 /62 ;Request Carousel in
M100 /70074 ;Wait for Carousel in
G4 P.5 ;Carousel debounce
M100 /70074 ;Wait for Carousel in
IF !#70012 THEN M15 ;Request Unclamp if not already
M101 /50044 ;Check if drawbar is unclamped
M94 /61 ;Airblast on
M101 /50037 ;Drawbar air pressure above 120psi
G30 G91 Z0 L30 ;Move Z to tool change Position
G90
M95 /61 ;Airblast off
M16 ;Clamp Tool
M100 /50044 ;Check if drawbar is clamped
;M5 ;Turn off spindle and orient request
;------------------------------------------------------------------------------
; Carousel Finish Section
;------------------------------------------------------------------------------
M95 /62 ;Request Carousel Out
M100 /70075 ;Wait for Carousel Out
G4 P.5 ;Carousel debounce
M100 /70075 ;Wait for Carousel Out
M101 /70052 ;Wait for Tool Change Complete
M95 /7 ;Reset Tool Change Request
M108 /1/2 ;Enable Overrides
GOTO 900
N800 ;Errors
M225 #100 "Invalid Tool Requested\nCycle Cancel to Abort"
GOTO 800
N900 ;Restore Modes
G#101 ;Restore Positioning Mode
GOTO 1000
N950
M6
N1000 ;End of Macro