Hello Guest it is April 25, 2024, 05:26:18 AM

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - TPS

1811
VB and the development of wizards / Re: ATC Geneva wheel for mill
« on: April 05, 2018, 05:17:17 AM »
then put this part of code:

Function CW()'Rotation CW
   Dim x As Integer
   Dim CTPos As Integer 'Carrousel Tool Position Relative to OldTool Position
   CTPos=0

CWPos = 2

   ActivateSignal(OUTPUT9)'Turns the AC Motor On cw
   Sleep(50)

   For x=0 To CWPos
      While IsActive(INPUT4)'Wait for INPUT4 is off
        Sleep(10)
      Wend
      While Not IsActive(INPUT4)'Wait for INPUT4 is on
        Sleep(10)
      Wend
   Next x
   CTPos=x
   DeactivateSignal(OUTPUT9)

End Function


into Operator -> VB Script Editor  window  and use the green >|| button to step through code to see what is going on

1812
VB and the development of wizards / Re: ATC Geneva wheel for mill
« on: April 05, 2018, 05:02:17 AM »
so direction an number of step's where right ?

1813
VB and the development of wizards / Re: ATC Geneva wheel for mill
« on: April 05, 2018, 04:56:11 AM »
for the next add two msgbox instructions, to see that the right fuction is called, and the right Count is calculated


Function CW()'Rotation CW
   Dim x As Integer
   Dim CTPos As Integer 'Carrousel Tool Position Relative to OldTool Position
   CTPos=0

MSGBox "CW Rotation: " &CWPos

   ActivateSignal(OUTPUT9)'Turns the AC Motor On cw
   Sleep(50)

   For x=0 To CWPos
           While IsActive(INPUT4)'Wait for INPUT4 is off
      Sleep(10)
      Wend
           While NOT IsActive(INPUT4)'Wait for INPUT4 is on
      Sleep(10)
      Wend
        Next x
    CTPos=x
   DeactivateSignal(OUTPUT9)

End Function

Function CCW()'Rotation CCW
   Dim y As Integer
   Dim CTPos As Integer 'Carrousel Tool Position Relative to OldTool Position
   CTPos=0

MSGBox "CCW Rotation: " &CCWPos


   Activatesignal(OUTPUT9)'atc motor revirsing relay
   ActivateSignal(OUTPUT10)'Turns the AC Motor On
    Sleep(50)
   
     For y=0 To CCWPos
           While IsActive(INPUT4)'Wait for INPUT4 is off
      Sleep(10)
      Wend
           While NOT IsActive(INPUT4)'Wait for INPUT4 is on
      Sleep(10)
      Wend
        Next y
   CTPos=y
   DeactivateSignal(OUTPUT9)
   Deactivatesignal(OUTPUT10)'atc motor revirsing relay
End Function

1814
VB and the development of wizards / Re: ATC Geneva wheel for mill
« on: April 05, 2018, 04:40:04 AM »
see my last post on page 1

1815
VB and the development of wizards / Re: ATC Geneva wheel for mill
« on: April 05, 2018, 04:31:48 AM »
sorry seems i going to get bild

Function CW()'Rotation CW
   Dim x As Integer
   Dim CTPos As Integer 'Carrousel Tool Position Relative to OldTool Position
   CTPos=0
   ActivateSignal(OUTPUT9)'Turns the AC Motor On cw

   Sleep(50)

   For x=0 To CWPos
           While IsActive(OEMTrig9)'Wait for OEMTrig9 is off
      Sleep(10)
      Wend
           While NOT IsActive(OEMTrig9)'Wait for OEMTrig9 is on
      Sleep(10)
      Wend

            x=x+1
        Next x
this is wrong,not needed, the for next Loop is counting itselv.

1816
VB and the development of wizards / Re: ATC Geneva wheel for mill
« on: April 05, 2018, 04:24:43 AM »
if you put some Addition MSGBox instruction to your CW Routine you can how often
Input gets triggered

Function CCW()'Rotation CCW
   Dim y As Integer
   Dim CTPos As Integer 'Carrousel Tool Position Relative to OldTool Position
   CTPos=0
   Activatesignal(OUTPUT9)'atc motor revirsing relay
   ActivateSignal(OUTPUT10)'Turns the AC Motor On
    Sleep(50)
    
     For y=0 To CCWPos
           While IsActive(OEMTrig9)'Wait for OEMTrig9 is off
      Sleep(10)
      Wend
MSGBox "Input is off"
           While NOT IsActive(OEMTrig9)'Wait for OEMTrig9 is on
      Sleep(10)
      Wend
MSGBox "Input is on"
            y=y+1
        Next y
   CTPos=y
   DeactivateSignal(OUTPUT9)
   Deactivatesignal(OUTPUT10)'atc motor revirsing relay
End Function

1817
VB and the development of wizards / Re: ATC Geneva wheel for mill
« on: April 05, 2018, 03:50:34 AM »
so why do you not read the Input drectly.
this work 100%, if have used it many times.

for eample

While GetCsmioIn(91,15) = False  
   Sleep(20)
Wend


'CSMIO read input
Public Function GetCsmioIn (ByVal adr As Integer, ByVal n As Integer) As Boolean
   If(GetInBit(adr, n)) Then
      GetCsmioIn = true
   Else
      GetCsmioIn = false
   End If
End Function




here is a links witch Shows the adresses:

http://en.cs-lab.eu/wp-content/uploads/2016/06/csmio-ip-s-konfiguracja-we_wy-artykul.pdf


1818
a simple search for "tooltable Import" in the Forum:

http://www.machsupport.com/forum/index.php/topic,27640.0.html

1819
VB and the development of wizards / Re: centerpiece full (change)
« on: April 05, 2018, 01:43:43 AM »
Rem VBScript To center probe outside diameter Metric Version
Speak (" psizionarsi CINQUE millimetri sopra il pezzo") 'Avviso Vocale
response = MsgBox ("   5 mm    SOPRA IL PEZZO")

Sleep (1000) ' pausa di 1 secondi
Speak (" CONFERMARE centro pezzo pieno") 'Avviso Vocale
Message "INIZIO CENTRO PEZZO PIENO"
Sleep (1000) ' pausa di 1 secondi
response = MsgBox ("CONFERMARE CENTRO PEZZO PIENO")
 
CurrentFeed = GetOemDRO(818) 'Get the current feedrate to return to later
CurrentAbsInc = GetOemLED(48) 'Get the current G90/G91 state
CurrentGmode = GetOemDRO(819) 'Get the current G0/G1 state
CurrentToolDiameter = GetOemDRO(43) 'gets the current tool diameter

If GetOemLed (825) <> 0 Then 'Check to see if the probe is already grounded or faulty

    Call ProbeGrounded()
    Exit Sub

Else

    XCurrent = GetDro(0)
    YCurrent = GetDro(1)
    OutsideDiameter = GetUserDRO(1152)

    Code "G4 P1" 'Pause 1 second to give time to position probe plate
    While IsMoving ()
    Wend
    Call SetDro (0,0.000)
    While IsMoving ()
    Wend
    Call SetDro (1,0.000)
    Code "F50" 'slow feed rate to 100mm/sec
    Code "G90 G0 X" &XNew + OutsideDiameter * .6
    Code "G91 G0 Z-10"



anyhow this XNew is set nowhere before it is used.


1820
VB and the development of wizards / Re: centerpiece full (change)
« on: April 05, 2018, 01:40:44 AM »
Rem VBScript To center probe outside diameter Metric Version
Speak (" psizionarsi CINQUE millimetri sopra il pezzo") 'Avviso Vocale
response = MsgBox ("   5 mm    SOPRA IL PEZZO")

Sleep (1000) ' pausa di 1 secondi
Speak (" CONFERMARE centro pezzo pieno") 'Avviso Vocale
Message "INIZIO CENTRO PEZZO PIENO"
Sleep (1000) ' pausa di 1 secondi
response = MsgBox ("CONFERMARE CENTRO PEZZO PIENO")
 
CurrentFeed = GetOemDRO(818) 'Get the current feedrate to return to later
CurrentAbsInc = GetOemLED(48) 'Get the current G90/G91 state
CurrentGmode = GetOemDRO(819) 'Get the current G0/G1 state
CurrentToolDiameter = GetOemDRO(43) 'gets the current tool diameter

If GetOemLed (825) <> 0 Then 'Check to see if the probe is already grounded or faulty

    Call ProbeGrounded()
    Exit Sub

Else

    XCurrent = GetDro(0)
    YCurrent = GetDro(1)
    OutsideDiameter = GetUserDRO(1152)

    Code "G4 P1" 'Pause 1 second to give time to position probe plate
    While IsMoving ()
    Wend
    Call SetDro (0,0.000)
    While IsMoving ()
    Wend
    Call SetDro (1,0.000)
    Code "F50" 'slow feed rate to 100mm/sec
    Code "G90 G0 X" &XNew + OutsideDiameter * .6
    Code "G91 G0 Z-10"

Rem Probe Left

    XNew = Xcurrent - OutsideDiameter * .6
    Code "G31 X" &XNew
    While IsMoving() 'wait for the move to finish
    Wend
    XPos1 = GetVar(2000) 'get the probe touch location
    Code "G91 G0 X2"
    Code "G91 G0 Z10"
    Code "G90 G0 X" &XCurrent 'rapid move back to start point
    Code "G91 G0 X" &XCurrent - OutsideDiameter * .6
    Code "G91 G0 Z-10"

Rem Probe Right

    XNew = XCurrent + 75 'probe 75mm to right
    Code "G31 X" &XNew
    While IsMoving()
    Wend
    XPos2 = GetVar(2000)
    Code "G91 G0 X-2"
    Code "G91 G0 Z10"
    XCenter = (XPos1 + XPos2) / 2 'center is midway between XPos1 and XPos2
    Code "G90 G0 X" &XCenter 'rapid move to the x center location
    While IsMoving ()
    Wend
    Call SetDro (0,0.000)
    Code "G4 P0.25"
    Code "G90 G0 Y" &YNew - OutsideDiameter * .6
    Code "G91 G0 Z-10"

Rem Probe up

    YNew = YCurrent + 75
    Code "G31 Y" &YNew
    While IsMoving()
    Wend
    YPos1 = GetVar(2001)
    Code "G91 G0 Y-2"
    Code "G91 G0 Z10"
    Code "G90 G0 Y" &YCurrent
    Code "G91 G0 Y" &YCurrent + OutsideDiameter * .6
    Code "G91 G0 Z-10"

Rem Probe down

    YNew = YCurrent - 75
    Code "G31 Y" &YNew
    While IsMoving()
    Wend
    YPos2 = GetVar(2001)
    Code "G91 G0 Y2"
    Code "G91 G0 Z10"
    YCenter = (YPos1 + YPos2) / 2

Rem move To the center

    Code "G90 G0 Y" &YCenter
    While IsMoving ()
    Wend
    Call SetDro (1,0.000)
    While IsMoving ()
    Wend
    Call SetUserDro (1152,YPos2 - YPos1 - CurrentToolDiameter)

    Code "G4 P0.25"

    Code "F" &CurrentFeed 'restore starting feed rate
   Call ReturnG90G91State()
   Exit Sub
End If
 
Sub ProbeGrounded()
   Code "(Probe plate is grounded, check connection and try again)"
   Call ReturnG90G91State()
End Sub

Sub ReturnG90G91State()
   If CurrentAbsInc = 0 Then 'if G91 was in effect before then return to it
      Code "G91"
   End If
   If CurrentGMode = 0 Then 'if G0 was in effect before then return to it
      Code "G0"
   End If
   
   
End Sub