Hello Guest it is March 28, 2024, 07:57:21 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 - xiteamxi

Pages: 1 2 »
1
hello, ended up replacing the motor with a stepper motor coding will be much simpler now, i have one issue i need to solve,

in my new macro i have an equation which works but i need to figure out how to get the answer then move the stepper accordingly

ex.

s = (newtool - 1)*45
code "g00 a(s)"

so if it was tool 5 the equation would be

s = (5-1)*45
code" g00 a180"

when i'm in vb editor and i hover over "S" it will show the answer (ex. 180) but in the code line its not reading "S" as a number

whats the proper way to do that?

2
Hello, i tried that and its much better. i will tinker with it a bit and try to see what the issues, it seems to work fine if i change 1 tool number at a time (ex. t7 to t8) if i go multiple (ex. t1 to t4) it acts up. it seems like it over shoots the sensor some times like the response time is to slow so instead of ending with input1 active it will over shoot and end in a non active state.

Thanks for all your help so far.

3
for the moment i am little bit confused about the ligic of input1 for doing one step of ATC

in the original macro:

--> UNTIL IN4 OR STOPSW
--> REPEAT
--> UNTIL !IN4 OR STOPSW
--> REPEAT
--> UNTIL IN4 OR STOPSW
--> REPEAT
--> UNTIL !IN4 OR STOPSW

it looks like it is ON at the start

then OFF ON OFF ON

to do one step at ATC

please describe the pattern of input1 to do one step.

Thomas

Hello, that correct it will start ON
then OFF ON OFF ON (ending in ON)
this would equal 1 tool position so if i was at tool 1 and ran that id end up at tool 2 if i was at 1 and ran it in ccw it would be tool 8.


4
if its of any help i appear to have found the original macro just need it in a format mach 3 can work with ( output/input numbers may vary since i did update the machine)


REM ~~~~~~~~~~~~~~~ Tool Changer Routines ~~~~~~~~~~~~~~

#ArmIn
  GOSUB SpindleStop
  IF !comms(10) THEN RETURN : REM ignore it if we're none ATC
  IF !(OUT & 1) DO : REM Check spindle is stopped
    OUT3 = 1 : REM Switch the solenoid
    REPEAT : REM Wait for the IN switch (inverse logic)
    UNTIL !IN0 OR STOPSW
    WAIT = 500
  ENDIF
RETURN

#ArmOut
  IF !comms(10) THEN RETURN : REM ignore it if we're none ATC
  OUT3 = 0: REM Switch the solenoid
  REPEAT : REM Wait for the OUT switch (inverse logic)
  UNTIL !IN1 OR STOPSW
  WAIT = 500
RETURN

#ArmDown
  IF !comms(10) THEN RETURN : REM ignore it if we're none ATC
  IF !(OUT & 1) DO : REM Check spindle is stopped
    OUT4 = 1 : REM Switch the solenoid
    REPEAT : REM Wait for the DOWN switch (inverse logic)
    UNTIL !IN3 OR STOPSW
    WAIT = 500
  ENDIF
RETURN

#ArmUp
  IF !comms(10) THEN RETURN : REM ignore it if we're none ATC
  OUT4 = 0: REM Switch the solenoid
   REPEAT : REM Wait for the UP switch (inverse logic)
   UNTIL !IN2 OR STOPSW
  WAIT = 500
RETURN

#DrawbarUnClamp
  IF !comms(10) THEN RETURN : REM ignore it if we're none ATC
  IF !(OUT & 1) DO : REM Check spindle is stopped
    OUT5 = 1
    WAIT = 500
  ENDIF
RETURN

#DrawbarClamp
  IF !comms(10) THEN RETURN : REM ignore it if we're none ATC
  OUT5 = 0
  WAIT = 500
RETURN

#CarouselCW
  IF !comms(10) THEN RETURN : REM ignore it if we're none ATC
  IF !IN3 OR !IN1 DO    :REM If arm is back or down
   OUT7 = 1 : REM Set Direction Output
   OUT6 = 1 : REM Set the Power output
   WAIT = 50
   REPEAT
   UNTIL IN4 OR STOPSW
   REPEAT
   UNTIL !IN4 OR STOPSW
   REPEAT
   UNTIL IN4 OR STOPSW
   REPEAT
   UNTIL !IN4 OR STOPSW
   WAIT = 40
   OUT6 = 0
   Pocket = Pocket + 1 : REM Inc the Pocket Counter
   IF Pocket > MaxPockets THEN Pocket = 1
  ENDIF
RETURN

#CarouselHalf
  IF !comms(10) THEN RETURN : REM ignore it if we're none ATC
  OUT7 = 1 : REM Set Direction Output
  OUT6 = 1 : REM Set the Power output
  WAIT = 50
  REPEAT
  UNTIL IN4 OR STOPSW
  REPEAT
  UNTIL !IN4 OR STOPSW
  WAIT = 40
  OUT6 = 0
RETURN

#CarouselCCW
  IF !comms(10) THEN RETURN : REM ignore it if we're none ATC
  IF !IN3 OR !IN1 DO    :REM If arm is back or down
   OUT7 = 0 : REM Set Direction Output
   OUT6 = 1 : REM Set the Power output
   WAIT = 50
   REPEAT
   UNTIL IN4 OR STOPSW
   REPEAT
   UNTIL !IN4 OR STOPSW
   REPEAT
   UNTIL IN4 OR STOPSW
   REPEAT
   UNTIL !IN4 OR STOPSW
   WAIT = 40
   OUT6 = 0
   Pocket = Pocket - 1 : REM Dec the Pocket Counter
   IF Pocket < 1 THEN Pocket =  MaxPockets
  ENDIF
RETURN

#toolChange
  GOSUB SpindleStop
  if !comms(10) THEN Pocket=Comms(7) : REM store last tool if not ATC
  IF (comms(7) = Pocket) OR !comms(10) THEN RETURN : REM ignore it if we're already there or none ATC
  IF !(OUT & 57) DO :        REM If atc is back,Up and drawbar safe
  IF STOPSW THEN RETURN
  GOSUB ArmIn
  IF STOPSW THEN RETURN
  GOSUB DrawbarUnclamp
  IF STOPSW THEN RETURN
  GOSUB ArmDown

  REM Calculate the shortest path...
  steps = (comms(7) - Pocket + MaxPockets) MOD MaxPockets
  IF steps > (MaxPockets / 2) DO
    WHILE Pocket <> comms(7)
      GOSUB CarouselCCW
    ENDW
  ELSE
    WHILE Pocket <> comms(7)
      GOSUB CarouselCW
    ENDW
  ENDIF

  GOSUB ArmUp
  IF STOPSW THEN RETURN
  GOSUB DrawbarClamp
  IF STOPSW THEN RETURN
  GOSUB ArmOut
  IF STOPSW THEN RETURN
  ENDIF
RETURN

REM ~~~~~~~~~ End of Tool Changer Routines ~~~~~~~

5
Hello, yet again thanks for your help. there is no errors in that macro but it doesn't do what i'm trying to achieve, when i try to go from tool say 1 to tool 2 it just turns on for (about) a second then off getting about half way from t1 to t2. i think the g04 p05 is wrong that was me just trying anything i could think of. What is the correct term for "do until input 1 is not active"? i'm debating replacing the motor with a stepper as i could figure that out but in its current form i seen this atc work with the same sensor/motor/relays on the old less user friendly software so i know it should work.


if i can just get the 2 correct lines for
'activate output 7 until output 1 is not active"
then
"activate output 7 until input 1 is active"
i think it may be a step in the correct direction


Function CW()'Rotation CW
   Dim x As Integer
   Dim CTPos As Integer 'Carrousel Tool Position Relative to OldTool Position
   CTPos=0
   ActivateSignal(OUTPUT7)'Turns the AC Motor On
   Deactivatesignal(output8)'atc motor revirsing relay
   
   code"g04 p05"
   Do Until IsActive(input1)
   sleep(10)

6
i appreciate the attempt but im not sure whats required to achieve my goal I've attempted to look at probing macros ect to learn as they would do a similar task
(if probe input is active move Z+ if not active move Z-)
i'm getting many errors when trying to use the vb editor and not sure how to correct them.


a simple form of what i'm trying to achieve is

turn output 7 on until input 1 is NOT active (when initially turned on the input 1 will be active/home)
 
(then what ever option is easier)

(option 1) have output 7 remain on until input 1 returns to an active state

(option 2) have it shut off once input 1 is NOT active  then turn back on until active again

this cycle above will make it rotate the atc 1/2 of a tool distance so that ran twice will be equal to  1 tool position.


in non vb editor correct form...

activatesignal(output 7) until input 1 is not active
then deactivatesignal(output1)
next
activatesignal(output7) untill input 1 is active
then deactivate signal (output7)
loop the above the amount of times required to get to new atc position (i can work on this part after if needed)

7
Willing to try any suggestions you have and i appreciate the reply. If you have some code i can replace the section im having trouble with and see what happens i can do that.

8
General Mach Discussion / Re: starting a lubrication pump
« on: March 14, 2017, 02:52:03 PM »
hello, looks like that board (c32) has a relays on it you may be able to use those if your not using both for spindle or other items.

Thanks xiteamxi, I think your suggestion will work since I'm using the RJ45 port on the C32 board to allow Mach3 to control the spindle.

I'm still curious as to  how I would control an item like a lube or coolant pump via Mach3.

Regards,
Chuck
 


once the output pin/port number is set you can go to config tab then ports and pins then spindle setup and you will see the coolant relay numbers you can assign the output number that controls the pump here then when the turn coolant on command is seen it will activate. the coolant off code will deactivate it

9
General Mach Discussion / Re: starting a lubrication pump
« on: March 14, 2017, 02:02:30 AM »
hello, looks like that board (c32) has a relays on it you may be able to use those if your not using both for spindle or other items.

10
Hello all, I'm new to the forum but not cnc or mach3(have several machines running it) recently retrofitted a mill (denford triac) and i'm stumped with the atc macro. Any help will be appreciated at this point. The part i'm having an issue with is, i want to activate output 7(while input 1 is active)and have output 7 remain on until input 1 goes inactive and returns active again then deactivate output 7.

some info..
The input is a proximity sensor on the geneva gear drive thats shaped like 3/4 of a circle and is active on the missing 1/4 section
tool charger is 8 position
relays ect are setup
its a reversible ac gear motor driving a geneva gear
1 relay is motor power 1 for reversing
has proximity sensor which i have wired to a relay that grounds a pin to activate (input1)

ive started with a macro i found and edited (for better or worse...)the section below between the "#######" is the main issue but any help is welcome this is v1.0 after all...





Sub Main()
'Global variables declaration
NewTool = GetSelectedTool()
OldTool = GetCurrentTool()

While NewTool > 8
NewTool = Question ("Enter New Tool Number up to " & MaxToolNum)
Wend

If NewTool = OldTool Then'Compare between actual tool and requested tool
   Else
   End If
If NewTool > 8 Then'requested tool higher then tool numbers
   Else
   End If
If NewTool < 1 Then'tool number to low
   Else
   End If

code("m05")
   Call ZatcPosition
   Call AtcIn'Activate air cylinder valve to put old tool back to carrousel
   Call Unclamp'Spindle: Tool Unclamp
   Call AtcDown'lowers atc
   Call LeastTravel'determine the least travel to move and Turns CW or CCW
   Call AtcUp'raises atc
   Call Clamp'Spindle: Tool Clamp
   Call AtcOut'retracts atc
   Call SetUserDRO (1200,NewTool)'Store new tool as actual tool value
SetCurrentTool( NewTool )

End Sub

Function ZatcPosition()'Move to Z tool position and wait until position reached
   code("G53")'Move in Absolute Machine coordinates
   code("G00 Z-1") 'Z value as to be checked for exact match with carrousel height
   While(IsMoving())
      Sleep(100)'temporisation entre while++
   Wend
End Function

Function AtcIn()'Put old tool back to carrousel
      ActivateSignal(OUTPUT4)'Move carrousel air cylinder to the tool change position adjust output# to match atc slide
      code("g04 p01")
End Function

Function Unclamp()'Spindle: Tool Unclamp
       ActivateSignal(OUTPUT6)'Release the tool, adjust output number for drawbar output
code("g04 p01")'pause
End Function

Function AtcDown()'lowers atc to rotate
   ActivateSignal(OUTPUT5)'solonoid to lower atc
   code("G04 p01")'pause
End Function

'Sequence to determine the least travel to move for TC, CW or CCW
Function LeastTravel()
   NewTool = GetSelectedTool()
   OldTool = GetCurrentTool()
   NTool = 8 ' Number of tools changer holds
   CWPos = GetSelectedTool() - GetCurrentTool() ' Assume a CW move
   If CWPos < 0 Then ' CWPos < 0 ==> rtp < atp
      CWPos = CWPos + NTools
   End If
   CCWPos = NTools - CWPos
   If CWPos < CCWPos Then
      Call CW()
   Else
      Call CCW()
   End If
End Function
############################################################################################
Function CW()'Rotation CW
   Dim x As Integer
   Dim CTPos As Integer 'Carrousel Tool Position Relative to OldTool Position
   CTPos=0
   ActivateSignal(OUTPUT7)'Turns the AC Motor On
   code"g04 p05"
   Do Until IsActive(input1)
   ActivateSignal(OUTPUT7)'Turns the AC Motor On
   deactivatesignal(output7)
   sleep(0)
   Loop
      For x=0 To CWPos
         If IsActive(input1) Then
            x=x+1
            While IsActive(input1)'Wait for OEMTrig to de-assert
            Wend
         End If
      Next x
      CTPos=x
   DeactivateSignal(OUTPUT7)
End Function

Function CCW()'Rotation CCW
   Dim y As Integer
   Dim CTPos As Integer 'Carrousel Tool Position Relative to OldTool Position
   CTPos=0
   ActivateSignal(OUTPUT7)'Turns the AC Motor On
   activatesignal(output8)'atc motor revirsing relay
   code"g04 p05"
   Do Until IsActive(input1)
   ActivateSignal(OUTPUT7)'Turns the AC Motor On
   activatesignal(output8)'atc motor revirsing relay
   sleep(0)
   Loop
   For y=0 To CCWPos
      If IsActive(input1) Then
      y=y+1
         While IsActive(input1)'Wait for OEMTrig to de-assert
         Wend  
      End If            
   Next y
   CTPos=y
   DeactivateSignal(OUTPUT7)
   deactivatesignal(output8)
End Function
############################################################################################
Function AtcUp()'lifts atc
   deActivateSignal(OUTPUT5)'relay for solonoid to lower/lift atc
   code("G04 p01")'pause
End Function

Function Clamp()'power drawbar unactivated
   DeactivateSignal(OUTPUT6)'unactivating drawbar relay
End Function

Function AtcOut()'retracts atc
      deActivateSignal(OUTPUT4)'atc retract cylinder relay
      code("g04 p01")
End Function


Main

Pages: 1 2 »