Welcome, Guest. Please login or register.
Did you miss your activation email?
May 28, 2012, 12:40:11 PM

Login with username, password and session length
Search:     Advanced search
* Home Help Search Calendar Links Login Register
+  Machsupport Forum
|-+  Mach Discussion
| |-+  VB and the development of wizards
| | |-+  Help with macropump code
Pages: 1   Go Down
Print
Author Topic: Help with macropump code  (Read 1187 times)
0 Members and 1 Guest are viewing this topic.
dacostad
Active Member

Offline Offline

Posts: 48


View Profile WWW
« on: February 16, 2007, 09:37:35 AM »

Hi all,

I have just built a pendant for my CNC Router I built (see
http://web.mac.com/dacostad) and I have the following in my
macropump.m1s to control the turning on and off of the LED's on my
pendant.

As you can see towards the end of the code I have a single LED on the
pendant that when on means that the pendant is not in MPG mode.
However as there are two non-MPG modes (cont and step) I would like to
have the LED be on for cont mode and flash for step.

At the moment I just turn it on for both (OEM LED 14 and 15) and as I
am not a programmer I am not sure how to get to flash when OEM LED 15
is on.

I imagine that I need something like a do while loop.

Can someone advise me on the correct code.

Here is the code;

If GetOEMLed(59) Then ' X Axis selected
ActivateSignal (OUTPUT4)
Else
DeActivateSignal(OUTPUT4)
End If

If GetOEMLed(60) Then ' Y Axis selected
ActivateSignal (OUTPUT5)
Else
DeActivateSignal(OUTPUT5)
End If

If GetOEMLed(61) Then ' Z Axis selected
ActivateSignal (OUTPUT2)
Else
DeActivateSignal(OUTPUT2)
End If

If GetOEMLed(14) Or GetOEMLed(15) Then
ActivateSignal (OUTPUT3) 'Jog Mode, LED on is cont. mode
Else
DeActivateSignal(OUTPUT3)
End If

Thanks

David
Logged
Graham Waterworth
Administrator
*
Online Online

Posts: 1,665


West Yorkshire, England



View Profile WWW
« Reply #1 on: February 17, 2007, 04:45:55 AM »

Hi David,

if you add a dro onto a mach screen, (it can be off visible area of screen if you wish) you can set it to a value, say 0 for cont and 1 for step then add another dro for a counter.

Then you can read this to know the state of your jog.

then in your macropump put something like :-

Add code to set jog type dro and set counter

IF yourdro = 1  then
  if countdro>40 then (adjust the 40 to set flash rate)
    If GetOEMLed(15) Then
      turn led off
      set dro count to 0
    Else
      turn led on
      set dro count to 0
    End If
   else
     add 1 to dro count
   Endif
ENDIF

As the macropump runs about 40 times a second you need a delay to see the led flash the counter dro will do this.

Just a quick thought, but it should work

Graham.
Logged

G-Code is on the cutting edge

Autovalues Engineering, CNC machining specialists, Bradford, England
poppabear
S S SYSTEMS, LLC
Global Moderator
*
Offline Offline

Posts: 1,707


Briceville, TN, USA


View Profile WWW
« Reply #2 on: February 18, 2007, 08:55:07 PM »

It might be easier for you to just put 2 leds one for cont, and one for step. Set one led to solid and the other to flash. Then just turn on the one for the function that is on.
Logged

Commercial Mach3: Screens (regular and flash), Wizards, Plug-ins, Brains, PLCs, Macros, ATC's, machine build, retrofit and Prototyping
http://sites.google.com/site/volunteerfablab/
Pages: 1   Go Up
Print
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.16 | SMF © 2011, Simple Machines Valid XHTML 1.0! Valid CSS!