Converting CNC Stepper router with handheld DSP Controller (Richauto A11) PART2

More
12 Jan 2019 17:57 #124037 by geertd
After a break, I decided to continue with the idea of controlling my CNC Router with LinuxCNC. As I explained in my previous topic, this router currently has a handheld controller. I would like to be able to switch from this handheld to LinuxCNC and back.

I decided for now to go for a parallel port connection and a breakout cable, but I am having questions on the spindle speed control. The current controller board uses 3 input lines to select between 8 possible spindle speeds. Those 8 speeds are configured within the VFD that drives the spindle.

The linuxCNC manual explains Spindle speed control for PWM or 0-10V. My VFD can handle those, but the current CNC controller can't. It basically reads 3 input lines, and according to those inputs, selects one of the 8 speeds programmed in the VFD.

Is there a way to configure linuxCNC for this kind of speed control ?

Geert
More
12 Jan 2019 21:50 #124048 by rodw
Yes, mux8 outputs a binary signal (0-7) on 3 outputs which is what you want by the sound of it.
I posted an example for axis selection on this thread
forum.linuxcnc.org/39-pncconf/35827-7i76...with-pncconf?start=0
select8 might also be required as per the example.
More
12 Jan 2019 22:12 #124053 by rodw
Actually, I might be off the mark there. Mux8 decodes three inputs and you want 3 outputs.
You may be able to define an 8 step graph using lincurve but converting to the outputs might be convoluted so a custom component might be the go. Eg. Take a float (from a slider) as input and output your 3 pin bitmap based on a series of cutoff values.
More
13 Jan 2019 01:25 #124058 by PCW
You can do this with the "bitslice" component (on a scaled/converted RPM value)
More
14 Jan 2019 09:33 #124148 by geertd
Thanks for both replies.
Being new to LinuxCNC and HAL, and from what I could read in the documentation, I should probably prepare a HAL TCL file (TCL because I need calculations and conditionals) where I read the required RPM value (motion.spindle-speed-out-abs), calculate and assign this RPM value to one of 8 preset speeds, and with bitslice set the 3 output bits according to the resulting speed. And then include this HAL TCL file in the ini file of my machine. Would that be the right way to go ?
And should I then, in the HAL file generated by the stepconf wizard, comment-out the lines related to PWM and RPM ?
More
15 Jan 2019 16:16 #124239 by andypugh
No need for TCL. You just need to scale the spindle speed to a number between 0 and 7 ( linuxcnc.org/docs/2.7/html/man/man9/scale.9.html ) then convert from float to int ( linuxcnc.org/docs/2.7/html/man/man9/conv_float_u32.9.html ) then connect that int to bitslice ( linuxcnc.org/docs/2.7/html/man/man9/bitslice.9.html )
The following user(s) said Thank You: geertd
More
15 Jan 2019 16:20 #124240 by andypugh
To further explain... As far as I know HAL Tcl expressions are only evaluated at load-time. It can be used to make context-sensitive configuration choices, but isn't a way to perform real-time calculations.

If you do want to write code that runs in realtime then making a custom HAL component is the way.
linuxcnc.org/docs/2.7/html/hal/comp.html

You might want to do it this way, as the combination of scale and type conversion doesn't necessarily do what you want. (I imagine that you have a non-zero speed programmed for the 000 pattern?)
The following user(s) said Thank You: geertd
More
15 Jan 2019 23:06 #124273 by geertd
Actually, the controller board uses 4 inputs for spindle control: one is to start/stop the spindle and the other 3 are for selecting one of the the 8 speeds. The speeds themselves are defined by setting the parameters in the VFD. So I suppose the speed for the '000' pattern would be the lowest (non-zero) of the 8 possible speeds.

I will try your suggestion of scaling the speed. Do you know if the converter from float to int just chops off the decimal part of the float ? (e.g., 0.9 float converts to 0 int ?)
More
15 Jan 2019 23:35 #124275 by rodw
I'm not sure about the convert function and if it rounds or not but if it doesn't, using the sum2 component to add 0.5 to the value will solve the problem. (Usually I can check the cource but it seems these convert components are created by a macro which I don't understand except if that is the case, I suspect the result will be truncated not rounded which is the usual case with type conversion.)
The following user(s) said Thank You: geertd
Moderators: cncbasher
Time to create page: 0.117 seconds
Powered by Kunena Forum