Machsupport Forum
Mach Discussion => VB and the development of wizards => Topic started by: M250cnc on September 02, 2010, 06:16:56 AM
-
This is copied from RayL's VB ref guide
RefCombination
Sub RefCombination(Axes As Integer)
This function allows any combination of axes to be simultaneously referenced (homed). Which axes will
be referenced is determined by the Axes argument, which is a bit-mapped variable, with the bits mapped
as defined below.
Arguments:
Axes is a bit-mapped value the defines which axes are to be referenced. The value of Axes can be
calculated by adding the values corresponding to the individual axes to be referenced. The axis
values are:
X = 1
Y = 2
Z = 4
A = 8
B = 16
C = 32
So, for example, to reference the X, Z and B axes, Axes = 1 + 4 + 16 = 21.
Return Value:
None
Example:
‘ Define some constants
RefX = 1
RefY = 2
RefZ = 4
RefZ = 8
RefB = 16
RefC = 32
‘ Reference Y, Z and C axes
RefCombination(RefY + RefZ + RefC)
So my code is
RefX=1
RefZ=4
RefCombination (5)
Only one axis moves (X) this on a lathe, current stable release i have individual home switches on different pins using a SS
So what the hell is wrong. ???
-
I use this all the time in Mill but also just tried it on Lathe and it works fine here. Maybe another SS issue?
BTW - how did your other button problem turn out? >:D
-
I use this all the time in Mill but also just tried it on Lathe and it works fine here. Maybe another SS issue?
BTW - how did your other button problem turn out? >:D
OK thought maybe it was me somehow, yeah the other button works great but i took the feed part out so it just runs at the current feedrate.
Thanks for the help
-
You don't need the first part.
RefX=1
RefZ=4
All you need is RefCombination(5)
-
He he... I didn't point that out cos I thought people would think I was being picky - but it has no effect on the problem anyway - just two pointless (unused) variable decs and assignments. But whilst I'm being picky - the text in the guide is wrong anyway - they're not constants - they're variables. There - got that off my chest - thanks Gerry ;D
-
Thanks guys, it's so nice to know that it doesn't work whether they are variables or constants unnecessary parts or whatever. >:( ::)
-
I have a question, since I only pretend to be a programmer.:)
Wouldn't RefX be a variable, and 1 be the constant? And since the RefX is not needed, then the integers are constants? :) Maybe that's what he means?
Phil, do you get an error message, or does it just not work?
Does Dobutton(24) ref the Z?
-
Hi Gerry,
I have always been able to home each axis using the DoButton 22 & 24 if i remember correctly but one at a time.
When i first started playing with the combination only the Z referenced.
As i have it coded only the X axis is referenced with no error messages and i can step through the script from the edit button script no problem.
-
Phil
Can we start from scratch? When I look at the "Home All" button in lathe as it is out of the box, there is no VB in the button. Instead it uses OEM code 211. If you look up that in the OEM codes.xls file it says - Home X Home Z (turn). That seems to translate (after testing) to Home X THEN Home Z.
So - at some point I'm thinking you must have used a screen editor to change from using an OEM code to using VB - correct? (just trying to establish the full train of events)
Moving on. If I change from using an OEM code to using vbcode with:
doButton(24)
doButton(22)
Then it homes Z and then X
However, if I then change it to:
RefCombination(5)
It homes Z and X at the same time - i.e. what you want.
Two thoughts:
1) Can you try it using the parallel port driver and see what happens?
2) It's back to my thoughts that this may be an SS issue.
Meanwhile....
I have a question, since I only pretend to be a programmer.:)
Wouldn't RefX be a variable, and 1 be the constant? And since the RefX is not needed, then the integers are constants? :) Maybe that's what he means
What it says is:
‘ Define some constants
RefX = 1
RefY = 2
...etc...
So 1 indeed is a constant but that is not what's being defined - RefX is. ;)
We can do literal constants and symbolic constants if you like >:D
-
Phil
Can we start from scratch? When I look at the "Home All" button in lathe as it is out of the box, there is no VB in the button. Instead it uses OEM code 211. If you look up that in the OEM codes.xls file it says - Home X Home Z (turn). That seems to translate (after testing) to Home X THEN Home Z.
So - at some point I'm thinking you must have used a screen editor to change from using an OEM code to using VB - correct? (just trying to establish the full train of events)
Moving on. If I change from using an OEM code to using vbcode with:
doButton(24)
doButton(22)
Then it homes Z and then X
Yes you are exactly right, i have modified the standard sreen set and it worked as it should before i changed it ie sends each axis to the home position but i never used it.
However, if I then change it to:
RefCombination(5)
It homes Z and X at the same time - i.e. what you want.
Two thoughts:
1) Can you try it using the parallel port driver and see what happens?
2) It's back to my thoughts that this may be an SS issue.
Well it doesnt move both for me and i can't use the PP port, although my pc is a desktop not laptop.
At the end of the day i can find another use for that button i will just continue to ref one axis at a time
-
OK i have come across another small problem when i ref one axis after another to ref i want the machine in G94 mode with a feedrate of 150mm per min otherwise the referencing runs at a different speed and the home position is off
Code "G94"
Code "F150"
DoOEMButton (1022)
DoOEMButton (1024
The code above works perfectly but in general use i want the machine to be in G95 mode but when i change the code below as follows the referencing in ignoring the first two lines of code and using G95 all the way through
So i want to ref in G94 then automatically change to G95
Code "G94"
Code "F150"
DoOEMButton (1022)
DoOEMButton (1024)
Code "G95"
Code "F0.1"
All this code above runs in G95 mode
So i added the following pause but it still runs in in G95
Code "G94"
Code "F150"
DoOEMButton (1022)
DoOEMButton (1024)
Code "G04 P2"
Code "G95"
Code "F0.1"
Any clues anyone ?
-
Take out the dwell - just like in your thread a few days ago it's pointless.
then stick a
while isMoving()
sleep(50)
wend
after each line - probably not needed after every line but as they're all requests from VB to Mach it won't hurt.
-
just like in your thread a few days ago it's pointless.
Oiy watch what your saying ;D
Pointless threads Bl@@dy cheek, i just don't know what I'm doing ::)
Seriously, thanks i'll give it a try.
-
None taken :D (I think you know I meant the DWELL was pointless - but now you mention it - arf)
-
None taken :D (I think you know I meant the DWELL was pointless - but now you mention it - arf)
Yes i knew, but its so easy to get misconstrued a bit like VB code ;D
It works perfectly thanks