Machsupport Forum

Mach Discussion => VB and the development of wizards => Topic started by: Holk on February 21, 2021, 01:33:01 AM

Title: OEMtrig
Post by: Holk on February 21, 2021, 01:33:01 AM
Hi...

I have a question.

I would like to have 5 buttons to work, and the first one i have set to OEMtrig#1000, set all in pin and ports... and it work, when i push it start the machine, but i would like it to turn on the led in the button when i push, and the 4 other should be turn off, so i have try to make a little script, but i this its here some is wrong
If isactive (oemtrig1) then
activatesignal(output2)
end if

And so on...

but the light do not turn on, the machine start when i push but no light, i have write in the file name in the ini string, so it should be loaded, and i have set it to load when " reset "

Any good ideas ?

Just to test i have change the activ low, just to see if they work, and all 5 buttons do work, so i think it the script or ?

Thank you in advance 
Title: Re: OEMtrig
Post by: TPS on February 21, 2021, 04:04:52 AM
you have to create two scripts.

first lets say it is M333.M1s

Code: [Select]
SetTRiggerMacro 334            'Set Macro M334 for OEM-Code 301

M333 Needs to be added to init string

the entire macro will be M334.M1S
Code: [Select]
If IsActive (OEMTRIG1) Then
  activatesignal(output2)
End If

this will do the necessary code.

every OEMTRIG witch should call M334.M1s must be Setup with OEMCode 301 in System Hetkey Setup
Title: Re: OEMtrig
Post by: Holk on February 21, 2021, 05:02:41 AM
Super answer...

i will try to make 2 files, but if all 5 OEMtrig should be set to 301, to read the script, then i would maybe tell in the script what OEM function i want ?
so it know that i want function 1000 on oemtrig 1 and it should turn on output 2 ?

So the first file M333 tell... when a oemtrig will be activatet, look in file 334 ?
Title: Re: OEMtrig
Post by: TPS on February 21, 2021, 05:27:11 AM
i will try to make 2 files, but if all 5 OEMtrig should be set to 301, to read the script, then i would maybe tell in the script what OEM function i want ?
exactly
 
so it know that i want function 1000 on oemtrig 1 and it should turn on output 2 ?

so set OEMcode for OEMTRIG1 to 301 and the in the macroscript 304 :
Code: [Select]
If IsActive (OEMTRIG1) Then
  DoOEMButton(1000)
  activatesignal(output2)
End If


So the first file M333 tell... when a oemtrig will be activatet, look in file 334 ?
thats the was it is.[/code]
Title: Re: OEMtrig
Post by: Holk on February 21, 2021, 05:46:38 AM
Do you think it could look like this


( For start function )
If IsActive (OEMTRIG1) Then
  DoOEMButton(1000)
  activatesignal(output2)
  deactivatesignal(output3)
  deactivatesignal(output4)
  deactivatesignal(output5)
  deactivatesignal(output6)
End If

( For stop function )
If IsActive (OEMTRIG2) Then
  DoOEMButton(1003)
  activatesignal(output3)
  deactivatesignal(output2)
  deactivatesignal(output4)
  deactivatesignal(output5)
  deactivatesignal(output6)
End If

and so on ?
Title: Re: OEMtrig
Post by: TPS on February 21, 2021, 06:11:23 AM
yes thats it.
Title: Re: OEMtrig
Post by: Holk on February 21, 2021, 07:03:31 AM
Now i have try and its almost work...

When i push it do the function, and there come light in, i have try with start, but it i then push stop nothing happen, but if i change oem code in the script so i start on another button then this work, its like it only read one button, and not read the rest
Title: Re: OEMtrig
Post by: Holk on February 21, 2021, 07:14:57 AM
One more... when i push start it say in status Line... cannot reverse run from present feedhold 🤔
Title: Re: OEMtrig
Post by: TPS on February 21, 2021, 09:41:15 AM
try to use this, only to see witch Trigger Comes up:

Code: [Select]

( For start function )
If IsActive (OEMTRIG1) Then
  MSGBox "Trigger 1 hit!"
  DoOEMButton(1000)
  activatesignal(output2)
  deactivatesignal(output3)
  deactivatesignal(output4)
  deactivatesignal(output5)
  deactivatesignal(output6)
End If

( For stop function )
If IsActive (OEMTRIG2) Then
  MSGBox "Trigger 2 hit!"
  DoOEMButton(1003)
  activatesignal(output3)
  deactivatesignal(output2)
  deactivatesignal(output4)
  deactivatesignal(output5)
  deactivatesignal(output6)
End If



Title: Re: OEMtrig
Post by: Holk on February 21, 2021, 11:33:05 AM
thanks i will try later today... do you know it oemtrig should have low activ or not ? and i guess output should be with out low activ
Title: Re: OEMtrig
Post by: TPS on February 21, 2021, 11:47:52 AM
low or high active depends on how your Inputs are connected.

for are quick try you can assign port/pin pin to spare Input and check on diagnostic page
via led's for right Level.
Title: Re: OEMtrig
Post by: Holk on February 22, 2021, 09:56:32 AM
So i have try it... and it give the msg on all of them, and when i push there come light in, but if i push oemtrig 1 the machine start, and it i after push oem3 to stop it nothing happen, but it i reset again and push oem3 them i light and stop activate, but i can only push one oem, and then it do not react

My idea

Make a file pr oem and in the Main file write a triggermacro Line with all the file names

Oemtriggermacro 334
Oemtriggermacro 335
Oemtriggermacro 336
 

As example ?

Or do you have an idea why its only read one oemtrig ?
Title: Re: OEMtrig
Post by: TPS on February 22, 2021, 10:17:23 AM
in the sample code oemtrig2 is for stopping not oemtrig3

you can Setup only one triggerfile

pls post your m333.m1s and m334.m1s and a screenshot of your System hotkey Setup Screen.
Title: Re: OEMtrig
Post by: Holk on February 22, 2021, 01:27:47 PM
i have call it 1919 and 1920 i should not make any difference
Title: Re: OEMtrig
Post by: Holk on February 22, 2021, 01:28:11 PM
little more
Title: Re: OEMtrig
Post by: TPS on February 22, 2021, 02:30:05 PM
have you tryed to disable achtive Low?
Title: Re: OEMtrig
Post by: Holk on February 22, 2021, 02:37:31 PM
real i think... not from keyboard
Title: Re: OEMtrig
Post by: Holk on February 22, 2021, 02:37:53 PM
from the box
Title: Re: OEMtrig
Post by: TPS on February 22, 2021, 02:41:46 PM
have you tryed to disable achtive Low?
Title: Re: OEMtrig
Post by: TPS on February 22, 2021, 02:44:54 PM
this files are running, i have tested them.
Title: Re: OEMtrig
Post by: Holk on February 23, 2021, 03:24:21 AM
Cool... when i come home today i will try your files, i can see they are little different then mine...

I write later today, thank you for help
Title: Re: OEMtrig
Post by: Holk on February 23, 2021, 11:40:26 AM
So... i have try, and it work, first 1-2-3-4-5 blink and its done, i think its because all are true, maybe i should make oem1 true and 2-3-4-5 false

And oem 2 true and 1-3-4-5 false

Could that work