houly Posted June 8, 2014 Report Share Posted June 8, 2014 Hello all, I'm interesting in quadrature encoder decoding in (for example) SEQ4 project. Do you know how does the code function ? does it function with interrupt or polling ? thanks for your help Quote Link to comment Share on other sites More sharing options...
TK. Posted June 8, 2014 Report Share Posted June 8, 2014 Hi, the source code can be found under: http://svnmios.midibox.org/filedetails.php?repname=svn.mios32&path=%2Ftrunk%2Fmios32%2Fcommon%2Fmios32_enc.c It works with polling, interrupts are no option when encoders are scanned via serial registers. Best Regards, Thorsten. Quote Link to comment Share on other sites More sharing options...
houly Posted June 9, 2014 Author Report Share Posted June 9, 2014 Hello Thorsten, Thanks for your link. You notice that for 64 encoders the scan timing is about 32us @72MHz, but at which frequency do you call the scanning routine in the main loop (I suppose...) ? for the moment the code is too complex for me (I try to switch from ASM PIC to ARM C), but it gives me a good challenge to try to understand it ! thanks again regards Quote Link to comment Share on other sites More sharing options...
TK. Posted June 9, 2014 Report Share Posted June 9, 2014 The shift registers (to which the encoders are connected) are scanned each mS. Higher scan rates don't make a difference for encoders with up to 100 pulses per rotation. Here is btw. a tutorial for the encoder usage in MIOS32: http://svnmios.midibox.org/listing.php?repname=svn.mios32&path=%2Ftrunk%2Fapps%2Ftutorials%2F014_enc_relative%2F And here is an older PIC ASM based solution, which might help you to understand the migration from ASM to C ;-) -> http://svnmios.midibox.org/filedetails.php?repname=svn.mios&path=%2Ftrunk%2Fmios%2Fmios_enc.inc Best Regards, Thorsten. Quote Link to comment Share on other sites More sharing options...
houly Posted June 11, 2014 Author Report Share Posted June 11, 2014 Hello Thorsten, Thanks for the tutorial and ASM code .. regards Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.