Hello Guest it is April 18, 2024, 01:44:25 PM

Author Topic: Arduino -> modbus -> Brain  (Read 19091 times)

0 Members and 1 Guest are viewing this topic.

Arduino -> modbus -> Brain
« on: January 28, 2012, 09:32:47 AM »
Hi Guys,

Building a arduino[modbus] based Pendant for my machine but has run in some trouble with brain, plz help


1. I'm jogging the axis by buttonpress. When using the buttons I want it to jog while I press the buttons, just like the binded keys at my keyboard. It starts jogging but never stops! What am I missing?

# It haven't crashed. Everything else works.
# Keyboard jogging works
# "Cont jog" is selected
# According to control brain it all works, the input is turned on only when pressed.
# When trying in "Step mode" it works just fine, it steps the amount selected in "incremental step".

2. I'm using 2 analog inputs FRO and Jog%. One of the registers has stopped working, when I use another one it works but this is strange. The Arduino handles this registers the same way. Is there a limit of registers you can use (I'm using 22)? Is there some known bug causing this?

3. How do you configure brain to actuate a button on the screen that isnt in the buttonlist?

Offline poppabear

*
  • *
  •  2,235 2,235
  • Briceville, TN, USA
    • View Profile
Re: Arduino -> modbus -> Brain
« Reply #1 on: January 28, 2012, 11:00:54 AM »
Hi Guys,

Building a arduino[modbus] based Pendant for my machine but has run in some trouble with brain, plz help


see below:

1. I'm jogging the axis by button press. When using the buttons I want it to jog while I press the buttons, just like the binded keys at my keyboard. It starts jogging but never stops! What am I missing?

>>>>>>>>>>>>>>>>>>in Brains there are "Stop Jog" commands as well, you will need to integrate that so it will stop moving when you let go.

# It haven't crashed. Everything else works.
# Keyboard jogging works
# "Cont jog" is selected
# According to control brain it all works, the input is turned on only when pressed.
# When trying in "Step mode" it works just fine, it steps the amount selected in "incremental step".

2. I'm using 2 analog inputs FRO and Jog%. One of the registers has stopped working, when I use another one it works but this is strange. The Arduino handles this registers the same way. Is there a limit of registers you can use (I'm using 22)? Is there some known bug causing this?

>>>>>>Havent played with the ardino so couldnt tell you

3. How do you configure brain to actuate a button on the screen that isnt in the buttonlist?

>>>>>>>>No direct way to do that, the best work around, is to set an ULED with the Brian, then have the Macro-pump also execute the code that is in that custom button.
>>>>>>>>make sure you put an Interlock in the MP so that it will only "Hit" that code once per push and release of your button.

Scott
fun times
Re: Arduino -> modbus -> Brain
« Reply #2 on: January 28, 2012, 12:50:43 PM »


1. Ok I got it. But having problem with the AND statement. It only works for one of the two inputs. See attached pictures

2. I suspect that the bug is caused on the other end.

3. Hmm..., no shortcut here  :-\


Thanks Poppabear
Re: Arduino -> modbus -> Brain
« Reply #3 on: February 19, 2012, 04:54:22 AM »
Anyone that can help me with the AND statements?

Offline poppabear

*
  • *
  •  2,235 2,235
  • Briceville, TN, USA
    • View Profile
Re: Arduino -> modbus -> Brain
« Reply #4 on: February 19, 2012, 09:01:00 AM »
ok, that is an easy one..........  hehehee

the issue is according to your screen shots, for your and to work, BOTH of your inputs have to be OFF at the same time, so that the inverts flip it and pass both of them as ON to your AND block. In both screen shots, one of them is ON, and the other is OFF.......

For the AND to function, with the invert on both its feeds being ON, you will need BOTH of your inputs to be OFF at the same time. The Brian only reads what is in the input, so your Arduino is the one "setting" those two inputs. So you need to look at your Arduino code, and when you want the JOGX in M3 to push the off button, then the Ard, needs to send two "0's" one in each MB register.

Scott
fun times

Offline stirling

*
  • *
  •  2,188 2,188
  • UK
    • View Profile
    • www.razordance.co.uk
Re: Arduino -> modbus -> Brain
« Reply #5 on: February 19, 2012, 09:41:29 AM »
Hi Scott - I think what our man is saying is that in the bottom pic he's getting a "true" out of the AND gate and he SHOULDN'T be.

Ian

Offline poppabear

*
  • *
  •  2,235 2,235
  • Briceville, TN, USA
    • View Profile
Re: Arduino -> modbus -> Brain
« Reply #6 on: February 20, 2012, 08:36:19 AM »
Hi Ian,

   Yeap, your right, sorry I missed that.........    :-[

Ok, do these 5 (possible) things to see if it resolves.

1).  Go into editor, and delete your complete last rung, and redo it, see if it works then... If NOT #2.
2).  Go into editor delete that last rung, then make a new brain call it part2 or what ever, and put JUST that problem rung in it... if not #3
3).  If that fails, Edit the part2 brain, in where you keep your inputs, but pass that data (as a no-op) to 2 unused UDROs.
      Then in the macro pump, write a interlock script that looks at those two dros, and does a button push depending on their and'ed value.
      you can use "NOT" key words to in effect "invert" their value if your using them as Boolean's..... if not #4
4).  Delete the entire brain, and rebuild a new one from scratch..........  if not #5
5). Scrap the Brian stuff, and just do it all in a macro pump, or periodic macro.

scott
fun times

Offline stirling

*
  • *
  •  2,188 2,188
  • UK
    • View Profile
    • www.razordance.co.uk
Re: Arduino -> modbus -> Brain
« Reply #7 on: February 20, 2012, 01:50:04 PM »
5). Scrap the Brian stuff, and just do it all in a macro pump, or periodic macro.

 ;D ;D ;D

Ian
Re: Arduino -> modbus -> Brain
« Reply #8 on: February 26, 2012, 02:23:36 PM »
1. Fail !
2. Works

Its weird because I've already tried this, but well now it works!

Thanks for the help
Re: Arduino -> modbus -> Brain
« Reply #9 on: February 27, 2012, 09:07:13 PM »
I've also noticed that only the first 10 AND based rungs work in a brain. All the AND's after the 10th one don't get triggered in any case. I break the brain into 2 parts for them to work. Is it a bug with brains?

Zafar