Hello Guest it is March 29, 2024, 01:12:44 AM

Author Topic: Problem reading G31 sytem varibles  (Read 1947 times)

0 Members and 1 Guest are viewing this topic.

Offline ZASto

*
  •  423 423
    • View Profile
Re: Problem reading G31 sytem varibles
« Reply #10 on: August 01, 2021, 09:35:25 AM »
Hre you have some macros for chinese controller(s), I do not know which one, but I have it in my collection)

https://mega.nz/file/INFz0aqT#wo65uqPkmdppACMRy4mS5vYViE9uBQPdrxEyk6G9-9s
Make no mistake between my personality and my attitude.
My personality is who I am.
My attitude depends on who you are.

Offline Tweakie.CNC

*
  • *
  •  9,196 9,196
  • Super Kitty
    • View Profile
Re: Problem reading G31 sytem varibles
« Reply #11 on: August 01, 2021, 10:17:14 AM »
If it helps, this is a typical tool height setting script. The line in red would usually read GetVar(2002) but has been changed to GetOEMDRO(802) to allow for the Chinese controllers that do not recognize #2002.

CurrentFeed = GetOemDRO(818) 'Get the current feedrate to return to later
CurrentAbsInc = GetOemLED(48) 'Get the current G90/G91 state
CurrentGmode = GetOemDRO(819) 'Get the current G0/G1 state

If GetOemLed (825)=0 Then 'Check to see if the probe is already grounded or faulty
DoOEMButton (1010) 'zero the Z axis so the probe move will start from here
Code "G4 P3" ' this delay gives me time to get from computer to hold probe in place
Code "G90 G31Z-1. F4" 'probing move, can set the feed rate here as well as how far to move
While IsMoving() 'wait while it happens
Wend
ZProbePos = GetOEMDro(802)  'get the exact point the probe was hit
Code "G0 Z" &ZProbePos 'go back to that point, always a very small amount of overrun
While IsMoving ()
Wend
Call SetDro (2, 0.766) ' change 0.766 to your plate thickness and then adjust for final accuracy
Sleep 200 'Pause for Dro to update.
Code "G1 Z1. F5" 'put the Z retract height you want here, must be greater than the touch plate thickness
While IsMoving ()
Wend
Code "(Z axis is now zeroed)" 'puts this message in the status bar
Code "F" &CurrentFeed 'Returns to prior feed rate
Else
Code "(Z-Plate is grounded, check connection and try again)" 'this goes in the status bar if applicable
End If
If CurrentAbsInc = 0 Then 'if G91 was in effect before then return to it
Code "G91"
End If
If CurrentGMode = 0 Then 'if G0 was in effect before then return to it
Code "G0"
End If         
PEACE
Re: Problem reading G31 sytem varibles
« Reply #12 on: August 01, 2021, 05:33:56 PM »
I am coming to the conclusion that I need to buy another motion controller.
But I want to get it right this time.
I am running 4 axis but may need a 5th in the future.
the probe must work.
and I need at least 4 outputs plus  motor controls.
I would like to buy it in the UK.
and hopefully not hundreds of pounds.
Any recommendations?

Offline Tweakie.CNC

*
  • *
  •  9,196 9,196
  • Super Kitty
    • View Profile
Re: Problem reading G31 sytem varibles
« Reply #13 on: August 02, 2021, 02:53:44 AM »
If you buy a new motion controller (there are many to choose from) I recommend that you purchase one that is manufactured in the EU or USA and avoid anything made in China.

Tweakie.
PEACE

Offline Stuart

*
  •  311 311
    • View Profile
Re: Problem reading G31 sytem varibles
« Reply #14 on: August 02, 2021, 10:37:36 AM »
here you go
http://www.amadeal.co.uk/
http://emvioeng.com/

got mine ESS from the latter

but note you will still need a BOB or two maybe three as the ESS has three PP 26 pin headers to connect to the BOB

and to qualify my info I did have a Far Eastern motion controller but I built a 3d probe it got smashed researched the problem put it in the square black thing that sits outside the house got the ESS rewired the mill ( 4 axis ) to get rid of the hidden resistors that they had put in the wiring now it works as it should inc. G31 G31.1 G31.2 and G31.3
so 4 axis and 9 proximity limit switches completes the mill

Stuart  central UK

both are ok to deal with but disclaimer I am only a customer and have no ties with either

« Last Edit: August 02, 2021, 10:45:36 AM by Stuart »
Re: Problem reading G31 sytem varibles
« Reply #15 on: August 04, 2021, 02:54:16 PM »
Can anyone tell me how to transfer a value from a vb script variable to a #variable

Offline TPS

*
  •  2,501 2,501
    • View Profile
Re: Problem reading G31 sytem varibles
« Reply #16 on: August 05, 2021, 02:43:09 AM »
from VB script documentation:

SetVar

Sub SetVar(VarNum As Integer, Val As Double)

This function sets the Mach variable specified by VarNum to the value given by Val.
Mach variables are accessible both to CB scripts, using the SetVar() and GetVar()
functions, as well as G-code programs, using the #nnnn syntax.
Arguments:
VarNum is Integer the number of the Mach variable to be set.
Val is the Double value to which the variable will be set
Return Value:
None

Example:

‘ Set a variable 1234 to our target position of 2.3456
SetVar(1234, 2.3456)

‘ Now move X to our target position
Code “G0 X #1234”

See also:
GetVar()

https://www.machsupport.com/wp-content/uploads/2013/02/Mach3_V3.x_Macro_Prog_Ref.pdf
« Last Edit: August 05, 2021, 02:44:58 AM by TPS »
anything is possible, just try to do it.
if you find some mistakes, in my bad bavarian english,they are yours.
Re: Problem reading G31 sytem varibles
« Reply #17 on: August 05, 2021, 12:23:51 PM »
can val be a vb script variable?

Offline TPS

*
  •  2,501 2,501
    • View Profile
Re: Problem reading G31 sytem varibles
« Reply #18 on: August 05, 2021, 12:48:22 PM »
yes sure.
Code: [Select]
myvariable = 1.234
SetVar(1234,myvariable)

even both arguments can be a VB variable

Code: [Select]
myvariable = 1.234
mysetvar = 1234

SetVar(mysetvar,myvariable)

anything is possible, just try to do it.
if you find some mistakes, in my bad bavarian english,they are yours.
Re: Problem reading G31 sytem varibles
« Reply #19 on: August 06, 2021, 01:29:53 PM »
Thanks for all the help folks.
I think that I am getting somewhere now