I added an extra button as "PAUSE" and set the ddcsv to execute extkey2.nc. Here the content of extkey2.nc:
(get Haimer)
M05 ; stop spindle
M6 T10 ; take Haimer
G04P0 ; M30 directly after M6 may not work...
M30
(The idea is to pick up the haimer by a button press, probe the workpiece, zeroing the ddcsv and after that starting the real job)
The Problem: after executing extkey2.nc, the DDCSV imediately starts with the GCode loaded (if any vaild selected before), regardless of the end of extkey2.nc. Whether it ends with "M2", or "M30" or "G04P0 M30"...
Not directly related, yet I've done some experiments with ATmega32U4 (via cheapest Arduino Leonardo clone) and HID emulation and it's perfectly possible to emulate any keyboard controls supported by the DDCSV. So it's possible to use any number of scripts via direct control (e.g. manual movements of the CNC from the home sensor position with external probe connections for example). Also I think it's possible to re-write GCode scripts via keyboard control on the fly (via copy/paste for example), but it won't be generous to the internal flash of the controller
So only thing that I miss now for the external control is a feedback (e.g. receiving coordinates via internal serial or something like this). Yet simple automation is possible.Author: JPoepsel Time: 2019-3-17 21:52
Ytliu,
since you are back at the forum:
It seems, that the extkey2.nc execution acts like an "intermediate" execution. Independent of its content, the main program is started (or continued, I didn't test this) after the execution of extkey2.nc. This may be sensible in some cases, but in other cases it is not.
My proposal: in addition to the three possible settings for the external keys (start/find center/extkey1.nc and pause/zero/extkey2.nc) you may add a fourth setting start/find center/extkey1.nc+continue/extkey1.nc+stop and pause/zero/extkey2.nc+continue/extkey2.nc+stop.
Or simply delete the continue functionality after extkey2.nc, which would be absolutely okay for me...
What do you think?
Josef Author: ytliu Time: 2019-3-18 07:41
Hi JPoepsel!
I tested it as you said, and did not find the problem you said: after executing extkey2.nc, the DDCSV imediately starts with the GCode loaded.
My extkey2.nc content is as follows:
M5
G01X0Y0Z0
G01X10Y10Z10
G04P0
M30
Can you put extkey2.nc and related code, I see that you used M6T10, have you written T.nc?Author: JPoepsel Time: 2019-3-18 14:52 Last edited by JPoepsel In 2019-3-18 14:53 Editor
Hi!
Here my tool change file - it uses the serial interface to switch some pneumatic velves):
#1=18.60 ; X position first tool holder (in MACH koordinates)
#2=52.3 ; X distance of the toolholder
#3=-50 ; Y infront of the tool holder (start entry position)
#4=-8.56 ; Y of toolholder for get/release
#5=-10 ; Z top (for secure moves)
#6=-70 ; Z above tools
#7=-116 ; Z for release (a bit avove the tool holders)
#8=-124.5 ; Z for get (only move here if holdl/release #1032 is open
#9=0 ; current tool offset
#10=0 ; new tool offset
;#592: Current Tool Nummer, 0=no tool, 1...10)
;#593: New Tool Nummer, 0=no tool, 1...10)
;#767+i: tool offset i-th tool
;#802 G53 Z coodinate
M05 (stop spindle)
IF [#592 EQ #593] GOTO3
G90 G153 Z#5 F6000 ; move up
IF [#592>0] GOTO4
M110 (Make sure no tool in spindle!)
G04P0 ; disable look ahead
GOTO1 ; no current tool
N4 IF [#592>10] GOTO1 ; tool not from tool holder
(store old tool offset)
#9=#[767+#592]; current tool offset
(store old tool)
G90 G153 X[#1+[#592-1]*#2] Y#3 F6000; move above store position
G90 G153 Z#7 F6000 ; go down
G90 G153 Y#4 F2000 ; move into store position
(open clamp, switch on air, wait, switch off air, close clamp)
G04P0 ; disable look ahead
#1032=1 ; open tool clamp
#1034=1 ; air on
G04P1500 (releasing tool)
G04P0 ; disable look ahead
#1032=0 ; end release tool
#1034=0 ; air off
G04P0 ; disable look ahead
(get new tool)
N1 IF [#593<1] GOTO2 ; no new tool
IF [#593>10] GOTO2 ; tool does not exist
(store new tool offset)
#10=#[767+#593]; new tool offset
G90 G153 X[#1+[#593-1]*#2] Y#4 F6000; move above tool get position
;Z is up, if no old tool or at #6 above tools
(open clamp, switch on air, move with open clamp into tool)
G04P0 ;disable look ahead
#1032=1 ;open tool clamp
#1034=1 ;air on
G04P0 ;disable look ahead
G90 G153 Z#7 F3000 ; move down
G90 G153 Z#8 F300 ; move tool into clamp
G04P0 ;disable look ahead
#1032=0 ;close clamp
#1034=0 ;air off
G04P500 (getting tool)
#1033=1 ;fix tool
G04P500 (fixing tool)
G04P0 ;disable look ahead
#1033=0 ;end fix tool
G90 G153 Z#7 F500; move a bit up
G90 G153 Y#3 F2000; move forward out of holder
N2 G90 G153 Z#5 F6000; move up
N3 G04P0; Synchronization
#802=#802-#9+#10; G53 Z correction for new tool height
#592=#593; after tool change actual tool number to new one
Josef Author: ytliu Time: 2019-3-18 15:47
You are amazing! I will try your tool change code on my controller.Author: ytliu Time: 2019-3-18 19:09
Try this.
Author: JPoepsel Time: 2019-3-18 21:59
Hello again ytliu!
You are on the right way ;-) Now the G-Code loaded is no more executed after the end of extkey2.nc, but the spindle returns to the point where it was before pressing the 2nd (="Pause"/exktkey2) key. First an xy-move, than a z move. And this is a bit dangerouse, since extkey2.nc may have changend something in the maschine configuration (as it does in may case taking the Haimer, which is way more longer/bigger than the normal tools) and the chance, that something goes wrong is high (nothing happend so far, I left the haimer tool tray empty while testing ;-).
So, a final solution would be doing exactly nothing after the end of extkey2.nc.
BTW: if you are already fixing some code: can you figure out, why ()-comments of M110 (and also G04Pxxx and M1 I think) are not displayed, when performed in a macro (like T.nc in my case)?
Josef Author: ytliu Time: 2019-3-18 22:13
I modified it, try it.
Author: JPoepsel Time: 2019-3-19 15:53 Last edited by JPoepsel In 2019-3-19 16:01 Editor
Ytliu, you are my hero!
Now extkey2.nc works exactly, as expected. It is performed and nothing else happens after it ends!
I did not test, whether the other modes of the 2nd key still work correct but I think you did...
So: thank you very much!
Now my CNC is in a status where I can discribe it as full functional and productive. Thanx again.
May be, I'll make some videos of it including the ESP8266 port extension, the tool changer and the automatic tool probes. May be, time will show...
All the best
Josef
P.S.: At least on my PC using Chrome ytlius messages appear in the wrong order! The last and working version is the "I modiefied it, try it"-one!
Welcome Digital Dream Technology support (http://bbs.ddcnc.com/)