Machsupport Forum

Third party software and hardware support forums. => CS-Lab => Topic started by: Overloaded on November 16, 2013, 10:31:49 AM

Title: CS w/Brains & Triggers
Post by: Overloaded on November 16, 2013, 10:31:49 AM
Hi folks,
  Setting up CS with the macro call, Brain and Triggers set to 301 to respond to PLC outputs.
The led's on both units indicate the plc out and the CS in, but nothing executes.
Macropump is running, Brain enabled and working ( a separate lobe turns on an output when axis is at 0.000 working fine).
R3.043.057 licensed.
I can emulate the Triggers and they work fine.

Is the CS compatible to use this way ?

I'm at a loss.
Thanks for any help,
Russ :)
 
Title: Re: CS w/Brains & Triggers
Post by: Overloaded on November 16, 2013, 10:40:49 AM
This is what I am referring to :
http://www.machsupport.com/forum/index.php/topic,15120.msg101160.html#msg101160

Thanks
Title: Re: CS w/Brains & Triggers
Post by: Hood on November 16, 2013, 11:29:53 AM
Not really following what you are trying to do.
CS I presume is shorthand for CSMIO/IP-M?
PLC outputs are from  a PLC? Going to ?

What is the macropump doing?
Whats in the Brains?


Hood
Title: Re: CS w/Brains & Triggers
Post by: Overloaded on November 16, 2013, 06:03:55 PM
Hi Hood,
   Here is another post on the topic:
http://www.machsupport.com/forum/index.php/topic,16607.0.html

My setup is almost identical.
Only thing is, I'm doing the button press with the plc, then Mach sends a pulse back to the plc and the plc resumes.

Scripts for OEM Triggers 1,2,3 & 4 are all in one macro. M915
M999 is in the initialization string and sets the trigger macro (915)
Under hotkeys, all 4 triggers are set to 301
.... just like in the example post above.

The plc runs some cylinders and monitors several inputs. It uses 4 outputs tied to 4 inputs on the CSMIO, 1 for each of the 4 triggers.
When conditions dictate, one of the 4 plc outputs will fire.( tried a 1 scan pulse and a 500ms pulse to assure that it's seen by the CSMIO and I can see the leds)
At the end of the 4 trigger scripts, Mach sends a 500ms pulse back to the plc and the plc resumes. (this part works)

As said, I can see the plc output led light up and the CSMIO input led light up simultaneously but none of the triggers (macro) will execute.

I had this method working well before installing the CSMIO .... but don't know if that's my problem or not.
Maybe the plugin affects something ? ? ?

Please let me know if you need more info.
Thanks for your attention Hood,
Russ

Title: Re: CS w/Brains & Triggers
Post by: Hood on November 17, 2013, 08:16:38 AM
Ok so do the OemTrigger LEDs light in Mach?
If not are you sure you have the correct port and pins assigned to the triggers in Ports and Pins?
Hood
Title: Re: CS w/Brains & Triggers
Post by: Overloaded on November 17, 2013, 09:05:25 AM
Where do I monitor the OemTrigger LEDs light in Mach ? Do I need to add them to a screen ?
Emulating w/ the keyboard works, so I'm assuming Mach sees it.

Ports and pins all match.
Thanks Hood
Title: Re: CS w/Brains & Triggers
Post by: Hood on November 17, 2013, 09:10:32 AM
Sorry Russ, talking out my arse, no OEMs for trigger LEDs now I think about it.

Ok so need to get my head round this, you have your macro in your profiles folder, you also have the set trigger macro there, you also have that in the init line. You have the OEM Triggers set in ports and pins and then in system hotkeys they are set to 301.
So where do the Brains come into the equation?

Hood
Title: Re: CS w/Brains & Triggers
Post by: Overloaded on November 17, 2013, 09:30:13 AM
The Brain watches for the button press (input), then executes the script.

I know the brain is enabled and running because the last lobe is working perfectly. Whenever the X axis is at 0.000, output 2 is on.

Thanks again Hood,
Russ
Title: Re: CS w/Brains & Triggers
Post by: Hood on November 17, 2013, 09:35:00 AM
Ok will have to read a bit more of the posts linked above as I am still not seeing why the brain is needed, I was thinking the OEM trigger was all that would be required.

Ok so until then, if you are monitoring the Brain do you see the trigger go green when the appropriate input is active?
Hood
Title: Re: CS w/Brains & Triggers
Post by: Overloaded on November 17, 2013, 09:44:17 AM
The trigger pulse is pretty quick, might have to make it a full second or more to see it graphically.
Will go and try it.
Back soon,
Russ
Title: Re: CS w/Brains & Triggers
Post by: Overloaded on November 17, 2013, 10:09:17 AM
OK, monitoring the Brain, there is NO indication when the CS INput 1 goes active for 500ms. (emulating works perfectly, quick keystroke)
CS port 10, pin 1 (led on CS agrees)
Actually have 4 CS inputss set, all emulate perfectly, none fire from the CS.
Russ
Title: Re: CS w/Brains & Triggers
Post by: Hood on November 17, 2013, 10:32:32 AM
Ok how about forgetting about OEM Triggers, just disable them and set your inputs in the Brain as ModBus inputs.
Hood
Title: Re: CS w/Brains & Triggers
Post by: Hood on November 17, 2013, 10:34:02 AM
BTW I still dont see why the need for triggers and a brain, Maybe just try diabling the Brain and see if that works as I know if some things are duplicated in the CSMIO it wont work.
Hood
Title: Re: CS w/Brains & Triggers
Post by: Overloaded on November 17, 2013, 10:36:05 AM
Ok hood ,
I'll try that.

Also:
Hmmmm ......
Maybe the plugin negates the need for the old Mach way of doing this.

Seems it would work over top of the brain though.
Will try it directly (no brain) shortly.
Thanks,
Russ
Title: Re: CS w/Brains & Triggers
Post by: Overloaded on November 17, 2013, 10:37:28 AM
The only difference is, this needs to run a macro.

Russ
Title: Re: CS w/Brains & Triggers
Post by: Hood on November 17, 2013, 10:39:07 AM
All that is saying is you can use the OEM triggers as you always do in Mach.
In other words set your trigger port and pin number then in system Hotkeys set the OEM code you want to be executed when that OEM Trigger is active.
Hood
Title: Re: CS w/Brains & Triggers
Post by: Overloaded on November 17, 2013, 10:40:07 AM
The only difference is, this needs to run a macro.

Russ
:)
Title: Re: CS w/Brains & Triggers
Post by: Hood on November 17, 2013, 10:42:08 AM
Yes but is 0EM 301 not the OEM for running the macro?
Hood
Title: Re: CS w/Brains & Triggers
Post by: Overloaded on November 17, 2013, 10:46:53 AM
I see that it is .... but why is the Brain included in the previously related topics ? ? ?
I don't completely understand ? ? ?
Will try to slim it down a bit.
Thanks,
Russ
Title: Re: CS w/Brains & Triggers
Post by: Hood on November 17, 2013, 10:50:23 AM
I think they are using two methods, one is using OEM triggers to do the macro trigger, the other is using a Brain from a standard input. You seem to be using both methods and I am thinking that may be screwing things up, so disabling the Brain may get you results.
Then again I may be seeing this all wrong as I have never used this before. I usually just set up the macropump to look for the inputs (Modbus from CSMIO) and it does what I want when they are seen.
Hood
Title: Re: CS w/Brains & Triggers
Post by: Overloaded on November 17, 2013, 11:40:40 AM
I cannot get ANY CS input to OEM trigger anything (macro).

I think I need a very clear, simple example of where I can activate input 1 on the CS, and have IT execute a simple macro.

Thanks, off to chores now.
Russ
Title: Re: CS w/Brains & Triggers
Post by: Hood on November 17, 2013, 11:50:50 AM
Ok Russ,
 what I would do is use the macropump, as an example here is some stuff I do in the macropump.

Ref= GetInbit(100,6)
GoZ10=GetInBit(100,8)
GoZero=GetInBit(100,7)
Clamp=GetInBit(100,10)



  If Ref=1 Then
   DoOEMButton(1024)
   While IsMoving()
   Wend
   DoOEMButton(1023)
   While IsMoving()
   Wend
   DoOEMButton(1022)
   While IsMoving()
   Wend
   
  End If
 
 
 If Clamp=1 Then
  SetModOutput(0,1)
 Else
  SetModOutput(0,0)
 End If
 
 
 If GoZ10=1 Then
  Code"G0Z10"
  End If
 
If GoZero=1 Then
  DoOEMButton(1017)
  While IsMoving()
  Wend
  End If 

In the above example I am using an extra I/O module so the modbus address will be different, if I recall the address of the base unit is 99 but best check on that. Also note that in the "clamp" part that is me sending a signal out to my PLC over serial Modbus and it is not how you would call an output via CSMIO Modbus, you would have to check the CSMIO manual for that.


Hood
Title: Re: CS w/Brains & Triggers
Post by: Overloaded on November 17, 2013, 12:18:57 PM
modbus is new for me.
I'll study a bit on it.
So ...
Will have:
CSMIO-M  inputs 1,2,3 or 4 start the script in the pump that contains ....
If 1, then ******
If 2, then ********
If 3, then ********
If 4, then *******

Is it that simple ?

Thanks
                                         
Title: Re: CS w/Brains & Triggers
Post by: Hood on November 17, 2013, 12:47:24 PM
Not quite that simple Russ,,

I dont really know what things are called and what connections you have but maybe something like the following in your macropump (remember you need to enable macropump and restart Mach for it to load)


Russ1 = GetInBit(99,1)  ' this just sets a friendly name for the input, the input is the modbus address of the device in question and the bit number. The bit number equates to the input number so if using input 0 it would be 0 etc
Russ2 = GetInBit(99,2)
Russ3 = GetInBit(99,3)
Russ4 = GetInBit(99,4)


If Russ1=1 Then
WHATEVER YOU WANT TO HAPPEN GOES HERE
End If

If Russ2= 1 Then
 etc etc etc

As I said earlier I am not sure of the actual address that your IP-M base unit will be, I have put 99 above but that may not be correct. I think if you go to Plugin menu at the top right of Mach then click on the CSMIO entry there, you might see the modbus address.

Also note if using this method you MUST disable the OEM triggers as having any of the Ports and Pins set up to use the same values as the CSMIO Modbus I/O will make nothing work.


Hood
Title: Re: CS w/Brains & Triggers
Post by: Overloaded on November 17, 2013, 08:12:19 PM
That looks doable Hood, thanks.
I don't see any info anywhere regarding the CS-M ModBus address. ... or what com port to use. or if it's even available  ? ?

Going through Art's video again. kinda confusing.
Regards,
Russ
Title: Re: CS w/Brains & Triggers
Post by: Overloaded on November 17, 2013, 11:04:03 PM
Wondering about using ModBus directly to and from the PLC instead ? ? ? Make any sense ? ? ?
Still studying, don't see anything ModBus at the CSMIO ...... yet.
Thanks Hood,
Russ
Title: Re: CS w/Brains & Triggers
Post by: Hood on November 18, 2013, 02:50:23 AM
Russ, the Extra I/O modules manual gives good info regarding the calls you can make with the CSMIO and it also tells you how to work out the address for each module, not the base unit however..
I am not at the workshop yet but if I recall you can go to Plugin Control menu then to CSMIO. In the window that opens there should be a tab with something like Expansion Modules, click that and I think it will give you a list of all modules (inclucding base unit) and it should have the address there. I will confirm whether my memory is correct or not when I get to the workshop.

Modbus via PLC is also easy enough, or rather I should say the way I do it is easy for me ;D
I just use the old serial interface, not the plugin.
Hood
Title: Re: CS w/Brains & Triggers
Post by: Hood on November 18, 2013, 04:57:31 AM
Well just looked and the address is not there so cant remember where I saw it, I will have a search through the manuals and see if I can find it.
Hood
Title: Re: CS w/Brains & Triggers
Post by: Hood on November 18, 2013, 05:20:50 AM
Ok Russ, decided to just go to the wee lathe and disable the limit switch (in ports and pins, so it wouldnt conflict) then write some VB to look at it so I could figure out the address.
It has an IP-S on it but I think it will be the same address for all models base units.
Anyway what I had was

If GetInBit(90,7) Then  ' This is the input I am using for X limit
MsgBox"Switch Closed"
Else
MsgBox"Switch Open"
End If


It worked fine so the address is 90 :) The pin will be whichever you are connected to, starting from 0.
Hood
Title: Re: CS w/Brains & Triggers
Post by: Overloaded on November 18, 2013, 08:32:09 PM
Hey Hood, thanks !

Got that part working well.

Thought there was more to setting it up than that.

Good job, thanks again,
Russ
Title: Re: CS w/Brains & Triggers
Post by: Hood on November 19, 2013, 03:32:16 AM
Quote
Thought there was more to setting it up than that.

There would be if you were not using one of the CSMIO's, for the PP or ESS or....... you could only use one of Machs Inputs, so you would have to set that up and then look at that from the VB. CS-Lab however have added an extra layer in which you can look at any input to the CSMIO and then read its state direct from VB, likewise for OutPuts, you can set the state direct from VB without having to set up a Mach Output.
Hood