Hello Guest it is March 29, 2024, 09:11:47 AM

Author Topic: Brains writing wrong values to DRO's  (Read 16090 times)

0 Members and 1 Guest are viewing this topic.

Offline Bob49

*
  •  57 57
    • View Profile
Brains writing wrong values to DRO's
« on: March 06, 2015, 01:40:18 PM »
Hi,

I've been working on getting a new mill console connected and talking to Mach3 through a CubeLoc modbus card.  Everything through the modbus works as it should and all the different signals all get fed to my brain files.  The rotary switches I used are binary, that is to say they have single or multiple pins being contacted at the different switch positions.  It took me some time to figure out how to deal with the binary values moving from the switch, to the modbus, to Mach and finally to the individual brain files.  But I got there eventually.  All the binary is dealt with directly in my brain files, the rest of the system just sees it as the individual pins are either on or off.  And for the most part it all works like it should.

But I got one or two small problems I can't seem to understand what's happening.  In my feed rate override brain, I had to keep each brain file to only four switch positions each brain.  So I ended up with 5 individual brains for the 21 positions of my switch.  The spindle speed override is similar, but I was able to have five switch positions in each brain for a total of 3 brain files for that function.  That took some time to figure out what the problem was, but in the end the brains were just too long.

Some more history first, I got both of those switches working along with the rapid override switch some days ago, only to find that the correct percentage number would only get dropped into the corresponding dro while the switch was being turned to increment the value.  If the switches were turned to decrement or decrease the values, the values would be whatever the lowest switch setting reflected or a zero.  I could stop decreasing the switch positions wherever I wanted and go the other directions and the correct values would be displayed again.  I corrected that problem this morning by adding an "or" gate or lobe as shown in the brain pics I've attached.

But now that I have most values being dropped into the dro's correctly, I find that a few won't display the correct value in the dro's.  The brain shows the correct value, but the dro will just show a 0.  The ones I'm finding fault with are either the first or last switch position in each brain, but not across the board.  In brain #1, all four positions work correctly no matter the direction the switch is being turned, in brain #2, the top (63%) won't display anything other than a 0 while the switch is being incremented but works correctly while being decremented.  And in the same brain file, the bottom position (100%) will display a 0 while the switch is being decremented, bt works correctly when it's incremented.  In brain #3, the bottom position (150%) displays a 0 while the switch is being decremented but is fine with it being incremented.  Brain #4 works correctly at all switch positions just like brain #1.  Brain #5 has a problem with the top position (212%) with the switch being incremented, again displaying a 0.  But if decremented, the correct values is displayed.  These are all feed rate override brains and that's what the pictures reflect.

On the spindle speed override brains, I have two that display incorrectly with the switch being decremented and those two are bottom rungs in the individual brains.  All of them work correctly while the switch is being incremented.

Then one other brain is really throwing me for a loop.  It's the rapid override brain.  It only has 4 positions in it and all work correctly except the one that should reflect 75%.  The brain is made similar to the feed rate brains and the brain actually displays the correct percentage at 75%.  But what gets dropped into the dro was 91, not 75.  So I messed with this some this morning and only got more puzzled by it.  It seems I can change the 75 to 60 and it will display correctly in the dro,  61, 62 and 63 likewise.  But if I change it to 64, it will start to display oddly and show 89%.  I got no idea what to think about that problem.

So, I thought I'd ask the experts for some advise to see if anyone had any thoughts on how to correct these small problems.  I can use like it is, but I'd rather they work as they should.   Pics below.

Thanks for looking
Bob

Offline Bob49

*
  •  57 57
    • View Profile
Re: Brains writing wrong values to DRO's
« Reply #1 on: March 06, 2015, 01:41:25 PM »
One more pic.

Offline TPS

*
  •  2,501 2,501
    • View Profile
Re: Brains writing wrong values to DRO's
« Reply #2 on: March 07, 2015, 04:14:34 AM »
hi Bob,

i am realy not familar with brains, but i wold try to do this in one brain.

Thomas
« Last Edit: March 07, 2015, 04:16:44 AM by TPS »
anything is possible, just try to do it.
if you find some mistakes, in my bad bavarian english,they are yours.

Offline Bob49

*
  •  57 57
    • View Profile
Re: Brains writing wrong values to DRO's
« Reply #3 on: March 07, 2015, 10:23:25 AM »
Thanks for the response Thomas,

Couldn't wait to get out there and give that a try this morning.   But as you show it, it just keeps sending the value 250 to the feed override dro.  So I removed the 2 lines that start with V0 and terminate in V0 and it works.  Awesome!  I knew if I could get the whole thing into one working brain file it would work, but I'm very new to this brain thing.  Simple, I seem to be able to do.  These feed and speed overrides weren't that simple to me.  I had no clue about the local variables or what they could be used for, thanks for that tip.

This worked so well that I'll be rewriting my rapid override and spindle speed override brains too.  Maybe that will fix the incorrect value I keep getting in the rapid override.

Thanks a million,
Bob

Offline Bob49

*
  •  57 57
    • View Profile
Re: Brains writing wrong values to DRO's
« Reply #4 on: March 07, 2015, 08:27:35 PM »
Well, I got the rapid override working perfectly in the same format as Thomas came up with for the feed rate override, other than the two lines I mentioned above.  But the spindle speed override is giving me some trouble using that format.  There's a big difference between the feed rate and spindle speed in that the bottom of the feed rate was zero with the top being 250.  The spindle speed bottom value needs to be 40 with the top being 250.  And done in 15 steps instead of the 20 or 21 the feed rate had.  This makes the math different for every switch position, complicating it a lot.  At least I've not seen a common denominator in it.  And there's only 4 pins with values of 1, 4, 8 and 2.

One other thing I found out was either the individual math formulas I was using or the V2 termination I used was causing Mach3 to lock up at the brain control.  I fought that a big part of the day, coming to the conclusion it was the spindle speed override brain that was the problem.

Bob

Offline TPS

*
  •  2,501 2,501
    • View Profile
Re: Brains writing wrong values to DRO's
« Reply #5 on: March 08, 2015, 05:28:22 AM »
Hi Bob,


for the spindle should something like this work.(modbus adresses must be different)
not sure why you had to delete the two lines with V0

the first one should protect the value to get less than 0
the second one should protect the value to get greather than 250
are you sure your compare was "greater than" and not "less than".

Thomas
anything is possible, just try to do it.
if you find some mistakes, in my bad bavarian english,they are yours.

Offline TPS

*
  •  2,501 2,501
    • View Profile
Re: Brains writing wrong values to DRO's
« Reply #6 on: March 08, 2015, 07:02:36 AM »
Hi Bob,

ok forget about this V0 thing, played a little bit around,
it's not working. the values seam to be only updated
at the end of a brain.

think the protection for under- and oversizing the values need
to be done in macropump macro.

Thomas
anything is possible, just try to do it.
if you find some mistakes, in my bad bavarian english,they are yours.

Offline Bob49

*
  •  57 57
    • View Profile
Re: Brains writing wrong values to DRO's
« Reply #7 on: March 08, 2015, 05:30:12 PM »
Hi Thomas,

Thanks for the response,  My Feed rate override brain file looks just like the last one you did.  The problem was the value sent to the feed rate override dro stayed at 250.  And I reasoned yesterday that i probably didn't need the V0 if all I was doing was dropping off the value somewhere, so I went back to the Feed Ovrd DRO. 

That change was after having the brain control lock up on whenever I tried to enable a brain that had a local var other than V0.  V0 worked in the feed rate brain, but V1 or V2 wouldn't work in the rapid override or in the spindle override.  I spent a good part of the day rebooting my PC due to that problem.  So now I don't have any local vars in any brain files. 

I've been playing with the spindle override most of yesterday and all of today.  I had some ideas, but they all mostly involved having multiple brain files for the spindle override.  That does not work, comes close, but it was never 100% correct.  Some of the funky stuff I went through was due to the brain being too long, or being spread out over multiples.  Today, after talking to a machinist friend, I dropped the bottom value to 10 and the top value to 150 and made steps of 10's and have a 100% working brain for the first time on the spindle override.  That just makes my panel graphics wrong, but that's an easy fix with a decal if I stay with those values.

But lets talk about that spindle override brain you posted.  I messed with it and it works well.  I changed the 40 in yours to 30 and am nearly hitting my original steps well enough I think I can live with it.  How did you arrive at that formula?  I kept thinking that I should be able to add something to a base number and increase the values with each switch position.  Or to use a percentage in the formula's.  But I couldn't come up with anything. And I've done enough changing of brains the last few weeks to make me not want to experiment for the sake of experimentation.  That's just pretty cool.  I think I'll keep it active and try it out for a while to see if the steps are too big.  But it's pretty much where I was trying to go originally, so why not run with it.

I've only started to get involved in macro's and my first attempt works, but reports errors upon completion.  Lots more to learn on that subject.

Thanks again Thomas, you've been a big help.
Bob

Offline TPS

*
  •  2,501 2,501
    • View Profile
Re: Brains writing wrong values to DRO's
« Reply #8 on: March 09, 2015, 03:23:11 AM »
Hi Bob,

you asked:
--->How did you arrive at that formula?

ok i try to explain in my bad english:

we have the value from the knob, witch is 0->15
we want a outgoing value from 40->250, so we have a range
of 210.

210/15 = 14, so we multiply the origal value by 14 and add
the 40 for the beginning value, thats it.

Regards Thomas

anything is possible, just try to do it.
if you find some mistakes, in my bad bavarian english,they are yours.

Offline stirling

*
  • *
  •  2,188 2,188
  • UK
    • View Profile
    • www.razordance.co.uk
Re: Brains writing wrong values to DRO's
« Reply #9 on: March 10, 2015, 07:04:23 AM »
Just a thought but why don't you just send your 5 bits in ONE register rather than a separate register for each bit? (currently you're using 5 * 16 = 80 bits to send 5 bits of info)

If you did that your Brain would reduce to just one rung i.e.  Modbus reg -> formula (A*12.5) -> feed override.

Ian