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.

MPG Pendant Macro help request

Postby Dale » Mon Aug 21, 2017 12:54 pm

Hello all!

I'm a long time LinuxCNC user and in need of a change. I'm finding it harder and harder to remember all the detail of programming linuxCNC interface.
I've just purchased UCCNC and waiting for my U300Eth board to arrive. I'm running in simulation mode learning how the software works.
I'm also using Gerry's 2017 Screenset and loving it.

I have one problem though, I'm not a "Language" programmer. Did Fortran, Machine code etc way back when, but have not done any kind of modern programming in 30 years.

I have a pendant I designed and built. It was designed to support limited available inputs that I have on my old system. The pendant has 14 buttons and a MPG, while my old hardware had only 9 inputs and 2 outputs available for it. I designed the LinuxCNC code to scan a "Matrix" and act accordingly.

Now I would like to use the same pendant for UCCNC. I think a looping Macro may work for this. But I know nothing about C# program language.

I need a macro that would push a output pin high, look at 7 inputs pins to see if any go high, then if one does, act on it triggering one of 7 functions. Then it would turn that output low, turn on a second output pin, then scan the same 7 inputs again and trigger 7 different functions if any go high.
This way I get 14 unique functions triggered using only 9 I/O pins. (7-in and 2-out)

Does anyone know of a macro that might already be doing something like this? Or maybe help me a little with getting going?

Thanks and Cheers!
Dale

IMG_0220.jpg
Pendant
IMG_0205.jpg
PCB
Dale
 
Posts: 27
Joined: Mon Aug 21, 2017 12:23 pm
Location: Alberta, Canada

Re: MPG Pendant Macro help request

Postby Robertspark » Mon Aug 21, 2017 7:21 pm

Dale,

What happens if two buttons are pressed at the same time?

Does the macro ignore the input or choose the first input in the sequence?
[Do you want it to test the inputs in sequence or just check the inputs status]?
Robertspark
 
Posts: 1892
Joined: Sat Sep 03, 2016 4:27 pm

Re: MPG Pendant Macro help request

Postby dezsoe » Mon Aug 21, 2017 7:59 pm

Dale,

As I see this beutiful controller, the problem is not with the buttons. Am I right that you select (or hold) a button and change the setting with the rotary encoder? Could you write a short "users guide" in some words?
dezsoe
 
Posts: 2055
Joined: Sun Mar 12, 2017 4:41 pm
Location: Csörög, Hungary

Re: MPG Pendant Macro help request

Postby Dale » Mon Aug 21, 2017 8:18 pm

Robert,
I would say it choose the first in the sequence. But ignore is suitable as well if easier to implement.
Never thought about the test in sequence, vs simple status. I assume status check is better.
You some ideas?
Cheers!

Robertspark wrote:Dale,

What happens if two buttons are pressed at the same time?

Does the macro ignore the input or choose the first input in the sequence?
[Do you want it to test the inputs in sequence or just check the inputs status]?
Dale
 
Posts: 27
Joined: Mon Aug 21, 2017 12:23 pm
Location: Alberta, Canada

Re: MPG Pendant Macro help request

Postby Dale » Mon Aug 21, 2017 8:21 pm

Hi Dezsoe,

Thanks for the compliment on the controller.
Your are right. Hold the axis button and jog with encoder. That way the encoder is ignored preventing accidental movement.
Same idea for Feed & Speed buttons. Press one and increase/decrease override with MPG.
Dale


dezsoe wrote:Dale,

As I see this beutiful controller, the problem is not with the buttons. Am I right that you select (or hold) a button and change the setting with the rotary encoder? Could you write a short "users guide" in some words?
Dale
 
Posts: 27
Joined: Mon Aug 21, 2017 12:23 pm
Location: Alberta, Canada

Re: MPG Pendant Macro help request

Postby dezsoe » Mon Aug 21, 2017 8:28 pm

Just as I thought. :) The problem is that you have to use one encoder for the value changing and jogging. It will need some trick: I have to think it over. :)
(The polling of the keys is not a challenge: you can set and read any pin from macros or plugins.)
dezsoe
 
Posts: 2055
Joined: Sun Mar 12, 2017 4:41 pm
Location: Csörög, Hungary

Re: MPG Pendant Macro help request

Postby Robertspark » Mon Aug 21, 2017 8:32 pm

Dale,

Can you provide the pin map please
eg:
Output1 Button 1 = X axis select (Y, Z, Stop, )

Output1 Button 1
Output1 Button 2
Output1 Button 3
Output1 Button 4
Output1 Button 5
Output1 Button 6
Output1 Button 7

Output2 Button 1
Output2 Button 2
Output2 Button 3
Output2 Button 4
Output2 Button 5
Output2 Button 6
Output2 Button 7
Robertspark
 
Posts: 1892
Joined: Sat Sep 03, 2016 4:27 pm

Re: MPG Pendant Macro help request

Postby Robertspark » Mon Aug 21, 2017 8:34 pm

Is the encoder input seperate or does it just jog two pins?

.... sort of answered my own question by looking at the PCB

:roll: :roll: :oops:
Robertspark
 
Posts: 1892
Joined: Sat Sep 03, 2016 4:27 pm

Re: MPG Pendant Macro help request

Postby Robertspark » Mon Aug 21, 2017 8:54 pm

Don't understand some of the buttons, can you explain some of the symbols please
/ advise if the below is correct or otherwise (I can then select the right button codes from the UCCNC table of buttons)

static int Output1Input1 = 1 ; // Zero Z & Y
static int Output1Input2 = 1 ; // Zero Axis (X,Y,Z)
static int Output1Input3 = 1 ; // G61 / G64 (exact stop / constant velocity mode)
static int Output1Input4 = 1 ; // Spinde Speed Select
static int Output1Input5 = 1 ; // ?? Tick??
static int Output1Input6 = 1 ; // Start / Stop??
static int Output1Input7 = 1 ; // Reset
static int Output2Input1 = 1 ; // X Axis Select
static int Output2Input2 = 1 ; // Y Axis Select
static int Output2Input3 = 1 ; // Z Axis Select
static int Output2Input4 = 1 ; // Feedrate Select
static int Output2Input5 = 1 ; // G31 Z axis probe
static int Output2Input6 = 1 ; // G28 Go to Home ??
static int Output2Input7 = 1 ; // Go to X0. Y0, Safe Z
Robertspark
 
Posts: 1892
Joined: Sat Sep 03, 2016 4:27 pm

Re: MPG Pendant Macro help request

Postby Dale » Mon Aug 21, 2017 10:49 pm

Close! ;)

X Axis Select
Y Axis Select
Z Axis Select
Home All
Goto Home
Set Work Zero Offsets
Goto Work Zero
Stop
Start/Pause
Constant/velocity mode for jogging. Never use, so can change for sure.
Z Axis Probe
Select (Keyboard "Return")
Spindle Speed select for MPG increase or decrease.
Feed Speed select for MPG increase or decrease.
Dale
 
Posts: 27
Joined: Mon Aug 21, 2017 12:23 pm
Location: Alberta, Canada

Next

Return to Macros

Who is online

Users browsing this forum: No registered users and 3 guests