Hello Guest it is October 16, 2021, 02:14:01 PM

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

1501
Mach3 will run VB in demo.

post your code, and we will see.

1502
VB and the development of wizards / Re: ATC Geneva wheel for mill
« on: April 05, 2018, 08:00:41 AM »
happy to hear that it is working now.

1503
VB and the development of wizards / Re: ATC Geneva wheel for mill
« on: April 05, 2018, 06:44:09 AM »
no your CWPos and CCWPos are not global:


wrong:

Sub Main()
'Global variables declaration

Dim CCWPos as Integer
Dim CWPos as Integer
...

right:

'Global variables declaration

Global CCWPos as Integer
Global CWPos as Integer

Sub Main()
...

1504
VB and the development of wizards / Re: ATC Geneva wheel for mill
« on: April 05, 2018, 06:31:14 AM »
thats why i asked to use the


MSGBox "CW Rotation: " &CWPos

and

MSGBox "CCW Rotation: " &CCWPos

to see that the calculation of steps is right

1505
VB and the development of wizards / Re: ATC Geneva wheel for mill
« on: April 05, 2018, 06:16:34 AM »
the modify

For x=0 To CWPos -1

For y=0 To CCWPos -1

1506
VB and the development of wizards / Re: ATC Geneva wheel for mill
« on: April 05, 2018, 05:52:18 AM »
no you should put this part of code into

main menu -> Operator -> VB Script Editor window

an test the code wirh the green >|| button,
without running any M6 T someting in MDI

Code: [Select]
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)

it is only a prticular test of this part of code

1507
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

1508
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 ?

1509
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

1510
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