Recalculation of impulses

For questions and comments on programming in general. And for any items that don't fit into the forums below.

Moderators: Benj, Mods

Post Reply
User avatar
buvaylov
Posts: 10
Joined: Wed Sep 30, 2020 5:27 am
Contact:

Recalculation of impulses

Post by buvaylov »

Help me please! I don’t know in which direction to move to solve the problem (the project for clarification in the appendix) of recalculating the number of incoming pulses and issuing to the controller output. Thanks in advance, Alexander
Attachments
convert_8_to_6_ATTiNY13.fcfx
(4.97 KiB) Downloaded 25 times

User avatar
Benj
Matrix Staff
Posts: 15219
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4763 times
Been thanked: 4299 times
Contact:

Re: Recalculation of impulses

Post by Benj »

Hi Alexander,

Please can you provide more information which document are you referring to?

User avatar
buvaylov
Posts: 10
Joined: Wed Sep 30, 2020 5:27 am
Contact:

Re: Recalculation of impulses

Post by buvaylov »

It is necessary to recalculate the pulse repetition rate, for example, for every incoming eight pulses, six are generated in a continuous cycle

User avatar
buvaylov
Posts: 10
Joined: Wed Sep 30, 2020 5:27 am
Contact:

Re: Recalculation of impulses

Post by buvaylov »

a stepper motor in step-dir mode must receive a certain number of pulses from the pulse counter on the shaft, taking into account the recalculation of their number depending on the wire diameter

User avatar
Benj
Matrix Staff
Posts: 15219
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4763 times
Been thanked: 4299 times
Contact:

Re: Recalculation of impulses

Post by Benj »

Hello,

How's this?
convert_8_to_6_ATTiNY13.fcfx
(9.49 KiB) Downloaded 15 times

User avatar
buvaylov
Posts: 10
Joined: Wed Sep 30, 2020 5:27 am
Contact:

Re: Recalculation of impulses

Post by buvaylov »

Thank you! I will try to work in this direction

User avatar
buvaylov
Posts: 10
Joined: Wed Sep 30, 2020 5:27 am
Contact:

Re: Recalculation of impulses

Post by buvaylov »

Hello! in the simulation, I did not see the relationship between the number of pulses at the input and the number of pulses generated. Also, the use of interrupts is not clear. I am attaching two examples, with and without interruption. Please point out my mistakes. Sincerely, Alexander
Attachments
convert_8_to_6_ATTiNY13 with intr.fcfx
(7.4 KiB) Downloaded 9 times
convert_8_to_6_ATTiNY13 original.fcfx
(6.25 KiB) Downloaded 10 times

User avatar
Benj
Matrix Staff
Posts: 15219
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4763 times
Been thanked: 4299 times
Contact:

Re: Recalculation of impulses

Post by Benj »

Hello,

in your code you have point = point + 3/4

point is a byte and 3/4 in integer maths will be 0.

I've changed your example so that it uses a counter and simply doesn't output every fourth pulse.
convert_8_to_6_ATTiNY13.fcfx
(9.93 KiB) Downloaded 13 times

User avatar
buvaylov
Posts: 10
Joined: Wed Sep 30, 2020 5:27 am
Contact:

Re: Recalculation of impulses

Post by buvaylov »

Thank you very much for your help! My apologies for the incorrect statement of the problem. I made a simple example to understand the algorithm to the solution. I make winding machine. The main shaft turns an ordinary electric motor, adjustable speed. Shaft sensor, outstanding 18 pulses per 1 revolution of the shaft. Shaft stacker with a step of 1 mm. to 1 turn, is driven by a stepper motor with reducer. The use of stepper motor only possible in the step/dir. Depending on the wire diameter for one revolution of the main shaft must produce a certain number of steps stacker, with the factor, why I gave examples of how I tried to make a conversion pulses. Sincerely, Alexander

Post Reply