Hello Guest it is April 16, 2024, 12:55:50 AM

Author Topic: SetDro(0 ,GetDro(0)/2) in BrainControl  (Read 16331 times)

0 Members and 1 Guest are viewing this topic.

SetDro(0 ,GetDro(0)/2) in BrainControl
« 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

Offline poppabear

*
  • *
  •  2,235 2,235
  • Briceville, TN, USA
    • View Profile
Re: SetDro(0 ,GetDro(0)/2) in BrainControl
« Reply #1 on: January 27, 2008, 07:54:48 PM »
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)
fun times

Offline poppabear

*
  • *
  •  2,235 2,235
  • Briceville, TN, USA
    • View Profile
Re: SetDro(0 ,GetDro(0)/2) in BrainControl
« Reply #2 on: January 27, 2008, 07:58:14 PM »
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
fun times
Re: SetDro(0 ,GetDro(0)/2) in BrainControl
« Reply #3 on: January 28, 2008, 01:12:38 AM »
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


Best regards Gerhard

Offline poppabear

*
  • *
  •  2,235 2,235
  • Briceville, TN, USA
    • View Profile
Re: SetDro(0 ,GetDro(0)/2) in BrainControl
« Reply #4 on: January 28, 2008, 09:43:29 AM »
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
fun times
Re: SetDro(0 ,GetDro(0)/2) in BrainControl
« Reply #5 on: January 30, 2008, 11:22:46 AM »
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





 



 

Offline poppabear

*
  • *
  •  2,235 2,235
  • Briceville, TN, USA
    • View Profile
Re: SetDro(0 ,GetDro(0)/2) in BrainControl
« Reply #6 on: January 30, 2008, 11:45:00 AM »
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
fun times
Re: SetDro(0 ,GetDro(0)/2) in BrainControl
« Reply #7 on: January 30, 2008, 11:47:02 AM »
Hi Gerhard,

maybe you can use this one:



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

Offline poppabear

*
  • *
  •  2,235 2,235
  • Briceville, TN, USA
    • View Profile
Re: SetDro(0 ,GetDro(0)/2) in BrainControl
« Reply #8 on: January 30, 2008, 03:24:16 PM »
I think the booleen operations are bit only as in will look at 1 or 0 only not a 16 bit register
fun times
Re: SetDro(0 ,GetDro(0)/2) in BrainControl
« Reply #9 on: January 30, 2008, 03:51:01 PM »
2nd try

first inactive button:



and active button:



Frank
« Last Edit: January 30, 2008, 04:44:55 PM by jimmybondi »