Hello Guest it is March 04, 2021, 11:12:39 AM

Author Topic: System wait macro function help  (Read 1063 times)

0 Members and 1 Guest are viewing this topic.

System wait macro function help
« on: January 27, 2020, 05:26:02 AM »
Hi,

I kindly asking anyone to help me with that macro. I need System wait function, but it doesn't work. What is right command to get it work?  I could get command from input 2, or OemLed 822.

I need that macro for Lathe Bar Fedder.

If GetOemLED(821) Then
   Code "G0 G54 Z110"
   ResetOutBit(90,11)
   SetOutBit(90,9)
        SetOutBit(90,6)
        SetUserLed(1001,1

Else
   ResetOutBit(90,11)
   SetOutBit(90,9)
        SetOutBit(90,6)
        SetUserLed(1001,1)
        SystemWaitFor(INPUT2)
        ResetOutBit(90,9)
        ResetOutBit(90,6)
        Sleep 100
        SetOutBit(90,11)
        SetUserLed(1001,0)
   


End If 



Thank you

Best regards

Gasper

Online TPS

*
  •  2,015 2,015
    • View Profile
Re: System wait macro function help
« Reply #1 on: January 30, 2020, 11:02:11 AM »
Looks like you are using a CSMIO

you can use GetInBit

Code: [Select]


If GetInBit(adr, bit) = False Then
Sleep(50)
End If

anything is possible, just try to do it.
if you find some mistakes, in my bad bavarian english,they are yours.
Re: System wait macro function help
« Reply #2 on: January 31, 2020, 05:49:20 AM »
Looks like you are using a CSMIO

you can use GetInBit

Code: [Select]


If GetInBit(adr, bit) = False Then
Sleep(50)
End If


Hi,

Thank you for answer.

If I use this it will not wait for needed input signal and then continue program.  It will continue if input wont be active. Or I'm I wrong?

Thank you

Best regards

Gasper

Online TPS

*
  •  2,015 2,015
    • View Profile
Re: System wait macro function help
« Reply #3 on: January 31, 2020, 05:53:21 AM »
it will continue program if Input is true

Code: [Select]
If GetOemLED(821) Then
   Code "G0 G54 Z110"
   ResetOutBit(90,11)
   SetOutBit(90,9)
        SetOutBit(90,6)
        SetUserLed(1001,1

Else
   ResetOutBit(90,11)
   SetOutBit(90,9)
        SetOutBit(90,6)
        SetUserLed(1001,1)
        If GetInBit(adr, bit) = False Then
Sleep(50)
End If
        ResetOutBit(90,9)
        ResetOutBit(90,6)
        Sleep 100
        SetOutBit(90,11)
        SetUserLed(1001,0)
   


End If
you Need to replace "adr" and "bit" by your real values.
anything is possible, just try to do it.
if you find some mistakes, in my bad bavarian english,they are yours.
Re: System wait macro function help
« Reply #4 on: January 31, 2020, 06:27:09 AM »
it will continue program if Input is true

Code: [Select]
If GetOemLED(821) Then
   Code "G0 G54 Z110"
   ResetOutBit(90,11)
   SetOutBit(90,9)
        SetOutBit(90,6)
        SetUserLed(1001,1

Else
   ResetOutBit(90,11)
   SetOutBit(90,9)
        SetOutBit(90,6)
        SetUserLed(1001,1)
        If GetInBit(adr, bit) = False Then
Sleep(50)
End If
        ResetOutBit(90,9)
        ResetOutBit(90,6)
        Sleep 100
        SetOutBit(90,11)
        SetUserLed(1001,0)
   


End If
you Need to replace "adr" and "bit" by your real values.
it will continue program if Input is true

Code: [Select]
If GetOemLED(821) Then
   Code "G0 G54 Z110"
   ResetOutBit(90,11)
   SetOutBit(90,9)
        SetOutBit(90,6)
        SetUserLed(1001,1

Else
   ResetOutBit(90,11)
   SetOutBit(90,9)
        SetOutBit(90,6)
        SetUserLed(1001,1)
        If GetInBit(adr, bit) = False Then
Sleep(50)
End If
        ResetOutBit(90,9)
        ResetOutBit(90,6)
        Sleep 100
        SetOutBit(90,11)
        SetUserLed(1001,0)
   


End If
you Need to replace "adr" and "bit" by your real values.

Can you please check attached macro and look what is wrong in it, coz I have sytax error.   And please repair, coz I believe there are errors in it, coz I'm beginner with marcos...
« Last Edit: January 31, 2020, 06:29:46 AM by BGelektronika »
Re: System wait macro function help
« Reply #5 on: January 31, 2020, 06:27:39 AM »
Could we also change instead 'If GetOemLed (821)' to If GetInBit(90,16) ? 

Here Is attachment.

Online TPS

*
  •  2,015 2,015
    • View Profile
Re: System wait macro function help
« Reply #6 on: January 31, 2020, 06:38:13 AM »
Code: [Select]

If GetInBit(90,16) Then                 'Bar end signal
Code "G0 G54 Z110"              'Clear to make space for Bar fedder to push remnant out
ResetOutBit(90,11)              'Collet close reset
SetOutBit(90,9)                 'Collet Open
        SetOutBit(90,6)                 'Collet Open
        SetUserLed(1001,1)              'Set Collet open LED ON
        If GetInBit(90,17) = False Then 'Wait for Start signal from Bar fedder                   
                Sleep(50)
        End If
        Code "G0 G54 Z-35"              'Position stopper at top cut position
                Sleep(1000)
        If GetInBit(90,17) = False Then 'Wait for Start signal from Bar fedder                   
                Sleep(50)
        End If
        ResetOutBit(90,9)               'Reset Collet Open
        ResetOutBit(90,6)               'Reset Collet Open
        SetOutBit(90,11)                'Collet Close
        Sleep(100)
        SetUserLed(1001,0)              'Set Collet open LED OFF
        Sleep(2000)
Else
ResetOutBit(90,11)              'Collet close reset
Sleep(100)
SetOutBit(90,9)                 'Collet Open
        SetOutBit(90,6)                 'Collet Open
        SetUserLed(1001,1)              'Set Collet open LED ON
        If GetInBit(90,17) = False Then 'Wait for Start signal from Bar fedder
                Sleep(50)
        End If       
        ResetOutBit(90,9)               'Reset Collet Open
        ResetOutBit(90,6)               'Reset Collet Open
        SetOutBit(90,11)                'Collet Close
        Sleep(100)
        SetUserLed(1001,0)              'Set Collet open LED OFF
        Sleep(2000)
End If 




anything is possible, just try to do it.
if you find some mistakes, in my bad bavarian english,they are yours.
Re: System wait macro function help
« Reply #7 on: January 31, 2020, 07:14:17 AM »
Code: [Select]

If GetInBit(90,16) Then                 'Bar end signal
Code "G0 G54 Z110"              'Clear to make space for Bar fedder to push remnant out
ResetOutBit(90,11)              'Collet close reset
SetOutBit(90,9)                 'Collet Open
        SetOutBit(90,6)                 'Collet Open
        SetUserLed(1001,1)              'Set Collet open LED ON
        If GetInBit(90,17) = False Then 'Wait for Start signal from Bar fedder                   
                Sleep(50)
        End If
        Code "G0 G54 Z-35"              'Position stopper at top cut position
                Sleep(1000)
        If GetInBit(90,17) = False Then 'Wait for Start signal from Bar fedder                   
                Sleep(50)
        End If
        ResetOutBit(90,9)               'Reset Collet Open
        ResetOutBit(90,6)               'Reset Collet Open
        SetOutBit(90,11)                'Collet Close
        Sleep(100)
        SetUserLed(1001,0)              'Set Collet open LED OFF
        Sleep(2000)
Else
ResetOutBit(90,11)              'Collet close reset
Sleep(100)
SetOutBit(90,9)                 'Collet Open
        SetOutBit(90,6)                 'Collet Open
        SetUserLed(1001,1)              'Set Collet open LED ON
        If GetInBit(90,17) = False Then 'Wait for Start signal from Bar fedder
                Sleep(50)
        End If       
        ResetOutBit(90,9)               'Reset Collet Open
        ResetOutBit(90,6)               'Reset Collet Open
        SetOutBit(90,11)                'Collet Close
        Sleep(100)
        SetUserLed(1001,0)              'Set Collet open LED OFF
        Sleep(2000)
End If 





I have test it now and It does not wait for signal, it just goes forward. What I'm I doing wrong?

I really appreciate for help.
Re: System wait macro function help
« Reply #8 on: January 31, 2020, 07:35:48 AM »
It is working!

It is not GetInBit(xx,xx)  but GetInput(xx)
Re: System wait macro function help
« Reply #9 on: January 31, 2020, 07:52:57 AM »
Well I was wrong. It still does not wait for signal, it just goes forward. How to tell him to wait for signal to be active, and then continue?