Hello Guest it is October 21, 2019, 01:42:57 AM

Author Topic: G code help  (Read 5318 times)

0 Members and 1 Guest are viewing this topic.

G code help
« on: May 20, 2010, 02:19:35 AM »


Hi all-

First I want to say that I know ZERO about G-code.  This is my first cnc project, so I am learning as I go.

I am using sheetcam, and this does just about everything I need, but I am wanting to make it better.

I have a cnc oxygen/ propane cutter nad here is what I am wanting to do

Here is the order of events
>
> 1. torch moves to cut position
> 2. z axis moves down to find the plate---at speed 75ipm G31 Z-75
   3. Z axis resets zero + needed offset G92 Z-.15
> 4. z axis moves UP to .140
> 5. output #2 turns on (this turns oxy/propane on)
 6. wait .1 or .2 seconds (this allows propane to get to torch)
7. turn on output #3 for  .2 seconds ( this turns on electronic torch igniter
>
> continue with the existing post processor
>
> 8. when cut is finished, raise Z axis to safe height and turn off
> output 2 (this turns off the solenoids for the pre heat oxygen and
> propane)
>
> 9 continue to the next cut cycle


so my main questions are

1.  how do I turn output #2 and 3 on and off
2.  How would I create a timer/ delay

Les with sheetcam is helping me create a POST that will do all the functions that I need, I just have to develope the g-code that I need


thanks for the help


Steve



Offline ger21

*
  • *
  •  6,288 6,288
    • View Profile
    • The CNC Woodworker
Re: G code help
« Reply #1 on: May 20, 2010, 07:46:27 PM »
You'll either need to write some M code macros to turn the outputs on, or, maybe you can use the coolant codes, M7 and M8 to do what you want. Assign them to your outputs in Ports and Pins, spindle tab I think.
Gerry

2010 Screenset
http://www.thecncwoodworker.com/2010.html

JointCAM Dovetail and Box Joint software
http://www.g-forcecnc.com/jointcam.html

Offline BR549

*
  •  6,902 6,902
    • View Profile
Re: G code help
« Reply #2 on: May 20, 2010, 10:23:23 PM »
I would use the existing m3 to turn on the torch and the M5 to turn OFF the torch. This will keep it simple AND allow you to simply modify the M3/M5 macros.

The delays can be setup in the M3 macro code it would be something like:

ActivateSignal(2)
Sleep(200)
ActivateSignal(3)
Sleep(200)
Deactivatesignal(3)

Let LESS at SCam know to  basically use the same post as the MP3000 plasma unit. It uses the G31 to find the top of material and turns on the torch with M3 and OFF with M5

Then modify your M3 and M5 as above.

When you get to that point lets us know if you need help.

Hope that helps
Re: G code help
« Reply #3 on: May 21, 2010, 01:29:25 AM »
Ger21 and BR549-

I started playing with the Macros, and I could get everything to work when I used 4 macros.

I used m801, 802, 901, 902.  I chose these numbers because I could test different codes, and still have my cutter running using M03 and M05.

Once I get everything figures out, then I will edit M03 and Mo5


ok Now for the problems

When I used simple 1 line commands everything works great
ActivateSignal (output2)

When I statrted doing multiple tasks is when I started having problems

code ("G31 z-100")
code ("g92 z-.08")
sleep (100)
ActivateSignal (output2)
sleep (100)
ActivateSignal (output3)
sleep (100)
deactivateSignal (output3)


the problem is that the solenoids turn on before the z axis reaches the correct height

I tried to use --

While IsMoving()

Sleep (100)

wend


but this command locked up the computer.  Is there something that is supposed to be inside the () like a 1 or 0?



Thanks for the help


Steve

Offline BR549

*
  •  6,902 6,902
    • View Profile
Re: G code help
« Reply #4 on: May 21, 2010, 09:30:22 AM »
HI Steve,

When I statrted doing multiple tasks is when I started having problems

code ("G31 z-100")
code ("g92 z-.08")
sleep (100)
ActivateSignal (output2)
sleep (100)
ActivateSignal (output3)
sleep (100)
deactivateSignal (output3)




FIRST we need to clean up your code a bit. You do not use the () around the code statement it will cancell the statement.

Next we need to add in the wait while moving states to allow mach time to get to position.

code "G31 z-100"
While IsMoving()
Sleep(1000)
Wend
code "g92 z-.08"
Sleep (200)
ActivateSignal (output2)
Sleep (100)
ActivateSignal (output3)
Sleep (100)
DeactivateSignal (output3)


Re: G code help
« Reply #5 on: May 22, 2010, 09:08:24 AM »
Br549-

Thanks for setting me straight.  I used your version of the G-code and everything is now working great. 

Les Sent me a modified POST program, now I can run a program without editing all the code.

Thanks for the help


Steve

Offline BR549

*
  •  6,902 6,902
    • View Profile
Re: G code help
« Reply #6 on: May 22, 2010, 03:45:29 PM »
Glad you got it working, now go burn some plate. (;-)