Machsupport Forum
Mach Discussion => Brains Development => Topic started by: sams_n on January 27, 2008, 12:28:54 PM
-
Hi,
I want to run this simpe Code in BrainControl.
Dim taste as Integer
Taste = GetInput (70)
Select Case Taste
Case = 1
SetDro(0 ,GetDro(0)/2)
Case = 2
SetDro(1 ,GetDro(1)/2)
Case = 3
SetDro(2 ,GetDro(2)/2)
End Select
Have anybody an idea how I can do this in a BrainControl.
I only want to divide a Dro Value when some Input Signal comes in.
Best regards ,
Gerhard
-
Ok here you go:
This Brain is called "Taste Brain" and what it does is take the value of UserDRO(1700), and uses a compare statement, if it meets the criteria it will scale that axis. NOTE: When you first load the Brain your scaling LEDs may blink that is ok, just push the reset scaling or G50.
When the 1700dro is 1, x is scaled by2, etc. for the Y and Z. (you can change 1700 to what ever is good for your needs).
the Brain is mutually exclusive only one axis can be scaled at a time with the UserDRO.
I have enclosed a Screen Shot of the Brain, and a Zip file with the Brain in it (works as of 3.0)
I have put a Test Script that you can step through on the VB scripter to watch its function.
Scott
'Scaling DRO Script
SetUserDRO(1700,1)
SetUserDRO(1700,2)
SetUserDRO(1700,3)
SetUserDRO(1700,0)
-
Note: you could add another Rung that when 1700=0 it would reset the scaling to "1.00" for you and that would stop the scaling led lights blinking unless your 1700 was active or you changed it by entering someing the usual ways.
Scott
-
Hi Scott,
thank you for the quick answer.
But I think , what you wrote is not that what i want to do.
What i need is: to change a DRO value when I press a button, but i cant find a function in BrainControl
(http://festplatte.aon.at/a/filemanager.get/1108120/brain1.jpg)
Best regards Gerhard
-
In your request, you showed an example of an input changing value from 1-3, only a DRO will do that, OEMTriggers are on or off only.
Here is the Brains that will work, it is set up for OEMTRIG1,
each time you push the trigger, it will increment by 1, as
it increments it will scale each axis as it meets the criteria.
At 4, the other Brain (I had to make two since the multilple glitch
happened at that point), has the reset the counter DRO.
The TWO Brains as screenshots are posted, and they are in a Zip
for you to try out.
Here is a VB scripter Testing macro for you to step through and
watch its function on the Brain view.
'Taste2 Brain test macro
ActivateSignal(OEMTRIG1)
DeActivateSignal(OEMTRIG1)
ActivateSignal(OEMTRIG1)
DeActivateSignal(OEMTRIG1)
ActivateSignal(OEMTRIG1)
DeActivateSignal(OEMTRIG1)
ActivateSignal(OEMTRIG1)
DeActivateSignal(OEMTRIG1)
'scott
-
Hi scott,
thanks for your answer.
But I cant use a scale funktion, that is not that what I need.
What I need is :
If A=1 then
B=B/2
end if
I am missing many functions in braincontrol and I hope that there comes more functions in the next time with the next versions of mach3.
An other missing function ist the output of DRO values with modbus.
Presently we need many Brains to do that.
There is the sendstring command to send text but not to send DRO values , its a pity.
Best regards , Gerhard
-
Then I dont understand you original request. You wanted the Axis to divide by 2 then make that the amount the axis moves, and that is what Scaling the Axis by 50% does.........
So perhaps you could go into much more detail to Clairfy what it is, that you do want, since for the life of me, I Cant see what it is.
scott
-
Hi Gerhard,
maybe you can use this one:
(http://irc.global-radio.ch/img/maybe.png)
i used any input (input #1), any DRO (X Pos) and as destination a Modbus-register
you have to apply to your requirements :-)
Not sure if it works well but an attemp
Frank
-
I think the booleen operations are bit only as in will look at 1 or 0 only not a 16 bit register
-
2nd try
first inactive button:
(http://irc.global-radio.ch/img/Inactive.png)
and active button:
(http://irc.global-radio.ch/img/Active.png)
Frank
-
that wont work since you need to start at zero, also as your first equation keeps adding up, only the value of 1, will give you a half value after that your dro value is climbing to no change at 2, and it continues to climb in multimple of the original value.......
scott
-
sry - i don't understand what you mean
can you give a sample ?
Frank
-
his original post, as I understand it, he wanted a singlular input that each time you push it, (and it starts at zero value).
Then when he pushes the button the first time, the X axis current value is divided by 2 and then reposted into the X position dro.
When he incremnts by pushig the button again the Y axis value is cut in half and then reposted to the Y dro.
next press (value is now 3), does the Z, at value higher it then resets everyting back to zero w3ith standard "true" axzis positions.
Since theser are temporary, I dont understand why scaling wont work for him since it would do exaclty that.
scott
-
ah ok
i have taken his last words of the first post:
I only want to divide a Dro Value when some Input Signal comes in.
and thats what the brain do
Frank