dcservo
dcservo copied to clipboard
Replace INT with LONG
Hi.
I found out why my Z axis worked so erratically. It was not due the frequency or missed pulses. The problem is resolution. As I have 4096 pulses per one rotation (and therefore 1mm of movement) I run out of INT space after 8mm in any direction. Initially I changed the values for encoder0pos, but I also had to change it for target1. I have no idea why, but the compiler for ATmega328 compiles INT with the same size as LONG - therefore testing the code on Arduino Mini Pro worked every time, but as soon as I ported the code to ATtiny85, I got this weird behavior. Stupid error - it took me a month to find it :( But now even my Z axis works flawlessly ;) I can't give you pull request as I made so big mess with my code I have to clean it up quite a lot.
Good that you figure it out :-)
On Fri, Jun 10, 2016 at 10:06 PM, Robert Klauco [email protected] wrote:
Hi.
I found out why my Z axis worked so erratically. It was not due the frequency or missed pulses. The problem is resolution. As I have 4096 pulses per one rotation (and therefore 1mm of movement) I run out of INT space after 8mm in any direction. Initially I changed the values for encoder0pos, but I also had to change it for target1. I have no idea why, but the compiler for ATmega328 compiles INT with the same size as LONG - therefore testing the code on Arduino Mini Pro worked every time, but as soon as I ported the code to ATtiny85, I got this weird behavior. Stupid error - it took me a month to find it :( But now even my Z axis works flawlessly ;) I can't give you pull request as I made so big mess with my code I have to clean it up quite a lot.
— 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/10, or mute the thread https://github.com/notifications/unsubscribe/AAccyDkhWskHVbPh5Rt2cmQQjXU6FDt5ks5qKcPHgaJpZM4IzSFc .