Machsupport Forum

Mach Discussion => VB and the development of wizards => Topic started by: Johnny Storm on December 02, 2016, 02:11:43 PM

Title: MacroPump code for custom "antidive" feature activated with slow velocity
Post by: Johnny Storm on December 02, 2016, 02:11:43 PM
Hello,

I have a cnc plasma table with a stand alone THC, when I cut any shape, the torch dive in each corner or when the speed slow down in complicated shapes, my THC have one input to disable the automatic feature, this input is NC.

I read about antidive feature in Mach3, but, after many attempts I never make works, so I decided to write some code in macropump.m1s, but still dont work, this is the code I write:

Code: [Select]
velset = GetOEMDRO(818) 'This is the DRO when I set the cutting speed or set velocity
velact = GetOEMDRO(816) 'This is the DFO that shows te real time speed of the machine or actual velocity
autooff = GetUserDRO(2224) 'This is a custom DRO, I put the percent of the speed for disable the AUTOMATIC FEATURE of my THC, for example 70%
velpercent = ((velact / velset) * 100) 'This is the percent of the real time velocity compared with the set velocity
plasma = IsActive(OUTPUT1) 'I use te OUTPUT1 for activate the plasma torch
If (plasma = true) Then 'If the plasma torch is on then...
If (velpercent <= autooff) Then 'If the "velpercent" is less or equal than the "autooff" then..
DeActivateSignal(OUTPUT2) 'Activete OUTPUT2, this is the output I use for a relay for activate/deactivate te AUTOMATIC FEATURE of my THC
SetUserLED(555,1) 'This turn ON a custom LED for see when the AUTO FEATURE is disabled
Else
ActivateSignal(OUTPUT2) 'Deactivete OUTPUT2, this is the output I use for a relay for activate/deactivate te AUTOMATIC FEATURE of my THC
SetUserLED(555,0) 'This turn OFF a custom LED for see when the AUTO FEATURE is active
End If
End If

Can any one tellme what is wrong with te code?

Thanks