Changeset 1807 for trunk/MagicSoft/Cosy/aposs/Manual.m
- Timestamp:
- 03/06/03 17:53:59 (22 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Cosy/aposs/Manual.m
r1716 r1807 4 4 /* */ 5 5 kVERSION = 0 /* */ 6 kSUBVERSION = 3/* */6 kSUBVERSION = 6 /* */ 7 7 /* */ 8 8 /* HISTORY: */ 9 /* */ 10 /* * V0.6 */ 11 /* - do not reset the velocity if set already */ 12 /* - set acceleration to 20% */ 13 /* */ 14 /* * V0.5: */ 15 /* - changes 'DKC Ready' signal to IN1 for all MACS */ 16 /* - control brake only when cannr==3 */ 17 /* */ 18 /* * V0.4: */ 19 /* - restart MACS with PRGPAR 1 when not in manual mode */ 20 /* - replaced label reset by a subprg */ 9 21 /* */ 10 22 /* * V0.3: */ … … 112 124 /*----------------*/ 113 125 SET RAMPTYPE 1 /* Ramp: 0=linear, 1=sinus */ 114 defacc = 60*vres%100126 defacc = 10*vres%100 115 127 116 128 SET DFLTACC defacc /* Default acceleratio: [%] */ … … 124 136 125 137 print "Vel Res (vel max): ", GET VELRES, " Encoder Ticks/min" 126 print "V_man: ", manvel, " Encoder Ticks/min "138 print "V_man: ", manvel, " Encoder Ticks/min, Acc=", defacc 127 139 128 140 /*----------------*/ … … 152 164 153 165 brake = 0 166 RF = 0 167 velo = 0 154 168 155 reset: 156 out 1 0 157 out 2 0 158 RF = 0 159 motor off 160 waitt 1000 161 162 if (brake==1) then 163 waitt 3000 /* wait 3s for DKC to stop the motor */ 164 out (kIoModule+1) 0 /* brake the brake */ 165 waitt 1000 166 endif 169 gosub reset 167 170 168 171 mainloop: … … 171 174 vltg = in (kIoModule+3) 172 175 mode = in (kIoModule+4) 173 176 /* 174 177 if (get cannr==1) or (get cannr==2) then 175 ready = in 1 178 */ 179 ready = in 1 180 /* 176 181 elseif (get cannr==3) then 177 ready = in (kIoModule+5) /* !!!FIXME!!! */182 ready = in (kIoModule+5) 178 183 endif 184 */ 179 185 180 186 if (ready==0) and (RF==1) then 181 187 print "DKC not ready, but RF set... setting RF=AH=0!" 182 goto reset 188 gosub reset 189 goto mainloop 190 elseif mode==0 then 191 print "Control not in manual mode!" 192 gosub reset 193 SET PRGPAR 1 194 exit 183 195 elseif fuse==0 then 184 196 print "Motor-Power Fuse not OK!" 185 goto reset 197 gosub reset 198 goto mainloop 186 199 elseif vltg==0 then 187 200 print "Overvoltage control broken!" 188 goto reset 201 gosub reset 202 goto mainloop 189 203 elseif emcy==0 then 190 204 print "Please release Emergency Stop!" 191 goto reset 192 elseif mode==0 then 193 print "Control not in manual mode!" 194 goto reset 205 gosub reset 206 goto mainloop 195 207 elseif (ready==1) and (RF==0) then 196 208 print "DKC powered, RF=0... setting RF=AH=1!" … … 210 222 waitt 100 211 223 212 if (brake==0 ) then224 if (brake==0 and get cannr==3) then 213 225 out (kIoModule+1) 1 214 226 brake = 1 … … 239 251 backward = in 3 240 252 241 if (forward==1) and (backward==0) then 242 cvel manvel 243 elseif (forward==0) and (backward==1) then 253 if (forward==1) and (backward==0) and (velo!=manvel) then 254 cvel manvel 255 velo = manvel 256 elseif (forward==0) and (backward==1) and (velo!=-manvel) then 244 257 cvel -manvel 245 else 246 cvel 0 258 velo = -manvel 259 elseif (forward==backward) and (velo!=0) then 260 cvel 0 261 velo = 0 247 262 endif 248 263 goto mainloop 249 264 250 265 SUBMAINPROG 266 subprog reset 267 out 1 0 268 out 2 0 269 RF = 0 270 motor off 271 velo = 0 272 waitt 1000 273 274 if (brake==1 and get cannr==3) then 275 waitt 3000 /* wait 3s for DKC to stop the motor */ 276 out (kIoModule+1) 0 /* brake the brake */ 277 waitt 1000 278 endif 279 return 280 251 281 subprog suberror 252 282 out 1 0 … … 254 284 RF = 0 255 285 waitt 100 286 velo = 0 256 287 257 if (brake==1 ) then288 if (brake==1 and get cannr==3) then 258 289 waitt 5000 259 290 out (kIoModule+1) 0
Note:
See TracChangeset
for help on using the changeset viewer.