Spindle soft start delay

More
21 Aug 2017 23:32 #97841 by justinj
justinj created the topic: Spindle soft start delay
For some reason my machine refuses to now get through POST with it's 2nd parallel port PCI card installed so I can no longer use the spindle at speed input on it (Card works fine in another machine so it's not the card). I've never done anything with HAL, and have used stepconf to generate the config files which was fine up until now. I know the ramp up and down time settings in the VFD so I'd like to fake the spindle speed and at speed settings in EMC.
I've tried putting the example in the docs ( linuxcnc.org/docs/html/examples/spindle....#_spindle_soft_start ) into my custom.hal but I get the following error:
./custom.hal:14: Pin 'motion.spindle-speed-out' was already linked to signal 'spindle-cmd-rpm'
I'm sure it's probably incredibly easy to someone who has done this before, but I can't make heads or tails of it and have spent ages playing with the custom.hal and stepconf generated .hal. Can anyone help me?
More
22 Aug 2017 20:12 #97899 by andypugh
andypugh replied the topic: Spindle soft start delay
It is very simple, probably.

In line 14 of your custom.hal file change the signal name to be the already-defined "spindle-cmd-rpm" and that will already have the value of "motion.spindle-speed-out" in it.
More
23 Aug 2017 02:59 #97903 by justinj
justinj replied the topic: Spindle soft start delay
Unfortunately not that simple. I had tried changing that already (I have a programming background in other languages so I tried to use that to debug) but then I get an error
./custom.hal:14: Pin 'spindle-cmd-rpm' does not exist
I tried copying that code to the main .hal file, thinking perhaps the signals didn't carry between the files but get the same error. I made sure I put the code after the line (and tried before just in case HAL acts differently) that had declared the spindle-cmd-rpm signal.
The signal is definitely declared in the main HAL file:
29: net spindle-cmd-rpm => pwmgen.0.value
More
23 Aug 2017 03:28 #97904 by justinj
justinj replied the topic: Spindle soft start delay
I think I may have been changing line 14 wrong as the error indicates a pin that doesn't exist. I changed the line to:
net spindle-cmd-rpm => spindle-ramp.in
but now I get an error
./custom.hal:17: Pin 'scale.0.in' does not exist
. I don't see anywhere else calling a signal or pin scale.0.in either so I'm not sure how that figure comes to be in the example.
More
23 Aug 2017 03:41 #97905 by rodw
rodw replied the topic: Spindle soft start delay
I think you are missing the loadrt and addf commands listed further up the page here
linuxcnc.org/docs/html/examples/spindle...._0_10v_spindle_speed
The following user(s) said Thank You: justinj
More
23 Aug 2017 04:00 #97906 by justinj
justinj replied the topic: Spindle soft start delay
Indeed I am :whistle:
I had read through that area, but assumed that part was already handled by stepconf so skipped it. I'm getting a pwmgen.ko file exists error when I add that, so I'm guessing I need to manually do the spindle part instead of stepconf. I'll give it a try later tonight when I get another chance! Thanks :)
The following user(s) said Thank You: rodw
More
23 Aug 2017 12:16 #97913 by andypugh
andypugh replied the topic: Spindle soft start delay

justinj wrote: Unfortunately not that simple. I had tried changing that already (I have a programming background in other languages so I tried to use that to debug)

It might help to not think of HAL as a programming language. Or, if you must, then it is most like LabView or Simulink. You are defining data paths.

but then I get an error

./custom.hal:14: Pin 'spindle-cmd-rpm' does not exist


The format of a "net" command is "net signal pin [pin ....]"
The first string after the "net" is the signal name. You appear to have put the "spindle-cmd-rpm" signal in a pin "slot"

You can't allocate a signal to a different name, you can't even copy the value of one signal to another (well, not without using a unit-gain scale or similar).
More
23 Aug 2017 12:32 - 23 Aug 2017 12:33 #97917 by justinj
justinj replied the topic: Spindle soft start delay

andypugh wrote:

andypugh wrote:

justinj wrote: Unfortunately not that simple. I had tried changing that already (I have a programming background in other languages so I tried to use that to debug)

It might help to not think of HAL as a programming language. Or, if you must, then it is most like LabView or Simulink. You are defining data paths by defining a net-list.

but then I get an error

./custom.hal:14: Pin 'spindle-cmd-rpm' does not exist


The format of a "net" command is "net signal pin [pin ....]"
The first string after the "net" is the signal name. You appear to have put the "spindle-cmd-rpm" signal in a pin "slot"

You can't allocate a signal to a different name, you can't even copy the value of one signal to another (well, not without using a unit-gain scale or similar).


That makes a bit more sense, but I still have no idea how the ramping etc. is working when there are no variables (That I can see)

I've tried all sorts of combinations with the part I missed and am still getting errors. Can anyone have a quick look and see what I'm missing? paste.ubuntu.com/25376124 & paste.ubuntu.com/25376128
Last Edit: 23 Aug 2017 12:33 by justinj.
More
30 Aug 2017 12:34 #98198 by andypugh
andypugh replied the topic: Spindle soft start delay
You appear to be referencing scale.0 and connecting something to the "in" pin.
But I don't see anything connected to the out. (though that would be normal if it was to be connected to a GUI element, as the GUI isn't loaded when the normal HAL files are parsed. The GUIs themselves load a POSTGUI_HALFILE typically)

More importantly I don't see the scale function being loaded or added to a thread.

loadrt scale count=1
addf scale.0 servo-thread
Time to create page: 0.101 seconds
Powered by Kunena Forum