CNCzone.com-The Largest Machinist Community on the net!



Home Page Mark Forums Read Today's Posts My Replies Classifieds Reviews Photo Gallery Web Links Share Files Advertise With Us Ad List
Go Back   CNCzone.com-The Largest Machinist Community on the net! > MetalWorking Machines > Haas Mills


Haas Mills Discuss Haas machinery here!


This forum is sponsored by:

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Ban this user!
Old 06-20-2011, 08:03 PM
 
Join Date: Jul 2005
Location: usa
Posts: 164
DaOne is on a distinguished road
Macros - Checking skip input not working...

Can someone take a look at this that knows macros.. Having a hell of a time getting this to check to see if my probe is off. Basically it uses a M code relay that will turn it on or off. I want it to turn it off and make sure its off (#1029 skip) before continuing. It will try 4 times before throwing an error. With this code it will finish without error even if it turns the probe back on. It appears as if I cannot use a IF statement to read a changing variable. It outputs what the value was when the start button is pressed.

Code:
%
O09833 (REN MP700 OFF) 
G103 P1 (LOOK AHEAD ONE BLOCK)
#3001= 0 
G04 P250 
G04 P1 
G04 P1 
G04 P1 
G04 P1 
G04 P1 
G04 P1 
IF [ #3001 LT 200 ] GOTO999 
N2 
#4= 0 
N3 
M63 (RESET M RELAY)  
G04 P200 
#4= #4 + 1 (TRY TURN OFF 4 TIMES) 
IF [ #4 EQ 4 ] GOTO4 
M63 (RESET M RELAY) 
G04 P200 
M53 (M CODE TO SWITCH OFF PROBE) 
#3001= 0 (RESET MS TIMER) 
WH [ #1029 NE 1 ] DO1 (WAIT FOR MP700 OFF) 
IF [ #3001 GT 3000. ] GOTO3 (MP700 FAIL TO TURN OFF AFTER 3 SEC TRY AGAIN) 
END1 
GOTO999 
N4 
#3000= 101 (TURN OFF PROBE FAILURE)  
N999 
G103 (DISABLE LOOK AHEAD)
M99 (RETURN) 
%
Reply With Quote

  #2   Ban this user!
Old 06-21-2011, 08:28 PM
 
Join Date: Jul 2005
Location: usa
Posts: 164
DaOne is on a distinguished road

Bueller?...Bueller?...Bueller?... anyone?
Reply With Quote

  #3   Ban this user!
Old 06-22-2011, 10:37 AM
 
Join Date: Feb 2010
Location: USA
Posts: 484
haastec is on a distinguished road

I am not an expert by any means, but I will give it a shot. My apologies if I am way off.

----------------

M63 (RESET M RELAY)
G04 P200
M53 (M CODE TO SWITCH OFF PROBE)

#3001= 0 (RESET MS TIMER)
WH [ #1029 NE 1 ] DO1 (WAIT FOR MP700 OFF)
IF [ #3001 GT 3000. ] GOTO3 (MP700 FAIL TO TURN OFF AFTER 3 SEC TRY AGAIN)
END1
GOTO999
N4
#3000= 101 (TURN OFF PROBE FAILURE)
N999
G103 (DISABLE LOOK AHEAD)
M99 (RETURN)
%
------------------------
For the Red line, does #3001 even have a chance to become GT 3000? If not, it will always jump to N999 and end without alarm.

On another note regarding the Blue lines, arent you turning the probe off then back on with the M53? Your comment line at the M53 says your are switching the probe off but the M53 code turns it on.

Not sure if this has helped any.
Good luck!
Reply With Quote

  #4   Ban this user!
Old 06-22-2011, 01:56 PM
 
Join Date: Jul 2005
Location: usa
Posts: 164
DaOne is on a distinguished road

haastec, first let me say thanks for taking your time to help me. Let me walk through these and maybe it will help...

"For the Red line, does #3001 even have a chance to become GT 3000? If not, it will always jump to N999 and end without alarm."

This seams to work fine on turning it on... just cant make it turn it off by switching the bit on the 1029 check.

"On another note regarding the Blue lines, arent you turning the probe off then back on with the M53? Your comment line at the M53 says your are switching the probe off but the M53 code turns it on."


The probe system turns on with a momentary input. It turns off the same way. This requires the m code relay to be off.. turn on for a second or two and then turn off. This will turn the probe on if it in the off state or turn it off if its in the on state.
Reply With Quote

  #5   Ban this user!
Old 06-22-2011, 08:01 PM
 
Join Date: Jan 2011
Location: USA
Posts: 100
Wizzard of H is on a distinguished road
turning off probe

I think I see a problem with the way you are writing macros.
There is a peculair effect when mixing macro variable references and normal G code.
The macro variable references are all executed frist due to look-ahead.
While the first dwell G04 is running, up to 80 lines after that will be pre-fetched and all macro lines will be executed.
There are a couple of fixes to this.
The easiest is to turn off look-ahead with: "G103 P1".
Make sure you turn it back on with: "G103" before you go back to normal codes.
Reply With Quote

Sponsored Links
  #6   Ban this user!
Old 06-22-2011, 10:55 PM
 
Join Date: Jul 2005
Location: usa
Posts: 164
DaOne is on a distinguished road

Look at line 2 and the 2nd from the last line of the code. I did try that and to my hopes that wasn't it Also it seams as if I cannot make a IF statement work that way as well. Seams like it uses the value that is present at the start of the macro. If the value changes in the macro it still uses the old value. Is this the way its supposed to work? Would be very easy to just use a bunch of IFs to make this work but it wont.

Originally Posted by Wizzard of H View Post
I think I see a problem with the way you are writing macros.
There is a peculair effect when mixing macro variable references and normal G code.
The macro variable references are all executed frist due to look-ahead.
While the first dwell G04 is running, up to 80 lines after that will be pre-fetched and all macro lines will be executed.
There are a couple of fixes to this.
The easiest is to turn off look-ahead with: "G103 P1".
Make sure you turn it back on with: "G103" before you go back to normal codes.
Reply With Quote

  #7   Ban this user!
Old 06-22-2011, 11:03 PM
 
Join Date: Jul 2005
Location: usa
Posts: 164
DaOne is on a distinguished road

This is how I would rather do the code. It also will not work.

Code:
%
O09833 (REN MP700 OFF) 
G103 P1 (LOOK AHEAD ONE BLOCK) 
IF [ #1029 NE 1 ] GOTO999 
N2 
#4= 0 
N3 
M63 (RESET M RELAY)  
G04 P200 
#4= #4 + 1 (TRY TURN OFF 4 TIMES) 
IF [ #4 EQ 4 ] GOTO4 
M63 (RESET M RELAY) 
G04 P100 
M53 (M CODE TO SEND START SIGNAL TO SWITCH OFF PROBE)
G04 P100  
IF [ #1029 NE 1 ] GOTO3 (TEST FOR MP700 OFF)  
GOTO999 
N4 
#3000= 101 (TURN OFF PROBE FAILURE)  
N999 
M63 (RESET M RELAY)
G103 (DISABLE LOOK AHEAD)
M99 (RETURN) 
%
Reply With Quote

Reply




Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
New skip in the house latheboy CNCzone Club House 4 08-19-2011 11:30 PM
G540 input 1 not working ! Action-KAT Gecko Drives 0 05-12-2011 01:08 PM
RS232 DNC input not working dingo0722 Haas Mills 19 12-10-2010 06:48 PM
Working on Design - Looking for Input Jesse B DIY-CNC Router Table Machines 68 03-23-2010 10:55 PM
G540 input not working? stoneyreef Gecko Drives 1 05-08-2009 01:52 AM




All times are GMT -5. The time now is 06:34 AM.





Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2012, vBulletin Solutions, Inc.
Content Relevant URLs by vBSEO
Template-Modifications by TMS

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361