slviajero / tinybasic

A BASIC interpreter for Arduino, ESP, RP2040, STM32, Infineon XMC and POSIX with IoT and microcontroller features.
GNU General Public License v3.0
208 stars 32 forks source link

Motor encoders and interrupts #63

Closed EncomLab closed 4 weeks ago

EncomLab commented 8 months ago

Hi Stefan - sorry for being away from this project for far too long! I have a question regarding the use of HC-020K optical encoders for motor control - namely the best way to use interrupts and/or the best commands to allow for the counting of pulses from them. I have attempted using the EVENT command but it appears I am getting a pulse length and not a count of pulses. Best regards and I look forward as always to your feedback! - Brian

slviajero commented 8 months ago

Hi Brian,

the EVENT command is tricky and not really well tested. What exactly are you trying to do with it. Do you have some code you tried?

In general, EVENT is used to react to one event by jumping to a subroutine. There one has to count the number of interrupts. Is this what you are trying to do?

Best Regards, Stefan

On 18. Mar 2024, at 01:41, Encom Lab @.***> wrote:

Hi Stefan - sorry for being away from this project for far too long! I have a question regarding the use of HC-020K optical encoders for motor control - namely the best way to use interrupts and/or the best commands to allow for the counting of pulses from them. I have attempted using the EVENT command but it appears I am getting a pulse length and not a count of pulses. Best regards and I look forward as always to your feedback! - Brian

— Reply to this email directly, view it on GitHub https://github.com/slviajero/tinybasic/issues/63, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACSY56DUGN5WQLFOJ7UVZHTYYYZ3RAVCNFSM6AAAAABE2UYYV6VHI2DSMVQWIX3LMV43ASLTON2WKOZSGE4TCMBQGQ2DAMQ. You are receiving this because you are subscribed to this thread.