Another "what do I need" thread. Vmc retrofit

More
04 Mar 2015 07:20 #56446 by thewho
I think that I have all the parts for this retrofit now (probably not tho)
So I got linuxcnc installed but I'm a bit unsure on what to do now. I bought the 5i25+7i77 kit, do I need to flash the 5i25 card?
And if yes, is there any quick guide for that?

I feel that this would have been much easier if emcPT's wiki was finished ;)

There is no step by step guide for this am I right?

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

More
04 Mar 2015 07:26 #56447 by PCW
You should not need to flash the 5i25 card if it was ordered with the 7I77

The 5i25 manual has instructions on how to flash the 5I25 card should this
be needed

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

More
04 Mar 2015 15:25 #56458 by emcPT
Working on it. We are now on the phase of wiring the 7i77, but we had some waiting time because we were expecting cables and we are making some mechanic work so that the axis can move ...

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

More
05 Mar 2015 03:33 #56477 by emcPT

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

More
05 Mar 2015 16:13 #56496 by thewho
Any reason why you are using a external 5V supply?

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

More
05 Mar 2015 21:14 #56503 by emcPT

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

More
19 Apr 2015 02:47 #57882 by thewho
Yay, finally got it running! :laugh:


Now to the questions..
1. Can I change max velocity and acceleration from within Linuxcnc? If yes, how? I've been closing linuxcnc and changing in the ini file.
2. Do I have to use .hal files to control my atc? If yes, is there any "Children's guide to HAL files"? I'm not joking, I've been reading about them and have absolutely no clue how they work.
I've done some Arduino programming but I have a hard time to write a "advanced" program from scratch. So I usually find an example or similar and then work from that.

For example: I have a hydraulic pump that releases the tool from the spindle and I would like to bind an output on the 7i77 to a key on the keyboard. It's important (for obvious reasons) that the key wont work when the spindle is enabled.
How do I do that?

It's probably really easy for you guys that have done it before.
Despite that the Mesa cards and Pncconf are quite hard to learn it's quite easy now when i've got it running :laugh:

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

More
20 Apr 2015 01:32 #57902 by andypugh

1. Can I change max velocity and acceleration from within Linuxcnc? If yes, how? I've been closing linuxcnc and changing in the ini file.

I think that is the only way to do it, as the accel and velocity limits are only read once at startup.

You can change the PID settings with the Machine->Calibrate option in Axis. But your machine looks pretty well tuned to me.

2. Do I have to use .hal files to control my atc? If yes, is there any "Children's guide to HAL files"? I'm not joking, I've been reading about them and have absolutely no clue how they work.
I've done some Arduino programming but I have a hard time to write a "advanced" program from scratch. So I usually find an example or similar and then work from that.


There are two different things here. Whatever system you use to operate the ATC will need to interact with HAL, but it is unlikely that you will be able to run a complete ATC with just standard HAL modules.
You string together standard HAL modules in the HAL file:
www.linuxcnc.org/docs/2.7/html/hal/intro.html
I think it is possible to do almost anything with standard HAL components, but it eventually becomes very unwieldy and hard to follow. So sometimes it makes sense to create a custom HAL component.
If you have written code for Arduino then you should be able to write a custom HAL component using comp / halcompile (The compiler changed names between LinuxCNC 2.6 and 2.7).

For example: I have a hydraulic pump that releases the tool from the spindle and I would like to bind an output on the 7i77 to a key on the keyboard. It's important (for obvious reasons) that the key wont work when the spindle is enabled.


I made a custom HAL component to interlock my spindle. Perhaps is makes a good example. You can see that the main code is a "state machine" and that is the normal way to code any sort of sequence-based action in a HAL component.
component spindle_interlock """Prevents tool or chuck release when the spindle is 
running""";

pin in signed encoder-counts "connect this to the spindle encoder";
param rw unsigned encoder-vel = 1 """how many counts per sec to accept as
spindle-stopped""";

pin in float spindle-speed-in """Pass-through the spindle speed request only if
the release is not activated""";
pin out float spindle-speed-out;

pin out bit release-allowed "For operating an indicator lamp, for example";
pin in bit release-request "The release request from the button/pedal";
pin out bit release-out "the release signal to the valve";
pin in bit release-state = 1 """This bit sets the value that is passed to
"release-out". Toggle it to 0 or 1 to suit internal or external gripping,
for example""";

function _;

license "GPL";
author "Andy Pugh";

pin out float vel;
pin out unsigned st;
pin out float timer;

;;

FUNCTION(_){
    //static int st = 0;
    static int last_counts;
    static double last_timer;
    //static double timer;
    //double vel;
    
    timer += fperiod;
    if (last_counts != encoder_counts){
        vel = abs(last_counts - encoder_counts) / timer;
        last_timer = timer;
        last_counts = encoder_counts;
        timer = 0;
    }
    else
    {
        vel = 1/(last_timer + timer);
    }
    
    switch (st){
        case 0: // spindle stopped, release allowed
            if (vel > encoder_vel) {
                st = 1; 
                break;
            }
            if (release_request){
                st = 2;
                break;
            }
            release_out = ! release_state;
            spindle_speed_out = spindle_speed_in;
            release_allowed = 1;
            break;
        case 1: // spindle moving
            // This state deliberately never changes the release-out pin
            if (vel <= encoder_vel){
                st = 0;
                break;
            }
            spindle_speed_out = spindle_speed_in;
            release_allowed = 0;
            break;
        case 2: // spindle released
            if (! release_request ) {
                release_out = ! release_state;
                st = 0;
                break;
            }
            release_out = release_state;
            spindle_speed_out = 0;
    }
}

A;ternatives to custom HAL components for ATC control are a G-code subroutine, or using Classic Ladder. Or any combination of all three.

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

More
20 Apr 2015 03:24 #57909 by thewho
Thanks for trying Andy but I really have no clue whats going on in your hal-file :( I kind of understand from where you define the variables but the first part is a mystery to me..
I feel like I'd have no problems to get the atc going on a arduino but I still need the spindle to stop in the correct position and Z to move up and down. And of course somehow tell the arduino what tool to change to.

I have not tuned any axis yet so "P" is 1 and the rest 0. But I think I know how to do that now. :P
I was going to do that today but I ended up going through the spindle head instead. The low gear was not working and I was hoping to fix that but something is really broken in that clutch so I couldn't fix it sadly.
Found out there is a 1024 line TTL encoder on the spindle tho :laugh: Just have to figure out what pin is what and connect it.

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

More
20 Apr 2015 03:34 - 20 Apr 2015 03:35 #57911 by andypugh

Thanks for trying Andy but I really have no clue whats going on in your hal-file.


Well, the first problem is that it _isn't_ a HAL file...

You should read the HAL introduction document I linked to, and have a look at your existing HAL file for the machine, it should all make sense eventually.

The file I posted is a special sort of C-file, rather like an Arduino sketch. It is written for "comp" so it is two sections, one that defines HAL pins, and documents them. Then there is a bit of C-code that defines the logic of how the pin values interact with each other.

The first thing you need to get the hang of is what a HAL pin is and how they get linked together with HAL signals.

But, your ATC almost certainly wont be controlled by a HAL file alone.

(Oh, and don't bother trying to use an Arduino for the ATC, HAL / LinuxCNC can do absolutely anything that the Arduino can do, and you can watch it doing it with the HAL tools, which will make debugging easier)
Last edit: 20 Apr 2015 03:35 by andypugh.

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

Moderators: PCWjmelson
Time to create page: 0.210 seconds
Powered by Kunena Forum