## 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

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

### Recalculation of impulses

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

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

Hi Alexander,

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

### Re: Recalculation of impulses

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

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

### Re: Recalculation of impulses

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

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

Hello,

How's this?
convert_8_to_6_ATTiNY13.fcfx

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

### Re: Recalculation of impulses

Thank you! I will try to work in this direction

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

### Re: Recalculation of impulses

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
convert_8_to_6_ATTiNY13 original.fcfx

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

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