Hello Guest it is April 19, 2024, 05:04:06 PM

Author Topic: How are variables used in Brains - variable as Brain input locks up MACH  (Read 9327 times)

0 Members and 1 Guest are viewing this topic.

Offline simpson36

*
  •  1,369 1,369
    • View Profile
I have watched the videos and read a few threads and read Poppa Bears excellent docs . . and just now dis a series of searches  . . . but I can't find what is probably a Brain 101 task so hoefully someone can shed light on this for me.

In case there is a better solution than variables, my goal is to use the plug-in enabled modbus, but I have a lot of data passed to modbus with the SET/GET which I understand does not work with the plug-in enabled version.

Therefor I need an alternate way to pass the data and using variables seems ideal except that any attempt to use a variable as input to a Brain 'rung' results in MACH locking up.  :'(

Variables is a valid choice on the Brain editor dialogue box so I assume that I am just doing something wrong.

Any guidance will be much appreciated.

Offline BR549

*
  •  6,965 6,965
    • View Profile
The variables in Brains are unique to only brains. They are NOT the same thing as Gcode #Vars.

Just a thought, (;-) TP

Offline simpson36

*
  •  1,369 1,369
    • View Profile
The variables in Brains are unique to only brains. They are NOT the same thing as Gcode #Vars.

Just a thought, (;-) TP

Thanks for the response.

What is the purpose of Vars that can't reach outside of the brain?

Is there any documentation at all on how these work. I have not found anything and I've looked everywhere I can think of.

For MACH, I am thinking I can set up a bunch of USER DROs or something like that and feed the data to the brain that way.

At one time I was told that to set and get data with VB when using TCP modbus, Use SetMasterOutput in place of SetModOutput and use GetMasterInput in place of GetInput, but I was not able to get that to work.



 

Offline BR549

*
  •  6,965 6,965
    • View Profile
The var is there to hold values you need to hold locally inside the brain.

I agree and remember talking with Art about it  BUT the brains came at the END of Art's control over Mach3 and it is what it is Unfortunately.

Also you will find that not all things work as one would expect(;-)

As to Docs there is VERY little detailed info on the working of the brains. Just a couple of Vids and some user contributions.

(;-) TP

Offline simpson36

*
  •  1,369 1,369
    • View Profile
If I use any 'V' variable as input into a rung, Mach freezes solid and I have to sick the Task Manger on it. Not a particularly valuable feature.

Global variables accessable from anywhere would certainly be a benefit. Maybe in MACH4.

I've been messing with adding a bunch of 'phantom' DROs and that seems to be doing the trick. The DRO's function as variable for my purposes at the moment.

I want to move to TCP Modbus and I figure to get me feet wet using the Plug-in Serial and get rid of all of the SET/GET to modbus. Then the changeover to TCP should be fairly simple (famous last words) :)

So, I have a direction now. Thanks very much for the help. 

 

Offline BR549

*
  •  6,965 6,965
    • View Profile
Steve I don't know if this would help you but there ARE a block of VARs tied directly to a block of DROs. One updates the other.

Just a thought, (;-) TP

Offline simpson36

*
  •  1,369 1,369
    • View Profile

If they are the special 'Brain Only' vars, then probably useless. What vars and how many?

I'm reading some buzz about MACH4. Would I be painting myself into a corner by using this feature of MACH3 or will it remain in MACH4?

Offline BR549

*
  •  6,965 6,965
    • View Profile
Dros  1000 - 1255    are tied to #vars 15000-15255.  BUT here is the dragon to deal with

You can use them from inside a GCODE program  as

#15000= 999 and it updates the DRO1000

Update the DRO1000 and it updates the #var 15000

From CB you have to use  Code" #15000=999"

BUT NONE of that works with SetVar() GetVar() from inside CB.

AS I understand Mach4, NONE of this will be in it including BRAINS. Mach4 will go to a ladder logic PLC type program  like other Controllers use.

Yes I know GGRRRRRRR, (;-) TP

Offline simpson36

*
  •  1,369 1,369
    • View Profile
Thanks for the info. Looks like I'll be better off making up the 'phantom' DROs. Then the proceedure will be visible a year from now or whenever MACH4 is released. If I use undocumented stuff, I'll have a hell of a time figuring out what I did after some time passes.

Incidentally, shoudl I assumen TCP modbus does not work with Win7 64 bit? I get zero reaction from the net card while testing the TCP. On 32 bit systems you can see MACH pinging the port.

Offline BR549

*
  •  6,965 6,965
    • View Profile
I would have thought the TCP would work , could be wrong. I thought the LPT driver was the only part that did not work in 64 bit mode.



(;-) TP
« Last Edit: January 18, 2013, 05:02:25 PM by BR549 »