Hello Guest it is July 12, 2020, 03:58:42 PM

Author Topic: start-up button  (Read 2744 times)

0 Members and 1 Guest are viewing this topic.

start-up button
« on: July 23, 2009, 10:12:24 AM »
hi everyone

i want to program a button on my lathe screen to home all axis. the button is already there, now i need the program. and don't have a clue where to start.
when i put the button on the screen i cliqued on "execute vb script in mach 3" as the action. here is the sequence i want to do:

- clic on button
- output pin 1 on port 2 for 1 second  (signal to x drive to start homing sequence)
- wait for pin 2 port 2 to turn on  (signal from drive tha x axis is home)
- output pin 3 port 2 for 1 second  (signal to z drive to start homing sequence)
- wait for pin 4 port 2 to turn on  (signal from drive tha z axis is home)
- turn on z axis homed led on screen

obviously the pin numbers are not the ones i will actually use, but that i can figure. any advise on what the program should be and where to put it would be appreciated

Offline Hood

*
  •  25,846 25,846
  • Carnoustie, Scotland
    • View Profile
Re: start-up button
« Reply #1 on: July 23, 2009, 03:09:52 PM »
Heres the VB I have in my RefAll button. My servos dont require that I cancel the Start Homing button right away, do yours require that? I am also doing it over ModBUS but you can do the same with ActivateSignal(OutPut*) etc
Hood


DoOemButton (240)                     'De-Reference All axis
 Sleep(10)
 If GetOemLED (809) Then               'Check that Ref Z LED is RED
  Do
   Call SetModOutput (21,1)             'Activate ModOutPut 20
    If GetInput(19) Then Exit Do       'Loop until ModInPut 18 is seen
    Sleep (10)
    Loop
    End If
    Call SetModOutPut (21,0)            'DeActivate ModOutPut 20
    DoOemButton (1024)                          'Set Z axis Home
 
   
 If GetOemLED (807) Then
  Do
   Call SetModOutPut (20,1)
    If GetInput(18) Then Exit Do
    Sleep (10)
    Loop
    End If
    Call SetModOutPut (20,0)
    DoOemButton (1022)   
Re: start-up button
« Reply #2 on: July 23, 2009, 11:07:40 PM »
thanks, this is exactly what i wanted, i am not using modbus but i guess i can figure out how to use this with SS on port 2. but where do i write this code and how do i attach it to a specific button?

Offline Hood

*
  •  25,846 25,846
  • Carnoustie, Scotland
    • View Profile
Re: start-up button
« Reply #3 on: July 24, 2009, 03:32:14 AM »
What you need to do is set up Inputs/OutPuts to use the pins/port you want so for example you may want to use Output 3 to start the homing routine for the Z axis and InPut 3 for the drives signal to say its home. You would just go to Ports and Pins and asign the port and pin to them. The VB would look something like this

DoOemButton (240)                     'De-Reference All axis
 Sleep(10)
 If GetOemLED (809) Then               'Check that Ref Z LED is RED
  Do
   ActivateSignal(OutPut3)                      'Activate OutPut 3
    If IsActive(Input3) Then Exit Do          'Loop until InPut 3 is seen
    Sleep (10)
    Loop
    End If
    DeActivateSignal(OutPut3)                'DeActivate OutPut 3
    DoOemButton (1024)                          'Set Z axis Home

   If GetOemLED (809) Then               'Check that Ref Z LED is RED
  Do
   ActivateSignal(OutPut4)                      'Activate OutPut 4
    If IsActive(Input4) Then Exit Do          'Loop until InPut 4 is seen
    Sleep (10)
    Loop
    End If
    DeActivateSignal(OutPut4)                'DeActivate OutPut 4
    DoOemButton (1022)                          'Set X axis Home


To put that in the button you need to go to the Operator menu and choose Edit Button Scripts, your button you have should be flashing, click on it then in the editor that pops up put the above VB then choose to save and that should be it.

Hood
« Last Edit: July 24, 2009, 03:35:08 AM by Hood »
Re: start-up button
« Reply #4 on: July 26, 2009, 09:24:11 PM »
everything is working fine thank you