Skip to content

Commit bf8db45

Browse files
committed
removing macropump - checking sensors when need it by specific scripts
1 parent 6e8fc20 commit bf8db45

File tree

16 files changed

+147
-20
lines changed

16 files changed

+147
-20
lines changed

.gitignore

+8
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
1024.se1
2+
Aqua.*
3+
Aqua_ATC.xml
4+
Bitmaps/Aqua/
5+
Brains/Offset LEDs.brn
6+
Brains/Spindle OR LED.brn
7+
SS-Messages.txt
8+
macros/Aqua_ATC/
19
ScreenSetMacros/MachStdMill.set/Custom/Scripts/bkp/
210
MachStdMill/Mill_ToolTable_Report.txt
311
Mach1Lic.dat
-968 Bytes
Binary file not shown.

ScreenSetMacros/MachStdMill.set/Custom/Scripts/TCSlots.m1s

+2
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,8 @@ Else
6868
Message "ATC Setup - Error! Tool T" & NTS & " is already loaded in rack!"
6969
End If
7070

71+
Call RunScript("ScreenSetMacros\" & GetActiveScreenSetName() & "\" & "Custom\Scripts\checkslots")
72+
7173
Exit Sub
7274

7375

ScreenSetMacros/MachStdMill.set/Custom/Scripts/TCSpindle.m1s

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
Option Explicit'nu rulam la click accidental in timpul altei operatiuni ATCIf GetUserLED(1725) = 1 Then Exit SubDim OT As IntegerDim NT As IntegerOT = GetOEMDRO(824)NT = Question("Enter New Tool Number - M6 Tx command")If OT = NT Then Message "Requested tool is same with existing tool, exiting!" Exit SubEnd If'ignore if tool no < 0If NT < 1 Then Exit SubEnd IfCode "M6 T" & NTExit Sub
1+
Option Explicit'nu rulam la click accidental in timpul altei operatiuni ATCIf GetUserLED(1725) = 1 Then Exit SubDim OT As IntegerDim NT As IntegerOT = GetOEMDRO(824)NT = Question("Enter New Tool Number - M6 Tx command")If OT = NT Then Message "Requested tool is same with existing tool, exiting!" Exit SubEnd If'ignore if tool no < 0If NT < 1 Then Exit SubEnd IfCode "M6 T" & NTCall RunScript("ScreenSetMacros\" & GetActiveScreenSetName() & "\" & "Custom\Scripts\checkslots")Exit Sub

ScreenSetMacros/MachStdMill.set/Custom/Scripts/checkslots.m1s

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
Option Explicit'exit subsettimer(12)' setuserled(s+210,0) - stingem ledul rosu de eroare' setuserled(s+210,1) - aprindem ledul rosu de eroare' getuserled(s+200) = 0 - slot ocupat' getuserled(s+200) = 1 - slot liber' s + 500 = 0 => slot gri, declarat neocupat' s + 500 = 1 => slot ocupat' s + 300 = 0 => slot verde (dar trebuie detectat in combinatie cu s+500=1)' s + 300 = 1 => slot ocupat si tool in spindleDim s As Integer' daca senzorii sunt activatiIf getuserled(1152) = 1 Then For s = 1101 To 1110 'daca slotul este activat If getuserled(s+40) = 0 Then 'daca slotul raporteaza liber in timp ce are scula declarata in el If getuserled(s+300) = 0 And getuserled(s+500) = 0 And getuserled(s+200) = 1 Then setuserled(s+210,1) 'daca slotul raporteaza ocupat in timp ce scula aferenta este incarcata in spindle ElseIf getuserled(s+300) = 1 And getuserled(s+500) = 0 And getuserled(s+200) = 0 Then setuserled(s+210,1) 'daca slotul raporteaza ocupat in timp ce este declarat liber, fara scula alocata ElseIf getuserled(s+500) = 1 And getuserled(s+200) = 0 Then setuserled(s+210,1) Else setuserled(s+210,0) End If Else setuserled(s+210,0) End If Next s Else 'daca senzorii sunt dezactivati stingem toate ledurile de eroare For s = 1101 To 1110 setuserled(s+210,0) Next sEnd Ifmessage "timer12 = " & gettimer(12)Exit Sub
1+
Option Explicit'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' update slot LEDs statusDim s As IntegerFor s = 1101 To 1110 If getuserled(s+30) = 1 Then 'daca slotul este activat setuserled(s+40,0) 'grey, slot enabled If getoemdro(s) = getoemdro(824) And getoemdro(s) <> 0 Then setuserled(s+300,1) 'orange, tool in spindle setuserled(s+500,0) 'slot not free End If If getoemdro(s) <> getoemdro(824) And getoemdro(s) <> 0 Then setuserled(s+300,0) 'green, tool NOT in spindle setuserled(s+500,0) 'slot not free End If If getoemdro(s) = 0 Then setuserled(s+300,0) 'grey, tool NOT in slot setuserled(s+500,1) 'slot free End If If InStr(1, GetToolDesc(getoemdro(s)), "NRH") > 0 Then setuserled(s+100,1) 'turn off NRH led Else setuserled(s+100,0) 'turn on NRH led End If 'citim inputurile oem si stabilim starea ledurilor in interfata - ocuparea sloturilor din magazie If Not (IsActive(28+s-1100)) And GetUserLED(1152) <> 0 Then 'And getoemdro(1920) <> getoemdro(1913) setuserled(s+200,1) Else setuserled(s+200,0) End If' If (getuserled(s+200) = 1 And getuserled(s+300) = 0) Or (getuserled(s+200) = 0 And getuserled(s+500) = 0) Then ' setuserled(s+210,0)' Else' setuserled(s+210,1)' End If Else setuserled(s+500,1) 'grey, slot disabled setuserled(s+40,1) 'grey, slot disabled End If 'end if daca slotul este activatNext s'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''Exit Sub

ScreenSetMacros/MachStdMill.set/Custom/Scripts/removeTool.m1s

+2
Original file line numberDiff line numberDiff line change
@@ -37,4 +37,6 @@ If oldtool > 0 And R = 1 Then
3737
Message "ATC - Tool T" & oldtool & " manually removed from spindle" ' SetOEMDRO(1824,0)
3838
End If
3939

40+
Call RunScript("ScreenSetMacros\" & GetActiveScreenSetName() & "\" & "Custom\Scripts\checkslots")
4041

42+
Exit Sub

ScreenSetMacros/MachStdMill.set/Custom/Scripts/returnTool.m1s

+3
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,7 @@ Dim oldtool As Integer
1313
oldtool = GetOEMDRO(824)
1414
If oldtool > 0 Then R = MachMsg ("Return tool T" & oldtool & " to rack?","Warning!",1)
1515
If oldtool > 0 And R = 1 Then Code "M6 T0"
16+
17+
Call RunScript("ScreenSetMacros\" & GetActiveScreenSetName() & "\" & "Custom\Scripts\checkslots")
18+
1619
Exit Sub

ScreenSetMacros/MachStdMill.set/Custom/Scripts/sensorsOnOff.m1s

+2
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,6 @@ End If
3131
'reload ATC Settings Page
3232
DoOEMButton(62)
3333

34+
Call RunScript("ScreenSetMacros\" & GetActiveScreenSetName() & "\" & "Custom\Scripts\checkslots")
35+
3436
Exit Sub

ScreenSetMacros/MachStdMill.set/Custom/Scripts/slotsOnOff.m1s

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
Option Explicit'nu rulam la click accidental in timpul altei operatiuni ATCIf GetUserLED(1725) = 1 Then Exit SubDim slotno as integerslotno = Getvar(1101) 'slot numberDim deactivate As Integerdeactivate = 0If GetUserLED(1130 + slotno) = 0 Then SetUserLED(1130 + slotno,1) Else deactivate = MachMsg ("ATC Setup - Disable Slot " & slotno & "?", "Disable Slot " & slotno & "?", 1) If deactivate = 1 Then SetUserLED(1130 + slotno,0) SetUserDRO(1100 + slotno, 0) End IfEnd If'reload ATC Settings PageDoOEMButton(62)
1+
Option Explicit'nu rulam la click accidental in timpul altei operatiuni ATCIf GetUserLED(1725) = 1 Then Exit SubDim slotno as integerslotno = Getvar(1101) 'slot numberDim deactivate As Integerdeactivate = 0If GetUserLED(1130 + slotno) = 0 Then SetUserLED(1130 + slotno,1) Else deactivate = MachMsg ("ATC Setup - Disable Slot " & slotno & "?", "Disable Slot " & slotno & "?", 1) If deactivate = 1 Then SetUserLED(1130 + slotno,0) SetUserDRO(1100 + slotno, 0) End IfEnd IfCall RunScript("ScreenSetMacros\" & GetActiveScreenSetName() & "\" & "Custom\Scripts\checkslots")'reload ATC Settings PageDoOEMButton(62)
22
Exit Sub

ScreenSetMacros/MachStdMill.set/Custom/Scripts/switchXY.m1s

+3-1
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,6 @@ Else
2828
End If
2929
End If
3030

31-
exit sub
31+
Call RunScript("ScreenSetMacros\" & GetActiveScreenSetName() & "\" & "Custom\Scripts\checkslots")
32+
33+
Exit Sub

_Doc/Arduino Modbus/RackModbusInputs/RackModbusInputs.ino

+32-14
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,14 @@ u16 _D[DATA_SIZE];
1111
#define SLAVE_ID 2
1212
#define DE_RE_PIN 13
1313

14-
ModbusRTUSlave rtu(SLAVE_ID, &Serial, DE_RE_PIN);
14+
ModbusRTUSlave rtu(SLAVE_ID, &Serial1, DE_RE_PIN);
1515

1616
void setup()
1717
{
1818
rtu.addWordArea(VIRTUAL_ADDRESS, _D, DATA_SIZE);
1919
rtu.begin(9600);
2020

21+
pinMode(A0, INPUT_PULLUP); // set pull-up on analog pin 0
2122
pinMode(2, INPUT_PULLUP);
2223
pinMode(3, INPUT_PULLUP);
2324
pinMode(4, INPUT_PULLUP);
@@ -28,28 +29,45 @@ void setup()
2829
pinMode(9, INPUT_PULLUP);
2930
pinMode(10, INPUT_PULLUP);
3031
pinMode(11, INPUT_PULLUP);
31-
pinMode(A0, INPUT_PULLUP); // set pull-up on analog pin 0
3232

33-
//Serial.begin(9600); // not needed, for logging purpose only
33+
Serial.begin(9600); // not needed, for logging purpose only
3434

3535
}
3636

3737
void loop()
3838
{
3939
// set some value in data array to test if master can read and modify it
40-
_D[0] = digitalRead(2);
41-
_D[1] = digitalRead(3);
42-
_D[2] = digitalRead(4);
43-
_D[3] = digitalRead(5);
44-
_D[4] = digitalRead(6);
45-
_D[5] = digitalRead(7);
46-
_D[6] = digitalRead(8);
47-
_D[7] = digitalRead(9);
48-
_D[8] = digitalRead(10);
49-
_D[9] = digitalRead(11);
50-
_D[10] = analogRead(A0);
40+
_D[0] = analogRead(A0);
41+
delay(10);
42+
_D[1] = digitalRead(2);
43+
delay(10);
44+
_D[2] = digitalRead(3);
45+
delay(10);
46+
_D[3] = digitalRead(4);
47+
delay(10);
48+
_D[4] = digitalRead(5);
49+
delay(10);
50+
_D[5] = digitalRead(6);
51+
delay(10);
52+
_D[6] = digitalRead(7);
53+
delay(10);
54+
_D[7] = digitalRead(8);
55+
delay(10);
56+
_D[8] = digitalRead(9);
57+
delay(10);
58+
_D[9] = digitalRead(10);
59+
delay(10);
60+
_D[10] = digitalRead(11);
61+
delay(10);
5162

63+
for (int i = 0; i <= 10; i++) {
64+
Serial.print(_D[i]);
65+
if (i==0) {Serial.print(" - ");} else {Serial.print(" ");}
66+
}
67+
Serial.println("");
68+
5269
// waiting for requests from master
5370
// reading and writing _D according to requests from master happens here
5471
rtu.process();
72+
delay(10);
5573
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
#include <ModbusRTUSlave.h>
2+
3+
// size of data which will be read and written
4+
#define DATA_SIZE 100
5+
// data array which will be read and written
6+
u16 _D[DATA_SIZE];
7+
8+
// address (kind of name) of above data, may be anything
9+
#define VIRTUAL_ADDRESS 0x0000
10+
11+
#define SLAVE_ID 2
12+
#define DE_RE_PIN 2
13+
14+
ModbusRTUSlave rtu(SLAVE_ID, &Serial1, DE_RE_PIN);
15+
16+
void setup()
17+
{
18+
rtu.addWordArea(VIRTUAL_ADDRESS, _D, DATA_SIZE);
19+
rtu.begin(9600);
20+
21+
pinMode(A0, INPUT_PULLUP); // set pull-up on analog pin 0
22+
pinMode(A1, INPUT_PULLUP); // set pull-up on analog pin 0
23+
pinMode(A2, INPUT_PULLUP); // set pull-up on analog pin 0
24+
pinMode(A3, INPUT_PULLUP); // set pull-up on analog pin 0
25+
pinMode(A4, INPUT_PULLUP); // set pull-up on analog pin 0
26+
pinMode(A5, INPUT_PULLUP); // set pull-up on analog pin 0
27+
pinMode(A6, INPUT_PULLUP); // set pull-up on analog pin 0
28+
pinMode(A7, INPUT_PULLUP); // set pull-up on analog pin 0
29+
pinMode(A8, INPUT_PULLUP); // set pull-up on analog pin 0
30+
pinMode(A9, INPUT_PULLUP); // set pull-up on analog pin 0
31+
pinMode(A10, INPUT_PULLUP); // set pull-up on analog pin 0
32+
// pinMode(2, INPUT_PULLUP);
33+
// pinMode(3, INPUT_PULLUP);
34+
// pinMode(4, INPUT_PULLUP);
35+
// pinMode(5, INPUT_PULLUP);
36+
// pinMode(6, INPUT_PULLUP);
37+
// pinMode(7, INPUT_PULLUP);
38+
// pinMode(8, INPUT_PULLUP);
39+
// pinMode(9, INPUT_PULLUP);
40+
// pinMode(10, INPUT_PULLUP);
41+
// pinMode(11, INPUT_PULLUP);
42+
43+
Serial.begin(9600); // not needed, for logging purpose only
44+
45+
}
46+
47+
void loop()
48+
{
49+
// set some value in data array to test if master can read and modify it
50+
_D[0] = analogRead(A1);
51+
delay(10);
52+
_D[1] = analogRead(A2);
53+
delay(10);
54+
_D[2] = analogRead(A3);
55+
delay(10);
56+
_D[3] = analogRead(A4);
57+
delay(10);
58+
_D[4] = analogRead(A5);
59+
delay(10);
60+
_D[5] = analogRead(A6);
61+
delay(10);
62+
_D[6] = analogRead(A7);
63+
delay(10);
64+
_D[7] = analogRead(A8);
65+
delay(10);
66+
_D[8] = analogRead(A9);
67+
delay(10);
68+
_D[9] = analogRead(A10);
69+
delay(10);
70+
_D[10] = analogRead(A0);
71+
delay(10);
72+
73+
for (int i = 0; i <= 10; i++) {
74+
75+
if (i < 10) {
76+
if (_D[i] > 600) { _D[i] = 1; } else { _D[i] = 0; }
77+
delay(10);
78+
}
79+
80+
if (i==10) {Serial.print(" - ");} else {Serial.print(" ");}
81+
Serial.print(_D[i]);
82+
// delay(10);
83+
}
84+
Serial.println("");
85+
86+
// waiting for requests from master
87+
// reading and writing _D according to requests from master happens here
88+
rtu.process();
89+
// delay(10);
90+
}

macros/MSM_ATC/ModBus.cfg

32 Bytes
Binary file not shown.

macros/MSM_ATC/checkslots.m1s

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Option ExplicitDim s As IntegerFor s = 1101 To 1110 If getuserled(s+30) = 1 Then 'daca slotul este activat setuserled(s+40,0) 'grey, slot enabled If getoemdro(s) = getoemdro(824) And getoemdro(s) <> 0 Then setuserled(s+300,1) 'orange, tool in spindle setuserled(s+500,0) 'slot not free End If If getoemdro(s) <> getoemdro(824) And getoemdro(s) <> 0 Then setuserled(s+300,0) 'green, tool NOT in spindle setuserled(s+500,0) 'slot not free End If If getoemdro(s) = 0 Then setuserled(s+300,0) 'grey, tool NOT in slot setuserled(s+500,1) 'slot free End If If InStr(1, GetToolDesc(getoemdro(s)), "NRH") > 0 Then setuserled(s+100,1) 'turn off NRH led Else setuserled(s+100,0) 'turn on NRH led End If 'citim inputurile oem si stabilim starea ledurilor in interfata - ocuparea sloturilor din magazie If Not (IsActive(28+s-1100)) And GetUserLED(1152) <> 0 Then 'And getoemdro(1920) <> getoemdro(1913) setuserled(s+200,1) Else setuserled(s+200,0) End If' If (getuserled(s+200) = 1 And getuserled(s+300) = 0) Or (getuserled(s+200) = 0 And getuserled(s+500) = 0) Then ' setuserled(s+210,0)' Else' setuserled(s+210,1)' End If Else setuserled(s+500,1) 'grey, slot disabled setuserled(s+40,1) 'grey, slot disabled End If 'end if daca slotul este activatNext sSetOEMDRO(245,ToolLengthOffset)Exit Sub

macros/MSM_ATC/m6atc.m1s

+1-1
Large diffs are not rendered by default.

macros/MSM_ATC/macropump.m1s

-1
Original file line numberDiff line numberDiff line change
@@ -1 +0,0 @@
1-
Option Explicit'SetTimer(11)Dim s As IntegerFor s = 1101 To 1110 If getuserled(s+30) = 1 Then 'daca slotul este activat setuserled(s+40,0) 'grey, slot enabled If getoemdro(s) = getoemdro(824) And getoemdro(s) <> 0 Then setuserled(s+300,1) 'orange, tool in spindle setuserled(s+500,0) 'slot not free End If If getoemdro(s) <> getoemdro(824) And getoemdro(s) <> 0 Then setuserled(s+300,0) 'green, tool NOT in spindle setuserled(s+500,0) 'slot not free End If If getoemdro(s) = 0 Then setuserled(s+300,0) 'grey, tool NOT in slot setuserled(s+500,1) 'slot free End If If InStr(1, GetToolDesc(getoemdro(s)), "NRH") > 0 Then setuserled(s+100,1) 'turn off NRH led Else setuserled(s+100,0) 'turn on NRH led End If 'citim inputurile oem si stabilim starea ledurilor in interfata - ocuparea sloturilor din magazie If Not (IsActive(28+s-1100)) And GetUserLED(1152) <> 0 Then 'And getoemdro(1920) <> getoemdro(1913) setuserled(s+200,1) Else setuserled(s+200,0) End If' If (getuserled(s+200) = 1 And getuserled(s+300) = 0) Or (getuserled(s+200) = 0 And getuserled(s+500) = 0) Then ' setuserled(s+210,0)' Else' setuserled(s+210,1)' End If Else setuserled(s+500,1) 'grey, slot disabled setuserled(s+40,1) 'grey, slot disabled End If 'end if daca slotul este activatNext sSetOEMDRO(245,ToolLengthOffset)'checking slot for errors (if sensor report empty when should have tool loaded or when slot report tool in it when should be empty)'#expand <Custom\Scripts\checkslots>'Call RunScript("ScreenSetMacros\" & GetActiveScreenSetName() & "\" & "Custom\Scripts\checkslots")'message "timer11 = " & GetTimer(11)Exit Sub

0 commit comments

Comments
 (0)