Start/Restart Lock Cell
LANGUAGE: Karel
CREATED: 2017-04-20
MODIFIED: 2019-11-21
CODE
/PROG BSTARTRESETLOCK
/ATTR
OWNER = MNEDITOR;
COMMENT = “StartResLockCell”;
PROG_SIZE = 3126;
CREATE = DATE 17-04-20 TIME 09:14:42;
MODIFIED = DATE 19-11-21 TIME 11:34:24;
FILE_NAME = BGLSTART;
VERSION = 0;
LINE_COUNT = 114;
MEMORY_SIZE = 3458;
PROTECT = READ_WRITE;
TCD: STACK_SIZE = 0,
TASK_PRIORITY = 50,
TIME_SLICE = 0,
BUSY_LAMP_OFF = 0,
ABORT_REQUEST = 0,
PAUSE_REQUEST = 0;
DEFAULT_GROUP = *,*,*,*,*;
CONTROL_CODE = 00000000 00000000;
/APPL
/MN
1: –eg:Copyright (c) 2019 DIY-Robotics.com All rights reserved. ;
2: –eg: ;
3: –eg:Redistribution and use in source and binary forms, with or without ;
4: –eg:modification, are permitted provided that the following conditions
: are ;
5: –eg:met: ;
6: –eg: ;
7: –eg:Redistributions of source code must retain the above copyright ;
8: –eg:notice, this list of conditions and the following disclaimer. ;
9: –eg:Redistributions in binary form must reproduce the above ;
10: –eg:copyright notice, this list of conditions and the following
: disclaimer ;
11: –eg:in the documentation and/or other materials provided with the ;
12: –eg:distribution. ;
13: –eg:Neither the name of DIY-Robotics.com nor the names of its ;
14: –eg:contributors may be used to endorse or promote products derived from ;
15: –eg:this software without specific prior written permission. ;
16: –eg: ;
17: –eg:On reset la sequence si elle est plus grande que 0 et on depasse le
: temps max ;
18: IF (TIMER[20]>10 AND R[15:BGLTrackSeq]<>0),R[15:BGLTrackSeq]=(9001) ;
19: ;
20: ;
21: IF (R[15:BGLTrackSeq]>9000 AND DI[2:StartBtn]=OFF AND DI[3:ResetBtn]=OFF AND DI[1:LockDoorBtn]=OFF) THEN ;
22: $TIMER[20].$TIMER_VAL=0 ;
23: R[15:BGLTrackSeq]=0 ;
24: ENDIF ;
25: ;
26: –eg:Sequence Selection ;
27: IF (R[15:BGLTrackSeq]=0) THEN ;
28: $TIMER[20].$TIMER_VAL=0 ;
29: ;
30: IF (DI[6:FenceOK]=OFF AND DO[1:LockDoors]=ON),DO[1:LockDoors]=(OFF) ;
31: ;
32: IF (DI[1:LockDoorBtn]=ON),R[15:BGLTrackSeq]=(31) ;
33: IF (DI[3:ResetBtn]=ON),R[15:BGLTrackSeq]=(11) ;
34: IF (DI[2:StartBtn]=ON AND UO[2:System ready]=ON AND UO[1:Cmd enabled]=ON AND UO[3:Prg running]=OFF),R[15:BGLTrackSeq]=(21) ;
35: ENDIF ;
36: ;
37: ;
38: ;
39: –eg:== RESET ROBOT == ;
40: IF (R[15:BGLTrackSeq]=11) THEN ;
41: F[1023:UIReset]=(ON) ;
42: ;
43: IF (TIMER[20]>3 AND DI[3:ResetBtn]=ON) THEN ;
44: F[1022:UIStop]=(ON) ;
45: R[15:BGLTrackSeq]=9999 ;
46: ENDIF ;
47: ;
48: IF (DI[3:ResetBtn]=OFF),R[15:BGLTrackSeq]=(9999) ;
49: ;
50: ENDIF ;
51: ;
52: !END RESET ROBOT ;
53: ;
54: –eg:== DEPART ROBOT == ;
55: IF (R[15:BGLTrackSeq]=21) THEN ;
56: IF (F[10:MemTeachOff]=OFF),R[15:BGLTrackSeq]=(22) ;
57: IF (F[10:MemTeachOff]=ON),R[15:BGLTrackSeq]=(29) ;
58: ENDIF ;
59: ;
60: –eg:Si le teach a ete active on fait un cycle stop ;
61: IF (R[15:BGLTrackSeq]=22) THEN ;
62: F[1022:UIStop]=(ON) ;
63: F[10:MemTeachOff]=(ON) ;
64: R[15:BGLTrackSeq]=23 ;
65: ENDIF ;
66: ;
67: –eg:Quand le programme est arrete on passe a l’autre etape ;
68: IF (R[15:BGLTrackSeq]=23 AND F[1022:UIStop]=OFF AND UO[3:Prg running]=OFF) THEN ;
69: R[15:BGLTrackSeq]=29 ;
70: ENDIF ;
71: ;
72: –eg:On demarre le robot ;
73: IF (R[15:BGLTrackSeq]=29) THEN ;
74: F[1024:UIStart]=(ON) ;
75: R[15:BGLTrackSeq]=9999 ;
76: ENDIF ;
77: !END START ROBOT ;
78: ;
79: ;
80: ;
81: –eg:Lock/Unlock Door Sequence ;
82: ;
83: –eg:1st Step ;
84: IF (R[15:BGLTrackSeq]=31) THEN ;
85: IF (TIMER[20]>3),R[15:BGLTrackSeq]=(32) ;
86: IF (TIMER[20]<=3 AND DI[1:LockDoorBtn]=OFF),R[15:BGLTrackSeq]=(33) ;
87: ENDIF ;
88: ;
89: –eg:Unlock Door ;
90: IF (R[15:BGLTrackSeq]=32) THEN ;
91: DO[1:LockDoors]=OFF ;
92: R[15:BGLTrackSeq]=9999 ;
93: ENDIF ;
94: ;
95: –eg:Lock Door ;
96: IF (R[15:BGLTrackSeq]=33) THEN ;
97: DO[1:LockDoors]=ON ;
98: //IF (DI[6:FenceOK]=ON),DO[218:NX_Free]=(ON) ;
99: IF (DI[6:FenceOK]=ON),R[15:BGLTrackSeq]=(100) ;
100: IF (DI[6:FenceOK]=OFF AND TIMER[20]>2),R[15:BGLTrackSeq]=(32) ;
101: ENDIF ;
102: ;
103: –eg:EuropMap73 ACK ;
104: IF (R[15:BGLTrackSeq]=100 AND TIMER[20]>3) THEN ;
105: DO[218:NX_Free]=ON ;
106: R[15:BGLTrackSeq]=9999 ;
107: ENDIF ;
108: ;
109: IF (DO[218:NX_Free]=ON),DO[218:NX_Free]=PULSE,1.0sec ;
110: ;
111: ;
112: –eg:Lock/Unlock Door Seq. End Section ;
113: ;
114: ;
/POS
/END