Machsupport Forum
Mach Discussion => Brains Development => Topic started by: JasonEngbrecht on January 19, 2023, 06:34:34 PM
-
Hello im trying to write a brain to activate an output when a encoder dro and axis dro are the same. This was simple, but the output then stays active. I need it to switch off once the encoder dro and axis dro are no longer. This is my first time using brains, and this has stumped me. Attached is my sad non working attempt. Can anyone help me out?
Thanks
-
think it is enough if the output is connected directly after the compare, without the And and OR behind it.
-
Thats how i originally had it, but the output stays active once the compare is true, and stays active after the compare becomes untrue.
-
I need it to switch off once the encoder dro and axis dro are no longer.
the encoder dro and axis dro are no longer, not longer what?
for the moment i can not get your off condition, so what should switch off the output exactly?
-
When they are no longer equal. Once the compare A equals B becomes untrue, i need output to turn back off.
-
OK, as mentoined, this should be enough
-
That is how i first wrote the brain, and the output is stuck on after A equals B becomes untrue.
-
this must work, something else maybe doing something with output5 ? macropump or some othe script?
-
try an other output, witch is defently not used just for test
-
Ill give that a shot.
-
Outputs are latched under normal control so I would have thought Brains did the same. I could be wrong as I do not use Brains much.
-
I take it latched means once turned on, it also needs turned off, because that seems fo be the issue i have ?
-
Latched is locked into a fixed state until forced to change. So my guess is you need to toggle the state in the brain or force a state to make sure you have the state you need.
-
Thats what i figured, and also what im having a hard time doing. I will keep working at it. I wrote some that i thought would work but they did not 🤔.
-
I am not an expert at Brains, not needed to use them much but this is what I think should work.
-
I tried one similar and it seemed to only use the greater than or less than condition, but ill give it another shot and see what happens, thanks for the suggestion.
-
I gave that a try, still no luck. I would think such a small task would be simple. Not sure what im missing.
-
It works for me, try my file.
-
i tried yours, but you used 143 encoder count 3. I used 170 encoder count 0 I believe.
That was the dro input number I found to correspond with the z axis DRO in the mach 3 settings tab. The brain I built is identical to yours other than that. The less than or greater than statements work fine as i toggle the DRO above or below the Z position, but when the encoder count, and z position match, I do not get the Encoder Count = Z position to work. Where in mach 3 does 143 encoder count 3 correspond to?