PDA

View Full Version : Anyone want me to leave the dual quadrature encoder driver in the OBEX?



Kye
11-07-2010, 10:45 PM
I made this object some time ago:

http://obex.parallax.com/objects/544/

However, I made a much better version of the driver which can do PID control also:

http://obex.parallax.com/objects/673/

While the dual version can do two encoders at once, I and other people have said that they have problems with it. I don't feel like maintaining it anymore as I no longer need it for anything so I'm thinking about taking it down from the OBEX. I am trying not to add clutter to the website.

Any replies on this would/ be great. Thanks,

lardom
12-27-2010, 04:10 PM
Kye, Thanks for your contributions to the OBEX. I've downloaded http://obex.parallax.com/objects/673/. I'm going to try to modify it to use the Parallax Serial Terminal since I don't know much about RS232.

Kye
12-27-2010, 04:25 PM
It already works for the parallax serial terminal.

lardom
12-27-2010, 04:48 PM
Great. Now that I know it already works with the PST I found the baud rate, 250_000. :cool: Thanks again.

Tapperman
12-27-2010, 07:08 PM
I made this object some time ago:
http://obex.parallax.com/objects/673/

Any replies on this would/ be great. Thanks,

I'm reading through your assembly in the encoder PWM1C_PIDEngine



cmp encoderPrevious, encoderCurrent wz ' Update current state.
if_nz rev encoderPrevious, #30 '
if_nz xor encoderPrevious, encoderCurrent '
if_nz cmpsub encoderPrevious, #2 wc, nr '
if_nz sumc encoderPosition, #1 '
wrlong encoderPosition, positionAddress '
mov encoderPrevious, encoderCurrent ' Update previous state.


And I'm having a little trouble with the manuals explination of the REV opcode. My question is "the way you use the REV opcode above is to reverse all the bits, except the carry ... is that correct?"

... Tim

PS - I'm the one who had the question about 'JonnyMac's object, that you replied to ... BTW, thankyou for the input!

Kye
12-28-2010, 02:50 AM
(Rev) reverses 32 - 30 = 2 bits in my code.

So, it reverses the bottom 2 bits and zeros the rest.

The tricky peice of code you see there does the work of all the code in the Parallax Quadrature Encoder Object in like ~8 lines versus arround 30+. (The grey code stuff)

kuroneko
12-29-2010, 02:13 AM
@Kye: As this is one of your fully optimised OBEX contributions I challenge you to replace the three red instructions with a single one.


cmp encoderPrevious, encoderCurrent wz
if_nz rev encoderPrevious, #30
if_nz xor encoderPrevious, encoderCurrent
if_nz cmpsub encoderPrevious, #2 wc, nr
if_nz sumc encoderPosition, #1

wrlong encoderPosition, positionAddress
mov encoderPrevious, encoderCurrent