MPG Pendant Macro help request

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

Re: MPG Pendant Macro help request

Postby Dale » Tue Aug 22, 2017 4:07 pm

No electronics on the PCB. The C10S BB can support both Pull-high and Pull-low inputs.

dezsoe wrote:Hi Dale,

I made a little table, could you fill it? And which ports/pins are connected to the encoder?

And one more question. Do you have any electronics on this pendant or is it just connected to the I/O pins? I ask it because the input pins have built-in pull-up resistors, so if there is no electronics in your pendant then you have to use low level column selection.
Dale
 
Posts: 27
Joined: Mon Aug 21, 2017 12:23 pm
Location: Alberta, Canada

Re: MPG Pendant Macro help request

Postby ger21 » Tue Aug 22, 2017 4:09 pm

The M6 macro has a Message Box, to stop the macro and allow the user to change tools (M6 set to automatic toolchanger). He wants to click the OK on the messagebox with his pendant.
Gerry
UCCNC 2022 Screenset - http://www.thecncwoodworker.com/2022.html
ger21
 
Posts: 2671
Joined: Sat Sep 03, 2016 2:17 am

Re: MPG Pendant Macro help request

Postby dezsoe » Tue Aug 22, 2017 4:52 pm

Gerry,

Because M0 works wrong in a macro, I wrote a pause macro. exec.Code("M0") will execute after the calling macro has finished. Calling this macro while waiting for tool replacement (and M31 if needed) from M6 works fine. The other advantage of this pause macro is that you can continue with Cycle Start, even if it is pressed on a pendant or a trigger input. The middle of M6:

Code: Select all
  exec.Code("M20900"); // Pause
  while(exec.IsMoving()){}

I put a LED on the Start button to show pause state:

PauseLED.png
PauseLED.png (3.37 KiB) Viewed 23398 times

And here is the macro:

Code: Select all
if (!exec.GetLED(54)) return;                                                   // No Cycle -> no pause

int PauseLED = Convert.ToInt32(exec.Readkey("DASH", "PauseLED", "499"));

while(exec.IsMoving()){}

exec.Stop();
while(exec.IsMoving()){}

exec.SetLED(true, PauseLED);
while(exec.IsMoving()){}

while(!(exec.GetLED(54) || exec.Ismacrostopped())) exec.Wait(20);               // Wait for Cycle Start or Stop

exec.SetLED(false, PauseLED);

You can replace the read of PauseLED number with a constant, I always use values from the profile.

Feel free to use this pause macro instead of MessageBox in your screenset if you like it.
dezsoe
 
Posts: 2055
Joined: Sun Mar 12, 2017 4:41 pm
Location: Csörög, Hungary

Re: MPG Pendant Macro help request

Postby ger21 » Tue Aug 22, 2017 5:05 pm

Thanks, I'll take a look when I have time.
Gerry
UCCNC 2022 Screenset - http://www.thecncwoodworker.com/2022.html
ger21
 
Posts: 2671
Joined: Sat Sep 03, 2016 2:17 am

Re: MPG Pendant Macro help request

Postby dezsoe » Wed Aug 23, 2017 8:07 am

Dale,

Did you make a new PCB for the pendant or the pin mapping is wrong? I cannot pair the text file with the PCB.

Dale_pendant_pcb_mod.jpg


Code: Select all
                Col1                  Col2
                Port 2                Port 2
                Pin 01                Pin 14
Port 2 Pin 02   Feed +/-              Z Select
Port 2 Pin 03   C/V                   Y Select
Port 2 Pin 04   Zero X,Y(Work Zero)   X Select
Port 2 Pin 05   Home All              Goto Home
Port 2 Pin 06   Start/Hold            Zero Z TLO
Port 2 Pin 07   Cycle Stop            Goto Work Zero leave Z alone
Port 2 Pin 08   Tool change Complete  Spindle +/-
dezsoe
 
Posts: 2055
Joined: Sun Mar 12, 2017 4:41 pm
Location: Csörög, Hungary

Re: MPG Pendant Macro help request

Postby Dale » Wed Aug 23, 2017 11:46 am

Your holding the PCB upside down. Spin it 180deg.
I did remake it, using holes to solder wires to, but the rest is same.
Dale
Dale
 
Posts: 27
Joined: Mon Aug 21, 2017 12:23 pm
Location: Alberta, Canada

Re: MPG Pendant Macro help request

Postby Dale » Wed Aug 23, 2017 11:59 am

I opened the case for you to see.
Cheers!
Dale
Attachments
2.jpg
1.jpg
Dale
 
Posts: 27
Joined: Mon Aug 21, 2017 12:23 pm
Location: Alberta, Canada

Re: MPG Pendant Macro help request

Postby dezsoe » Wed Aug 23, 2017 12:15 pm

Oh, yes! The PCB is changed, I see. Thank you!
dezsoe
 
Posts: 2055
Joined: Sun Mar 12, 2017 4:41 pm
Location: Csörög, Hungary

Re: MPG Pendant Macro help request

Postby Robertspark » Tue Aug 29, 2017 11:34 am

Has this been done, or is it still waiting?

[my holidays are over and things will now return to normal whatever that means so I'm about to have another look at this]

Some of these button functions are fairly easy, the ones that got me were the spindle speed and feedrate adjust via MPG (encoder) input without MPG button codes select, as the X, Y and Z can all be selected via button codes 220, 221 & 222
Robertspark
 
Posts: 1892
Joined: Sat Sep 03, 2016 4:27 pm

Re: MPG Pendant Macro help request

Postby dezsoe » Tue Aug 29, 2017 2:33 pm

Not yet. I have other things to complete first. All the functions are easy to do, I will show it later, but I'm struggling with the easyest job: reading the keys. I'll be back in some days with the details. :)
dezsoe
 
Posts: 2055
Joined: Sun Mar 12, 2017 4:41 pm
Location: Csörög, Hungary

PreviousNext

Return to Macros

Who is online

Users browsing this forum: No registered users and 3 guests