Machsupport Forum
Mach Discussion => General Mach Discussion => Topic started by: donrecardo on January 30, 2013, 09:00:57 AM
-
Hi
I have a 5 axis breakout board but only use 3 axes, so I have some spare outputs ,
A step , A direction , A enable , B step, B direction and B enable
On my pendant I wish to have 3 LEDs to indicate the jog increment step 1mm , 0.1mm , 0.01mm
my plan was to use these spare outputs on the B.O.B to drive the LEDs .
Can someone tell me if its possible and if so how I can get Mach3 to output 3 signals when the
1mm , 0.1 or 0.01 jog increment is enabled
I am ok at making inputs work and I can see that an easy way around my problem might be to
design 3 buttons on screen and assign each one a hotkey and an OEM code in the range
191 -200 which I think are the jog steps in the list of ten on the config/general config page.
My Pendant has a keyboard encoder in it so I could use 3 buttons to give me the hotkeys which
then trigger the OEM codes
But I would sooner use ALT J to cycle through the jog increments and have LEDs indicate which is selected
Can it be done?
Don
-
Easiest way would likely be the macropump
Just have something like
If GetOemDRO(828)=1 Then
ActivateSignal (OutPut1)
Else
DeActivateSignal(OutPut1)
End If
If GetOemDRO(828)=0.1 Then
ActivateSignal (OutPut2)
Else
DeActivateSignal(OutPut2)
End If
If GetOemDRO(828)=0.1 Then
ActivateSignal (OutPut3)
Else
DeActivateSignal(OutPut3)
End If
Hood
-
Hi Hood
Once again thanks for your help
Rather than just copy and use the help someone gives me I like to try and understand it so then just maybe
next time I can work it out for myself .
I am assuming that GetOemDRO(828) is the little window that shows the jog increment ?
How did you know it was 828 , is there a list that I havent found yet ?
So I think your code is saying if there is a one in the window , turn on output1
and if there isn't then turn output1 off
and the same for output2 with 0.1
and output3 with 0.01
That makes sense ( assuming my understanding is correct)
when you say output 1,2 or 3 I am guessing I will set that up in config/ports pins / outputs and give output#1 ,#2 or #3 the
port and pin numbers I have free
Now need to learn about Macro pump so I can implement your code. I guess there will be a tutorial or video somewhere ,
I shall go and look for it now
Thanks again Hood
Don
-
There is a list in a sticky at the top of the forum, "OEM codes for buttons, DRO's and LED's" there you will find a xls file with the OEM codes for buttons, LEDs etc There is also the same list on the wiki, I just put it in the Excel document so you can search easily and donthave to go online to the wiki.
Yes what you are thinking is correct and yes for that code you would have to set up in ports and pins to Output 1, 2 and 3 but you could change to other outputs if you are already using these ones.
The macropump is a file in the macro folder of the profile you use, eg if you use a standard Mill profile it will be in the folder c:\Mach3\Macros\Mach3Mill To open you can go to Operator menu in Mach then Edit VB Script and a window will open, browse to your folder and open Macropump.m1s then paste in the above (or modified for your outputs) then save and close. Next go to Config menu in Mach then General Config and on the right you will see Use Macropump, choose that and restart Mach and it should work.
Hood
-
I went to the machsupport page and clicked on
support then tutorial videos and clicked the link Artsoft Video Tutorials
down the left of the page that appeared I clicked on
" Introduction to Macropumps" but rather than get a video tutorial as I expected
I got a picture of the Mach3 screen
I feel daft now but , how do I get the video to play ?
Don
-
Ah , you must have posted while I was writing my last post.
I will follow your instructions , but it would still be nice to be able to play the videos
Don
-
Scroll down and you should see the Play button, see screenshot below.
Hood
-
Thanks for that ,
the video is running now , I feel pretty stupid not seeing it , but it was off
the bottom of the screen
went to open macropump.m1s but I dont have one
have lots of others , spindlespeed , hiddenscript and lots that start with m10, m11 m41 etc
should I just make a new one and call it macropump ?
Don
-
Yes you can either open any macro and then delete whats in an paste or type in what you want then choose Save As and call it macropump.m1s
You could do the same with opening notepad and putting your info in then saving as Macropump.m1s.
Hood
-
IT WORKS !!! IT WORKS !!! :D :D :D
Thanks to your help it is now working just as it should.
Now I shall see if I can work it out for myself how to do
the same with the jog mode Step / Continuous indicators
I am assuming i will be looking for OEM codes for LEDs this time rather than DROs
Thanks for the help
Don
-
Yes just use the OEM codes for the LEDs for them, similar idea as before, if LED is on then switch the output, if its off then switch it off. You could also do similar with the step increment outputs, ie if you have the following instead of what you already have
,
If GetOemDRO(828)=1 and GetOemLED(15) Then
ActivateSignal (OutPut1)
ActivateSignal (OutPut4)
Else
DeActivateSignal(OutPut1)
End If
If GetOemDRO(828)=0.1 and GetOemLED(15) Then
ActivateSignal (OutPut2)
ActivateSignal (OutPut4)
Else
DeActivateSignal(OutPut2)
End If
If GetOemDRO(828) and GetOemLED(15)=0.1 Then
ActivateSignal (OutPut3)
ActivateSignal(OutPut4)
Else
DeActivateSignal(OutPut3)
End If
Hood
-
Then for the next part you would have
If GetOemLED(14) Then
DeActivateSignal(OuPut4)
ActivateSignal(OutPut5)
Else
DeActivateSignal(OutPut5)
End If
Hood
EDIT
There were a few syntax errors so I have sorted.
-
Thanks Hood
I assume I would tack your last post onto the end of the one before
like this
If GetOemDRO(828)=1 and GetOemLED(15) Then
ActivateSignal (OutPut1)
ActivateSignal (OutPut4)
Else
DeActivateSignal(OutPut1)
End If
If GetOemDRO(828)=0.1 and GetOemLED(15) Then
ActivateSignal (OutPut2)
ActivateSignal (OutPut4)
Else
DeActivateSignal(OutPut2)
End If
If GetOemDRO(828) and GetOemLED(15)=0.1 Then
ActivateSignal (OutPut3)
ActivateSignal(OutPut4)
Else
DeActivateSignal(OutPut3)
End If
If GetOemLE(14) Then
DeActivateSignal(OuPut4)
ActivateSignal(OutPut5)
Else
DeActivateSignal(OuPut5)
End If
Don
-
Yes, it may need tweaked slightly to get things exactly right, busy at work at the moment but if you dont get it running right I will have a look when I get home.
Hood
-
Thanks Hood
I have to go to a meeting this evening so cant look at
it any more till tomorrow so will try it then.
Don
-
Hi Hood
I tried running it but it didnt want to work . I was supposed to go out to a meeting but
I found it so interesting I had to keep trying and eventualy got it working
I did all the jog increments first then did the jog mode afterwards
If GetOemDRO(828)=1Then
ActivateSignal (OutPut2)
Else
DeActivateSignal(OutPut2)
End If
If GetOemDRO(828)=0.1 Then
ActivateSignal (OutPut3)
Else
DeActivateSignal(OutPut3)
End If
If GetOemDRO(828)=0.01 Then
ActivateSignal (OutPut4)
Else
DeActivateSignal(OutPut4)
End If
If GetOemLED(14) Then
DeActivateSignal(OutPut5)
ActivateSignal(OutPut6)
Else
DeActivateSignal(OutPut6)
ActivateSignal(OutPut5)
End If
Thank you so much for your help
Don
-
Good you got it, was a bit rushed today and was typing my replies in between loading the lathe so made wuite a few errors. What I should have done was as below, that should work, but if yours is then all is fine, there are many ways to do things in VB.
If GetOemDRO(828)=1 and GetOemLED(15) Then
ActivateSignal (OutPut1)
Else
DeActivateSignal(OutPut1)
End If
If GetOemDRO(828)=0.1 And GetOemLED(15) Then
ActivateSignal (OutPut2)
Else
DeActivateSignal(OutPut2)
End If
If GetOemDRO(828)=0.01 and GetOemLED(15) Then
ActivateSignal (OutPut3)
Else
DeActivateSignal(OutPut3)
End If
If GetOemLED(14) Then
DeActivateSignal(OutPut4)
ActivateSignal(OutPut5)
Else
DeActivateSignal(OutPut5)
ActivateSignal (OutPut4)
End If
Hood
-
Hi Hood
I appreciate that there is more than one way to write code but
as you have a lot of experience and I have very little I knew your code was
likely to be better than mine , but I wondered why it was better.
I sat looking at it trying to see what it did differently to mine , and then I
spotted it. My code will show the increment size and the jog mode which
is what I required but of course when you are in continuous jpg mode then
increment size is irrelevent. Your code turns off the increment size LEDS when
in continuous jog but mine still showed the jog increment which is pointless
So thank you for the new code, which I will now use , but even more thank you for
the learning experience . I now know a little bit more than I did before.
Don
-
I am terrible at VB but usually manage to muddle through, I can envisage ways to do things easily but doing the actual VB is the hard part as I am not a programmer :)
Hood