Digital Encoders
I have been working on a project using a digital encoder. I am using the Quadrature Encoder from OBEX. The spec sheet for the encoder is attached. I have the 288V232R161B2.
It always reads 0. I have pins a & b pulled up to 3.3 volts using 10K resistors. pins a & b are also attached to pins 0 and 1 on the prop. Pin C goes to ground. I don't think I am understanding the quadrature encoder documents fully. Any help or insight is much appreciated!
Thanks
Greg
Post Edited (Greg LaPolla) : 6/17/2010 1:35:50 AM GMT
CON _clkmode = xtal1 + pll16x ' Crystal and PLL settings. _xinfreq = 5_000_000 ' 5 MHz crystal (5 MHz x 16 = 80 MHz). OBJ Encoder : "Quadrature Encoder" pst : "Parallax Serial Terminal" ' Serial communication object VAR long Pos[noparse][[/noparse] 3 ] PUB Main | value, prev Encoder.Start(0, 1, 1, @Pos) 'Start continuous two-encoder reader (encoders connected to pins 8 - 11) pst.Start(115200) pst.Str(String("Encoder Reading")) ' Heading pst.Chars(pst#NL, 2) ' Carriage returns prev := 99 'Set it to something it wont be for the first loop through so it will be displayed repeat value := Pos[noparse][[/noparse]0] 'Read each encoder's absolute position if value <> prev pst.Dec(value) pst.Chars(pst#NL, 2) ' Carriage returns prev := value
It always reads 0. I have pins a & b pulled up to 3.3 volts using 10K resistors. pins a & b are also attached to pins 0 and 1 on the prop. Pin C goes to ground. I don't think I am understanding the quadrature encoder documents fully. Any help or insight is much appreciated!
Thanks
Greg
Post Edited (Greg LaPolla) : 6/17/2010 1:35:50 AM GMT
Comments
http://www.parallax.com/Portals/0/Downloads/docs/cols/nv/prop/col/nvp6.pdf
You can also download the code here in this zip file.
http://www.parallax.com/Portals/0/Downloads/docs/cols/nv/prop/code/nvp6.zip
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
There is no problem that can't be solved with a suitable amount of explosives!
EOD Memorial
Thanks, using that code it works perfectly.
http://www.parallax.com/Resources/NutsVoltsColumns/tabid/272/Default.aspx
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
There is no problem that can't be solved with a suitable amount of explosives!
EOD Memorial