Hello Guest it is April 24, 2024, 10:20:54 PM

Author Topic: Drilling Machine Macro  (Read 930 times)

0 Members and 1 Guest are viewing this topic.

Drilling Machine Macro
« on: March 09, 2023, 01:09:51 PM »
Hello Forum.
We have a drilling machine at work. It rotates a table, like a record player (axis A) on which is a disk of wood. Every 10 degrees or so rotation stops and we drill a hole. A valve opens, letting air through, pushing down the drill where a magnetic read switch should trigger the return stroke, where another read switch signals the next rotation around A. We have never got the read switches to work, we use a short drill stroke timer instead.

I have looked and looked for a way to read a switch but ended up looking at learning visual basic, an 8 hour video, to write what I think will be about 4 lines of code in a macro. Can anyone save me the time?

In Mack 3 we can see an LED on the diagnostics page... it changes state along with the magnetic read switch, so our signal is getting all the way to mach 3. I think the two read switches are pins 10 and 11.

The cycle should go like this..... turn A to the drilling position, stop rotating, M7 (pushes the drill down) , wait for the bottom of the drill stroke read switch to trip, M9 (pulls the drill back up), wait for top of drill stroke read switch to trip, turn axis A some more....etc

I need a macro that waits for the switch to trip before it moves to the next line. Can anyone help me please.



Re: Drilling Machine Macro
« Reply #1 on: March 13, 2023, 07:50:32 AM »
SystemWaitFor
but what next....... a change to the active state.... of a pin.....

Offline TPS

*
  •  2,505 2,505
    • View Profile
Re: Drilling Machine Macro
« Reply #2 on: March 13, 2023, 01:37:55 PM »
so your G-code is looking like this:

G1 A10
M07
M09
G1 A20
.
.

M07 and M09 activate your Outputs for drill down/up

replace M07 and M09 for example by M400
so your G-Code will look like this

G1 A10
M400
G1 A20
.
.



now create a Macro M400.M1S in your profile folder C:\Mach3\macros\your profile name

Code: [Select]

'here activate the output for drill down
ActivateSignal(OUTPUT1)


'here we wait for an Input1 to go to high signal
While Not IsActive(Input1) 'drill down
  Sleep(10)
Wend

'here deactivate the output for drill down
DeactivateSignal(OUTPUT1)

'here we wait for an Input2 to go to high signal
While Not IsActive(Input2) 'drill up
  Sleep(10)
Wend


you have to replace Output1 and Input1/2 with the oenes you have declared in Port's&Pin's


« Last Edit: March 13, 2023, 01:41:17 PM by TPS »
anything is possible, just try to do it.
if you find some mistakes, in my bad bavarian english,they are yours.
Re: Drilling Machine Macro
« Reply #3 on: March 17, 2023, 01:44:19 PM »
Thank you Sir. I tried and tinkered and it works.
I ended up with while active rather than while not active.
It rattled round no problems.
Superb, thank you.