In SX Microcontrollers, SX/B Compiler and SX-Key Tool, robotworkshop wrote: Are you sure about the inputs? The code looks a lot like the example in the SX/B help file which would have the encoder connected to RA.0 and RA.1 It appears to missing a few things however. It should have: EncodersNew = EncPort & %00000011 ' Mask off extra bits And the calculations loko a bit off. To me it appears that your code is kind of mixed in that it expects some of th bits to be on 0 and 1 while others as bits 2 and 3. If you are connecting the encoders to ports RA.2 and RA.3 I would used the code in the example program but start out with something like: EncodersNew = EncPort & &00001100 ' Mask off extra bits EncodersNew = EncodersNew >> 2 ' Shift over to perform all calculations Hope this helps, Robert ---------- End of Message ---------- You can view the post on-line at: http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=259381#m259473 Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2008 (http://www.dotNetBB.com)