Hello Guest it is December 03, 2021, 03:25:35 PM

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - rayscott

Pages: 1
1
VB and the development of wizards / counting iterations of macro
« on: June 16, 2008, 02:22:36 PM »
Hello all,

I am running programs that need to load a part, do movements, other stuff, move...etc... unload part, .. restart.  For now, the operator watches the machine run for several hours as it loads and unloads from a magazine.  I don't have a "part in magazine" detector and just want to tell the program to run 16 cycles.  I am pretty good at writing macros.. How would I recall values of variables to count through 16 cycles?

Thank You,
Ray Scott

2
General Mach Discussion / gcode preprocess
« on: February 16, 2008, 11:44:57 PM »
When mach3 loads the new g-code file it preprocesses all the code.  This allows it to show the tool position and planned cutting path.  I do NOT want the tool path screen and plan to make my own screens with out it.  The preprocessing causes MACH3 to enact my custom macros.  This starts timers and all other types of trouble.

What can I do to stop the preprocessing from enacting my macros?

Ray Scott
ray@scottware.net

3
VB and the development of wizards / custom macro sequence in g code
« on: January 30, 2008, 12:14:36 AM »
Hello to all,

My machine is a specialized pneumatic punch press machine that is controlled by a touchscreen (MACH3) and a G100.  It is basically just two axis and plenty of IO.  I have the touch screen interface plus a few buttons.  The G100 is connected to an Opto22 IO rack for interfacing the 24VDC IO.  Relays, fusesAll my IO works great. 

I am using custom macros that I have written for my machine.  I am getting better at writing macros and beleive that all my macros seem to work fine when called from the "diagnostics" screen.  Some of my macros are simply activating a signal... other macros set signals, wait for specific signals and then change other signals.

The M900X macros are used to turn off the respective output.
The M5010 retracts a cylinder and confirms this with specific sensors.
The M5011 Extends the cylinder and confirms this with sensors.
The M5062 is a bit more complex. 

I have two main problems. 
(1) The macros seem to occur out of sequence.  In the program below, the macro M021 is suppose to happen after the code G0 X1.0Y-1.  The problem is that it happens at basically the same time or even the macro happens first .  I need the code to go in order as I wrote it.  I added some code inside one macro to immediately enact a feedhold.. change the signal... wait for the sensors... change signals.... wait for sensors... press start button.  The code still seems out of sequence.  Is there some way to ensure that the macro happens after the g/m-code motion is stopped ... and the next g/m-code doesn't start until after the m-code is done.

G0 X1Y1
M5011
G0 X4Y1

The idea here is that I want to go to a specific position, stop, engage a clamp, move the part.  I tried this without the feedhold and restart commands.. but the macro wanted to engage the output while moving.  I added code to feedhold, but it basically looks like it holds the first g command.  I added the code to check for ismoving, but the macro appears to run before the first g-command.

(2) The call to subroutine doesn't run as expected.  (M98 P400 L17)  I added a beep in the M5062 macro to hear how many times it gets called.  It sounds like it runs 17 times (as expected), but it looks like there are only 9 movements.  I think this is another situation of how the macro is not running in the same time process as the g-code.  The acc/dec may be getting blended.

I would appreciate any help that would be offered.

Thank You,

Ray

(FILENAME: PUNCHTEST_SKEL.NC)

(MACHINE IS BY DEFAULT IN ABSOLUTE MODE)
G90

(CANCEL CUTTER COMP)
G40

(ENABLE LIGHT CURTAIN BYPASS)
M1008
(OPTIONAL STOP)
M01
(REMOVE LIGHT CURTAIN BYPASS)
(M9008)

(GOTO HOME/WAIT POSITION)
G0X0Y0

(Macro - ENTEND SHEET FEEDER)
M5011

(RAPID TO FIRST CLAMP POSITION)
G0 X1.0Y-1

(Close Gripper)
M5021

(Remove Sheet from feeder)
G1 X5 F200

(Macro - Retract Sheet Feeder)
M5010

(Go to LINE 1 START POSITION)
G0 X20 Y-2
M5062
(Macro - Punch and Retract)
M98 P400 L17

(Go to LINE 2 START POSITION)
G0 X20.3415 Y-1.5
M5062
(Macro - Punch and Retract)
M98 P400 L17

(ENSURE BACK TO ABSOLUTE MODE)
G90

(GO HOME)
G0X0Y0

(RESTART AT FIRST LINE)
M47

(SUBROUTINE FOR INCREMENT AND PUNCH)
O400
(CHANGE TO INCREMENTAL MODE)
G91
(MOVE)
G0 X-0.25
(PUNCH)
M5062
(BACK TO ABSOLUTE MODE)
G90
(RETURN FROM SUB)
M99

(NOTE AS LAST LINE)



The following is cut-paste from my most complex macros.

SUB M5062()
REM Extend and retract the Punch Cylinders
REM Cylinders controlled by a three position valve with two solenoids. Center blocked.

RetractOutput = OUTPUT5
ExtendOutput = OUTPUT6
ExtendedInput = INPUT4
RetractedInput = INPUT3

ActivateSignal(ExtendOutput)
REM *Activates solenoid valve to extend punch cylinders

DO WHILE NOT (ISACTIVE(ExtendedInput) and NOT ISACTIVE(RetractedInput))
LOOP

DeactivateSignal(ExtendOutput)
ActivateSignal(RetractOutput)
REM *Activates solenoid to retract punch cylinders

DO WHILE NOT (ISACTIVE(RetractedInput) and NOT ISACTIVE(ExtendedInput))
LOOP

REM * Cylinders have enough pressure to hold up while valve is closed.
DeactivateSignal(RetractOutput)

BEEP
END SUB


SUB M5011()
REM Extend Sheet Feeder
REM This macro is used to extend a cylinder controlled by a two position valve .. one solenoid.

WHILE ISMOVING
   REM * DELAYS THE CODE UNTILL PRIOR MOVEMENT IS COMPLETED
WEND

REM - CALL FOR BUTTON - FEED HOLD
DOOEMBUTTON (1001)

ExtendOutput = OUTPUT1
ExtendedInput = INPUT2
RetractedInput = INPUT1

ActivateSignal(ExtendOutput)
REM *Activates solenoid to extend cylinder

DO WHILE NOT (ISACTIVE(ExtendedInput) and NOT ISACTIVE(RetractedInput))
LOOP
REM *Meeting the desired senor states allows the macro to finish

DOOEMBUTTON (1000)
END SUB

Pages: 1