Machsupport Forum
		Mach Discussion => Brains Development => Topic started by: lightntrax on May 30, 2012, 03:02:19 AM
		
			
			- 
				I am new to brains and not sure if this will work.  I would like to count the number of time I drill a hole.  This way I can see what life I am getting out of the bit.  Can brains do this?
 
 Thanks.  Eddy
- 
				Eddy - please do not cross post - especially numerous times. you already have an active thread for this here http://www.machsupport.com/forum/index.php/topic,20499.msg142371.html#msg142371 (http://www.machsupport.com/forum/index.php/topic,20499.msg142371.html#msg142371)
			
- 
				You really don need a macro pump or brains to do that. Just some simple Gcode.
 
 I assume you are using a Sub program to do the drilling. If so then insert a
 
 #500 = [#500+1]
 
 at the end of the sub. Each time the sub cycles it increments the #var 1 number. The #vars 500-600 are persistant and Mach3 SAVES them in the XML when it shuts down.
 
 You can use the Var monitor to Do a query on the value of #500 and you have your running hole count.
 
 IF you need to ZERO the VAR from the MDI #500=0 enter.
 
 Just a thought, (;-) TP
 
 
- 
				Thanks for you help.  Is there a way with Screen 4 to display that variable?  I found the GCode Var Monitor.
			
- 
				SUre, Drop a UserDro on the screen say OemDro(2000)
 
 Then you would need to create a macropump or add to the existing MP
 
 'Macro to update Dro
 SetOemDro(2000, GetVar(500))
 
 (;-) TP
- 
				just as an alternative view, the reason you used a gcode var in the first place was...
 
 You really don need a macro pump or brains to do that. Just some simple Gcode.
 
 which of course was quite right, but now that you want to display it in a DRO you HAVE to use some macro coding so there's no point in using the gcode var anymore as the DRO will act as the var/counter.
 
 Plus it seems a tad round the houses setting a gcode var to some value and then monitoring it in the macropump to see what it was you just set it to so you can copy it to another place.  ;)
 
 So like T says you'd drop a DRO onscreen and then in your gcode in place of your #500 = [#500+1]  you'd have (say) M666 (other numbers are available), where its code would be:
 
 SetOEMDRO(2000, getOEMDRO(2000) + 1)
 
 Plus of course you can now set/reset the val anytime to anything by typing in the DRO itself.
 
 Ian