dcservo
dcservo copied to clipboard
Tiny speed improvement
Hi. I was checking your code for the AS5600 i2c encoder for ESP8266 and I noticed one tiny improvement. Within the readTwoBytes() subroutine you are addressing one address byte of the AS5600 and requesting its value, while in the very next step you address the next address byte and request its value, too. You can address the lower address first and request 2 bytes - the auto counter on AS5600 will increase the address pointer and you will save ~50% of i2c communication.
Hi Robert,
I did have that same thought and acted upon it. It worked ok at low speed but it gave me the wrong measurement, the second byte would be wrong many times, so I revert back to the original one (which was borrowed from AMS 5600 Arduino library.
Can you double check whether you get the same problem or not. I really stated noticing when I moved to the 5601, so it might work fine for 5600 ... ??
Cheers,
Miguel
On Sat, Jul 2, 2016 at 9:20 PM, Robert Klauco [email protected] wrote:
Hi. I was checking your code for the AS5600 i2c encoder for ESP8266 and I noticed one tiny improvement. Within the readTwoBytes() subroutine you are addressing one address byte of the AS5600 and requesting its value, while in the very next step you address the next address byte and request its value, too. You can address the lower address first and request 2 bytes - the auto counter on AS5600 will increase the address pointer and you will save ~50% of i2c communication.
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/misan/dcservo/issues/11, or mute the thread https://github.com/notifications/unsubscribe/AAccyNLl7NA96xQ1LxQ7kpmBjvl6D_uZks5qRrnggaJpZM4JDvH2 .