On Sat, 12 Dec 2020 at 14:15, Matthew Herd <herd.m...@gmail.com> wrote:

> I would like to selectively reverse direction depending on whether a backgear 
> input switch is triggered.  I see there is a gearchange component but I’m not 
> clear on how to utilize it.  Does the gearchange component translate to the 
> pin assignments for spindle.0.forward and spindle.0.reverse?

No, it handles the ratio change, so that the correct motor speed is
sent to the drive for the selected spindle speed.

> if (backgear == TRUE) {
>         net SpindleFwd <= ppmc.2.dout.00.out
>         net SpindleFwd => spindle.0.forward
>         net SpindleRev <= ppmc.2.dout.01.out
>         net SpindleRev => spindle.0.reverse
> } else {
>         net SpindleFwd <= ppmc.2.dout.01.out
>         net SpindleFwd => spindle.0.forward
>         net SpindleRev <= ppmc.2.dout.00.out
>         net SpindleRev => spindle.0.reverse
> }

One way is with a pair of bitwise mux components.
http://linuxcnc.org/docs/2.8/html/man/man9/mux_generic.9.html

loadrt mux_generic config="bb2,bb2"
...
addf mux-gen.00 servo-thread
addf mux-gen.01 servo-thread
...
net backgear => mux-gen.00.sel-bit-00    mux-gen.01.sel-bit-00
net SpindleFwdCmd spindle.0.forward => mux-gen.00.in-bit-00
mux-gen.01.in-bit-01
net SpindleRevCmd spindle.0.reverse => mux-gen.01.in-bit-00
mux-gen.00.in-bit-01
net SpindleFwdPin => mux-gen.00.out-bit => ppmc.2.dout.00.out
net SpindleRevPin => mux-gen.00.out-bit => ppmc.2.dout.01.out


-- 
atp
"A motorcycle is a bicycle with a pandemonium attachment and is
designed for the especial use of mechanical geniuses, daredevils and
lunatics."
— George Fitch, Atlanta Constitution Newspaper, 1912


_______________________________________________
Emc-users mailing list
Emc-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/emc-users

Reply via email to