Hello Guest it is April 25, 2024, 08:33:00 PM

Author Topic: convert modbus CB to brain?  (Read 3396 times)

0 Members and 1 Guest are viewing this topic.

Offline stirling

*
  • *
  •  2,188 2,188
  • UK
    • View Profile
    • www.razordance.co.uk
convert modbus CB to brain?
« on: May 12, 2011, 01:51:18 PM »
In the CB code below, reg0 and reg1 are both modbus 16 bit registers and it works just fine as a macropump. Can this code snippet be converted into a brain?

reg0 = getInput(0)
reg1 = getInput(1)

if reg0 <> reg1 then
  setModOutput(1, reg0)
end if

Thanks

Ian

Offline poppabear

*
  • *
  •  2,235 2,235
  • Briceville, TN, USA
    • View Profile
Re: convert modbus CB to brain?
« Reply #1 on: May 18, 2011, 08:04:13 AM »
Hey Ian,

Yes it can be done........ maybe........if........  hehehe
I dont have anything hooked up at the moment for the OLD style serial MB, (since your using the vb that accesses it, I am thinking that is what your using).
The Brain that is attached, in THEORY........ should do what you want, with the following caviot.

what it does is this, if SNPMB inputs 0 and 1, are NOT equal that sets the var to true or 1, if equal it is set to 0.
on the second line, I run a formula that will multiply the Var times the input0, so if the rung above is true, then the var
multiplies the input times 1, then sends it out to SNPMB output 1. But if your VAR is 0, i.e. if inputs 0 and 1 above are eqaul
then your output 1 will always be forced to 0............. dont know if that would be a problem for you or not.

scott





fun times

Offline stirling

*
  • *
  •  2,188 2,188
  • UK
    • View Profile
    • www.razordance.co.uk
Re: convert modbus CB to brain?
« Reply #2 on: May 19, 2011, 05:44:35 AM »
Hi Scott - thanks for your reply.

I like the cut of your jib sir - that's devious - unfortunately forcing the output to zero if inputs are equal is a problem.

It's kinda become academic in a way because I liked the idea of speeding up the processing frequency - hence Brians - but as it turns out my macropump version seems to work fine so no worries.

All I'm doing is keeping a pendant in synch so that if for example you press cycle start on the pendant and then say feedhold on the standard keyboard, the pendant knows your now in feedhold.

Anyway - thanks again Scott.

Cheers

Ian