On Sat, 12 Jun 2021 at 12:15, Nicklas SB Karlsson <n...@nksb.eu> wrote:
> Do not find any modulo arithmetic in hal, it is very useful then waiting > for a particular angle both if value overflow or just accumulate. May be > solved by loop and modulo operator in g-code but maybe adding to > carousel component would be a better option. One solution (though an untidy one) would be to scale the encoder counter so that it gives the correct position as a float. Then convert that float to a u32 with conv_float_u32 Then convert the bottom set of bits of that u32 to signals with "bitslice" Then connect each relevant bit to the carousel comp. For a power-of-2 carousel that will automatically do the modulo calc. How many tool pockets do you have? And how many counts-per-rev is the encoder? -- atp "A motorcycle is a bicycle with a pandemonium attachment and is designed for the especial use of mechanical geniuses, daredevils and lunatics." — George Fitch, Atlanta Constitution Newspaper, 1912 _______________________________________________ Emc-users mailing list Emc-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/emc-users