Self Made Jog Pendat Macro Help

This is where you talk about Macros, show examples of your macro scripting and SHARE handy segments of script code as examples.

Self Made Jog Pendat Macro Help

Postby mgolec » Thu Nov 14, 2019 7:40 pm

hi everybody,

in my old Mach3 times i worked on a jog pendant, which i will use also in uccnc.

My set up: UCCNC --> UC400ETH --> Stepper BoB

My question is if i can change the Axis to X,Y,Z with one button?
Maybe you can help me with my problem.
MPG works, but only for one Axis...

I would like to have a

SET Button --> Change from Code 220 to 221 to 222
ZERO Button --> SET Active Axis Working Zero
HOME Button --> Active Axis Homing

OUTPUT 1 --> X Axis Active
OUTPUT 2 --> Y Axis Active
OUTPUT 3 --> Z Axis Active

In Mach it works with Macros, but i dont know if it works also in UCCNC.
Maybe you can help me a bit? :)

I made the Pendat with this tutorial from Gerhard Günzel. (See also the Codes at the Page).
http://www.emagu.de/Mach3-Handrad.htm


Maybe you can help me a bit,
thanks very much.
Markus
Attachments
IMG-20191111-WA0045.jpeg
mgolec
 
Posts: 7
Joined: Thu Nov 14, 2019 7:15 pm

Re: Self Made Jog Pendat Macro Help

Postby Robertspark » Sat Nov 16, 2019 1:14 pm

This should work for you....

You need 3x macro files creating .... M20001.txt, M20002.txt and M20003.txt

Place them within your profile

Then you need to
GO TO SETTINGS >> IO TRIGGER >> I.TRIGGER
Set PIN + PORT references for each of the INPUTS corresponding MACRO#below
-> input #1 - SET ACTIVE AXIS >> 20001
-> input #2 - ZERO ACTIVE AXIS >> 20002
-> input #3 - HOME ACTIVE AXIS >> 20003

THEN
GO TO SETTINGS >> IO TRIGGER >> O.TRIGGER
Set PIN + PORT references for each of the OUTPUTS corresponding below:
-> output #1 - X AXIS ACTIVE ->> LED 155
-> output #2 - X AXIS ACTIVE ->> LED 156
-> output #3 - X AXIS ACTIVE ->> LED 157


The contents of the 3 files are as follows:

M20001.txt MACRO (CHANGE MPG AXIS MACRO)
Code: Select all
/*
M20001.txt MACRO (CHANGE MPG AXIS MACRO)
________________________________________

 UCCNC Macro for simple pendant control
3 inputs + 3 OUTPUTS
-> input #1 - SET ACTIVE AXIS
-> input #2 - ZERO ACTIVE AXIS
-> input #3 - HOME ACTIVE AXIS
-> output #1 - X AXIS ACTIVE
-> output #2 - Y AXIS ACTIVE
-> output #3 - Z AXIS ACTIVE

NOTE: DEFAULT AXIS IS "Z" at startup.... {not saved at reboot, if required can use construction and deconstructor macro to set and save flags....  should not be that important as it's just a button press}

Robertspark 16/NOV/2019, no copyright in any form use as you wish, just update with a version + description of the update

*SETUP*
GO TO SETTINGS >> IO TRIGGER >> I.TRIGGER
Set PIN + PORT references for each of the INPUTS corresponding MACRO#below
-> input #1 - SET ACTIVE AXIS  >> 20001
-> input #2 - ZERO ACTIVE AXIS >> 20002
-> input #3 - HOME ACTIVE AXIS >> 20003

THEN
GO TO SETTINGS >> IO TRIGGER >> O.TRIGGER
Set PIN + PORT references for each of the OUTPUTS corresponding below:
-> output #1 - X AXIS ACTIVE ->> LED 155
-> output #2 - X AXIS ACTIVE ->> LED 156
-> output #3 - X AXIS ACTIVE ->> LED 157

BTN# -> 100   ZeroX   Zeros the X axis position.
BTN# -> 101   ZeroY   Zeros the Y axis position.
BTN# -> 102   ZeroZ   Zeros the Z axis position.
BTN# -> 103   ZeroA   Zeros the A axis position.
BTN# -> 104   ZeroB   Zeros the B axis position.
BTN# -> 105   ZeroC   Zeros the C axis position.
BTN# -> 106   ZeroAll   Zeros All axis position.

BTN# ->  107   HomeX   Runs the X axis to the home sensor.
BTN# -> 108   HomeY   Runs the Y axis to the home sensor.
BTN# -> 109   HomeZ   Runs the Z axis to the home sensor.
BTN# -> 110   HomeA   Runs the A axis to the home sensor.
BTN# -> 111   HomeB   Runs the B axis to the home sensor.
BTN# -> 112   HomeC   Runs the C axis to the home sensor.

BTN# -> 220   220   MPGXaxisselect   Selects the X axis for the MPG jog.
BTN# -> 221   MPGYaxisselect   Selects the Y axis for the MPG jog.
BTN# -> 222   MPGZaxisselect   Selects the Z axis for the MPG jog.
BTN# -> 223   MPGAaxisselect   Selects the A axis for the MPG jog.
BTN# -> 224   MPGBaxisselect   Selects the B axis for the MPG jog.
BTN# -> 225   MPGCaxisselect   Selects the C axis for the MPG jog.

*/

if (AS3.GetLED(155) == true){
exec.Callbutton(221);
return;
}

if (AS3.GetLED(156) == true){
exec.Callbutton(222);
return;
}
if (AS3.GetLED(157) == true){
exec.Callbutton(220); // comment out if you have a  A, B or C axis jog machine.
//exec.Callbutton(223); // uncomment function if you have a A, B or C axis machine.
return;
}

// ** may need to change the below sequence if you have a XYZ+BC OR AN XYX+B OR and XYZ-C machine etc .... sure you can figure it out!

if (AS3.GetLED(158) == true){
exec.Callbutton(220); // comment out if you have a B,or C axis jog machine.
//exec.Callbutton(224); // uncomment function if you have a B or C axis machine.
return;
}
if (AS3.GetLED(159) == true){
exec.Callbutton(220); // comment out if you have a B or C axis jog machine.
//exec.Callbutton(224); // uncomment function if you have a B axis jog machine.
//exec.Callbutton(225); // uncomment function if you have a C axis machine.
return;
}
if (AS3.GetLED(160) == true){   // C axis Active
exec.Callbutton(220); // comment out if you need to....
return;
}



M20002.txt MACRO (ZERO ACTIVE AXIS)
Code: Select all
/*
M20002.txt MACRO (ZERO ACTIVE AXIS)
________________________________________

 UCCNC Macro for simple pendant control
3 inputs + 3 OUTPUTS
-> input #1 - SET ACTIVE AXIS
-> input #2 - ZERO ACTIVE AXIS
-> input #3 - HOME ACTIVE AXIS
-> output #1 - X AXIS ACTIVE
-> output #2 - Y AXIS ACTIVE
-> output #3 - Z AXIS ACTIVE

NOTE: DEFAULT AXIS IS "Z" at startup.... {not saved at reboot, if required can use construction and deconstructor macro to set and save flags....  should not be that important as it's just a button press}

Robertspark 16/NOV/2019, no copyright in any form use as you wish, just update with a version + description of the update

*SETUP*
GO TO SETTINGS >> IO TRIGGER >> I.TRIGGER
Set PIN + PORT references for each of the INPUTS corresponding MACRO#below
-> input #1 - SET ACTIVE AXIS  >> 20001
-> input #2 - ZERO ACTIVE AXIS >> 20002
-> input #3 - HOME ACTIVE AXIS >> 20003

THEN
GO TO SETTINGS >> IO TRIGGER >> O.TRIGGER
Set PIN + PORT references for each of the OUTPUTS corresponding below:
-> output #1 - X AXIS ACTIVE ->> LED 155
-> output #2 - X AXIS ACTIVE ->> LED 156
-> output #3 - X AXIS ACTIVE ->> LED 157

BTN# -> 100   ZeroX   Zeros the X axis position.
BTN# -> 101   ZeroY   Zeros the Y axis position.
BTN# -> 102   ZeroZ   Zeros the Z axis position.
BTN# -> 103   ZeroA   Zeros the A axis position.
BTN# -> 104   ZeroB   Zeros the B axis position.
BTN# -> 105   ZeroC   Zeros the C axis position.


BTN# ->  107   HomeX   Runs the X axis to the home sensor.
BTN# -> 108   HomeY   Runs the Y axis to the home sensor.
BTN# -> 109   HomeZ   Runs the Z axis to the home sensor.
BTN# -> 110   HomeA   Runs the A axis to the home sensor.
BTN# -> 111   HomeB   Runs the B axis to the home sensor.
BTN# -> 112   HomeC   Runs the C axis to the home sensor.

BTN# -> 220   220   MPGXaxisselect   Selects the X axis for the MPG jog.
BTN# -> 221   MPGYaxisselect   Selects the Y axis for the MPG jog.
BTN# -> 222   MPGZaxisselect   Selects the Z axis for the MPG jog.
BTN# -> 223   MPGAaxisselect   Selects the A axis for the MPG jog.
BTN# -> 224   MPGBaxisselect   Selects the B axis for the MPG jog.
BTN# -> 225   MPGCaxisselect   Selects the C axis for the MPG jog.


*/

if (AS3.GetLED(155) == true){
exec.Callbutton(100);
return;
}

if (AS3.GetLED(156) == true){
exec.Callbutton(101);
return;
}

if (AS3.GetLED(157) == true){
exec.Callbutton(102);
return;
}

if (AS3.GetLED(158) == true){
exec.Callbutton(103);
return;
}

if (AS3.GetLED(159) == true){
exec.Callbutton(104);
return;
}

if (AS3.GetLED(160) == true){
exec.Callbutton(105);
return;
}



M20003.txt MACRO (HOME ACTIVE AXIS)
Code: Select all
/*
M20003.txt MACRO (HOME ACTIVE AXIS)
________________________________________

 UCCNC Macro for simple pendant control
3 inputs + 3 OUTPUTS
-> input #1 - SET ACTIVE AXIS
-> input #2 - ZERO ACTIVE AXIS
-> input #3 - HOME ACTIVE AXIS
-> output #1 - X AXIS ACTIVE
-> output #2 - Y AXIS ACTIVE
-> output #3 - Z AXIS ACTIVE

NOTE: DEFAULT AXIS IS "Z" at startup.... {not saved at reboot, if required can use construction and deconstructor macro to set and save flags....  should not be that important as it's just a button press}

Robertspark 16/NOV/2019, no copyright in any form use as you wish, just update with a version + description of the update

*SETUP*
GO TO SETTINGS >> IO TRIGGER >> I.TRIGGER
Set PIN + PORT references for each of the INPUTS corresponding MACRO#below
-> input #1 - SET ACTIVE AXIS  >> 20001
-> input #2 - ZERO ACTIVE AXIS >> 20002
-> input #3 - HOME ACTIVE AXIS >> 20003

THEN
GO TO SETTINGS >> IO TRIGGER >> O.TRIGGER
Set PIN + PORT references for each of the OUTPUTS corresponding below:
-> output #1 - X AXIS ACTIVE ->> LED 155
-> output #2 - X AXIS ACTIVE ->> LED 156
-> output #3 - X AXIS ACTIVE ->> LED 157

BTN# -> 100   ZeroX   Zeros the X axis position.
BTN# -> 101   ZeroY   Zeros the Y axis position.
BTN# -> 102   ZeroZ   Zeros the Z axis position.
BTN# -> 103   ZeroA   Zeros the A axis position.
BTN# -> 104   ZeroB   Zeros the B axis position.
BTN# -> 105   ZeroC   Zeros the C axis position.


BTN# ->  107   HomeX   Runs the X axis to the home sensor.
BTN# -> 108   HomeY   Runs the Y axis to the home sensor.
BTN# -> 109   HomeZ   Runs the Z axis to the home sensor.
BTN# -> 110   HomeA   Runs the A axis to the home sensor.
BTN# -> 111   HomeB   Runs the B axis to the home sensor.
BTN# -> 112   HomeC   Runs the C axis to the home sensor.

BTN# -> 220   220   MPGXaxisselect   Selects the X axis for the MPG jog.
BTN# -> 221   MPGYaxisselect   Selects the Y axis for the MPG jog.
BTN# -> 222   MPGZaxisselect   Selects the Z axis for the MPG jog.
BTN# -> 223   MPGAaxisselect   Selects the A axis for the MPG jog.
BTN# -> 224   MPGBaxisselect   Selects the B axis for the MPG jog.
BTN# -> 225   MPGCaxisselect   Selects the C axis for the MPG jog.


*/

if (AS3.GetLED(155) == true){
exec.Callbutton(107);
return;
}

if (AS3.GetLED(156) == true){
exec.Callbutton(108);
return;
}
if (AS3.GetLED(157) == true){
exec.Callbutton(109);
return;
}
if (AS3.GetLED(158) == true){
exec.Callbutton(110);
return;
}
if (AS3.GetLED(159) == true){
exec.Callbutton(111);
return;
}
if (AS3.GetLED(160) == true){
exec.Callbutton(112);
return;
}


Attachments
M20003.txt
MACRO (HOME ACTIVE AXIS)
(2.53 KiB) Downloaded 526 times
M20002.txt
MACRO (ZERO ACTIVE AXIS)
(2.53 KiB) Downloaded 504 times
M20001.txt
MACRO (CHANGE MPG AXIS MACRO)
(3.23 KiB) Downloaded 508 times
Robertspark
 
Posts: 1892
Joined: Sat Sep 03, 2016 4:27 pm

Re: Self Made Jog Pendat Macro Help

Postby mgolec » Sat Nov 16, 2019 2:16 pm

Hi!

Thank you very much!
It works phanomenal!!! :)

I will make a tutorial for this one.

Greets and Thank you,
Markus
mgolec
 
Posts: 7
Joined: Thu Nov 14, 2019 7:15 pm


Return to Macros

Who is online

Users browsing this forum: No registered users and 23 guests

cron