Hello Guest it is April 18, 2024, 12:06:12 PM

Author Topic: Whats wrong with this brain ???  (Read 11230 times)

0 Members and 1 Guest are viewing this topic.

Whats wrong with this brain ???
« on: April 18, 2012, 07:16:05 PM »
My modbus device is sending a value that the brain can recognize ( which is 40 in this case  - see the picture ) but the brain doesnt continue calculating the value as i would expect.
Since the value of 40 is less than 32767 i would expect to see a value of .004" in the "formula" box as well as the tool dia output.

It seems so simple that I'm probably missing something stupid or i've missed some documentation somewhere, any advise or guidance would really be appreciated.


Thanks

Ivan

Offline poppabear

*
  • *
  •  2,235 2,235
  • Briceville, TN, USA
    • View Profile
Re: Whats wrong with this brain ???
« Reply #1 on: April 18, 2012, 08:45:53 PM »
the problem is your "compare" block, if it is true it outputs a "1", if false a "0" that is why when it is true you getting that small value.
fun times
Re: Whats wrong with this brain ???
« Reply #2 on: April 18, 2012, 09:12:32 PM »
thanks for the information, I did not know that a compare resulted in a '0' or '1' output. I thought that a comparison would either allow or stop a continuation in the processes
after the comparison, not an output of '0' or '1'. Another one of those things in life that make you go hhhhhhhmmmmmmmmmmm...

Offline BR549

*
  •  6,965 6,965
    • View Profile
Re: Whats wrong with this brain ???
« Reply #3 on: April 18, 2012, 11:17:00 PM »
I think there is a serious flaw there(;-) How Else could you do a comparitor and have the previous value pass through. It should not have passed through the 0/1 that controls the gate???

Just a thought, (;-) TP

Offline stirling

*
  • *
  •  2,188 2,188
  • UK
    • View Profile
    • www.razordance.co.uk
Re: Whats wrong with this brain ???
« Reply #4 on: April 19, 2012, 09:40:21 AM »
I think there is a serious flaw there(;-) How Else could you do a comparitor and have the previous value pass through. It should not have passed through the 0/1 that controls the gate???
Can't agree Terry. A comparator's OUTPUT is BOOLEAN - that's it's job and definition. If you want it to output (pass through) it's input when it's comparison is TRUE - what do you want it to output if the comparison is false? (Hint: don't say zero because that COULD have been its input  ;)).

The OP's quest is to convert a 16bit twos complement number into a signed decimal - see his previous post and my answer. I've just done it with a brain. I'll leave you to have a go before I post  >:D.

Cheers

Ian

Offline BR549

*
  •  6,965 6,965
    • View Profile
Re: Whats wrong with this brain ???
« Reply #5 on: April 19, 2012, 10:09:18 AM »
HIYA Ian, I went at it for a long time last night.  I agree IF we were tlaking about CB but Brains are suppose to be a ladder type logic and ladder does have pass through values as the comparitor is a gate so to speak.

I understand what you are saying about a comparitor output being boolean.  

Yes IF the gate was open you would get the pass through value, IF the gate was closed you would get NIL or zero.

I can get the value to be correct but not with using the comparitor

OR I could be wrong all together, (;-) I will work on it some more.

(;-) TP

« Last Edit: April 19, 2012, 10:12:21 AM by BR549 »

Offline BR549

*
  •  6,965 6,965
    • View Profile
Re: Whats wrong with this brain ???
« Reply #6 on: April 19, 2012, 10:53:07 AM »
I am not getting anywhere My brain is locked in the logic loop and is NOT coming out. I just repeat everthing I did last night over and over again.

(;-) TP

Offline stirling

*
  • *
  •  2,188 2,188
  • UK
    • View Profile
    • www.razordance.co.uk
Re: Whats wrong with this brain ???
« Reply #7 on: April 19, 2012, 11:01:21 AM »
Yes IF the gate was open you would get the pass through value, IF the gate was closed you would get NIL or zero.
See above for why I already dismissed that ;).

OK I'm gonna be a tease. Duplicate your input. Comparator the first one. Multiply the comparator output by the other input....

Ian

Offline BR549

*
  •  6,965 6,965
    • View Profile
Re: Whats wrong with this brain ???
« Reply #8 on: April 19, 2012, 11:27:28 AM »
OK got it now.

Dro --> IF<100 = 0/1
Dro --> A * B =  *********   -->  output --> A/10000 -->  New DRO

I was close at one point last night BUT Iwould have never got the connection. SEEMS a long way around the block to cross the street  BUT I guess it is what it is (;-)

Thanks Ian, I owe you another pint(;-)

(;-) TP

Offline stirling

*
  • *
  •  2,188 2,188
  • UK
    • View Profile
    • www.razordance.co.uk
Re: Whats wrong with this brain ???
« Reply #9 on: April 19, 2012, 01:08:01 PM »
SEEMS a long way around the block to cross the street  BUT I guess it is what it is (;-)
I agree - but as you say - we work with what we have.

Of course there's always the macropump.

Ian