On Saturday 12 December 2020 09:12:47 Matthew Herd wrote:

> Hi All,
>
> I’m sure there’s a simple answer for my question, but I haven’t been
> able to figure it out.  Currently the configuration for the spindle
> forward and reverse outputs is as follows:
>
> # connect spindle fwd/rev to I/O controller
> net SpindleFwd <= ppmc.2.dout.00.out
> net SpindleFwd => spindle.0.forward
> net SpindleRev <= ppmc.2.dout.01.out
> net SpindleRev => spindle.0.reverse
>
> 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?  Don’t I need some additional logic?  The goal is
> to have logic like so:
>
> 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
> }
>
> As you can see, the only change is that I’m swapping which output is
> assigned to spindle.0.forward and spindle.0.reverse.
>
Hal doesn't have an IF/ELSE/ENDIF function that I know of. So you'll have 
to use a pair of mux2's to steer the signal according to the status 
of "backgear", easy enough to do. Drive the mux2's sel pin 
with "backgear", but interchange the inputs of the two modules. The 
biggest problem is speed as the update is limited by servo loop, 
generally 1 kilohertz, timing, so you can't steer a 10 kilohertz 
pwmgen's output that way. Even a 100 hz pwm would become badly damaged 
by that sort of a switch.

I'm not well versed in all the machines ever made, but I've never heard 
of a backgear, or spindle gearshift that reversed the spindles direction 
of rotation.  Not saying that is impossible but it sure seems odd.

> Thanks,
> Matt

Cheers, Gene Heskett
-- 
"There are four boxes to be used in defense of liberty:
 soap, ballot, jury, and ammo. Please use in that order."
-Ed Howdershelt (Author)
If we desire respect for the law, we must first make the law respectable.
 - Louis D. Brandeis
Genes Web page <http://geneslinuxbox.net:6309/gene>


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

Reply via email to