Hello Guest it is March 29, 2024, 11:30:23 AM

Author Topic: How to activate more then one macro with diffrent OEM Trigger Inputs ????  (Read 9847 times)

0 Members and 2 Guests are viewing this topic.

Offline Hood

*
  •  25,835 25,835
  • Carnoustie, Scotland
    • View Profile
Sorry that link was for the CSMIO/IP-A and I am not sure which one you have, I presume IP-S or IP-M as you mention steps.
You will find the info for all here
http://www.cs-lab.eu/en/artykul-128-Digital_and_analog_IOs__configuration__its_easy.html

Hood
Sorry that link was for the CSMIO/IP-A and I am not sure which one you have, I presume IP-S or IP-M as you mention steps.
You will find the info for all here
http://www.cs-lab.eu/en/artykul-128-Digital_and_analog_IOs__configuration__its_easy.html

Hood

No problems, I have CSMIO/IP-S, need to read that , probably did not paid much attention.

Thx for help.
Here is update, manage to solve problem of oilpump to work automatically , by myself (that is important, just kidding).

Here is in video what I did

https://youtu.be/G*********qxjDDw?t=2s

So to recapitulate what all I tried before I came to this solution.

First I made macro that controls oil pump and it is activated/triggered over button that I add in mach3 screen by program machscreen editor (it is free), and in my case I connected input that counts impulses on input Index and pressure switch from oil pump (that serves for detection is there any oil and is pump in working condition ) on Timing input, as I  use CSMIO/IP-S as I concluded I can treat those inputs(Index and Timing ) as regular inputs (Input 1 to 4) and I used them because I I thought I have only those 4 inputs.

So macro for for controlling oil pump works correct when is executed over button (I named it Auto lube) and everything work OK until E-stop is activated , I made macro for oil pump to save how many impulses is counted in file named oilpump.txt so I can have exact number of counted impulses even if I close Mach3 and open it again (for that I need to delete from code part that initializes counter of impulses on zero every time I press Auto Lube button).

So next I thought that problem that I have by stopping macro by Estop can be easily solved by inserting code in macropump (like Hood said it is macro but it executes cyclic after you turn on mach3, you do not need to press any buttons or switches , you just need to adjust in general config that you want to use it, just check box where it say macropump and that is it, escape mach3 and come back and it should work, and inside of macropump you can put what ever you want that need  checks to be executed cyclic (from my experience, I put inside logic that checks do I want to open or close power chuck, and now will need to put same logic for tailstock, and most important thing that I discovered you need to put inside of macropump SetOEMTrigger(*********) function).

So as I wanted to cyclic run code that will count impulses in order to control oil pump I put code inside of macropump, and I thought, OK it will work same as in macro triggered by button (Auto lube), but it does not work , why, probably because of code that is necessary for macro for counting impulses, it needs to detect is it rising edge present (otherwise if sensor is active , macro will count presence  of sensor same as timing pulley made one revolution which is not good , because of that it needs to count changes not presence  , and other thing is that data is saved in file (and file needs to be open and closed), anyway probably that goes from some reason slow in macropump and because of that it misses to count impulses (it counts but not accurate).

And only solution till now that I can use is to use code over macro triggered by Auto lube button, but in that way macro counts correct but it is stopped when Estop is activated, I have nothing against   stopping because I will not get wrong data but I need to manually press activate pump and I can easily forget to press button, so after reading forums I discovered that there exist brains in mach3, only problem I never used them and have no clue what that should be, it sounds complicated "brain" haha. It is similar to ladder diagram for programing PLC, so you can activate output by input and you can between insert some logic and as I read they are faster then macros.

So I had simple idea, when Estop is acknowledged (I need to press RESET) if I want to start macro for oilpump (I named it m555.m1s) , so if Estop is triggered I must press RESET if I want to continue to work, I can not forget to press it.

And after experimenting with bits that I tested before (some OEM cods) I gradually came to solution to choose brain and make some logic, I guess.

So when Estop (LED with code 800) is not turned on , it needs to activate OEMTrigger1 which triggers macro (m555.m1s), Estop and OEMTrigger1 are connected over (no operation inverted), and as I described in macropump needs to be SetOEMTrigger(555) .

How that works, macropump is cyclic running and inside of it is SetOEMTrigger(555) and it waits for OEMTrigger1 to be activated (in  System HotKeys Setup under Triggerer#1 is selected code 301, and that means when OEM Trigger#1 input is activated it will trigger my macro m555.m1s , and that will happen when I press on button RESET (for that need to be no operation inverted).

Hope you can follow idea and what I did, in that way I do not need to worry about oil pump at all because it will automatically be under control of macro555 (it is script because I do not made button for it, script/macro all the same to me) and information about how many impulses is counted is in file oilpump.txt, I just need to worry is there enough oil in reservoir :)

I do not know why link for video is wrongly showed *******, I did not wrote those symbols

If you are interested in video try to copy paste this in youtube search :

Macropump Macro Mach3 Brain OEMTrigger
« Last Edit: April 10, 2016, 07:27:01 AM by zmajmr »
Here is info on using CSMIO I/O
http://www.cs-lab.eu/en/upload/fotki/Elementy,%20banery/CSMIO-IP-A%20artykuł.jpg

I think there are also examples in the I/O modules manual.

There is stored info in Mach for axis distances but I am not sure if you can get that info from VB or not, you can view it from Operator Menu then Maintenance Hours.
Best bet would be to email Mach Support and see if there are any OEM codes for these DROs.
Hood

Funny update, got this from support before day ago :), I guess this what I did is best that can be done , I do not know...

"Hello Marko, take a look at this thread in our support forum, this user was able to achive what you are look to do and has posted their work there, best regards Jim.

https://www.machsupport.com/forum/index.php/topic,32293.msg224740.html#msg224740


James Dingus Jr.
Tech support staff
To learn the answers to our most Frequently Asked Questions please visit our FAQs page at http://www.machsupport.com/help-learning/f-a-q/