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! > Machine Controllers Software and Solutions > Fanuc


Fanuc Discuss Fanuc controllers here!


This forum is sponsored by:

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Ban this user!
Old 04-14-2010, 07:17 PM
 
Join Date: Jan 2010
Location: usa
Posts: 89
gwarble is on a distinguished road
Detect "Optional Stop" status in program/macro?

hey everyone

i'm wondering if there is a way to detect the state of the opt-stop switch on the operator's panel on any fanucs... programmatically.

system variable # by chance? that would be perfect

i want to send out status changes via dprnt when opt stop is on, but igonore them when the M1 is ignored (ie opt stop off)

thanks
- gwarble
Reply With Quote

  #2   Ban this user!
Old 05-26-2010, 06:02 PM
 
Join Date: Jan 2010
Location: usa
Posts: 89
gwarble is on a distinguished road

from what i can tell this isn't possible... maybe i can modify the ladders to set a macro variable or a system variable with the opt-stop pushbutton...

- gwarble
Reply With Quote

  #3   Ban this user!
Old 05-27-2010, 12:23 AM
MysticMonkey's Avatar  
Join Date: Mar 2009
Location: Australia
Posts: 366
MysticMonkey is on a distinguished road

You will need to tie the input for the switch to a variable via the PMC

UI0000 = #1000
~~~~
UI0031 = #1031

UO0000 = #1100
~~~~
UO0031 = #1131

GL
__________________
***********************************************************
*~~Darwinian Man, though well-behaved, At best is only a monkey shaved!~~*
***********************************************************
*__________If you feel inclined to pay for the support you receive__________*
*_______Please give to charity http://www.oxfam.org/en/getinvolved_______*
***********************************************************
Reply With Quote

  #4   Ban this user!
Old 05-27-2010, 01:37 PM
samu's Avatar  
Join Date: Feb 2007
Location: quebec
Posts: 216
samu is on a distinguished road

I found a way to do that without editing ladder but it is a little bit strange.
First i set a macro called by M01 (O9021)

O9021
#3001=0 (RESET TIMER)
M01
IF[#3001 LT 1000] GOTO 20
IF [#500 EQ 0] GOTO10 (DONT SEND IF THE STATE HAS NOT CHANGE)
POPEN
DPRNT[M01 ON]
PCLOS
#500=0 (RETAIN THE STATE OF THE SWITCH)
N10 M99
N20 IF [#500 EQ 1] GOTO 30 (DONT SEND IF THE STATE HAS NOT CHANGE)
POPEN
DPRNT[M01 OFF]
PCLOS
#500=1 (RETAIN THE STATE OF THE SWITCH)
N30 M99

The bad thing it is that you send the info only after cycle start is pressed after the M01.

How it works: first a timer is set to 0 and begin do count(by milisecond increment) If M01 is deactivate, a small amount of time depending of the block processing time, will be ellapsed so you have to set the comparative value of the first IF higher than the processing time to jump a the right place.

If M01 is activate, the timer will increase while the pause is active and when you will end the pause, the timer value will be higher than the comparative value, so you will know that M01 was active.

I tested it on a 0-MD and it works fine.

Let me know if you can do sometinhg with that
Reply With Quote

  #5   Ban this user!
Old 05-28-2010, 01:54 AM
MysticMonkey's Avatar  
Join Date: Mar 2009
Location: Australia
Posts: 366
MysticMonkey is on a distinguished road

Originally Posted by samu View Post
O9021
#3001=0 (RESET TIMER)
M01
Wouldn't this cause a loop ? calling M01 inside the macro.

Originally Posted by samu View Post
IF[#3001 LT 1000] GOTO 20
IF [#500 EQ 0] GOTO10 (DONT SEND IF THE STATE HAS NOT CHANGE)
POPEN
DPRNT[M01 ON]
PCLOS
#500=0 (RETAIN THE STATE OF THE SWITCH)
N10 M99
N20 IF [#500 EQ 1] GOTO 30 (DONT SEND IF THE STATE HAS NOT CHANGE)
POPEN
DPRNT[M01 OFF]
PCLOS
#500=1 (RETAIN THE STATE OF THE SWITCH)
N30 M99

The bad thing it is that you send the info only after cycle start is pressed after the M01.

How it works: first a timer is set to 0 and begin do count(by milisecond increment) If M01 is deactivate, a small amount of time depending of the block processing time, will be ellapsed so you have to set the comparative value of the first IF higher than the processing time to jump a the right place.

If M01 is activate, the timer will increase while the pause is active and when you will end the pause, the timer value will be higher than the comparative value, so you will know that M01 was active.

I tested it on a 0-MD and it works fine.

Let me know if you can do sometinhg with that
__________________
***********************************************************
*~~Darwinian Man, though well-behaved, At best is only a monkey shaved!~~*
***********************************************************
*__________If you feel inclined to pay for the support you receive__________*
*_______Please give to charity http://www.oxfam.org/en/getinvolved_______*
***********************************************************
Reply With Quote

Sponsored Links
  #6   Ban this user!
Old 05-28-2010, 07:58 AM
samu's Avatar  
Join Date: Feb 2007
Location: quebec
Posts: 216
samu is on a distinguished road

It won't cause a loop. When you use a M or G code inside a macro called by itself, it will be executed normally inside the macro. It allow to call macro with standard G or M code without loose the functionallity of this code.
Reply With Quote

  #7   Ban this user!
Old 05-28-2010, 11:38 AM
 
Join Date: Jan 2010
Location: usa
Posts: 89
gwarble is on a distinguished road

yup, samu's right... and if you need to call a macro from a macro you can use g65 p90xx if necessary


i like your clever thinking finding a solution for this with the timer, samu... but like you pointed out you only know after the M1

the two methods i've tried (but don't like the extra step) is to define my own M1 as follows, which allows me to use #101 macro variable as a secondary opt-stop with "status" dprnts:

Code:
O9006(OPT STOP...) 
IF[#101EQ1]GOTO1111
M1 
M99
N1111
POPEN
DPRNT[//HOLD] 
PCLOS
M0 
POPEN
DPRNT[//START]
PCLOS
M99
also, depending on your use of block skip, you could use that as well, with or without GOTOs, like:

Code:
O9006(OPT STOP...) 
/M1
/M99
POPEN
DPRNT[//HOLD*M1] 
PCLOS
M1
POPEN
DPRNT[//START*M1]
PCLOS
M99
just some preliminary work arounds... but none as easy as the "opt stop" button alone

- gwarble
Reply With Quote

  #8   Ban this user!
Old 05-28-2010, 12:07 PM
samu's Avatar  
Join Date: Feb 2007
Location: quebec
Posts: 216
samu is on a distinguished road

I'm curious. Why do you want to DPRNT M01 switch status?
Reply With Quote

  #9   Ban this user!
Old 05-28-2010, 12:20 PM
 
Join Date: Jan 2010
Location: usa
Posts: 89
gwarble is on a distinguished road

so i know when a machine has stopped...

really the computer software should handle it but its a work in progress...


i don't want to DPRNT the M1 status... i want to send the "HOLD" string when the machine stops at the M1 and send the "START" string when the cycle start happens again, if the opt stop actually stops the program... and send nothing if M1 does nothing

i want my log of statuses to look like this:
status: time:
Code:
start 30sec
hold 10sec
start 30sec
end
when opt stop is active, and like this:
Code:
start 60sec
end
when i switch off opt-stop... instead of:
Code:
start 30sec
hold 0sec
start 30sec
end

my first example, pretend variable #101 is another opt-stop button... and it works like i want opt-stop to

thanks
- gwarble
Reply With Quote

  #10   Ban this user!
Old 05-31-2010, 03:53 PM
samu's Avatar  
Join Date: Feb 2007
Location: quebec
Posts: 216
samu is on a distinguished road

I wrote a set of macro that do exactly wath i think you want. It is the macro itself that calculate time ellapsed and send it with the appropriate string (start, hold, end) I don't have time to post it right now but tomorow i will show you. Maybe it could be interesting to add time between cycle(part changing time)
Reply With Quote

Sponsored Links
  #11   Ban this user!
Old 05-31-2010, 05:16 PM
 
Join Date: Jan 2010
Location: usa
Posts: 89
gwarble is on a distinguished road

i'm not sure conceptually how the machine would know ahead of the M1 via timer... but i'd love to see your macro solution

thanks
- gwarble
Reply With Quote

  #12   Ban this user!
Old 06-01-2010, 01:18 PM
samu's Avatar  
Join Date: Feb 2007
Location: quebec
Posts: 216
samu is on a distinguished road

I hope that i will be clear enough and you'll take time to understand it.English is not my first language, so some explanation could appear nebulous. Have Fun
effectively, the machine won't know ahead for M1, but once the pause is finish, it send the duration of the pause and the time ellapsed before the pause. I keep the same concept to detect M01. At the begining of the main program i store the current time of day(system variable #3012) in a common variable via a macro that translate it into second for easy calculation. Instead of M01 i call the detection macro.

At the first line of detection macro, i store again the current time of day in another common variable.If M01 is not detected, i go back to the main program.If M01 is detected, once the pause is finished i store again (always via a macro) the current time of day and call another macro to do the calculation of the duration of each segment(Time ellapsed from start to pause and pause duration) and DPRNT this info before go back to main program.

At the end of the main program, once again, i store the current time of day and call a macro to to de calculation and send the right info.

Here is the code:
O1234 (Main program)
M64 B101(SAVE CURRENT TIME OF DAY in #101 once it is translated in second)
G04 X2.0
M98 P9021 (M01 WITH DETECTION)
G04 X2.0
M64 B104 (SAVE CURRENT TIME OF DAY IN #104)
IF[#110 EQ1] GOTO 10 (IF M01 WAS ACTIVE)
G65 P9022 A#104 B#101 C1.0 (CALCULATE DURATION OF WHOLE PROGRAM C=0 FOR HOLD TIME, C=1 FOR START TIME)
GOTO 15
N10 G65 P9022 A#104 B#103 C1.0 (CALCULATE DURATION AFTER PAUSE)
N15 POPEN
DPRNT[END]
PCLOS
M30

O9021 (M01 DETECTION)
#3001=0 (RESET TIMER)
M64 B102 (STORE TIME OF DAY IN #102)
M01
IF[#3001 LT 1000] GOTO 20 (IF M01 IS INACTIVE)
M64 B103 (STORE TIME OF DAY IN #103)
G65 P9022 A#102 B#101 C1.0 (SEND START TIME BEFORE PAUSE)
G65 P9022 A#103 B#102 C0 (SEND HOLD TIME)
#110=1 (STORE THAT M01 WAS ACTIVE)
M99
N20 #110=0 (STORE THAT M01 WAS INACTIVE)
M99

O9022 (CALCULATE DURATION,TRANSLATE IN HOUR,MINUTE,SECOND AND SEND INFO)
#106= [#1- #2] (DELAY TIME IN SEC)
#107= FIX[#106/3600] (HOUR)
#108= FIX[[#106- #107*3600]/60] (MINUTE)
#109=[#106-#107*3600-#108*60] (SECOND)
POPEN
IF [#3 EQ 1] GOTO10 (IF START TIME IS OUTPUT)
IF [#107 EQ 0] GOTO3 (IF LESS THAN 1 HOUR)
DPRNT[HOLD;#107[20]HOUR;#108[20]MIN;#109[20]SEC]
GOTO20
N3 IF[#108 EQ 0] GOTO4 (IF LESS THAN 1 MINUTE)
DPRNT[HOLD;#108[20]MIN;#109[20]SEC]
GOTO20
N4 DPRNT[HOLD;#109[20]SEC]
GOTO20
N10 IF[#107 EQ 0] GOTO13
DPRNT[START;#107[20]HOUR;#108[20]MIN;#109[20]SEC]
GOTO20
N13 IF[#108 EQ 0] GOTO14
DPRNT[START;#108[20]MIN;#109[20]SEC]
GOTO20
N14 DPRNT[START;#109[20]SEC]
N20 PCLOS
M99

O9023 (STORE AND TRANSLATE TIME OF DAY IN SECOND)
#1=#3012
#3=FIX[#1/10000]
#4=FIX[[#1-#3*10000]/100]
#5=[#1-10000*#3-100*#4]
#[#2]=3600*#3+60*#4+#5 (TOTAL TIME IN SEC)
M99


O9023 is called by a M code that is not buffered (set M code value in parameter #111 or #112 (on a 0-MD)) It is very important else, the time of day will be stored as soon that the line #xxx=#3012 is read into the buffer. Another method shold be to put a cople of empty block before that line but cause the buffer size isn't the same on evry control it is not a good way to do. Argument passed in this macro is the variable number where time of day will be stored(in sec).

In my example:
#101=time at start
#102=time at the beginning of pause
#103=time at the end of pause
#104=time at the end of program

when you call macro O9022, you also pass as argument the two time value on wich the duration have to be calculated and if it is a START or a Hold period. So:
A=end of period
B=start of period
C=0 if it is a hold and 1 if it is a start (to send the good string before the time)

It works great, the only fail is if a part is start before midnight and end after midnight. But it won't be difficult to correct it.

It could be easier to use timer instead of time of day but #3001 can only count about 64 sec and #3002 is only precise within 3.6 sec (1/1000 hour)

Here is how the data looks like once it is send

START 5SEC
END

START 2SEC
HOLD 2SEC
START 4SEC
END

START 2SEC
HOLD 4MIN 13SEC
START 3SEC
END

START 3SEC
HOLD 2MIN 20SEC
START 3SEC
END

Another possible faillure i forgot, timer #3001 reset itself after about 64 sec. So if pause duration is about a multiple of 64 sec, pause can end when timer value is less than the comparative value in the macro detection.To reduce this risk, comparative value must be set as small as possible(just high enough to compansate block processing time)
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 Mach version "Elapsed Time" doesn't stop kprice1658 Tormach PCNC 5 04-14-2010 03:53 PM
How to monitor VSD-A "Ready" status? LBodnar Granite Devices 19 06-05-2009 07:59 AM
Continue subprogram after push "CYCLE-STOP" dzga Fanuc 2 06-13-2008 05:18 AM
"HACKING" the optional functions on the Haas control? AMCTony Haas Mills 16 12-03-2006 11:28 AM
How do I stop receiving "News Letters" from the site? CNCadmin CNCzone.com FAQ 0 03-03-2006 10:47 AM




All times are GMT -5. The time now is 04:08 PM.





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