Hi H,
Thank you, I will try it and let you know what happens. I'm a bit slow understanding code though
Will you annotate where the DEADBAND is in your code please?
C.
Hi H,
Thank you, I will try it and let you know what happens. I'm a bit slow understanding code though
Will you annotate where the DEADBAND is in your code please?
C.
There's no deadband but it's easy enough to add that after the actual calculation, before you decide to move or not/Henrik.Code:IF ABS Distance > Deadband THEN ' Make the move ELSE ' Sit tight ENDIF
Have you tried it?
Using your numbers with 3580 ticks around the circle:
If you're moving from 0 to 11 distance is +11.
If you're moving from 11 to 0 distance is -11.
In both cases the ABSolute value of distance is 11. If you have deadband set to 1 then you'll move because distance is larger than deadband.
If you're moving from 11 to 12 distance is +1.
If you're moving from 12 to 11 distance is -1.
In both cases the ABSolute value of distance is 1. If you have deadband set to 1 then you won't move because distance is not larger than deadband.
/Henrik.
Hi Henrik,
My system is actually 0 to 3581, so 3582 ticks/circle. I used the 0 to 11 clock face to simplify my question, so actually 11 to 0 is similar to 3283 to 0.
This is an interesting solution, if I can use it. At the moment I'm trying to unravel a pile if spaghettiwith my existing program.
I have to convert it for use with the Oshonsoft system, while learning about ABS, and the ????????.15 variable. I'm not sure if Oshonsoft supports ABS, but I assume it can be got round in some way.
I'll let you know once I get it running, thanks.
C.
PBP doesn't have signed 16-bit (WORD) variables so the distance.15 is simply a way to determine if the value is negative. The equivalent code, if you have signed variables, would be:
/Henrik.Code:Distance = Target - Position IF Distance > 1790 THEN Distance = Distance - 3580 Endif IF Distance < -1790 THEN Distance = Distance + 3580 ENDIF
Hi Henrik,
As mentioned my system has 3582 tick/rev, so is the 3580 in the last post correct?
I don't think Oshonsoft supports negative values, but I'll check.
Thanks, C.
Bookmarks