calling subroutines

More
11 Mar 2023 11:47 #266397 by tommylight
Replied by tommylight on topic calling subroutines
From what i can gather, OP wants to open Axis GUI (example) and have VCP pannel with several buttons for several shapes he uses mostly.
Is that it?

Please Log in or Create an account to join the conversation.

More
11 Mar 2023 14:05 #266403 by spumco
Replied by spumco on topic calling subroutines
Tommy, I think the problem is the OP has seen something work but doesnt understand a whole lot about CNC.

And I suspect I just figured out why hes going on about subroutines instead of just having a macro button for each shape he wants to cut:

They all have to come from the same block of foam, so the subsequent shapes need to be referenced from the original/one. They cant be stand-alone programs as the shapes need, basically, to nest.

And the subroutine mess hes describing sounds like a workaround when you cant just CAM up a whole complicated program in one go.  

its also complicated by the fact that the machine likely has non-trivial kinematics and what sounds like some wierd motor configurations (2-axs vs 4-axis mode?)

Please Log in or Create an account to join the conversation.

More
11 Mar 2023 14:45 #266406 by foam man
Replied by foam man on topic calling subroutines
hi picture 2 extruded aluminum rails with grooves running about 30" above the floor, one is x axis the other z
on these horizontal rails, using the grooves to guide, are plastic wheels connected to the vertical axis, y and a.
so x and z run parallel on the horizontal guides
y and a run parallel on the vertical guides

exact same concept as frogwire, except the rails are screwed to the floor and you can make your own bed or work off the floor.
i glued pieces of foam to the floor and cut them parallel to the floor with the wire
this is my work bed

sorry I couldn't paste pictures in here
thanks

Please Log in or Create an account to join the conversation.

More
11 Mar 2023 15:54 #266411 by spumco
Replied by spumco on topic calling subroutines
OP - can you post your LinuxCNC configuration files please?  You'll need to re-name them from "something.hal" & "something.ini" to "somethinghal.txt" and "somethingini.txt" to be able to attach them in this forum.

Just make a copy of the files in some other folder (like /Downloads), rename them, and then attach them to a forum reply.

If you need help finding them let us know.

Please Log in or Create an account to join the conversation.

More
11 Mar 2023 16:26 #266413 by foam man
Replied by foam man on topic calling subroutines
 

File Attachment:

File Name: foam_cutter.hal.txt
File Size:4 KB
 

File Attachment:

File Name: foam_cutter.txt.ini
File Size:2 KB
Attachments:

Please Log in or Create an account to join the conversation.

More
11 Mar 2023 16:30 #266414 by foam man
Replied by foam man on topic calling subroutines
 

File Attachment:

File Name: Slabber.hal.txt
File Size:4 KB

 

File Attachment:

File Name: Slabber.txt.ini
File Size:2 KB


the foam cutter files are for 4 axis mode
the slabber files are for 2 axis mode

I have a rough idea, but my knowledge  is very limited on whats going on in these files
Attachments:

Please Log in or Create an account to join the conversation.

More
11 Mar 2023 16:37 #266416 by foam man
Replied by foam man on topic calling subroutines
the main reason that I was trying to fix 2 axis mode before is because it's a lot easier to write code for circles, and I guess code in general. also jogging the axis, i have to use 4 buttons v 2

Please Log in or Create an account to join the conversation.

More
11 Mar 2023 17:34 #266417 by spumco
Replied by spumco on topic calling subroutines
Ok, before we get to actually programming and - maybe - subroutines, I think you need to get some background and context on your machine.

I'd suggest you read a bunch in the LinuxCNC (LCNC from now on) online manual, but I suspect you'd get lost without a bit of a primer on what's going on behind the scenes.  Once you've read this and had a think, then you can go poke around in the manual.

Your machine is set up as two different 'machines'.  Without seeing it, I'd guess you have two shortcuts on the desktop - one labeled 'foam_cutter' and one labeled "Slabber".

When you select foam_cutter, LCNC reads the foam_cutter.ini file which tells LCNC how to configure everything.  How many axes you have, what the display should look like, how fast to move, how many motor steps equals an inch - that sort of thing.  Same-same for Slabber.ini.

The HAL file is where the software connects to hardware.  If LCNC wants to output a step to a motor, the HAL file is where LCNC is told "use this physical output pin to send step pulses to a motor."

In your case, when you run foam_cutter, all four motors are controled independently.  You tell LCNC (via G-code) to move the X axis, and it sends a signal to the X motor. Same for the other three axes.  This is the "4-axis mode" you've mentioned.

When you run Slabber, the X and Y signals from LCNC are also connected to the Z and A motors. X to Z, Y to A.  So an X-axis command will result in BOTH the X and Z motors moving the same amount.

This double connection is done in the slabber.hal file.  That's really the only difference between foam_cutter.hal and slabber.hal.

With me so far?

The strange thing I found is that the step scale between the two INI files is different.  Step scale is how LCNC knows how many pulses to the motors equals a unit of movement (an inch in your case). 

Example: If the motor has 200 steps per rev, and your leadscrew has 20 turns per inch, LCNC needs to know to send 4000 pulses (200*20) to move the axis an inch.  That value - pulses per inch - is set in the INI file.  The section in the INI file controlling this value looks like this:
[AXIS_0]    
TYPE = LINEAR
HOME = 0.0
MAX_VELOCITY = 25.0
MAX_ACCELERATION = 25
STEPGEN_MAXACCEL = 25
[color=#c0392b]SCALE = 249.4678[/color]
FERROR = 0.05
MIN_FERROR = 999
MIN_LIMIT = -999
MAX_LIMIT = 999
HOME_OFFSET = 0.0

If you look at your INI file(s) you can see that all four motors have very similar SCALE settings.  This is to be expected if they all have the same leadscrew pitch - very slight differences in the screws require very slight differences in the SCALE setting.

What's strange is that comparing the foam_cutter.ini SCALE to the Slabber.ini SCALE shows the scale is different between the two.  This makes no sense to me; the motors and leadscrews don't change between the two 'modes', so why change the SCALE when switching between different modes?

The result will be that when you program an axis to move an inch, the axes will move different amounts depending on which 'mode' you've started.  As I said, strange.

If the above sort of makes sense, we can keep going and try to get your machine set up so it moves properly in both 2-axis and 4-axis mode.
 

Please Log in or Create an account to join the conversation.

More
11 Mar 2023 19:11 #266426 by foam man
Replied by foam man on topic calling subroutines
hi thanks for your help
all you said above I know the basics about
the layout is exactly how you described it
the reason the numbers are different from foamcutterini to slabberini is because the last time I calibrated the scale# I did it in foamcutterini.
what I would normally do is copy&paste the numbers into slabberini
the reason I didn't is because I'm waiting for the guy thats selling this cutter to come back with something where Z&A will use their own SCALE#
so I'm not using SALBBER unless I'm cutting shapes where accuracy doesn't matter
I've tried to look at and kind of figure out what the section below means but it's a little out of my range of understanding. I've actually only been doing cnc for a year, so am still very green at this programming.

net xstep => parport.0.pin-02-out
setp parport.0.pin-02-out-reset 1

net xdir => parport.0.pin-03-out
net ystep => parport.0.pin-04-out
setp parport.0.pin-04-out-reset 1
net ydir => parport.0.pin-05-out
net zstep => parport.0.pin-06-out
setp parport.0.pin-06-out-reset 1

net zdir => parport.0.pin-07-out
net astep => parport.0.pin-08-out
setp parport.0.pin-08-out-reset 1
net adir => parport.0.pin-09-out
net spindle-cw => parport.0.pin-14-out
net spindle-pwm => parport.0.pin-16-out
net xenable => parport.0.pin-17-out

Please Log in or Create an account to join the conversation.

More
11 Mar 2023 21:01 #266431 by spumco
Replied by spumco on topic calling subroutines
Z&A use their own scale regardless of which hal file is being used - that's set in the INI files.

I'd suggest pasting the foam_cutter SCALE values in to the Slabber INI file and see if that helps with accuracy when using the 2-axis Slabber config.

Regarding the HAL file snip you posted... take the first couple of lines:

net xstep => parport.0.pin-02-out

"net" just means "connect this signal to the following pins"
"xstep" is the name of the signal
"parport.0.pin-02-out" is a physical parallel port pin

So, in English: "connect parallel port pin #2 to some other pin using the signal named xstep"

In your case, if you scroll further down in the file, you see:
net xstep <= stepgen.0.step

And this is the other end of the connection.  Taken together, they mean:

"connect pulses from stepgen.0.step to parallel port pin #2 using signal xstep"

Simplified, that's how LCNC outputs a signal to the motor driver - the 'stepgen' is the software inside LCNC that makes regular, high-speed pulses for the stepper motor.

If it helps, you can think of signals as wires instead of random-sounding names.  So the above could be read like this:
"connect pulses from stepgen.0.step to parallel port pin #2 using the green wire"

And the trick with your Slabber HAL file is that the author used the same scheme to connect the x-axis stepgen to both X&Z motors:
net xstep <= stepgen.0.step
net xstep => parport.0.pin-02-out

net xstep => parport.0.pin-06-out
"connect pulses from stepgen.0.step to parallel port pin #2 AND pin #6 using the green wire"
 
The following user(s) said Thank You: foam man

Please Log in or Create an account to join the conversation.

Time to create page: 0.389 seconds
Powered by Kunena Forum