Hello guys
I ask you for a suggestion.
I want to drive a motor in Dc or Stepper this and connected to an encoder how do I perform a check in ms on the encoder pulses so that if the motor gets stuck it disconnects the supply of power to the motor?
I want to make an electronic lock for a security door with the exit of steel pistons.
Thank you all
Ferla
Encoder impulse control time
Moderator: Benj
-
- Matrix Staff
- Posts: 9520
- Joined: Sat May 05, 2007 2:27 pm
- Location: Northamptonshire, UK
- Has thanked: 2585 times
- Been thanked: 3815 times
- Contact:
Re: Encoder impulse control time
Hi Ferla
The rules here state:
I have assumed that you use Flowcode V7?
The rules here state:
I have moved your post to a more suitable place.5. The “Tips and Tricks” sub forum is for sharing your knowledge and NOT for starting off with asking questions.
I have assumed that you use Flowcode V7?
Martin
-
- Flowcode v5 User
- Posts: 126
- Joined: Sun Jan 06, 2013 8:58 pm
- Location: Italy
- Been thanked: 19 times
- Contact:
Re: Encoder impulse control time
Sorry I thought the correct suggestions section.
Correct, I use FC7
Thank you
Correct, I use FC7
Thank you
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: Encoder impulse control time
Hello
I would do something like when the motor is active enable a timer interrupt. The timer interrupt macro increments a variable. If the variable reaches a certain count value then disable the motors and maybe block using a while 1 loop.
Next enable a second interrupt that fires on a pin change from the encoder. Inside the second interrupt macro reset the counter to 0.
Hope this helps.
I would do something like when the motor is active enable a timer interrupt. The timer interrupt macro increments a variable. If the variable reaches a certain count value then disable the motors and maybe block using a while 1 loop.
Next enable a second interrupt that fires on a pin change from the encoder. Inside the second interrupt macro reset the counter to 0.
Hope this helps.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
-
- Flowcode v5 User
- Posts: 126
- Joined: Sun Jan 06, 2013 8:58 pm
- Location: Italy
- Been thanked: 19 times
- Contact:
Re: Encoder impulse control time
Thanks Benj
You have to offer me a simple example please, I do not ask you to make me the program
Use anything at your convenience, then I adjust my project
Thank you
Ferla
You have to offer me a simple example please, I do not ask you to make me the program
Use anything at your convenience, then I adjust my project
Thank you
Ferla
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: Encoder impulse control time
Hi Ferla,
Here's a quick example.
I suggest you look at the interrupt enables to get the timer firing at the right rate and the encoder interrupt firing when the encoder output change state.
I also suggest you change the constant value from 20 to a suitable number of timer interrupts before engaging the safety cut off.
I am blocking when there is an error but you could instead set a variable and check for this in the main loop.
Here's a quick example.
I suggest you look at the interrupt enables to get the timer firing at the right rate and the encoder interrupt firing when the encoder output change state.
I also suggest you change the constant value from 20 to a suitable number of timer interrupts before engaging the safety cut off.
I am blocking when there is an error but you could instead set a variable and check for this in the main loop.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
-
- Flowcode v5 User
- Posts: 126
- Joined: Sun Jan 06, 2013 8:58 pm
- Location: Italy
- Been thanked: 19 times
- Contact:
Re: Encoder impulse control time
Thanks, I'll check your project tonight. It is with these suggestions that I appreciate from day to day FC and all those who are part of it.
Ferla
Ferla