Hello Guest it is April 19, 2024, 02:31:20 AM

Author Topic: Custom plasma probing code?  (Read 10896 times)

0 Members and 1 Guest are viewing this topic.

Offline BR549

*
  •  6,965 6,965
    • View Profile
Re: Custom plasma probing code?
« Reply #10 on: December 26, 2015, 05:24:39 PM »
You have the general idea with teh SUB.  Yes you CAN access the Values of a range of DROs through Gcode directly with #vars in the Gcode (;-).

There is a list here on the site somewhere I will look for it again. This comes up about every 2years or so (;-).

What exactly are you checking for in teh M900 ?? To see IF teh Z switch is stuck on ?? I would do this in teh M3 macro and eliminate teh M900 all together.


As to making the ouput active yo MAY want o consider doing this from Gcode and use a simple brain to do teh switching eliminating 2 more macros.

Simply have the Gcode Set a #var to either 0 or 1 and have the brain watch that dro # that is matched to teh #var.  That range should work both ways modify either one and it updates the other.

Now you have eliminated any problems or delays  that you could run into from using Mcodes .

Just a thought, (;-) TP


Offline BR549

*
  •  6,965 6,965
    • View Profile
Re: Custom plasma probing code?
« Reply #11 on: December 26, 2015, 09:18:38 PM »
Dave if it helps the OEMdros 1000 - 1255 as supposed to be mapped to #Vars 15000 -15255.

(;-) TP

Offline Davek0974

*
  •  2,606 2,606
    • View Profile
Re: Custom plasma probing code?
« Reply #12 on: December 27, 2015, 03:46:52 AM »
Thanks for that, i will now need to read up on brains and #vars ;)

this is a post modded by CandCNC for their MP3000-DTHC2 system, the odd thing is M900 does not exist in my running Mach setup so I can only guess it does absolutely bugger all??

I did a search through my backup archive and i did find a M900.m1s - it has this in it

'code to stop a touch off if the Ohmic is stuck on
if IsActive(_8_) then
Response =  MsgBox ("Touch - Off sensor jammed.  Clear and hit RUN to continue ", 4 , "Clear Z Jam")
code "M00"
end if

but i don't use the post it was related too, might be some post code overhang from another version?

I guess it checks input 8 to see if it is on at the time it wants to start IHS and stops if so???
I had to modify the input number as bracket-eight-bracket seems to convert to a smiley :)

Might be easier to pull the code from the post to tidy up a bit?

So my HeightSense.tap now looks like...

#???? = 1
G28.1 Z3.000   
G92 Z0.000 
#???? = 0                 
G00 Z#15045
G92 Z0.000
M99
%

Need to find an unused DRO number for the brain to monitor
« Last Edit: December 27, 2015, 03:57:04 AM by Davek0974 »

Offline Davek0974

*
  •  2,606 2,606
    • View Profile
Re: Custom plasma probing code?
« Reply #13 on: December 27, 2015, 03:57:25 AM »

Thanks for that, i will now need to read up on brains and #vars ;)

this is a post modded by CandCNC for their MP3000-DTHC2 system, the odd thing is M900 does not exist in my running Mach setup so I can only guess it does absolutely bugger all??

I did a search through my backup archive and i did find a M900.m1s - it has this in it

'code to stop a touch off if the Ohmic is stuck on
if IsActive(_8_) then
Response =  MsgBox ("Touch - Off sensor jammed.  Clear and hit RUN to continue ", 4 , "Clear Z Jam")
code "M00"
end if

but i don't use the post it was related too, might be some post code overhang from another version?

I guess it checks input 8 to see if it is on at the time it wants to start IHS and stops if so???
I had to modify the input number as bracket-eight-bracket seems to convert to a smiley :)

Might be easier to pull the code from the post to tidy up a bit?

So my HeightSense.tap now looks like...

#? = 1
G28.1 Z3.000   
G92 Z0.000  
#? = 0                
G00 Z#15045
G92 Z0.000
M99
%

Need to find an unused DRO number for the brain to monitor

Offline Davek0974

*
  •  2,606 2,606
    • View Profile
Re: Custom plasma probing code?
« Reply #14 on: December 27, 2015, 08:23:32 AM »
Ok, getting there now,

I have this as a Subroutine "HeightSense.tap"

#15239=1
G04 P0.5
G28.1 Z3.000   
G92 Z0.000  
#15239=0                  
G00 Z#15045
G92 Z0.000
M99
%

And the G-Code looks like,

N0190 M09 (Turn off extract fan)
N0200 M00 (Paused: Check the DTHC Settings - Hit RUN to continue)
N0210 G00 X36.000 Y17.475 Z15.000
N0220 M900 (Check for Z active) **this line will be removed soon - does nothing
N0230 M08 (Turn on extract fan)
N0240 M98 (HeightSense.tap)
N0250 G00 Z3.8000
N0260 M03

I tried to use a screen OEM LED numbered 1239 so i had a bit of bling but it would not work so i gave up on that and altered the brain to switch the output directly from the #15239 value and it works, the output has a button and LED on my screen anyway so i do get a little feedback as to where its at. I think this was the right way to go anyway as it's simpler.

One query - I pulled the var 1239/15239 from thin air - is there a way to see if vars are already used??????

As the G-code loads you can see it run the macro at each call so I guess thats good?

The brain was the easy part, almost ladder-logic and i'm used to that from PLC programming.

Hardware changes next, this will have to wait until I return to work as all my pneumatic stuff is there :( unless i get desperate and drive in to pick it up ;)

From measurements, a 40mm stroke cylinder at 45deg will give plenty of safety clearance when retracted, 10mm bore is plenty as no power is required, it can easily be bolted to a bracket using bolts already in place on the floating head - this makes it an easy task to fit and remove if it fails.

As it stands right now I still have made massive improvements I think as the probing and IHS is now relative to the machine and NOT the g-code so any mechanical changes will mean not having to recreate my stock code files over - nice :)

Thanks for the guidance, especially at this time of year, been a fun project so far.
« Last Edit: December 27, 2015, 08:25:20 AM by Davek0974 »

Offline Davek0974

*
  •  2,606 2,606
    • View Profile
Re: Custom plasma probing code?
« Reply #15 on: December 27, 2015, 09:39:01 AM »
One thing i have just noticed is that as the code is loaded, it triggers the probe output as it is scanned  clearly a bad thing,

I think i need to add an additional condition to the brain but what is best to monitor???

Offline Davek0974

*
  •  2,606 2,606
    • View Profile
Re: Custom plasma probing code?
« Reply #16 on: December 27, 2015, 11:35:44 AM »
Ok need more help here :(

been messing with the brain, i want to activate output3 only if #var15239 is = 1 AND the run led is on i.e. not loading code etc.

I have tried many variations and nothing seems to work here, I had two inputs - #15239 & LED804 then a >0 comparator on each then an AND then the output3 but this does nothing at all.

Any brain guru's around??

Can't be that complicated surely?

Offline Davek0974

*
  •  2,606 2,606
    • View Profile
Re: Custom plasma probing code?
« Reply #17 on: December 27, 2015, 03:32:03 PM »
Sorted it, couple more hours of reading and testing and it works perfectly if you use the pass-thru option and don't do any comparative ops on the signals.

input1)
         )  -->Pass-thru--> AND --> output
input2)

Offline BR549

*
  •  6,965 6,965
    • View Profile
Re: Custom plasma probing code?
« Reply #18 on: December 27, 2015, 09:48:04 PM »
For the most part you can look in the screen editor to see IF you have used OEMDROs 1000 -1255 as these are tied to #vars 15000 - 15255 internally.  Also you will figure out soon enough that you cannot reference from a macro #vars 15000 - 15255 with GetVar or setvar.  Art stopped allowing you to access them at about 13000 from CB. BUT you still can use Code" #15000 = XX" to set those VARs from a macro if you need to.

Soon enough you are going to figure out that you can do most of the CandCNC stuff without all the CandCNC stuff and even a bit MORE they don't want you to know. (;-) 

(;-) TP



Offline Davek0974

*
  •  2,606 2,606
    • View Profile
Re: Custom plasma probing code?
« Reply #19 on: December 28, 2015, 04:02:08 AM »
Thanks TP,

I will double-check the screen editor for the used DRO's as suggested just to make sure.

I have no idea why that M900 was there as there was no M900 macro so i guess it was just skipped by Mach. For the most part the CandCNC stuff works well, I won't recommend them anymore due to an issue I had previously which they did not help me out with satisfactorily and even tried to extract more money from me to replace stuff that was not faulty.

Anyway, i think what i have in place now is an improvement and when I add the new hardware it may be better or not but at least how it is now makes making changes far easier.