PLUS+1 User Forum

PLUS+1 Hardware => Controllers => Topic started by: Mike AA on August 04, 2016, 08:57:20 PM

Title: Quadrature Direction
Post by: Mike AA on August 04, 2016, 08:57:20 PM
I have been working with just speed pickup and now need to get direction the hydraulic motors are spinning. I can get the 1 and -1 on quad count and I can get the speed from freq. What is the best practice to combine these values for direction at speed?

I am using an MC024-020 pins C2P1, C2P2 for my speed quadrature speed sensor.

Thanks,
Mike
Title: Re: Quadrature Direction
Post by: jashom1 on August 05, 2016, 06:57:14 AM
Hi Mike,

I'd look at the quad count and if it's negative, I would just multiply the speed by -1.

Is this what you were thinking?

Cheers,

John.

(http://)
Title: Re: Quadrature Direction
Post by: Mike AA on August 08, 2016, 06:08:21 PM
John,

That is exactly what I was thinking just wasn't sure if that was reliable. I was using a signal generator but my sign kept going 0 -1 0 -1 so likely an issue with the generator not my code.

Thanks!
Mike
Title: Re: Quadrature Direction
Post by: Mike AA on August 12, 2016, 04:35:07 PM
I got this program loaded into the controller on the test bed and my quadcount value was jumping -1 to 0 to -1 etc. The sprocket, a 60 tooth sprocket is running one direction continuously getting these values. I haven't used the direction before so I was wondering if this is normal or if it should stay -1 steady while in one direction and 1 steady the other direction? Obviously if I have my feedback to multiply by the quadcount if it is 0 it would cause my PID loop to falter, which I am already having issues tuning.
Title: Re: Quadrature Direction
Post by: FluidPowerTom on August 12, 2016, 05:19:30 PM
Quad count is the number of measured counts this loop.  When you see 0 that means that the processor has completed a cycle without seeing a pulse - which is entirely possible.  I seem to recall that it's fairly easy to determine the average cycle time for the processor running your program, and if that time is shorter than the period of pulses from your sensor then there will be cycles that don't see a pulse.  I wouldn't be too worried about it.

I'd recommend some logic that ignores a 0 quadcount unless it's like that for a certain amount of time.  I'm envisioning an On Delay Timer and probably some Value Connect components.  It could also be accomplished fairly easily in Structured Text.