Hello Guest it is March 29, 2024, 09:31:23 AM

Author Topic: Getting Outputs from Mach3  (Read 8687 times)

0 Members and 1 Guest are viewing this topic.

Offline Hood

*
  •  25,835 25,835
  • Carnoustie, Scotland
    • View Profile
Re: Getting Outputs from Mach3
« Reply #10 on: January 31, 2013, 09:22:45 AM »
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

Offline Hood

*
  •  25,835 25,835
  • Carnoustie, Scotland
    • View Profile
Re: Getting Outputs from Mach3
« Reply #11 on: January 31, 2013, 09:26:25 AM »
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.
« Last Edit: January 31, 2013, 09:34:29 AM by Hood »
Re: Getting Outputs from Mach3
« Reply #12 on: January 31, 2013, 09:36:40 AM »
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

Offline Hood

*
  •  25,835 25,835
  • Carnoustie, Scotland
    • View Profile
Re: Getting Outputs from Mach3
« Reply #13 on: January 31, 2013, 10:29:54 AM »
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
Re: Getting Outputs from Mach3
« Reply #14 on: January 31, 2013, 11:00:43 AM »
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
Re: Getting Outputs from Mach3
« Reply #15 on: January 31, 2013, 12:33:24 PM »
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

Offline Hood

*
  •  25,835 25,835
  • Carnoustie, Scotland
    • View Profile
Re: Getting Outputs from Mach3
« Reply #16 on: January 31, 2013, 01:32:24 PM »
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
Re: Getting Outputs from Mach3
« Reply #17 on: January 31, 2013, 02:36:06 PM »
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

Offline Hood

*
  •  25,835 25,835
  • Carnoustie, Scotland
    • View Profile
Re: Getting Outputs from Mach3
« Reply #18 on: February 01, 2013, 03:22:24 AM »
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