M107/BCD

All things related to the Centroid Acorn CNC Controller

Moderator: cnckeith

markcadcam
Posts: 49
Joined: Thu Sep 28, 2017 2:15 pm
Acorn CNC Controller: Yes
Allin1DC CNC Controller: No
Oak CNC controller: No
CNC Control System Serial Number: none
DC3IOB: No
CNC11: No
CPU10 or CPU7: No
Location: Xenia Ohio

M107/BCD

Post by markcadcam »

Can someone from Centroid tell me where to look for information on how the M107/BCD works with Acorn? Some examples would be great. I’m trying to interface my Acorn with the turret on my lathe. I know others are wondering how to do this also.
cnckeith
Posts: 7306
Joined: Wed Mar 03, 2010 4:23 pm
Acorn CNC Controller: Yes
Allin1DC CNC Controller: Yes
Oak CNC controller: Yes
CNC Control System Serial Number: none
DC3IOB: Yes
CNC11: Yes
CPU10 or CPU7: Yes
Contact:

Re: M107/BCD

Post by cnckeith »

Mark,
i suggest you document how your particular turret works. start wtih make, model, post some photos and most importantly a description of the sensor logic functionality. and do you have a schematic of the turret logic sensors that you can post? basically full information to describe the turret and how it works. then we can begin to setup Acorn/CNC12 to match.
beta ATC programs are here.
viewtopic.php?f=63&t=1340
Need support? READ THIS POST first. http://centroidcncforum.com/viewtopic.php?f=60&t=1043
All Acorn Documentation is located here: viewtopic.php?f=60&t=3397
Answers to common questions: viewforum.php?f=63
and here viewforum.php?f=61
Gear we use but don't sell. https://www.centroidcnc.com/centroid_di ... _gear.html
markcadcam
Posts: 49
Joined: Thu Sep 28, 2017 2:15 pm
Acorn CNC Controller: Yes
Allin1DC CNC Controller: No
Oak CNC controller: No
CNC Control System Serial Number: none
DC3IOB: No
CNC11: No
CPU10 or CPU7: No
Location: Xenia Ohio

Re: M107/BCD

Post by markcadcam »

I don't have anything right now to post that would make sense to anyone. The turret controller is my design. What I need to know is how will the BCD be sent out of the Acorn? Will the output pins be toggled somehow to send the information on what tool # is being called? Can the BCD be sent serially?
diycncscott

Re: M107/BCD

Post by diycncscott »

Briefly, and in very basic terms - Automatic tool changes rely on 3 things:

1. Parameter 6 must be set to 1 to indicate that an ATC is installed. parm 161 = maximum tools/turret positions

2. A tool change macro -mfunc6.mac for mills and cnctch.mac for lathes must be written to sequence the tool change such as moving to a return point, notify the PLC that a tool change has been requested, waiting for the PLC to indicate that the tool change is complete etc.. This macro must reside in c:\cncm or c:\cnct respectively.

3. The PLC monitors the current turret/magazine position and rotates the turret/magazine to the requested position if needed and notifies the tool change macro when complete.

The tool number/requested turret position is sent to the PLC in decimal form(not BCD) the tool change macro when an M107 is issued. This is received in the system variable SV_TOOL_NUMBER which the PLC can read and determine if the requested turret position does not = the current turret position and therefore needs to rotate to the requested position.

In the example below, the turret is at position 1.

In the cnctch.mac macro:
; #4120 = contains the requested tool number from the g code program
; #90014 = contains the value of W14 in the PLC program which the PLC uses to ; store the current turret position

For instance, if your g-code program calls for a T0404 and parameter 6 is set to 1 to indicate it is an ATC, the control will automatically call cnctch.mac to perform the tool change:

example cnctch.mac:


;------------------------------------------------------------------------------
; Filename: cnctch.mac
; Tool change request macro
; Description: User Customizable Macro
; Notes:
; Requires: Machine home must be set prior to use.
; Please see TB300 for tips on writing custom macros.
; #4120 = contains the requested tool number from the g code program
; #90014 = contains the value of W14 in the PLC program which the PLC uses to ; store the current turret position
;------------------------------------------------------------------------------

IF #50010 ;Prevent lookahead from parsing past here
IF #4201 || #4202 THEN GOTO 1000 ;Skip macro if graphing or searching
IF #4120 == #90014 THEN GOTO 1000 ;Skip macro if already at requested position
N100 ;Insert your code between N100 and N1000

M107 ;Send tool number
G4 P.5 ;Wait .5 second
M94 /6 ;Request tool change
M101 /70001 ;Wait for toolChangeComplete (MEM1)
M95 /6 ;Turn off tool change request.

N1000 ;End of Macro

Since the turret is at position 1 (not 4 as requested), the M94/6 tells the PLC to begin a tool change and waits until the PLC sets MEM1 M101/70001
before continuing.

In the PLC:

This section below monitors the current turret position. The turret being used has a 3 bit gray code encoder that uses 3 inputs INP5-INP7 on the Acorn for ToolBit1, ToolBit2, ToolBit3 to report the turret position as follows.


IF TRUE THEN CurrentTurretPosition_W = 0
IF ToolBit1 && ToolBit2 && !ToolBit3 THEN CurrentTurretPosition_W = 1
IF !ToolBit1 && ToolBit2 && !ToolBit3 THEN CurrentTurretPosition_W = 2
IF !ToolBit1 && !ToolBit2 && !ToolBit3 THEN CurrentTurretPosition_W = 3
IF ToolBit1 && !ToolBit2 && !ToolBit3 THEN CurrentTurretPosition_W = 4
IF ToolBit1 && !ToolBit2 && ToolBit3 THEN CurrentTurretPosition_W = 5
IF !ToolBit1 && !ToolBit2 && ToolBit3 THEN CurrentTurretPosition_W = 6
IF !ToolBit1 && ToolBit2 && ToolBit3 THEN CurrentTurretPosition_W = 7
IF ToolBit1 && ToolBit2 && ToolBit3 THEN CurrentTurretPosition_W = 8
IF TRUE THEN SV_PLC_CAROUSEL_POSITION = CurrentTurretPosition_W

This section below gets the requested tool position when a tool change is requested -Note M6 is set by the M94 /6 request in the cnctch.mac:

IF M6 THEN (M6PD), SET DoingTurretIndex_M
IF M6PD THEN RequestedLocation_W = SV_TOOL_NUMBER ; <------Decimal # sent when m107 is issued in cnctch.mac

The section below rotates the turret to the requested position. This particular turret requires that the turret "settle" for 700 milliseconds after the requested position is reached before turning the TurretMotor output off. After the TurretMotor ouput is turned off, it needs to reverse for 1.5 seconds in order to lock before completing the tool change.

;Setup timers
IF TRUE THEN TurretTimer = 700, ReversingTimer = 1500

;If current position != requested position, rotate turret
IF DoingTurretIndex_M && RequestedLocation_W != CurrentTurretPosition_W THEN SET TurretMotor

;After requested position has been reached, start timer to allow turret to settle
IF RequestedLocation_W == CurrentTurretPosition_W THEN SET TurretTimer

;After turret has settled, turn off TurretMotor, start reversing timer
IF TurretTimer THEN RST TurretMotor, SET ReversingTimer, RST TurretTimer

;After turret has reversed for 1.5 seconds, notify cnctch.mac that tool change is complete
;Tell cnctch.mac that tool change is complete by setting MEM1
IF ReversingTimer THEN RST ReversingTimer, SET ToolChangeComplete

There is more to it susch as error checking and fault reporting, checking for valid tool numbers etc..
that I didn't have time/space to post here but are included in the complete PLC program and macro I have attached for your reference. If you provide details of your particular turret, I may be able to provide more specific help.



8posgray.zip
(29.72 KiB) Downloaded 241 times
markcadcam
Posts: 49
Joined: Thu Sep 28, 2017 2:15 pm
Acorn CNC Controller: Yes
Allin1DC CNC Controller: No
Oak CNC controller: No
CNC Control System Serial Number: none
DC3IOB: No
CNC11: No
CPU10 or CPU7: No
Location: Xenia Ohio

Re: M107/BCD

Post by markcadcam »

Thanks diycncscott,

I will digest all of this and see what I can come up with. I'll get back to you when I get stuck.
martyscncgarage
Posts: 9914
Joined: Tue Mar 28, 2017 12:01 pm
Acorn CNC Controller: Yes
Allin1DC CNC Controller: Yes
Oak CNC controller: No
CNC Control System Serial Number: none
DC3IOB: No
CNC12: Yes
CNC11: Yes
CPU10 or CPU7: Yes
Location: Mesa, AZ

Re: M107/BCD

Post by martyscncgarage »

markcadcam wrote: Wed Nov 08, 2017 9:03 am Thanks diycncscott,

I will digest all of this and see what I can come up with. I'll get back to you when I get stuck.
Mark,
Keep us posted of your progress.
Marty
Reminder, for support please follow this post: viewtopic.php?f=20&t=383
We can't "SEE" what you see...
Mesa, AZ
markcadcam
Posts: 49
Joined: Thu Sep 28, 2017 2:15 pm
Acorn CNC Controller: Yes
Allin1DC CNC Controller: No
Oak CNC controller: No
CNC Control System Serial Number: none
DC3IOB: No
CNC11: No
CPU10 or CPU7: No
Location: Xenia Ohio

Re: M107/BCD

Post by markcadcam »

Will do.
markcadcam
Posts: 49
Joined: Thu Sep 28, 2017 2:15 pm
Acorn CNC Controller: Yes
Allin1DC CNC Controller: No
Oak CNC controller: No
CNC Control System Serial Number: none
DC3IOB: No
CNC11: No
CPU10 or CPU7: No
Location: Xenia Ohio

Re: M107/BCD

Post by markcadcam »

diycncscott,

The way my 8 position ATC presently works is as follows:

When a Tool # is requested, the turret by way of the motion controller moves to the XZ Home position and then the Tool # is sent serially from the motion controller to my turret controller.

The turret controller looks to see if it is already at that tool location. If it is, then it will go back into the program loop and waits for another tool #. There are 4 outputs from the Hall Effect sensor circuit connected to the turret that gives a 12 or 0 volt output. I scan these outputs to determine what position the turret is in.

If it sees that it needs to change tool position, it puts the motion controller in Feed Hold mode and then raises the turret to disengage/unlocks it and waits for a limit switch to be hit, assuring it is disengage and ready to move.

A servo motor rotates the turret until it has move the correct amount of steps. Then an air cylinder is activated which precisely locates the turret in the radial location and then the turret is lowered locking it in place.

Now the turret controller Un-Pauses the motion controller letting it continue on with the g-code program.

Looking at what you sent me, I see that input pins 5, 6 and 7 are used on the Acorn board to determine the turret location, correct?

How is the turret movement controlled? Is an output pin (using M107) used to tell the turret to rotate until pins 5, 6, 7 tell Acorn to stop when the correct pins are hit?
diycncscott

Re: M107/BCD

Post by diycncscott »

You wrote:
Looking at what you sent me, I see that input pins 5, 6 and 7 are used on the Acorn board to determine the turret location, correct?
Correct: ToolBit1 = INP5, ToolBit2 = INP6, ToolBit3 = INP7. You would simply substitute your turret sensor states for those below.

IF ToolBit1 && ToolBit2 && !ToolBit3 THEN CurrentTurretPosition_W = 1
IF !ToolBit1 && ToolBit2 && !ToolBit3 THEN CurrentTurretPosition_W = 2
IF !ToolBit1 && !ToolBit2 && !ToolBit3 THEN CurrentTurretPosition_W = 3
IF ToolBit1 && !ToolBit2 && !ToolBit3 THEN CurrentTurretPosition_W = 4
IF ToolBit1 && !ToolBit2 && ToolBit3 THEN CurrentTurretPosition_W = 5
IF !ToolBit1 && !ToolBit2 && ToolBit3 THEN CurrentTurretPosition_W = 6
IF !ToolBit1 && ToolBit2 && ToolBit3 THEN CurrentTurretPosition_W = 7
IF ToolBit1 && ToolBit2 && ToolBit3 THEN CurrentTurretPosition_W = 8



You wrote:
How is the turret movement controlled? Is an output pin (using M107) used to tell the turret to rotate until pins 5, 6, 7 tell Acorn to stop when the correct pins are hit?
Yes. TurretMotor is an output. It turns on if currentPosition_W != RequestedLocation_W.

;If current position != requested position, rotate turret
IF DoingTurretIndex_M && RequestedLocation_W != CurrentTurretPosition_W THEN SET TurretMotor
markcadcam
Posts: 49
Joined: Thu Sep 28, 2017 2:15 pm
Acorn CNC Controller: Yes
Allin1DC CNC Controller: No
Oak CNC controller: No
CNC Control System Serial Number: none
DC3IOB: No
CNC11: No
CPU10 or CPU7: No
Location: Xenia Ohio

Re: M107/BCD

Post by markcadcam »

Ok, that should keep me going for awhile.
Post Reply