Hi all, So as you may have guessed, I'm working on some rotary encoder routines in = XC8. I've been looking around, and I've actually found a pretty neat Arduino library. It handles the encoder, acceleration (values change faster if you spin faster), encoder switch status (click, double click, held, etc). I'm considering trying to port it to XC8 as I think it would be useful, but also a really good exercise in coding. I have no Arduino experience, but from what I've been reading, it appears that in their ecosystem you can define multiple instances of a class. So in my case if I made one routine that dealt with a single encoder, I could create 2 instances to deal with 2 encoders, etc. As far as I understand it, I can't do that in straight C. So, what is the preferred way of dealing with this? I could make the original function deal with total number of encoders that I have. Or I could make multiple copies of a function that dealt with a single encoder. In both cases I'll need to deal with variables carefully. Is there another (possibly better) way? I'm interested in this in the abstract as eventually I will likely run into this situation with other routines (switch debounce, for instance). Thanks! Josh --=20 A common mistake that people make when trying to design something completely foolproof is to underestimate the ingenuity of complete fools. -Douglas Adams --=20 http://www.piclist.com/techref/piclist PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist .